Blogs
CSS menus
For the longest time I had been battling css menus with floating LIs. If the LI has within it normal text, instead of an image, each browser will indefinitely display the LI's with different widths because each font will be displayed differently. I either ended up usually giving fixed widths to each of the LIs, (which sort of defeated the purpose), or ended up with the entire menu being short of a few pixels in certain browsers.
The main problem with this is if you have a rollover, or an active state for the selected item, you will definitely see that extra space and it will look bad.
Learning Javascript Through Negative Example
The last couple weeks I've spent learning a client-side Javascript application framework, sproutcore. In the process, I took the opportunity to take a refresher on my javascript skills.
A decade and a half after the emergence of Javascript, there is still a tremendous amount of confusion, even among developers, between Javascript (an awesome scripting language that is built into web browsers) and the DOM (the horrendous API that the browsers expose to Javascript). Compounding the problem is that you don't really need to understand javascript to write programs that sort of work most of the time. It kind of looks like C, and you can hack through it as if it were any other C style language. This has led to Javascript becoming the most widely misunderstood language. However, for your own sanity and the ultimate success of your webapps, it's a good idea to buckle down and actually learn it well.
The problem is, it's hard to learn Javascript. Or, more precisely, it's hard to know that you are actually learning javascript. The first google result for "Javascript tutorial" is the W3 Schools tutorial, which is a collection of nearly every mistake you could possibly make writing in javascript, presented as examples of what you *should* do. Not good.
Read notes as html
I tend to keep a lot of notes around my ~/docs directory. They are
formatted in Pandoc Markdown
because it's easy to type and easy to read. However, sometimes the
notes get fairly extensive, and it's nice to be able to read them as
html in a web browser rather than in the terminal window. To that end,
I wrote up this little tool that I call vah -- "View As HTML". All
it does is orchestrate the conversion of the text file into html and
then has a web browser open it.
SMS to Web
I set out to find just some basic information about how text messages translate into website actions, and ended up with more information than expected. SMS is the term for short messages service, referring to a message being up to 160 characters, and being sent from a mobile phone, or (SME) to a short messages service center, (SMSC), stored, and then forwarded to another SME.
A good diagram would be here, including a few other paths an SMS can make, but also beyond the scope of what I sought to find.
Filter a directory listing by characters
In Bash, you can get a list of files filtered by a range or choice of characters in the filename by using character expansion. For example, to get a listing of just log files in /var/log ending in .1, .2, .3 and .4, use this command:
$cd /var/log
$ls -l *.[1-4]
Or to just see the files ending in .1 and .4, use:
$ls -l *.{1,4}
Open a directory in Mac OS X Finder from the Terminal
From the Mac OS X Terminal application, you can open the Finder to any directory you wish by typing:
$open <directory name here>
For example, to open up the current directory in the Finder, type:
$open .
or the apps directory:
$open /Applications
Bash Shell Quickies
- CTRL-C : cancel the line you are typing
- CTRL-D : log out
- CTRL-R [word] : Search command line history for a command matching [word]. Keep typing CTRL-R to cycle thru all matches.
- CTRL-L : clear the terminal screen
show all process information with ps
$ps axww
The a option displays all process information other than your own.
The x option displays process information for those with no terminal; in other words, daemons and such.
The ww option tells ps to display all process information regardless of the window size. Info will be wrapped to the next line and not cut off like normal.
Ps is useful for getting information about what and how processes are running on your system. But normally, ps truncates each line at the width of the terminal window. The ww option prevents the truncation; very useful for when you know a certain string exists in the process line and you want to pass it to grep.
Old Greenwich Traffic Calming
My neighbors have banded together to implement a traffic calming program on our streets. Read the about the goals and progress of our efforts on the Old Greenwich Traffic Calming site.
How to find listening tcp processes
Sometimes you need to know what services are listening to what ports on your unix box. Two utilities that can get you some of this port and process information are netstat and lsof.
With netstat, you can find out which services are listening under which ports:
# netstat -na
The n option prevents ip to hostname lookups.
The a option adds to the output the sockets used by server processes.
Part of the output of the above netstat command will look like this (foreign ips have been x'd out to protect the innocent) :
$ netstat -na
Active Internet connections (including servers)

