Code for Concinnity

Hasn’t updated this blog for a long while! I just took a good look and I thought this blog is swarmed with things tagged geek stuffs, which prob­a­bly isn’t what I made this blog pri­mar­ily for.

So I am start­ing my second blog that focuses on these things:

Code for Concinnity

Hope­fully I’ll be migrat­ing my tech posts over there soon — if I can get off my lazy ass :-P

how to confuse an idiot?

Are you ready for this? These folks really have some cre­ative ideas:

how-to-confuse-an-idiot

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!

eclipse-toolbar-right-click

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:

1
<a href="http://kizzx2.com/eclipse/hide-toolbar/updates/">http://kizzx2.com/eclipse/hide-toolbar/updates/</a>

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

CCleaner

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!

Defraggler

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!

df3

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

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

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

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.

Situation

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 alice@localhost 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 alice@mail.local, foobar@mail.local 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
1
127.0.0.1    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 foobar@mail.local

A simple test to make sure everything’s working:

$ exim -bt foobar@mail.local
foobar@mail.local
  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 foobar@mail.local
Hello World!
.
LOG: MAIN
  <= Chris@mail.local U=Chris P=local S=296
delivering KEQKED-0002RS-A7
LOG: MAIN
  => foobar <foobar@mail.local> R=localuser T=local_delivery
LOG: MAIN
  Completed
 
# 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 <Chris@mail.local>)
        id KEQKED-0002RS-A7
        for foobar@mail.local; Sun, 08 Feb 2009 15:20:39 +0800
Message-Id: <EKEQKED-0002RS-A7@mail.local>
From: Chris <Chris@mail.local>
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

run

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
    1
    %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
    1
    sysdm.cpl
  5. Append your
    1
    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:

notepad
calc
Cal­cu­la­tor
explorer
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
sysdm.cpl
Opens System Properties
dxdiag
Opens DirectX Diagnostic
msinfo32
Opens System Information
msn­msgr
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

clipx-intray

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:

1
Ctrl+Shift+Esc

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

1
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.

have we run out of new invention ideas? …not!

Recently I had a con­ver­sa­tion with my uncle. We talked briefly about get­ting a job vs. being an entrepreneur.

My con­clu­sion was that get­ting a job is prob­a­bly suit­able for the “stable” people who won’t want too many fluc­tu­a­tions and just want to get by, while being an entre­pre­neur is not for the faint-​hearted but will def­i­nitely bring greater rewards if you are not too dumb.

His con­clu­sion was that get­ting a job is the way to go for except the really bril­liant people, and his reason was we have run out of ideas in today’s world and it is too dif­fi­cult to com­pete with estab­lished giant com­pa­nies if we don’t invent new ideas.

So really, is that the case?

On the sur­face, his con­clu­sion seemed to have a lot of truth to it. I remem­ber my dad telling me the same thing when I was a child, and I couldn’t come up with a clever new inven­tion idea to chal­lenge his stance. Even today, I can’t come up with some cool ideas on the spot. So it would be normal for most people to reach that we have run out of new ideas to start a new, suc­cess­ful business.

I don’t think so

But then, I really put some think­ing into that, and I could see that there are in fact end­less pos­si­bil­i­ties still wait­ing for us to dis­cover. How did I know? I asked myself this simple ques­tion, “Does every­thing in the world that we live in simply just works?” Obvi­ously, any­body will tell you how some­thing, many things, don’t work quite right in their lives. As opposed to having to come up with con­struc­tive ideas, just blam­ing what’s not work­ing (or put another way, incon­ve­niences of life) is a lot easier. I can come up with a few on the spot here:

  • I still spend a sig­nif­i­cant amount (maybe 5 – 15%) of my life on transportation.
  • I recently permed my hair curly, and I am con­stantly wor­ry­ing that I might do some­thing wrong that will make it straight.
  • If I want to eat some food I enjoy, I’m con­stantly count­ing the calories.
  • Urban coun­tries dump tons of food every day. Third world coun­tries dump tons of corpses every day.
  • I have to man­u­ally clean my ass with toilet paper every time after I defecate.

OK the last one might sound like a cheap joke but it’s a pretty legit­i­mate issue, when we look at the fact that flush toilet is con­sid­ered one of the inven­tions with most impacts by many scientists.

See, there are count­less small things that are still scream­ing for improve­ments in our daily lives. It’s just that we don’t notice them. Many people think that it would take a rocket scen­tist to make some ground break­ing inven­tion, which is totally not true. For exam­ple, I recently came across this bril­liant new device:

Approx­i­mately 3,000 wood­work­ers get their finger cut by a saw like that every year. This new inven­tion, which con­sists of no next-​generation sci­en­tific dis­cov­er­ies, is saving 3,000 woodworkers’ fin­gers every year.

The point I want to illus­trate here, is that there are still end­less pos­si­bil­i­ties here in the world, and we are not des­tined to be stuck in a cubi­cle day in and day out. All it takes is the ambi­tion and the cre­ativ­ity, and we all can do much more mean­ing­ful work than sit­ting in a cubicle.

So until the day when we have all the gad­gets in Dorae­mon, you don’t have to get a job because you can start your own!

