Monthly Archive for February, 2009

Hide eclipse’s toolbar, permanently

I’ve been a long time eclipse user since 3.0. What has bug­gered me since that time is the mys­te­ri­ous tool­bar – there is no way to turn it off! Since I think around eclipse 3.3 they added an option on the right click menu to “Hide Toolbar”, but that is only tem­po­rary. The tool­bar creeps right back in on restart!


After some LONG time strug­gle with the eclipse PDE (Plug-​in Devel­op­ment Envi­ron­ment), I finally rolled out this little plug-​in that hides the tool­bar for me on eclipse start up.

Man, I still cannot believe how much time it took to actu­ally write a simple plug-​in like this! Maybe that’s a reason why the eclipse plug-​in scene hasn’t seen much advances lately – there’s too darn little resources! I mean, for the most of us, dig­ging through API and classes man­u­ally aren’t the most pleas­ant thing to do.

Please go check out the Google Code project page or use this update site directly:

P.S. I prob­a­bly will write some ecilpse plug-​in tuto­ri­als later, if I feel like it. So please stay tuned!

missing hard-disk space? – the answer!

Many of us Win­dows users have expe­ri­enced the frus­trat­ing mys­ter­ies – we find our hard-​disks shrink­ing and shrink­ing after some period of usage. Emp­ty­ing the recy­cle bin didn’t solve the mys­tery, nei­ther did clear­ing the TEMP folder.

Here I’ll present two amaz­ing, free­ware prod­ucts from Piriform


This pro­gram is an excel­lent clean up util­ity. As far as I have tested it myself, this is unlike many other prod­ucts which try to delete as many files as they could to make them sound useful. CCleaner per­forms safe oper­a­tions and I haven’t broken my com­puter with it. On my first time use, it dis­cov­ered and recov­ered more than 1GB of my hard disk space!


Another free­ware prod­uct from the same com­pany. Defrag­gler is orig­i­nally intented to use as a defrag­men­ta­tion tool, but it sur­pris­ingly served extremely well at dis­cov­er­ing large chunk of mys­te­ri­ous files that choke up pre­cious disk space. One unique fea­ture this piece of soft­ware has is the abil­ity to defrag indi­vid­ual files. And the Ana­lyzer is blaz­ing fast too – it ana­lyzed my 80GB drive in less than 10 sec­onds. Then I switched to the File list, and I can imme­di­ately sort by file size to find out the biggest files on my disk!


Sea­soned users might say this cygwin com­mand accom­plishes the same result:

du . 2>/dev/null | sort -nr | less

But that would prob­a­bly take 10 min­utes instead of 10 seconds!

Update: WinDirStat

My latest favorite method to do this is to use WinDir­Stat. I’ll let the offi­cial screen­shot speak for itself:


Totally reveals the answer, although Defrag­gler could still be faster in show­ing the biggest file.

cygwin+exim: setting up a local SMTP server for testing email applications

This is mainly a ref­er­ence for myself in case I forget how to do it later, as it took me a good deal of time to figure out.


I want to unit test appli­ca­tions that send emails. Obvi­ously I don’t want to be open­ing a dozen of real email accounts just to test this thing out. Nat­u­rally I would want to install an SMTP/POP3/IMAP server on Win­dows, and there is one free (open source) option that is quite promis­ing – hMailServer. How­ever, it still involves 2 (quite major) incon­ve­niences for my use case:

  • I have to go through the con­fig­u­ra­tion screens to create new users. i.e. if I want to send email to [email protected] I’d have to create the user account alice manually
  • I have to use an email client (like Out­look Express) to con­nect to the local POP3 server to view the emails. This seems redun­dant to me, since the files are already stored in my disks, why can’t I just view them?

The Solution

