Thursday, December 31, 2009

An iPod Saga - or how I nearly went mad trying to use it


My sister recently gifted me an iPod Nano. I tried to use iTunes to load some mp3s onto it... seemed like a simple enough task given the "user-friendliness"/"coolness" (depending on if you are a fan/fanatic) of Apple. First of all, it says it needs to delete everything existing on the iPod. Hmmm, ok... WAIT! WHAT THE FUCK! why do you need to delete the existing stuff, Cant you just "add" to it? Apple's Steve Jobs makes an appearance on the iPod nano's screen and lists Apple's Official Policy - "Itz my product damn it, I can make it shit on you - if I wish to".

So, I deleted the existing songs, and wrote new mp3s onto it - using iTunes on my office laptop which had windoze I-REALLY-promise-not-to-crash-XP with Service Pack I-NOW-REALLY-REALLY-promise-not-to-crash. (Never mind it BSODs once a day on "heavy usage", But I digress) Now, I wanted to shutdown the damn iPod and there is no "off" button... hmmm, so I had to google the controls on how to shutoff the damn thing. Score one for "user-friendliness"!

All is well for one single goddamed day, when I decided to add a couple more songs. I start up iTunes and connect iPod, and iTunes crashes. ok maybe I connect ipod before starting iTunes? still crashes. maybe I reboot iPod? crashes. maybe I reboot Windoze? crashes. maybe I reboot both? crashes. maybe I update software? crashes. crashes. crashes.

OK, screw it. I would rather listen to my 12 songs already loaded for the rest of my entire life, than put up with another second of this i-Piece-of-CRAP-Tunes. So disconnect & Play. What is it? oh, when i-fucking-stupid-Tunes crashed - it corrupted the song DB and said I have to reset the device with iTunes. and guess what happens when I try to connect the iPod with iTunes?

At this point, I would have taken a comically giant mallet and bashed the evil incarnate out of existence, if it were not a gift. So, I thought therez got to be a way out from the dark side, and sure enough I found out about GTKPOD for Linux (and win-fucking-doze), which kicks iTunes's ass anyday and we lived happily ever after. The battle against the evil machinations of iTunes was over.

But i-will-be-back-Tunes wont give up so soon. I might see it striking back with the i-am-so-DAMN-cool-that-you-bow-to-me-right-fucking-now-Phone. I am counting on Google Phone to kick its ass then :)

Monday, July 20, 2009

Trekking in The Himalayas - Where the earth meets the Sky...

Himalayas had always been a trekking destination which eluded me. Sometimes it was my fitness level, sometimes the cost, sometimes the professional commitments - but whatever the reason, it was not happening. So when I saw the BMC posting for a Himalayan trek, I immediately knew I could not miss it. Thus started my tryst with the Himalayas...

After taking a flight to Delhi from Hyderabad, followed by a disastrous bus journey to Manali, we landed at the Hotel on Sunday Evening. Monday morning we started to Solang Valley by Sumos, where I did Zorbing. We then moved on to Rohtang Pass, where we played by sliding on the small patches of snow etc. Then towards evening we moved to the the Base Camp at 14 mod (at 3250m) in heavy rain, and retired for the night.

The next day we began our trek to the next camp at Ravalikoli at 3750 m. Initially the trek passed through the forest, but soon we were above the tree line in beautiful grasslands. we reached the Ravalikoli camp, which was surrounded by mountains on 3 sides, with small rivers originating from them - and combining to form a big stream which snaked past the camp, and distant snow-covered peaks on the 4th side. After having some hot soup, we played Dumb charades and then proceeded to rest for the night.

The next day we started our trek to the sacred Brighu Lake located at 4250m above sea level. After a couple of hours of climbing through grassland, rocky areas as well as some snow, we reached the majestic lake Brighu. We rested for half an hour near the lake and then ate packed lunch before starting our descent. On the way back, a couple of us, played in the snow by throwing snow balls as well as sliding in it. By the time we reached the camp at Ravalikoli, there was a heavy fog and visibility was reduced to less than 10ft. I then climbed the nearby mountain for a view of the camp, but had to return soon due to a lot of rain. We played song & dance for some time before retiring for the night. However, unlike the previous nights, it never rained, which was a big surprise, given the downpour that used to hit the tents on earlier nights.

