Monday, July 19, 2010

Going LED!!!


This weekend was a rather industrious one for me since I was in a mood to fix stuff at home. It started off with fixing a damaged component of the car which would have cost over 15k LKR if went for a replacement. After this, I was eager to fix something else. Then I remembered that the fluorescent light based emergency lamps at home were giving trouble all the time, without serving the purpose. Their light was so dull and the emergency lamp was gradually becoming a decoration.

Then I thought, “hey, why not replace the dull tube with LEDs?!” Without a second thought, I got to work and formulated a quick and dirty plan. The lamp already has a chargeable 6V 4.5 Ah battery. So, my job is going to be really easy if I connect the LEDs properly without drawing out too much current from the battery and also without letting a high current flow through the LEDs which would bust them off instantly.

So, it was shopping time! Well, there’s nothing to exaggerate here. I simply bought 40 white LEDs, some circuit wire, soldering lead and a switch.

The light panel was the crucial element of the project. So, I took a thick cardboard and marked where the bulbs would go. My plan was to have two arrays of LEDs 20 on each array. 6V across two series LEDs seemed fine. Therefore, the entire light panel became a set of parallel connected two series LED units.

In this entire endeavor, I had an assistant who was very eager to help – my little sister :) . Since she also wanted to help, she was given the task of testing all LEDs to see whether they were working and she also helped to hold things in place while I soldered.

Once the light panel was made, I had to open up the lamp and make the connections to the power source. Since I had a rep to maintain, I needed to have something up and running before I left back to Colombo. So, my plan was to have the basic functionality up and running. Without any fancy stuff, I gave a direct connection to the battery and attached a new switch on the side of the lamp since the original switch was acting more like an insulator :P

And Voila!!! There’s my simply DIY project to make the emergency lamp LED powered!

This is not yet complete. I am yet to make the surface of the panel reflective and also need to run some tests to see if I can improve the power utilization. Let that be phase 2.

I know, this is not rocket science, but it was fun to get my hands on something ‘non-binary’ after a long time :)

Here are some snaps of the intermediate stages.







Monday, July 12, 2010

Watching a Java app die!


When you start living with Java, and extend that to eating and drinking java you start realizing amazing similarities between the language/paradigm and life. You start seeing java as a living organism which breaths and eats.

Once you hook up a java application for a monitoring tool like JConsole, you start seeing wondrous things. Analogically speaking this is similar to hooking up a person to an ECG machine. Once you get to analyze how the heap space keeps on increasing and how the garbage cleaner frees up memory from time to time it really starts looking like the ECG output. As a part of my geeky investigations, I felt like checking out whether I could recreate the ECG representation of a dying person on the JConsole using a dying Java program.
So, I chose one app which was throwing out of memory exceptions randomly, and decided to crank up the environment to the max and let the app run with probably the most resourceful environment. So, I turned on the –XX:+AggressiveHeap option which greedily expands the heap space and sets other relevant parameters. Then I also turned off the overload detection for the garbage collector. This latter was done by setting the -XX:+UseGCOverheadLimit option. This evaluates the proportion of time spent on GC and if it is significantly high, throws an out of memory error since it is very likely that it will run out of memory anyway.
After firing up the application, the awesome started to happen. I could see how the application started choking for life, until the heap space could not be expanded anymore, and the GC could not clean up anything further. After a tough battle, the application just died…!
Have a look at the JConsole output below.


Isn’t it fascinating? :)
FYI, here’s a list of VM options which you might not try out everyday.
Long live Java!!!


Friday, July 9, 2010

The UNnecessary intervention and our response...

Every Sri Lankan knows by now, or should know what this country went through over the last 30 years and how we got over that curse, despite the stereotype that the fallen villain has put on us saying that we remember something only for 2 weeks. When we are trying to remove the ‘developing country’ tag and move forward, it hurts the Western powers who were eyeing on SL’s bad times to hook in and take advantage of the extremely strategic location in the Indian Ocean. They would love it very much if we as a nation become a debtor to them eternally and cry and suck up for them to survive.

But when the ball starts rolling the other way, they panic. The UN is supposed to be an elite organization which is aimed at “facilitating cooperation in international law, international security, economic development, social progress, human rights, and the achieving of world peace” – at least that is what has been coined as its objectives. I agree that it has helped the member states significantly. But, again that is why it was created. How good the intentions might be, it seems to be in evil hands right now, and I have no hesitation is saying that the current secretary is tarnishing the UN’s reputation and obscuring our country’s rights as a nation.

The last few years in which the war came to an end thanks to the gallant efforts of the forces and associated leadership, it was visible in black and white how the so called saints tried to rejuvenate the terrorists who were falling day by day. There are so many atrocities taking place throughout the world by their own leading member countries, and yet they are ignored and these guys are chasing after our country with all sorts of awful charges. I need not go in to details.

So, how do we respond? At the end of the war, every one of us joined hands and hailed as one nation. It was a treat to see the national flag flying high in all corners of the country and how festivities took place in the island. A question is to be asked as to whether we still have that unity. The default answer would be ‘politicians are to be blamed’! I agree to a greater part of it. But, we are not idiots. We have brains to think and figure out who the bad guy is. When Mr. Ki-moon and his committee is trying to trample down our country, what are we doing? I know we all can’t go and declare war with those guys. But, at we should have a heart to backup the efforts taken by the government to defend us. Afterall, who has to go and face this in the end? It is not you and me. It is the government of the country who will be the interface. So, no matter whether you like the people in it or not, at a point like this everyone should ‘back em up’. Everyone can give their opinions on stages and thorough media. But, it is just a small set of people which has the ability and most importantly the spine to do something for it.

One person had the spine to walk up to the UN office and start a death fast. How realistic or not that might be, at least he had the guts to do it for the country. And it is extremely heartbreaking to see how he has become a joker on the face of many. Some guy who is excreting in cyberspace has even started a competition to predict the day that this person dies. Should we look at these and have a hearty laugh? Or should we condemn such treachery?

Think about it… This is not Iraq or Afghanistan! This is Sri Lanka!

We have only one country and the choice of everyone matters...

Disclaimer : This is a generic thought of mine as someone who loves the country which has nurtured him up to now, and is not aimed at promoting the government, a person or anything like that :)