Thursday, January 24, 2008

Easy solution on complex problem.

We call this "elegant solution". It is obviously very hard to achieve. One example of "Do things easy way" will be a book "The C programming Language by Ritchie and Kernighan." Reading this book several times is recommended. This thin book brought me new things each of three readings so far.
I admit that I used to be a spoiled programmer. "Jump on to the code without thorough thinking, busy in applying modern buzz worded technologies, proud of solving problems harder way than it supposed to be. Threaded, J2EE chasing, Fancy message passing methodology over MQ systems, Application Servers,.." Name it! I have tried many things on a lot of topics. Right, buzz words make my solution look fancier.
I remember a team when I was in AOL. It was my favorite team in my career so far. The team was handling 5000 servers directly, more than 15000 indirectly. To tell the truth, the best people that I remember are all them. Their solutions were very elegant. Berkeley DB was used for distributed storage. Socket was used, but home grown message router is involved in. No wonder that message router does not use any buzz word. Non-blocking IO is essential because of massive data size. But, most technical topics were pretty simple and basic. Only exception was Java WebStart. Grapher for analyzing data was written in Java Swing and it is distributed by webstart. That was convenient.

Elegant solution comes from thorough understanding of 1)nature of the problem, and 2)considering permutation of many possible subsolutions. Sloppy engineer doesn't have room to think alternatives. But, real guru can draw a complete solution in brain without touching a keyboard. And he enjoys several pictures of solutions and choose what will be the best. In this case, when he is using "global variable" (ah.. inevitable evil...), this really brings more convenience than complexity, with complete control. One example will be main() and PostmasterMain() of postgresql. It is beautiful piece of code.

Again, architecture is the key thing to make solution elegant. Do not just rush for a solution. Prepare a big chunk of brain for a complete solution. Key capability will be memory... Yeah. This is the train that I need to go for near future. Either I become a code monkey or I grow up as an architect. Things are not impossible. The best people that I remember are also 'human beings'.

Friday, January 4, 2008

simplest way for "ALT" key in xterm

After relocating to new place, Atlanta, with new work, my tasks are involved in many systems at the same time. In this case, using xterm is more useful than konsole. My konsole and emacs pair is generally one desktop, but multiple konsole or tabbed konsole for concurrent monitoring is annoying. So, working with many xterms on one desktop. xterm sucks when I need 'ALT' key. The easiest way is to replace xterm with rxvt. Here is my rxvt options:
rxvt -mod alt -bg black -fg white -vb +sb -fn 6x13

Bind this command with 'WIN'+x, then it is easy to bring up Xterm-like terminal emulator with 'ALT' enabled. If you are a fan of transparent background, Aterm is another good choice. I don't use aterm any more. First, transparency is obsolete since modern 3D based desktop manager(compiz-fusion/beryl) supports transparency for any type of win-frame. Second, more importantly, I am not a fan of transparency anymore.

One cool thing that I remember about transparent term is this. I made no-frame 100% transparent terminal with enough width. It is spawned with command "sudo tail -f /var/log/messages". It fakes like log messages flowing on Desktop directly.