The next day the sky cleared up completely resulting in a bright and sunny day. This made the return trek one of the most pleasurable experiences of my life. We enjoyed a lot by singing, dancing and plain freaking out on the way down. We walked through big meadows filled with exotic flowers, while sheep and horses were grazing peacefully. We reached the road, where we were picked up by Sumos and headed back to Manali.

I did some basic shopping that night, as well as visited the Manu temple. The next day we did white water rafting on the Beas River which was very exciting, especially when a couple of us, jumped into the river. In the evening we boarded the bus back to Delhi. After staying at my cousin's place in Delhi for a while, I reached Hyderabad sunday evening by flight.

This trek is easily the best among all the treks I had ever done due to the sheer beauty of the Himalayas coupled with the very diverse backgrounds and intellects of my team mates. I look forward to doing more such treks in the Himalayas.

Friday, June 26, 2009

Some people NEVER learn - CitiBank

Today I got a call from a Citibank guy hawking Citibank investment products. Being the seventh call about this in as many weeks, I was pretty pissed off, but was trying to be polite. He asked me "CitiBank would like to help you plan your investments", and I told him "No thanks, I have already planned my investments". Most citibank guys usually leave me alone at this point (which was why I was generally polite to them.) But this guy was persistent.

"But Sir we will give you free counseling on how to make investments...". Trying to end this pointless conversation I replied - "OK, I dont have any money left with me after my previous investment". That I figured would effectively end the conversation, since you cannot sell to a guy who is broke.

"Sir, Do you have a CitiBank credit card sir?" he asked. what the ...? Now he is selling me credit cards? "No" - I snapped. He then explained to me that if I got a CitiBank Credit card, I can take out a loan on it (@24% interest rate) and then use the money to make Investments. I ended the conversation with a "no thanks".

This is the EXACT thing that burned CitiBank (and Wall Street) - Taking Loans to make investments - Leverage. If these big shots could not handle leverage and went to the Fed for handouts, how come common people are supposed to handle it? How can they even make these kind of stupid suggestions? No wonder so many subprime mortgages got sold! Something ought to done about these bloodsuckers, before they precipitate another meltdown.

Friday, June 19, 2009

Falling off the grid - An Experiment with my Life...

Off late I have become kinda addicted to email, browsing, social networking - basically to computers. So I am planning on doing a small experiment with my life, where I try to fall off the grid. I will try to see how much more productive I can be if I keep away from these computer related activities... I was planning on it for sometime, and now appears to be a good time.

In a way, I am partly off-the-grid already, since I do not have a television at home. It leaves so much spare time and I really loved it! I will try to blog about how long I can carry on this "experiment", and what all additional things I have done, and how there was an increase (or decrease) in the quality of my life :) Maybe I will do stuff like clean my room, visit places, go for a jog, read a book, wake up early and enjoy the finer things in life. I believe, for a start, a week should be enough.

So why am I doing this? Sometimes in life, we think some things are so indispensable that we cannot live without them. Once we start thinking that way, we inadvertently hand over control of our lives. This exercise will hopefully put things back in perspective. And when Judgement Day strikes, I would be better suited to fight SkyNet :P

Ofcourse, I will still be using a computer for office work and will be available at my office email id. Well, what did you think? I am trying to fall off the grid, not get my ass fired :D

Nights on Necklace Road

If you are bored at night in Hyderabad, and dont know what to do - here is a new destination, visit the Necklace road, which true to its name, is like an ornament on the Hussian Sagar Lake, in the center of the City. We live a couple of blocks from the necklace road, so whenever my friend and I feel bored at nights, we take our high-end bikes and jolly ride to the necklace road at late nights. But you need to be on the lookout for idiot bike/car racers. Racing is common, and so are accidents and deaths on this stretch.

There is a Heritage Parlour which sells milk products etc until 11PM, which is our regular hangout point. (Big names like Eat Street close by 10 or so, and are too crowded). Besides this there are a couple of the Ice Cream Bandis too.

There are cops prowling the place at late nights, and they are decent enough to leave you alone until about 12:30-1AM. But after that you better not park your bikes there. But cars are safer all throughout. Also, due to these regular patrols, the area turns out to be very safe.

Coming from the Destiny City - Vizag - I always loved the beach there, and missed it a lot after moving to Hyderabad. The Necklace road is the closest, one can get to such an experience in Hyderabad.

Monday, June 15, 2009

Trek to Kudremukh - Touching the face of God!

