Browsing All Posts published on »April, 2009«

One-Liner to Display My Computer’s IP Address

April 30, 2009

0

Here is yet another way to diplay a list of IP address associated with the current computer. python -c "import socket; print '\n'.join(socket.gethostbyname_ex(socket.gethostname())[2])" The socket.gethostname() call returns the host name of the computer. The socket.gethostbyname_ex() call returns a list of three items: The host name, the list of aliases for this host, and a list […]

The No-Tulip Festival

April 30, 2009

0

This year we once again went to the Skagit County Tulip Festival. However, we were in a bit of surprise: the fields are yet to bloom due to the colder-than-usual winter. Instead of driving around and watch the disappointing fields, we decided to visit the Roozengaarde and enjoyed their spectacular tulip patches. I took most […]

Changing Directory Listing (ls) Color in Linux and Mac OS X

April 25, 2009

11

Problem I practically “live” on the Linux command line and one thing that has been bugging me for so long that now I decided to do something about it. On my company’s Linux systems the ls command produces color output, which makes it easy to distinguish different file types. However, the directories are dark blue […]

Else If in Popular Programming Languages

April 25, 2009

0

Problem Statement I write program in many languages and the one thing I keep forgetting is how to spell “else if”. OK, stop laughing and think about it: each language spells “else if” differently: else if, elseif, elsif, or even elif. Solution To put my mind to rest, I create this list which serves as […]

Debugging Tcl script with puts

April 23, 2009

1

Using puts is the one of the oldest, yet effective debugging technique. For example: puts "before calling myproc" puts "myvar = $myvar" myproc myvar puts "after calling myproc" puts "myvar = $myvar" This technique is good, but it has at least two problems: To turn off debugging output, I either have to delete or comment […]

Boolean logic in Tcl

April 23, 2009

3

Many people who write Tcl script get confused when it comes to boolean logic, especially within if, while construct. To clear up some of these confusions, let’s take a look at the following interactive session: (tcl) 66 % # What is true? (tcl) 66 % set var -1 -1 (tcl) 67 % string is true […]

Email Settings for Popular Email Services

April 4, 2009

0

I often need to look up information to setup my mail clients such as POP3, IMAP, or SMTP servers and ports. Today, I decided to create a spreadsheet with these information which should help me and others. Feel free to edit the spreadsheet to include other services such as comcast, verizon, … Here is the […]

Unusual Juggling

April 2, 2009

0

Check out this video.

Follow

Get every new post delivered to your Inbox.

Join 34 other followers