Comodo: a free antivirus/firewall solution vs. ESET Smart Security

Update 2: I’ve given this prod­uct some real life usage tests. I must con­clude that the antivirus component’s per­for­mance is slow, ugly and unac­cept­able. I was fooled by its small foot­print (memory usage), but the scan­ning speed is slow and it effec­tively ren­ders my com­puter unus­able when I am doing any slightly more demand­ing oper­a­tions. Bot­tom­line: Stray away from this if you want any per­for­mance at all – for that pur­pose, I’d say ESET AntiVirus is still the best

Update: Unfor­tu­nately, after some test­ing, I just real­ized Comodo’s UI still requires the use of a mouse. Although it has slightly more options than ESET’s fire­wall, the manda­tory use of mouse still sucks.

In the past I’ve always used the com­mer­cial NOD32 Antivirus. Since ver­sion 3 it has also included a fire­wall in the ESET Smart Secu­rity. I have been quite sat­is­fied with NOD32 Antivirus since it has a solid detec­tion rate and more impor­tantly to me, very min­i­mal use of system resources. This is unlike say Norton, which is noto­ri­ous for eating up 50% of your system resources even when it is doing observ­ably nothing.

Recently though, I started get­ting annoyed enough by ESET’s firewall’s user inter­face. Simply put, I’m get­ting really annoyed by the fact that I have to con­stantly click the fre­qently appear­ing pop ups. What’s worse, the pop ups must be clicked by a mouse – it doesn’t sup­port using a key­board with tab­bing to the right button.

That’s not too bad though, after maybe a year of using it, I’ve learned of its con­fig­u­ra­tion enough so that I could set up rules to pre­vent the pop ups from appear­ing so fre­quently, but the occas­sional pop ups that appear finally drove me to inves­ti­gate into better solutions.

Then I found Comodo Inter­net Secu­rity – which comes with an Antivirus and a Firewall.

Comodo has been well known for its fire­wall, but the Antivirus com­po­nent is the company’s new inven­tion – this is like the reverse of ESET, which is best known for its antivirus but then expanded its market to fire­wall too.

I still haven’t used Comodo long enough to do a com­pre­hen­sive review of the two, but there’s one thing that I can say for cer­tain: Comodo’s user inter­face is so much nicer and pro­vides much more options than ESET.

And from some­where I’ve read, per­for­mance and low system resources usage is one of the design philoso­phies of the Comodo’s team. I forgot where exactly but I think I read it from the Comodo’s offi­cial forum – you can prob­a­bly take a look and you’ll quickly real­ize how inter­ac­tive the sup­port staff are in the forum – some­thing that blew my expec­ta­tion for a free product.

So, give it a try for this free secu­rity prod­uct, it’s def­i­nitely not wosre, if not way better than, most of its paid counterparts.

cygwin: WARNING: terminal is not fully functional

I recently encoun­tered an error where when I do a less in cygwin it goes WARNING: terminal is not fully functional Quite some people seem to have encoun­tered this prob­lem before and there are some dis­cus­sion threads on the Web, but I couldn’t find a page that pointed out the direct solu­tion after some googling. Here’s what I did to fix the prob­lem: It turns out that the envi­ron­ment vari­able TERM is some­how set to dumb instead of the normal cygwin. Appar­ently the dumb ter­mi­nal is not as fully func­tional as cygwin. Here’s what I did to con­firm the problem:

1
2
$ echo $TERM
dumb

I got less work­ing prop­erly again by doing:

1
2
$ export TERM=cygwin
$ less

It turned out that some­how the $TERM envi­ron­ment vari­able got set to dumb. To fix that, simply run sysdm.cpl from a Win­dows com­mand prompt, and delete the envi­ron­ment vari­able TERM. cygwin will then default TERM to cygwin

type​r​acer.com – Simple typing game against other live people!

Today I bumped into this very addic­tive game called Type­R­acer. A pic­ture says is all:

At first I thought “Oh it’s just another Flash game, I’ll give it a try because I like typing”, then volia! It’s not your ordi­nary every­day Flash game. For a Web-​based game, it offers a com­plete fea­ture set and a smooth expe­ri­ence of that of a real, installed game!

The random match­ing process is as smooth as it can be – just clikc “Race against others” and you’ll find your­self typing away in sec­onds! Simply click “race again” after a race and you’ll be instantly matched against other play­ers. The time I tried, there were enough play­ers on the server that I never had to wait for more than 10 sec­onds to be matched against other players.

They also have a “Invite friends” fea­tures where you can open a pri­vate room for invited friends only. That can be done by sim­ply­ing send­ing the URL to your friend, and they can instantly start play­ing – no forced reg­is­tra­tion, no noth­ing – that’s what you call fun!

Talk­ing about the reg­is­tra­tion, the sign up process was really smooth. First off, you don’t have to go through a clumsy reg­is­tra­tion process to start play­ing. Anyone can play as Guest, and if they find that they want to keep their records, just click on Sign up which only required you to fill in the user­name and pass­word – all in an AJAX box that required 0 page reloads.

Give it a try, my hats off to the devel­oper (Yeah I heard it’s a one-​man project.) Great job!




Bad Behavior has blocked 48 access attempts in the last 7 days.