It had been a very long time since I had been on a trek. This summer was a complete bummer, with temperatures soaring in Hyderabad and surrounding areas. So after the first monsoon showers, I decided to go on a trek. With none of my friends having the time to join me, I decided to go with a professional club, and the Bangalore Mountaineering Club (BMC) was the BEST among them.

So I started a day earlier and landed in Bangalore on Friday morning, and worked that day and then joined with the BMC team leaving for Kudremukh on Friday night. We reached Kalasa and were put up in a local hotel, as the local nature camp did not allow large groups (we were 35 people). The next day morning, we reached the base of the trek at around 9:30 am, and started the trek.

Initially the trek was on a muddy road for a couple of km, and then it branched out into the forest. While waiting for others to catch up a couple of us also took a detour to a nearby waterfall with a check-dam which was beautiful. Back on the way, after crossing the first stream, I realized that there were leeches all over the place due to the incessant raining in the past few days. I have a serious fear of leeches (I looked it up and the actual term is "Bdellophobia" :), and these were really big ones at almost 4-5 cms long (without any blood i.e.), wiggling around vigorously to attach themselves to the nearest blood source. After reaching a patch of dry rock, we checked our shoes and sure enough there were 2 leeches, which were quickly removed by my teammates (thanks guys! I was really really grossed out :).

After climbing for some more time, we could see the actual peak we were about to climb. It was awesome, like a serene giant, being engulfed slowly in milky white clouds. The mountains around were majestic. After some comparatively steeper climbing, we reached the peak by 2:00 PM and relaxed there for an hour while enjoying the lunch of chapattis & chutney which our BMC contact Ram had provided.

On a nearby mountain, we could see a herd of bison, walking slowly, and it felt very exciting seeing them. On the peak, I realized that I ran out of my 2.5 litre supply of water, having misjudged the strenuousness of the climb. So, I had to drink some water from a nearby stream directly - since I did not have any iodine to purify it, but it was very pure. We started our way back down, after climbing down from the main peak, I was deep in leech territory, so I started running all the way until we were close to the mud road, which was safe from leeches.

Four of us were lost on the way back on the mud road, and reached a local village. Two local women were kind enough to lead us back to the Bus. It was almost 6:00 PM by the time we reached the bus. We went back to the lodge and the next day we went to a nearby waterfalls which were very beautiful, before starting back to Bangalore. It was almost 1AM by the time I reached my friend's place in Bangalore.

I did not carry a camera with me on this trip, so the pics from my cell are subpar, I will put up the remaining pics once the remaining team members upload their.

I was very happy with myself for completing this trek, since my strength and stamina training over the previous 5 months had paid off handsomely, with me being able to carry a lot of weight uphill without getting real tired! Hoping to do a trek sometime real soon.

Tuesday, June 9, 2009

Racism & Color - NOT the same everywhere

Recently my friend pointed me to this article on a Times of India Blog. The author of the article raises the point that Indians are as racist as any other people, and gives the example of the preference for fairness prevalent in many matrimonial ads as well as fairness cream ads.

However, this author, along with the countless others, always go wrong here. Dont get me wrong - most Indians ARE racist, hell they might be even more racist than most other peoples. But I entirely disagree about this author's example that preference for fairness is racism. It is taken out of context from the Western civilization's tryst with racism and color.

Some time back, there was this huge uproar about two cheerleaders to an IPL match being given marching orders because they were dark skinned, and the media raised an uproar about Indian "racism". While this is the correct thing to do in a western context where racism and color are intertwined so closely, In the Indian context it is just a preference (albeit very stupid and insensitive) of Indians. If you think this is racism - tell me why are all the cheerleaders (or for that matter actors, tv anchors etc) good looking? Is it not racism against the not-so-good looking people? The author mentioned in the Times blog asks rhetorically - 'when did u last see a matrimonial ad seeking attractive, dark-complexioned life partner'? Well I suppose he saw may ads which were seeking - 'fair skinned, fat, short, unattractive life partners'!!

Many Indians have a preference for fairness. While it is despicable in itself, it is NOT racism. You never see a group of fair-skinned guys way-laying and assaulting a darker skinned guy in India. (It might happen with people from a different caste, religion, place etc). Preference for fair skin is as much a preference for a trait like being taller, skinnier or good looking. But noooo.... these are all just "silly preferences", but use color and it is actual racism. The Indian authors import even the opinions from western authors without bothering to mold it to an Indian context.

Which is what makes me so angry about these articles. While I completely understand a western author mis-reading an Indian's preference for fair complexion as racism, it is completely idiotic for an Indian author make the same mistake.

