Thursday, April 30, 2009

Prince Of Persia


Screen shot from Prince Of Persia 2008

Oblivion


Screenshot from Oblivion - The Elder Scrolls IV

My hunt for air conditioner

It was monday in mid april. We were running our cooler at full speed. But it was still throwing out hot air. I tried sleeping but the heat was too much to bear. Even the bed was hot and the pillows were wet with sweat. That was the time when i decided that i should be going for an ac. Air conditioning is essential for a good night sleep in india.

My understanding was that i would get 2 ACs - one for me and another for my parents and it should cost between 25K to 30K max. I opted out of split ACs because, they require a lot of work for installation and cost a lot as well. Window ACs are relatively cheaper and since I had window AC space in all my rooms, it would be easy to install.

My first problem was to figure out the tonnage of AC that i should go for. Calculators are available - if you search for "AC Calculator" on google. Most AC calculators provide the amount of BTU required for specified room size. BTU stands for British Thermal Unit - something used to calculate the amount of energy. Well most calculators say that for a room of size 14 x 11 with sunlight should require an AC of around 10,000 BTU. And another room of size 10 x 12 should require around 8,000 BTU. A general 1 Ton AC outputs around 12,000 BTU & a 1.5 Ton AC outputs around 18,000 BTU.

So all this technical babble tells me that i should go for a 1 Ton AC in my smaller room and a 1.5 Ton AC in my bigger room. Though the AC tonnage calculator by LG at http://www.in.lge.com/Support/rac_calculator.aspx says that you should always go for a 1.5 Ton AC no matter what the room size is.

Next and the most important thing is to decide the amount of electricity an AC would consume. There are ACs which consume less electricity than the others. This fact has a formula and the formula is known as EER (Energy Efficiency Ratio). EER is simple to calculate. Just divide the BTU with the Watts. So if you take an AC with 12,000 BTU and which consumes 1300 watts - the EER for that AC would be 12000/1300 = 9.23. Good ACs should have an EER of > 10.0. In India the calculation is done differently and a star rating is calculated and put on all the ACs. So a 3* AC is more efficient than a 2* AC, and the cose of a 3* AC is more than a 2* AC.

After a lot of research and armed with all this information i started out on a hot sunny saturday to get the ACs. First stop was at Chroma Electronics store. They dont know anything about EER or Wattage or Tonnage calculation. The range of ACs available were only Voltas and Hitachi. All they knew were about the stars. A voltas 1* 1.5 ton would cost around 15K. Same thing with 2* would cost 18K and 3* would cost 21K. A nearby store was promoting haier window ACs 1.5 Ton with EER of around 10.3 at 17K. I have no idea how good they are.

Our next stop was sector 18, Noida. Just in front of centerstage mall, noida there is a 3 storey shop which has almost all brands of AC. Again they were promoting Voltas, LG, Samsung, Hitachi. They had Onida and OGeneral as well. But the models were very few and they looked like no one was purchasing them. Even godrej sells ACs. I was surprised. The market is full of 1* AC at 15K. No one was willing to compromise on the price. Imagine a world without discounts. Later after roaming around for 3-4 hours i was able to figure out that major players in the market were Hitachi, LG, Voltas and Carrier. You could also get ACs from Samsung, Electrolux, Whirlpool, Onida, Ogeneral, Haier, Godrej, videocon - but they were not as popular. People generally asked for LG and took a 1* AC.

I was very confused. I realized that i had not done enough research. The sales executive were terrible. In the same shop two sales executive were selling different products. One says that whirlpool is the best AC - no problems has been reported. Other salu in the same shop would say that Voltas is the best AC. It is from TATA. Whirlpool and all are just crap. I also re-realized that salus are meant to sell. It is said that a sales person should be able to sell an AC to a person living on the north pole. You can never trust a salu.

Everybody was tired and exhausted due to my research. We - who sit in the AC all day long and type on the key-board to get our monthly paycheques, have all turned soft. Even an hour of walking we run out of breath. And i have been dragging everyone for about 3 hours in the sun. I realized that i should take a decision without proper research - else everyone would be disheartened - 3 hours of walking in the sun and still no result would be frustrating.

Then i called up a friend of mine and he told me that if you are undecided, you can close your eyes and purchase a Hitachi. It is around 4 thousand costlier than other ACs but it is very efficient and in a year's time it should be saving enough to make up for the extra cost. And in the long run it is more cost efficient. I then remembered my debate of whether to purchase a diesel or a petrol car. I had decided to purchase a petrol car which is costlier than a diesel car - but whose running cost is high because petrol is costlier than diesel. And though i did not regret my decision - but i still debate the same fact. I had gone for initial low cost and high cost of running with my car. So, i should go for initial high cost and low running cost. Maybe it will be beneficial in the end. Bingo - i made the decision to take a Hitachi AC. 1 Ton with EER of 10.6 costed 21.5K and 1.5 Ton with EER of 10.6 costed 25K. Whereas i was getting 1.5 Ton Voltas with 3* - EER of around 10 for 21K.

Remember that An AC has an additional cost of installation which is around 500/- and you have to have a voltage stabilizer - which starts from 2.2K and goes up to 4-5K. It is better to go for a voltage stabilizer with copper winding.

Later, the next day i sat down and did my research and found out that AC has 3 brands to look out for - Voltas, Carrier and Hitachi - for budget, mid-range and the best AC respectively. Carrier is a very good option for those who are looking at better efficiency and low power consumption in mid-range. Maybe i should have bought a carrier AC and saved myself some money. Anyways, the AC is installed and running successfully.

Tuesday, April 07, 2009

memcached replication

Wow... finally a solution that provides replication in memcache - repcached.

You can have a look at it repcached.lab.klab.org.

