Wednesday, March 5, 2008

FreeBSD 7.0

After one line qsort() craziness, I still didn't get back to sleep. I read about FreeBSD 7.0. FreeBSD has been proud of making better codes in the kernel than Linux evolves. They heavily used asynchronous IO before Linux introduced asynch layer. epoll() in Linux still needs more work. This time, FreeBSD proved their superiority once again. Linearly scalable SMP. According to their history, it took seven years to complete the solution. They staged into sub-solution for each releases (5.x, 6.x), and the war was over at 7.0. When I looked at the graph, it was definitely attractive.
They added more stable wireless support. But, my stupid BCM943xx card is not supported. Due to lack of my wireless support, I lost interest about FBSD 7. I am not good at BSD system, anyway. But, I swear that I wouldn't buy Dell laptop anymore. If I am buying a Dell once again ( I doubt this may happen ), the wireless should be Intel. PERIOD!

1 line qsort() in python

quick sort is very simple, but generally fast algorithm. If it is implemented in python, seeing the simplicity is obvious. Thanks to ease of boundary check, code will look like this:

def qsort(lst):
    if len(lst) <= 1: return lst
    left = [ e for e in lst[1:] if e <= lst[0] ]
    right = [ e for e in lst[1:] if e > lst[0] ]
    return qsort(left) + [lst[0]] + qsort(right)

Now, if evil lambda comes into play, we express this in one line.

qs = lambda lst: qs([ e for e in lst[1:] if e<=lst[0] ]) + \
    [lst[0]] + qs([ e for e in lst[1:] if e>lst[0]]) \
    if len(lst) > 1 else lst

hehe.. Okay, I admit that it is not simple one line. I am insisting this to be one line.
I appologize for trolling :) Maybe I am going wierd at 3:30 in the morning.

Thursday, February 28, 2008

OpenOffice compile on Gentoo

http://forums.gentoo.org/viewtopic-t-529291-postdays-0-postorder-asc-highlight-openoffice-start-75.html

44 minutes and 6 seconds! This is incredible. I remember when I compile it for the first time on mmy old P4 with 512 Mb. It didn't finish for long time, so I went to sleep to see it working the next day. 44 minutes is not a short time, but big improvement. New intel quad core with 4G ram must be cranking up.

Friday, February 22, 2008

b43-fwcutter-011

I should not be the only one thirsty for this package, and now it is available! Combined with the recent kernel (2.6.24-r2), now I am free from ndiswrapper for my wireless. Without Gentoo linux, this should be harder. Once again, I appreciate Gentoo linux. In short, I used this wiki. But I had to compile b43-fwcutter version 011 myself because it was not on portage, yet.

I have waited for this to happen for around two years. My previous Dell E1505 and current Dell 1521 had both Dell 1390 wireless, which has bcm43xx type chip. Older kernel called this bcm4311 or Dell 1390 in lspci, but from 2.6.20 (I guess...) it is called bcm94311. Whenever I had spare time, I tried different method but to fail.
bcm43xx series were broken to work with me always. And it is a black box system. I just cut out the firmware file from tarball without knowing who made how. I tried windows version, openwrt version, etc. Since I am not a hardware expert, I could only use things available by other people. Once it is installed on my /lib/firmware, I always hoped to 'Please work...' Interfacing this with Linux kernel was even more tricky. But no kernel module were co-operating on my side. I tried wireless debug on and tried to trace where things were broken. But, failed point I found was always beyond my capability :( And went back to ndiswrapper with rough riding on wireless.
I used to succeed by using Ubuntu. Their bcm43xx somehow knew what combination worked. I bear with this for a while but gave up Ubuntu for my laptop. First, hibernate was broken on me. So I had to wait 3 minutes after turn-on. My battery lost about 5% of its capacity just for booting. Second, their solution pulled out only 5.5 Mbps. No duplex communication. Third, LCD brightness control was broken with Ubuntu. When I was working in my dark room, this 100% bright LCD not only ruined my eyes, but also sucked up my battery.

From kernel 2.6.24, broadcom wireless chip is introduced under network device driver as CONFIG_B43. In hand in hand, b43-fwcutter released new version (011) in February this year. Kernel interfacing is officially resolved, and if new b43-fwcutter-011 knows about this, my long fight would be over.
I was right and now my 'dhcpcd wlan0' smoothly loaded my wireless. Full bandwidth of 11Mbps. I was so happy and tried from reboot. Still working :) Bye rough ndiswrapper.

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.

Monday, December 31, 2007

Happy new year..

Unlike American culture, we Korean celebrate new year more than 'Merry Christmas'. In more detail, new year has two sorts. Solar (regular new year) and lunar ( aka Chinese new year ).
Anyway, for all of you who read this post, I wish truly your 'Happy new year.'