Friday, May 22, 2009

Not wasting food on your plate - Indian custom gone wrong

Here is another low-hanging fruit for bolstering your diet - if food is left on your plate after you are done - THROW IT AWAY! NEVER, EVER, EVER eat food because it will go waste.

This problem of not wasting food on the plate is especially prevalent among Indians, who consider it a cultural taboo to waste food, which is considered equivalent to insulting God. But the problem is by overeating you ARE insulting life itself, not to mention doing harm to yourself and your surroundings. The custom itself came from a time, when food was not as available as it is right now, atleast for many of us. So it is a more stronger version of "saving for the rainy day". But if you are on a diet, you KNOW you are trying to lose the rainy day reserves, so it makes no sense to eat the excess food.

If there is food wasted on your plate, remember you are the one you have taken more than you require. So deal with the problem by judging the quantities correctly in future, and not by stuffing yourself.

A special mention is required for social occasions in the Indian context, where the host is serving food. The host is EXPECTED to over-serve, lest the guest is feeling shy. Such scenarios need the guest to be culturally sensitive and handle the situation tactfully. If it is a once-in-a-blue-moon thing, just accept it. If it is more frequent, do inform the host politely but firmly that although you appreciate their hospitality, you do not want extra food on your plate.

Wednesday, May 20, 2009

Missing tasty foods for diet? - here is why your diet WILL fail

"Fallen off the wagon, have you?" is what people (who know I am on a diet) say when they see me eating chocolates, kebabs, lassi and hyderabadi biriyani. However what most people do not realize it that by staying off your favorite foods, your diet is essentially doomed!

The trick is to NEVER give up your favorite foods. If you do, you feel like sacrificing, which adds a lot more emotional stress to your diet. And believe me, your diet will fail, especially once the results start pleatueing.

All you have to do while eating your favorite foods is to make sure you are not exceeding calories by too much. Generally I put 2 complete days as no-diet days every week (mostly saturday and sunday), that way, I diet the entire week and eat the items I love on these two days. The important point of eating during these 2 off-diet days is RELISHING the food! not splurging it. Order a chicken biriyani or icecream, but eat until your hunger is satiated, not until your stomach feels like bursting!

I also realized something during this time - I used to eat one and a half biriyanis generally, but after I started eating only till my hunger was satiated, I am eating only half a biriyani! This is a very useful thing to do especially once your diet concludes and you are following a normal diet.

And most important of all - NEVER eat fatty food you HATE! For example, I hate sweets in general, but used to just pop them whenever I pass by a sweet box, just for the heck of it. NEVER do this. there is nothing more counter-productive and stupid than eating fatty foods you hate!

Spot Reduction Myth - Nightmares while losing tummy


"Do crunches/situps to reduce your tummy" - If I had a cent for everytime that was said to me, I would be a billionaire. But people fail to realize that this seemingly logical "truth", is a total myth! You do not lose any tummy fat by doing crunches/situps, anymore than you do by doing biceps.

This myth makes people believe that by working out a muscle underneath the layer of undesired fat, the fat will melt away! Fat is lost through out the body in a uniform fashion depending on genetics. However this myth which was started by the afternoon infomercials seems to be propagated on and on and on. They are able to sell more and more stupid devices like abdomen belts etc due to the prevalence of this myth.

You would be much better off doing cardio or weight training, than trying to strain those abdomen muscles exclusively to get rid of your tummy. Although, by doing crunches you improve your muscles in your abdomen it does not help if you have any amount of fat in your tummy, which will cover that six pack.

Also another major disadvantage of doing situps is that, you may end up getting lower back pain, which sucks because you could have avoided this altogether if you knew about the spot-reduction myth before hand!

So control your food, and do whatever exercise you feel like and count calories to make sure you are not over-eating. and your tummy will vanish in no time!

Here are some more links from Wikipedia and exrx.net about this myth.

Saturday, May 16, 2009

Virgin Cuba Libre - My Summer Special

Well to beat the Hyd heat over the weekends, I have devised my own mocktail which I call the - Virgin Cuba Libre. Well if you know the normal Mocktail naming conventions, you know what I am talking about - It is cola with Ice and Lime :) (Cuba Libre is Cola on Ice with white rum. A Virgin prefix for any cocktail indicates the alcohol part of it will be missing - just like a Virgin Mary is the mocktail equivalent of the Bloody Mary)