They provide two types of packages

1. a pached memcache source, which can be directly compiled.
2. a patch which can be applied to the memcache source and then compiled.

So, i downloaded the memcached-(version)-repcached-(version).tar.gz source and simply compiled it.

./configure --enable-replication
make
sudo make install


Note : When you enable replication, you cannot do --enable-threads.

I started two instances of memcached on ports 11211 & 11222

jayant@gamegeek:~/php$ memcached -p 11211 -m 64 -x 127.0.0.1 -v
replication: connect (peer=127.0.0.1:11212)
replication: marugoto copying
replication: close
replication: listen

jayant@gamegeek:~/php$ memcached -p 11222 -m 64 -x 127.0.0.1 -v
replication: connect (peer=127.0.0.1:11212)
replication: marugoto copying
replication: start


Now set and get a value on instance on port 11211

jayant@gamegeek:~$ telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
set hello 0 0 5
world
STORED
get hello
VALUE hello 0 5
world
END


Connect to port 11222 and try getting this value

jayant@gamegeek:~$ telnet localhost 11222
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
get hello
VALUE hello 0 5
world
END


Try the reverse as well

On 11222
<---snip-->
set key 0 0 5
myval
STORED
get key
VALUE key 0 5
myval
END
<---snip-->


On 11212
<---snip-->
get key
VALUE key 0 5
myval
END
<---snip-->


Suppose the master goes down (in this case lets assume that the memcached on port 11211 goes down). So, we redirect all traffic on port 11222. But later when memcached on port 11211 comes up, the data should be automatically replicated on the new instance. Lets kill the memcache on port 11211 and restart it

On port 11211

Killed
jayant@gamegeek:~/php$ memcached -p 11211 -m 64 -x 127.0.0.1 -v
replication: connect (peer=127.0.0.1:11212)
replication: marugoto copying
replication: start


On port 11222

<---snip-->
replication: close
replication: listen
replication: accept
replication: marugoto start
replication: marugoto 2
replication: marugoto owari
<---snip-->


Lets see if the data has been replicated on port 11211

jayant@gamegeek:~$ telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
get hello
VALUE hello 0 5
world
END
get key
VALUE key 0 5
myval
END


Bingo...
Please share your experience if you have tried it on a live scenario with large number of sets and gets.

Thursday, April 02, 2009

How my car was mowed down by a truck...

Actually my car was not mowed down, but it was damaged badly. This is a delayed post. The incident happened on March 08.

What happened was that i had gone with my friends and my wife to jaipur. And on the way back, we were in peak traffic. After driving for around 250 kms, We were around 2 kms from home and we were standing at a red light. There was a truck (not the big one, just a small one) on our right and lots of bikes on our left. We were waiting for the red light to turn green. After the light turned green, i just stood still allowing the bikes on the left to more out of my way. At that exact time i felt my door moving. I turned right and saw that the door was bending at an absurd angle. Actually it was coming off. And then my friend's wife from the back seat notified me that something was wrong. I looked up and saw the truck pushing my driver side door and trying to take it off with it.

My friend got down and asked the truck driver to move back. There were tons of vehicles behind us and all of them were honking. Also note thatthere was a police chowki just 10 meters from where the accident took place. No one got down to help us. Not even the respected police men. Anyways, the brawl started. My brain boiled with anger. After the car and the truck were unentangled, we got the truck to cross the red light andstop at the side of the road. I drove my car and stopped it right in front of the truck. And then joined the brawl.

The truck was having 1 driver and 4 passengers - all sqeezed in the tiny space at the front of the truck. We got the driver to come down. We could see a policeman coming. First of all, without even having a look at the vehicles, the policeman was sure that i was the culptript. Maybe that was because - i was the wealthier party and would have been able to oil his hands well (make a better offer to him for letting the matter dissolve). But when he saw the car, he was sure that the truck was at mistake. And as soon as he realized that he could not make anything out ofthis matter, he simply disappeared - leaving us to take justice in our own way. Why do the hell i pay my taxes then, so that the policeman would leave me without support at the time of need. This happens in india only - i believe.

I was so angry that i offered the truck driver my car. I told him that you take my car and get it repaired and give it back to me. I would drive around your truck for the time being. The truck driver was just trying to comprehend was i wanted to say. Anyways, after lots of argueing and haggling, the truck driver fell to my knees and asked me to let him go. And i did that in return of just Rs 2000/- so that he can go ahead and mow down someone else's car. I would like to extend my appologies if any truck by the number UP-21-N-0568 mows down another car.

The next day was another fight to figure out the cheapest way to get the car back in shape. I went over to Shiva motors - the authorized dealer for GM cars, and they gave me a quote of around 60,000/-. I was shocked. My heart stopped for a moment. They wanted to replace both the righthand side doors and the front bumper along with paint job and labour. I also went to another "bajaj allianz" authorized workshop and they gaveme a quote of around 30,000/-. My insurance is from bajaj allianz - so i was basically looking for the cashless facility.

By chance i came across a workshop in noida sector 5 "Kashyap auto works". They took a look at my car and told me that they would arrange all the parts and it should cost me around 25,000/-. I said ok, cause this was the best deal i had got. I intimated the insurance claim to bajaj allianz and left my car at the workshop. The surveyor from Bajaj Allianz came and saw the car - took photos. It took them 2 weeks to repair the car along with labor and new parts. The door cost me around 5000/- and the beading and handle of the door cost me 3000/- The total cost came to be around 15,500/-. I claimed and got 80%. But i lost my no claim bonus for the next year.

The morale of the story is, stay as far away from a truck as possible while driving. The indian police only steps in when they see a probability of making some money for themselves. Prevention is better than cure.