Then I came across exim on cygwin. exim is (as it claims to be) a vast improve­ment over the good ol’ send­mail. So I gave it a shot – man, that was awe­some! I can now direct my appli­ca­tion to send to arbi­trary address like [email protected], [email protected] and I can view the results imme­di­ately in a text file, solv­ing the two prob­lems men­tioned above. Here’s what I did:

  • Install exim using cygwin installer
  • Run exim-config
  • Edit /etc/exim.conf
  • Uncom­ment primary_hostname and set it to mail.local
  • Edit the router localuser, com­ment out the line check_local_user (If you don’t know what that means, just search for the line localuser:)
  • Edit %WINDIR%\system32\drivers\etc\hosts, add the line mail.local
  • Finally, reboot the exim service

And there you go! You can now send mail to *@mail.local. To view the mail, go to /var/spool/mail which con­tains all the mail in text files. A simple tail -f /var/spool/mail/foobar can mon­i­tor the mail sent to [email protected]

A simple test to make sure everything’s working:

$ exim -bt [email protected]
[email protected]
  router = localuser, transport = local_delivery
# If something is wrong in your config, it would say "Unrouteable address"
# Now let's try sending an email
$ exim -v -odf [email protected]
Hello World!
  <= [email protected] U=Chris P=local S=296
delivering KEQKED-0002RS-A7
  => foobar <[email protected]> R=localuser T=local_delivery
# Cool, let's see if it really delivered
$ tail /var/spool/mail/foobar
Received: from Chris by mail.local with local (Exim 4.69)
        (envelope-from <[email protected]>)
        id KEQKED-0002RS-A7
        for [email protected]; Sun, 08 Feb 2009 15:20:39 +0800
Message-Id: <[email protected]>
From: Chris <[email protected]>
Date: Sun, 08 Feb 2009 15:20:39 +0800
Hello World

tricks for the Windows Power Users

Many crit­i­cize Win­dows as being not user-​friendly to power users – you can’t do things the fast way even when you’ve used it for a couple of years. Here’s some tricks I’ve accu­mu­lated over the years to make using Win­dows (hope­fully) as swift as a *nix guru.

Why should we use Win­dows when we want per­for­mance and speed? Well, I guess that’s we game play­ers have to live for

Customize your Run dialog


This is undoubt­edly the coolest and most pow­er­ful trick for Win­dows power users. To be able to type what­ever com­mand you want from the Win­dows com­mand prompt is like being able to place sym­bolic links in /usr/local/bin

  1. Create a direc­tory some­where con­ve­nient. A good place I used is %HOMEDRIVE%:%HOMEPATH%\Commands.
  2. Now you’ll want to add this direc­tory to your %PATH%. This is done by:
  3. Press Win + R to open the Run dialog
  4. Enter sysdm.cpl
  5. Append your Commands path to %PATH% in Advanced -> Envi­ron­ment Variables
  6. Now you can place short­cuts (*.lnk) and even BAT files there and they will be run when you type the com­mand in the Run dialog!

Useful commands for the Run dialog

Talk­ing about the Run dialog, there’s a hand­ful of useful com­mands you may want to mem­o­rize to speed things up a little bit:

Opens Win­dows Explorer on path
con­trol netconnections
Opens the Net­work Con­nec­tions con­trol panel
sndvol / sndvol32
Opens the volume con­trol panel
Opens System Properties
Opens DirectX Diagnostic
Opens System Information
Opens Win­dows Live Messenger

Enhance your clipboard with ClipX

The clip­board is designed decades ago. Given today’s computers’ memory size, there’s no reason to jus­tify why we can only hold one value in the clip­board. Enhance it with this free­ware ClipX. You can store like 25 pre­vi­ous clip­board entries (includ­ing pic­tures, files) and recall them with one key com­bi­na­tion (default: Shift-Ctrl-V). Very handy for system admins and programmers


Opening Task Manager directly on Vista

Microsoft changed the pop­u­lar key com­bi­na­tion Alt-Ctrl-Del to open a screen with a list of not very useful options instead of open­ing the task man­ager. Here’s the new key com­bi­na­tion to open the Task Man­ager directly:


Locking your computer from the command prompt

There are var­i­ous rea­sons you might want to do this instead of Win + L, such as from within a BAT script. Anyway here’s how to do it

rundll32 user32.dll, LockWorkStation

Putting files to the Recycle Bin from the command line

Oops, there’s no tricks to it. Down­load my recy­cle utility.