The recipe is simple, take a glass of Diet Pepsi, and add lots of icecubes. Then add a wedge of lime to it - and presto your new mocktail is ready for drinking.

WARNING: Using recipes created by the holy cow has been known to cause long lasting bouts of nausea, revulsion, headaches and suicidal tendencies in almost all people, other than the holy cow himself. So be forewarned! :D

JP wins from Kukkatpally

It is heartening to see that a leader who stands for development and progress has won the Kukkatpally seat. Call me pessimistic, but I thought that JP's chances of winning were pretty bleak given how easily voters get misled by false promises and alcohol/money supply. But the fact that the urban voters have come out against the traditional parties and voted for JP means that a definite change is happening although it is currently at a scale which will not affect the established polity. Also the lead of 15000+ votes is more or less substantial.

I believe JP now needs to develop a incorruptible second rung of leaders - who will also become equally famous as him. This will ensure the sustainability of the party in the state.

Lets see how JP develops his constituency over the next 5 years. And more than the constituency itself, people will be watching how he would approach various issues in the Legislative Assembly sitting in the Opposition. I strongly believe if he makes enough of a positive impact, Lok Satta can become a force to recon with in the future.

Monday, May 11, 2009

Processor Name Confusions

It used to be confusing a lot when people talk about i386, x86, AMD64, opterons etc. However there are some minor (and some major) differences in these terms. I try to explain some of the differences in this post. Consider this a very brief history lesson too :)

BTW, I oversimplified some product lines, so that clarity is maintained.

8088:An 8 bit processor from Intel, one of the first ones. You wont find this anywhere on PCs [EDIT: This is actually a 16 bit processor with an 8-Bit external bus]

8086:A 16 bit processor from Intel. Code written for this processor will STILL execute on even the latest Xeon multi-core processors! Such is the level of backwards compatibility provided

80x86:This is used to indicate the processors after 8086 like 80186, 80286, 80386 etc. This has been shortened to "x86".

x86:See 80x86

286:This processor had some basic support for segmentation etc

386:This was the first 32 bit processor in the Intel line and had a fully supported protected mode (along with an MMU), paging etc, which enabled development of complicated operating systems like Windows, Linux etc which provide features like Virtual Memory, protection between user processes & kernel etc.

486, 586, 686:Subsequently improved versions of 386

Pentium:For All processors mentioned before, other companies like AMD etc could make similar clones, AND use the same name, essentially denying branding of Intel's products. Intel's efforts to trademark 386 were denied by the US Govt on the grounds that a number cannot be trademarked. So Intel released the Pentium Line of processors to overcome these trademark issues. It was now able to prevent other companies from using the same names as itself.

Athlon:After Intel trademarked Pentium name, AMD was forced to use a new name for its processor line. It chose Athlon.

Itanium:Itanium was a 64 bit processor from Intel which was NOT backwards compatible with the x86 line. It was also fundamentally different at the ISA level using a VLIW architecture instead of the standard CISC of the x86 line. This was a major disaster for Intel, since AMD undercut it by releasing a x86-backwards compatible 64 bit processor. Barring a few HP machines, this did not sell much.

Athlon64:After Itanium, which required special OS and application development was faltering in the market, AMD released the AMD64 ISA which was backwards compatible. The corresponding 64 bit processor was Athlon64.

Opteron:Opteron is the AMD's Server class processor

Xeon:Xeon was a newer x86 64 bit Server-Class processor which was compatible with the AMD64 ISA. (Intel actually chose to call it EM64t instead of AMD64) (The 64 bit desktop processor was simply Pentium IV with EM64t)

IA32:This is the processor Instruction Set Architecture (ISA) of the i386 and above, 32 bit processors. Although this used to be called the x86 ISA, it was retroactively named as IA32 by Intel after the release of the IA64 line

IA64:See Itanium

AMD64/EM64T:See Xeon. Linux takes a neutral approach and calls it x86_64 architecture.

Xeon with HyperThreading: Hyperthreading (from Intel) is the poor silbling of Multi-Cores. Basically using just one processor core (and cache etc) they try to execute multiple threads. Some applications actually faced decrease in performance with this enabled. AMD never bothered to implement this.

DualCore: Intel failed horribly while trying to push processor speeds to more than 10GHz. It conceptualized a new Processor Architecture called NetBurst, which was supposed to do this, but it was overheating at sub-5Ghz levels itself. So Intel cleverly shifted focus away from processor speeds to Processor Cores per Package. Now even 8 cores in a single package are also being developed.

