Wednesday, December 24, 2008

Xterm with Truetype font?

I am not kidding. It has been a while, too. Just I knew that now. I simply googled and found this link.
This assumes xterm is compiled with xft library, which will be true for most of decent Linux distro like Fedora Core or Ubuntu. Especially, I am a fan of 'screen' utility, I don't need top menu, icons, tab names, etc. So!!! Try this:

$ xterm -fa 'Monospace-9'

Amazing.
Now, temptation for Enlightenment instead of KDE?

Thursday, December 18, 2008

new process state in linux kernel 2.6.25

I am obviously losing kernel tracking. I can't keep up linux kernel any more due to busy life. Today, while researching on my regular works, I ran into this article.

http://www.ibm.com/developerworks/linux/library/l-task-killable/index.html

In short, linux innovated new process state, called TASK_KILLABLE. Operating system is still evolving. Almost 50 years after its first version of Unix, still finding a way for innovation.

Wednesday, December 17, 2008

Adding unittest in python with TestSuite

Unittest is an important fundamental for solid software development. At the same time, maintaining proper unittests is also a burden. Managing good unittest is always a challenge.

One of the challenge in python comes when unittest.TestSuite is needed. Generally, each class will split out to each of unittest.TestCase class. But, to teach TestSuite what TestCase to load, we have to pass a list of TestCases, and writing a list manually like this isn't fun.

suite = unittest.TestSuite([
unittest.TestLoader().loadTestsFromTestCase(FirstTest),
unittest.TestLoader().loadTestsFromTestCase(SecondTest),
unittest.TestLoader().loadTestsFromTestCase(ThirdTest),
.....
])

It is error prone. More annoyingly, if I add a new test case, I have to modify suite, also. Using this driver will auto discover test classes in the current module.


moduleList = [ globals()[mod] for mod in globals().keys() if mod.endswith('Test') ]
suite = unittest.TestSuite([
unittest.TestLoader().loadTestsFromTestCase(i) for i in moduleList
])
unittest.TextTestRunner(verbosity=1).run(suite)


This uses naming convention of "SomethingTest" as a test case for class "Something".
Keeping this convention will be a keystroke save.

Friday, December 5, 2008

Tools for these days

I adapted two major changes in my tool set.

1. fish instead of zsh/bash
Most linux ships bash. I have used bash mostly. zsh was okay. But after I found fish, settled in fish. It is different but not difficult to migrate from bash. Nice color coding with good completion like zsh. Its script syntax resembles to tcl. I don't like tcl, but I could handle fish okay. Another unusual, but eventually more useful thing is the lack of history expansion. !! or !$ in bash does not exist in fish. Instead of them, fish simplifies all history recall with Up/Down and Alt-Up/Alt-Down. Action oriented :)
fish is very useful in many aspects. One useful thing is its history keeps not only history of the commands, but also keeps the timestamp when it ran.

2. screen instead of multiple xterm
Spreading xterms all around desktop looked sloppy. So, I tried to pack them into one screen session. At first, the environment was not familiar, but later I got used to it and navigated fine. So, mostly my dual screen is one emacs session plus one konsole with screen. These look more elegant than patching desktop with many xterms.