Discuss these Tidbits Subscribe to these Tidbits

Tidbits from the Dungeon

bite sized chunks of questionable wisdom

On Programmers
The trouble with programmers is that you can never tell what a programmer is doing until it's too late. -- Seymour Cray
The only thing more frightening than a programmer with a screwdriver or a hardware engineer with a program is a user with a pair of wire cutters and the root password. -- Elizabeth Zwicky
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning. -- Rich Cook
The best thing about a boolean is even if you are wrong, you are only off by a bit. -- Anonymous

Trying to build Firefox 3 with better font handling. This beast is huge:

deepak@vyomlinux:/s/build/firefox/mozilla$ time make -f client.mk build
Adding client.mk options from /s/build/firefox/mozilla/.mozconfig:
    MOZ_CO_PROJECT=browser
    MOZ_OBJDIR=$(TOPSRCDIR)/../obj-$(CONFIG_GUESS)
make  -C /s/build/firefox/mozilla/../obj-i686-pc-linux-gnu

... pages and pages of make output ...

make[1]: Leaving directory `/s/build/firefox/obj-i686-pc-linux-gnu'

real    73m37.836s
user    63m51.543s
sys     3m31.397s
deepak@vyomlinux:/s/build/firefox/mozilla$
I always pass on good advice. It is the only thing to do with it. It is never of any use to oneself. -- Oscar Wilde
fcp

Some time back, I noted on Tidbits how, frustrated by Firefox's useless file-picker, I've resorted to using a shell alias to copy file names to the clipboard. To recall:

$ alias xcp
alias xcp='dcop klipper klipper setClipboardContents'
$ xcp /home/antrix/file/to/send.txt

So what happened is that quite frequently, I found myself navigating to a directory in the shell and then using pwd to build the full file path for xcp. Like so:

$ xcp `pwd`/send.txt

As you can imagine, typing that pwd soon became a chore. Happily, BASH to the rescue again:

$ function fcp {
>   xcp `pwd`/$1
> }  
$ 
$ fcp send.txt

That's it! Another bit of irritation solved :-)

And this has been another presentation from the mildly-interesting-to-four-people department.

Spam for 2008

A zen moment in my Gmail today:

spam 2008
Elevators

Read this on Wes Felter's blog and it made me laugh out loud:

"Hello?"
"Help, we're trapped in an elevator."
"Which elevator?"
"Uh, #1, the north parking garage."
"What state are you in?"
"We're fine. We're in good spirits."
"Are you in North Carolina?"

On Photography
It's been said that photography is the ultimate example of quoting out of context. Perhaps street photography is the ultimate example of that ultimate example. -- Ken Tanaka
Django's goal is to be a toolkit to write applications, so at some point you'll probably want to fiddle with some technical bits, or hire someone who can (unless, of course, you're a Web 2.0 startup -- then you can simply use django.contrib.flatpages to slap up the "beta coming soon" page, and you're good to go) -- James Bennett
encoding bugs

For a long time, I've had trouble with using UTF-8 encoded text on this Tidbits mini blog. The software broke down as soon as it encountered a character that couldn't be mapped to the standard ascii range. As you may know, Tidbits runs on some home-rolled code so there is no one else to fix such bugs but me :-)

I finally tracked down the cause of this problem. Two causes actually:

  1. A missing set encoding=utf-8 in vim's ~/.vimrc meant I could never reliably edit utf-8 encoded text. So if I copied such text from somewhere else and pasted it in vim, breakage happened.

  2. Some bug in web.py's template module which I didn't actually have to trace or fix. Just upgrading to the latest 0.23 release resolved that bug.

So finally, Tidbits handles encoding cleanly from end-to-end. Now all I need is a vim function to generated timezone adjusted timestamps and Tidbits would be the perfect little little blog setup!

Photo Archives
Since I ruthlessly throw out everything that isn’t either publishable here or of sentimental value, my entire photo collection is something under 40G in size, so why shouldn’t I always have it with me? -- Tim Bray

I should stop caring about every photo I take and just follow tbray's philosophy. Getting attached to digital stuff is worse than material attachments.

Good Sense
Of all things, good sense is the most fairly distributed: everyone thinks he is so well supplied with it that even those who are the hardest to satisfy in every other respect never desire more of it than they already have. -- René Descartes
Shell Statistics

There's this meme going around:

deepak@vyomlinux:~$ history|awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
1242 cd
565 vim
209 svn
128 rm
104 ant
97 grep
89 hg
87 ssh
77 cp
69 sudo
deepak@vyomlinux:~$

Of course, these numbers are after ignoring duplicates and a few oft-used commands.

deepak@vyomlinux:~$ echo $HISTCONTROL
ignoredups
deepak@vyomlinux:~$ echo $HISTIGNORE
&:ls:ll:new:s:[bf]g:exit
deepak@vyomlinux:~$ alias ll s
alias ll='ls -lrt'
alias s='cd ..'
deepak@vyomlinux:~$

What are your shell stats?

A conservative is a liberal who got mugged and a liberal is a conservative who got arrested. -- Anon

For some reason, I realized only today that in Python, dict unpacking works just like tuple unpacking.

>>> def fn1(x=1, y=2):
...   print x, y
...
>>> d = {'x':'hello', 'y':'world'}
>>> fn1(**d)
hello world
>>>
Story in a game is like a story in a porn movie. It's expected to be there, but it's not that important. -- John Carmack
Beta?

Twiddla is now in Public Beta, which means you can use it to do real work with confidence that it will behave as advertised.

I hate web 2.0 for destroying the term beta.

Tip Jar

My Ricoh GX100 inexplicably sets the copyright and description exif headers to by Caplio GX100 User & Exif_JPEG_PICTURE and provides no way to change the defaults. Thankfully, there's exiftool to do the job:

$ exiftool -Copyright='Deepak Sarda' -ImageDescription= -overwrite_original r*.jpg

Ever needed to surf non-mobile optimized sites on your mobile phone? Try Google's 'hidden' content adaptation service at http://google.com/gwt/n

I frequently find myself getting frustrated with file picker dialogs when sending email attachments. The fact that Firefox on Linux uses the insanely inusable Gnome file picker just adds salt to the wounds. A workaround I've found useful is to use a combination of dcop, klipper and bash's auto completion to quickly copy the full file path from a shell to the clipboard. Next step, just paste the file name in the attachment field. With a Yakuake based shell always just a keypress away, this is way faster than messing around with the file picker dialog.

$ alias xcp
alias xcp='dcop klipper klipper setClipboardContents'
$ xcp /home/antrix/file/to/send.txt

Why is everything related to flying in the US so utterly crappy. Even the NorthWest lounge in SFO is crappier than in Narita or Singapore.

It seems that every time I visit the US of A, their DHS decides to increase the number of digits they want scanned. Started with a thumb, then two index fingers, then two thumbs and this time I felt-up a shiny plastic box with eight fingers and two thumbs. Like someone in the queue said, the toes are up next.

What do you call a locked-down private social networking system? How about PriSoN. -- Wes Felter