I chose not cover the Mobile class of processors like Pentium M, Atom etc and the latest GPGPU offerings from NVidia etc as this post was getting too big!

Adrian v1.0 RELEASED!

At last I ironed out the bugs in the 1.0 branch and was able to release Adrian both for Windows and Linux. You can download the Linux version or the Pre-Compiled Windows Version.

Hope you guys enjoy the game. Do report any bugs you find here.

Source code is licensed under GPLv3 and the SVN repository is located here.

Here are some screenshots from the game (scaling them reduced the quality here)







Same post is copied at adriangame.blogspot.com

Friday, May 8, 2009

Interesting Bug in C++ code

I was trying hard to release a 1.0 version of Adrian game, but we had to face a showstopper bug which was crashing the Windows Release version, on start of the game itself. After hunting for it for a long time, I was able to figure out the bug, which turned out to be a very interesting issue.

Basically we have a structure which has an embedded vector STL class in it. What the code was doing was to create the structure, and before assigning contents to it, was simply memsetting the entire structure to 0. While this is normal operation in any C code, in C++ this can cause very weird bugs.

When the vector is embedded in the structure as a C++ class (Composition), it's constructor gets calls when the structure is created. This constructor actually setting some fields (pointers namely) to some initial values. However, when we memset the structure, the vector fields are again initialized to zero (and the pointer to NULL). So whenever I try to access the vector it causes a panic.

The fix was to simply remove the memset code, and then write a new constructor for the structure, which will initialize the other variables to zero, leaving the vectors alone. What a bug! it took a lot of hunting to get to this one :)

Now, We would be able to release Adrian 1.0 version soon.

Thursday, May 7, 2009

The MOST important dieting secret

NOTE: I am no doctor or dietitian... so this may or may not work for you and worse can cause serious problems... so just consult you doctor or whatever... end of disclaimer...

Most of you who know me, already know that lately I have become a complete health nut. Well that is true. The reason I became a total health nut is that I figured out a very important secret for fat loss. (Note that I am saying FAT loss - NOT weight loss). OK, this is turning out to be freakishly close to the infomercials you see on afternoon TV :D, But bear with me, since I have no financial motive :P

The mantra is "Reduce NET calorie intake". Couple of points...

- Your body requires about 1900 calories per day
- You make sure you eat 1400 calories - no more no less
- That deficit of 500 calories over 7 days is EXACTLY equal to 1 POUND of Fat

Now forget all the "tips" you hear from people, and just follow the mantra... Some of the tips I heard over the years from various sources
- Dont eat before sleeping
- Eat groundnuts
- Avoid Eggs
- Cashew is good for weight loss
- You cant lose fat without exercise
- Follow Atkins Diet
- Avoid non-vegetarian and alcohol
- drink lots of water (another was avoid water, since you will get "water body" - whatever that is!)
etc

Just assume all that is lies, lies, lies, and stick to the mantra. (Ofcourse many of them have as much truth in them as there is gold in sea water... yes there is, but does it really matter?) So choose any diet you want and stick to 1400 calories per day routine. You will lose 1 pound per week! It is the first law of thermodynamics!

This is the basic diet plan that I used for 3 months to get down from 68+ kgs to 61Kgs. I have tweaked it a lot lately, to help my strength training, but the basic principle stands.

Codefest :)

Two weeks ago, I resurrected an old game that I have written six years ago with my friends. I was not sure how long it would hold my interest. But I guess I was unnecessarily worried. I have completed over two weeks of work on it and spread over 60 changesets, the total Lines of Code changed is easily over 8,000 lines. So that is good work for 2 weeks, working part-time. The entire game has been revamped, with more focus on extensibility.

Although it will look mostly like the old game, extensive code reorganization work was done on it. Loadable TTF Fonts, Loadable Maps, efficient rendering etc are some of the things that I have been working on. Booty has been working on the windows port. Once the code re-org is completed, we plan to add more experience and gameplay changing features like terrains etc.

We also plan on providing a FPS kind of perspective, in future - but that is a long way to go. By using a source code repository, tracking these major release branches is turning out to be very easy!

Friday, April 24, 2009

Resurrecting Adrian

Adrian was the name of the game which me and my friends swamy and vamsi, have written in 2003. We were studying 3rd year in IIIT-Hyd, and there was a game design contest announced. We immediately jumped on board and wrote this game - Adrian - in flat 7 days (actually more nights :P). It was awesome for a week's effort, and we won the first prize for it.

We had to borrow my friend's CPU for a week, since the graphics card on which we could actually program was very expensive and beyond our means. Unfortunately, after the contest, the development stalled as we cannot afford the graphics cards. Later I was able to afford one, but then, I was working full-time, so that left little time for game development.

A week ago, I got a mail from a guy who played the game and liked it. That prodded me into going back and look through the code and realized I was as excited about it, as I was when we first got the idea. So I decided to resurrect the game, and immediately moved the code to Google code for version control, and started working on it. The latest code and developments can be seen here.

I am also working on giving this game a newer home somewhere on the net. This might take a while as I plan to first improve the game etc. The old website of the game can be found here.

Wednesday, April 22, 2009

Out of Space on Picasa? Dont fret yet!


If you go on enough vacations, this is bound to happen sooner than later. You will be uploading pics and then realize that suddenly you ran out of the allotted 1GB on Picasaweb. And you dont want to shell out $20 for additional space! So, although you can go and delete old albums or some pics, it is very time consuming. For example I have over 20 albums and am not prepared to delete any in total. I tried going through them to remove less interesting pics, but lets face it - it is a very tedious task!

So here is a simple way, just use the Picasa software and use the "Import from Web Album" feature to download an album to your local machine. Then edit the settings and reduce the resolution to 1024x768, and then upload them back. You would have retrieved over 50% of the space from previous resolution!

Thats it... oh and while we are on the topic, check out my Gallery at http://picasaweb.google.co.in/chbhanukalyan :P

Sunday, March 29, 2009

Debugging Memory Allocations

Debugging memory allocations etc is always a pain, especially if you have memory leaks which dont cause errors directly. There are a wide variety of tools which facilitate detection, the most useful being Valgrind. The tool is awesome, and it definitely helps in this task. Also GNU libc has a wide ranging support for just this task.

But unfortunately you are not always lucky, and might find yourself working on systems other than Linux. Like FreeBSD. (Well you might have guessed that I am no fan of FreeBSD). Although Valgrind has a port to FreeBSD, it coredumps on startup. So in such dire circumstances you are left with no choice but to start from scratch.

Well everyone knows the standard mymalloc method, which is just a wrapper for the standard malloc call. However here is a more efficient method of doing it. Use the linker option "--wrap,malloc" which will make any references to malloc point to __wrap_malloc() (which you will be writing) and to call the actual malloc from inside your wrapper just call __actual_malloc().

The other option is to use the LD_PRELOAD, which loads your custom library, so any malloc calls are resolved to your wrapper calls. To call the actual malloc(), use the statement - "dlsym(RTLD_NEXT, "malloc");", which will give a function pointer to the actual malloc().

I know the blog is not too comprehensive on how to use these 2 facilities, but now that you know what can be done, just google them :)

OPEC - Why it no longer calls the shots

"Are you nuts?" might be the first response of anyone who sees the title. Afterall everyone knows that the single factor which definitely affects the spot price of an Oil barrel on the floor of the NYMEX, the most, is an OPEC meeting. So let me elaborate. OPEC is powerful, but not as much as it once used to be. If anyone remembers the 1973 Oil shock - which brought America and most of the world to its knees in a decade long bout of stagflation, you will now know how much less power it wields today.

So what can be the reasons for such a powerful body's influence to wane? To understand the reasons, you need to understand the composition of OPEC. OPEC stands for Organization of Petroleum Exporting Countries. It is a cartel of 12 countries, the main member being Saudi Arabia accounting for over 25% of world reserves. Other countries like Venezuela have much smaller reserves. So now lets take a look at some of the reasons for the waning of its effects.

Production: Although OPEC used to control a lot of Petroleum production, New reserves discovered in the Gulf of Mexico, and Russia opening up its vast Oil reserves have reduced OPEC's global output to under 40%.

Price Issues: OPEC members have divided interests over Oil prices. While the naive reader might think that a higher price is in the best interests of all suppliers, things are more complicated. Saudi Arabia has much more Oil in the ground compared to other members of OPEC. So while a higher price helps in the short term, it will also accelerate development of alternative technologies, which will eventually reduce the world dependence on Oil. So OPEC members with less Oil in the ground, could not care less about the future, and want to make more money with less oil, and hence want higher prices. Saudi Arabia, on the other hand, wants the world to continue its addiction with oil, and hence would not want to invariably prop up alternative fuel technologies. This attitude is summed up by a quote by a Saudi Oil Minister as "The stone age didn't end because we ran out of stones". Even towards the end of 2008, Saudi broke ranks, and declared it will pump over its OPEC imposed production quota, to reduce the Oil prices which were in the stratosphere.

Infighting: Also after a great show of unity in the 1970s, the major OPEC nations turned against one another. Firstly the 8 year Iran-Iraq war distanced the Shia Iran from the rest. Later, Iraq which was trying to service its war debts more easily by rising Oil prices was rebuffed by Saudi and Kuwait which pumped out more Oil and depressed global Oil prices, finally provoking Iraq to invade Kuwait and eventually Saudi, if it were not for America's intervention.

The Iraq Factor: Although Iraq is a member of OPEC, it is not taking part in production quotas since 1998. And with the highly increased American influence, it is much more likely to do US's bidding at least in the near future, which most probably will not coincide with the official OPEC stand. Also after a long time, Iraq is comparatively stabler and will start pumping more and more Oil, increasing supply and indirectly reducing OPEC's influence.

America: And finally lets not forget US's Gunboat diplomacy by having a couple of warships and aircraft carriers patrolling the Gulf. Although Saudi is an ally, the war ships let it know its position, and the emergence of a Shia Iran, right next to its borders as well as a discontented population, rising Islamic terrorism against the ruling sheiks would make Saudi more reluctant to anger it ally America. And America is much more interested in the Gulf after the 1973 Oil Shocks.

These are some of the reasons why OPEC is less powerful, but lets not get carried away, It is still the single most powerful factor in determining global Oil prices. So let us hope that the dependence on Oil will decrease soon enough.

Tuesday, March 24, 2009

Oil prices scrapping the bottom - Lost Lessons


Now-a-days, Oil price is the last thing on people's mind, with an Election just over in the US, the economy in the dump, and theories about a very prolonged recession - which has even been compared to the Great Depression of the 1930s. Sure enough, it seems like almost no one remembers that oil prices were topping $147 just a few months ago... The commodity bubble has burst at last, and has dragged the price of Oil back into $50 range now.

So what now? Will the prices continue at $50? Obviously not. Once the downturn is over, the OPEC countries will actively seek their pound of flesh. So here is a golden chance for Obama to right many wrongs that were done earlier. Instead of seeking short term quick fixes for bumping up Oil production by offshore drilling or invading other countries, a comprehensive plan to rid America of its Oil addiction needs to be worked on.

Although the end of the cold war made the world a much safer place, it inevitably resulted in America losing its focus on Science & Technology. Ofcourse the top technology companies are still US-based ones, but they are private. And private companies tend to be short sighted for obvious reasons. And real technologies take time to mature and generate profits. It is the federal govt's responsibility to fund such long-term technologies, which will help tap into renewable resources.

The recession is showing at least some signs of waning, so once again a message from the Oil crisis is being lost. Renewable sources are the way to go, and still more research and funding into better batteries, solar power, etc is needed. Lets hope Obama does not lose sight of the future while trying to save the present.

Thursday, February 12, 2009

Kernel Crash? Get the dying moans...

So you had a kernel crash, when you were not around, and could not see on the console what the issue was. Or it happened on a server, which has a hardware watchdog which reboots the machine if it has crashed. So here is a way to get the messages which the kernel spit out before dying...

First of all you need to have enabled kernel crashdumps... there is no reason not to. So you are all set and the next time a crash happens the core is saved in a file called vmcore. Now fire up GDB and run the following commands

(gdb) set logging file ~/gdb.out
(gdb) set logging on
Copying output to ~/gdb.out.
(gdb) set print elements 41216
(gdb) set height 0
(gdb) p (char*)__log_buf

The file gdb.out will now contain the messages, open it in and replace all instances of '\n' with a real newline (using something like ":%s/\\n/\r/gc" in vim), and you will see something like this

<4>ide-floppy driver 0.99.newide
<6>usbcore: registered new driver hiddev
<6>usbcore: registered new driver usbhid
<6>drivers/usb/input/hid-core.c: v2.6:USB HID core driver
<6>PNP: PS/2 Controller [PNP0303:KBC0,PNP0f13:MSE0] at 0x60,0x64 irq 1,12

Happy Debugging! (I KNOW it wont be HAPPY :P)