Sunday, December 28, 2008

Note how

fancy signature files have gone out of fashion. I got my first email account 1997ish and I saw all this fancy ASCII art at the end of emails and that was part of the charm of email. And then they got annoying. And now, they're rarely used. I wonder what the new thing is. I'll probably find out the decade after they go out of fashion. I'm really lucky that way.

Saturday, December 27, 2008

Odd aliasing issue with matplotlib

I was plotting some data collected from an ADC and noticed an odd aliasing issue. The images below are screen caps of the same plot simply with resizing of the window. The correct plot is the middle one that shows symmetric biphasic pulses.

I wonder if there is any way to avoid this kind of aliasing. I vaguely remember MATLAB handled this gracefully. I have found matplotlib's plotting to be superior to MATLAB's in every way (except for 3D) and it would be nice if aliasing could be handled gracefully.

Wednesday, December 10, 2008

Matplotlib: Title for whole figure


adds a title centred on the top of the current figure, regardless of the axes configuration in the figure.

Thursday, December 4, 2008

Python humor

In [125]: from __future__ import braces
SyntaxError: not a chance (, line 1)

From slashdot (that fountain of knowledge)

(re)Installing eclipse

Well, I was going for an upgrade (I installed aptana's radrails environment which has all these bells and whistles that I don't want and all these flashing signs that remind me of a cheap motel and it wasn't working quite alright, so I was thinking, may be it is the eclipse version..) and I wiped the existing installation, so I lost all my plugins. So now I have to redo it. And this is as follows:

  1. (RadRails) - Check 'Features', but uncheck 'Studio professional', Check support for 'scriptaculous'
  2. (pyDev)
  3. Let aptana download its own variant of svn for subclipse

Saturday, November 22, 2008

Definitions for 'PhD'

And for some more stuff that has disappeared from the internet, here are definitions of PhD.

What "PhD" really stands for:

* Patiently hoping for a Degree
* Piled higher and Deeper
* Professorship? hah! Dream on!
* Please hire. Desperate.
* Physiologically Deficient
* Pour Him a Drink
* Philosophically Disturbed
* Pathetically hopeless Dweeb
* Probably heavily in Debt
* Parents have Doubts
* Professors had Doubts
* Pheromone Deprived
* Probably hard to Describe
* Patiently headed Downhill...
* Permanent head Damage
* Pulsating heaving Disaster?
* Pretty homely Dork
* Potential heavy Drinker
* Professional hamburger Dispenser... "Would you like fries with that?"
* Post hole Digger
* Professional hair Dresser
* Piano hauling Drone
* Pizza hut Driver
* Pretty heavy Diploma
* Phinally Done !!

The graduate student anthem

So, I wanted to send round the graduate student anthem to some labmates, but I just could not find it on the internet. So, finally, on the wayback machine I found that on an old website of mine instead of linking to it I had actually reproduced it. Hurrah for redundancy. So here it is again, hopefully to rise up from the depths of the 'net once more (to be sung to the tune of Hotel California):

In a dark deserted room,
Brylcreem in my hair.
Warm smell of unwashed socks,
Rising up through the air.
Up ahead on my PC...
I saw a shimmering light
My head grew heavy and my sight grew dim,
I had to work through the night.
As he stood in the doorway,
I heard the Rush Rhees bells.
And I was thinking to myself,
'two years of researching - and this could be hell'
Then he picked up my paper,
And he gave me an 'F'.
there were voices down the corridor,
Thought I heard them say,
'Welcome to the world of academia
Such a lovely place, such a lovely place, such a lovely phase.
Plenty of room at the world of academia,
Any time of year. any time of year,
you can get screwed out here.'
My mind was stiff and a-twisted,
The coursework never seemed to end.
Got a lot of glassy genius boys,
That we call friends.
How they crammed in the libr'ry,
Sweet summer sweat.
Some mugged to remember,
Some mugged to forget.
So I called my advisor,
'Please make me a T.A.'
He said ' We've never had such spirit here
Boy, you really make my day'
And now those students keep calling from .. far away,
Waking up in the middle of the night,
Just to hear them say
'Welcome to the world of academia,
Such a lovely place, such a lovely place, such a lovely phase
Livin' it up at the world of academia
We don't mean to cheat, we don't mean to cheat,
where's your answers sheet?
Four years was my ceiling,
Then came some advice.
He said 'We are all just prisoners here
Failed my defense thrice'
In the dissertation chambers,
The doctoral committee,
They quiz him with their steely glares
And he can't get his Ph.D.
Last thing I remember,
I was running for the door.
I had to find a passage back
To the place I was before.
'Relax', said the chairman,
'Til some results we receive.
You can check out any course you like
But you can never leave.'

Friday, November 21, 2008

Changing sourceforge project unix name

From here: Go into admin->public info->self-service project rename tool. This service is currently deferred because sourceforge is messing around with migrating datacenters

Saturday, November 15, 2008

Switching a project's SVN repo on eclipse

Needed to change the subversion repository for a project I had in eclipse. The machine was the same, its address had changed:

1. Disconnect project, (Yes to delete SVN files?)
2. Share project (Yes, it will check out new version blah blah)

This does not over write the existing files on your local copy...

Wednesday, November 5, 2008

Sunday, October 19, 2008

Thursday, October 9, 2008

New way to access sourceforge project web spaces

I don't know when the changeover happened, but I couldn't get into my project webspaces for the past week or so. It turns out that the new way to access your project webspace via the secure ftp is to use the following log in:
sftp username,
The password is the usual sourceforge password

Monday, October 6, 2008

Xcode and Ruby on Rails

Apple's developer site has a nice tutorial on how to setup an xcode project for rails here.

Sunday, September 21, 2008

Harvard Archers back in session

Yes! Gotta did out the old bow from the box - if I can find it...

Saturday, September 20, 2008

Installing Eric4

Eric4 is more involved to install than SPE.

Install SIT
sudo make install

Install PyQT
sudo make install

Install QScintilla
cd Qt4
sudo make install
Now make the Qsci module
cd ../python
sudo make install

Now install Eric
sudo python

Installing SPE

Install wxPython mac OS dmg
Grab spe from subversion:
svn checkout svn://
SPE runs right off the bat. The things I didn't like

  1. Small interface bugs involving the side panels.
  2. Somewhat kludgy editor font handling (if you switch from the default courier font)
  3. Somewhat unresponsive
Otherwise it has what I need - code intelligence, code completion, syntax highlighting.

Monday, September 8, 2008

Where to post code snippets on line

As I've been learning python and using it more and more in my analysis work I've
been wondering where I can go to post and find code snippets for python. A
central file exchange, much like matlab's file exchange, would be great.

I'm thinking of a very streamlined, blog like interface, where you log in,
upload a bunch of .py files and then write a little description of what the code
does and add some tags to it.

I asked this question on the matplotlib mailing list and got the following pointers to snippet repositories:

Activestate (from Michael Droettboom)
Snipplr (from Derek Hohls)

Thursday, September 4, 2008

Eye painting

Plot of my eye movements as I fixate on points appearing on a uniform screen. Data obtained using an infrared eyetracker (Eyelink 1000)

Saturday, August 23, 2008

stacktrace with gdb

file [file name of executable]
[do the action that causes the crash]

MERA 877-431-2833 scam

I had a charge to a visa card for $9ish from a company identified only as MERA 877-431-2833 TX. I hadn't used the card for a while, so that sent up flags. I did a quick search on the internet. It seems that this has happened to a bunch of people [800notes]. I've disputed the charge with my company. The only additional information I got from them is that the co is listed as a toy company from texas. Check your records.

Tuesday, August 19, 2008

Endnote and MS word 2008 mac

With tracking on, and under circumstances I have not nailed down, endnote insert citation will fail with a 'COM' error and will not update the field codes. The solution is to close word, close endnote and then reopen the document. On the next citation insert all field codes will be properly updated.

Saturday, August 16, 2008

Install package from command line

To install a package (.mpkg) from the command line use

installer -pkg XXX.mpkg -target / (or whereever else you want it installed)

you can get a list of volumes where you can install by doing

installer -pkg XXX.mpkg -volinfo

Mount dmg from command line

To mount a disk image (dmg) on mac os X from the command line use hdid

Some one has a sense of humor...

Friday, August 15, 2008

200 MB log file

And I was wondering why syslogd was hogging 100% CPU and why, at midnight bzip, of all things grabbed 100% CPU.

Wednesday, August 13, 2008

"Instruments" : Memory leak tracking on Mac

  1. Instruments is a Mac GUI tool "...for dynamically tracing and profiling Mac OS X code." Jon says Instruments uses dtrace.
  2. I wanted a tool to track memory leaks in a c++ application I wrote
  3. I find the "Extended detail" view most useful because it shows a stack trace for each memory leak which includes the function name and the source code line number. To me, this is amazing.
I did not compile the code with any DEBUG settings on.

A big "Thank you" to Jon Hendry for this one.

The Mac just got a lot more attractive for me as a development platform, not that I hadn't gotten comfortable with it already. Between the debug mode in eclipse and this tool, I'm all set.

Sunday, August 10, 2008

Emulators on mac

  1. zx81 - zxsp. Games here
  2. c64 -

Installing matplotlib 0.98.3 on mac

(See this post for a step by step list for getting python and friends set up for analysis on a mac)
  1. Get numpy 1.1 from here [sourceforge]. Use the disk image version. Mount and then double-click the package installer
  2. Get matplotlib 0.98.3 egg from here [sourceforge]. Use easy_install to install the egg. It fails, but it installs fine. Why?
UPDATE: Charlie says:

The OSX egg on SF should work fine on ppc and x86 machines on OS 10.3
and up. Unfortunately setuptools does not understand fat binaries at all
yet. For some reason it installs the egg fine, but then tries to go out and
download the source and compile it. Your idea of using the nodeps flag is a
good one. That's the situation as it stands.

Want my money back

Watched Pineapple express, want my $10.50 AND my 2hrs back, should have gone and watched the Mummy instead.

Sunday, August 3, 2008

SQL to items in a table not in another table

select id from keywords where id not in (select keyword_id from photos_keywords);

Why I love Python

I was reading "The remarkable inefficiency of word recognition" (Pelli et al. 2003) and I wanted to generate some of the stimuli they were using. In Python it took me a few hours total, starting cold using the Python Imaging Library. The code is below....
"""This contains routines to generate degraded letter stimuli"""

import Image #The PIL
import ImageDraw
import ImageFont

import numpy

def generate_letter(contrast_energy = .01, #michelson contrast energy
noise = 30.,
bg_luminance = 128.,
letter = "a",
letter_size = 400):
N = 300 #size of image in pixels

#first figure out what is the ink-area of the letter

font = ImageFont.truetype("Data/arial.ttf", letter_size)
#we copy the .ttf file to the local directory to avoid problems

im_temp ="1", (1,1), 0)
draw = ImageDraw.Draw(im_temp)
#now we can draw on this

sz = draw.textsize(letter, font=font)
#this tells us the size of the letter

im_temp ="1", sz, 0)
#this is a temporary binary image created solely for the purpose of computing
#the ink-area of the letter
draw = ImageDraw.Draw(im_temp)
#now we can draw on this
draw.text((0,0), letter, font=font, fill=1)
pix = im_temp.load()
#pix is now an addressable array of pixel values
area_in_pixels = 0.
for row in xrange(sz[0]):
for col in xrange(sz[1]):
area_in_pixels += pix[row,col]

#since contrast_energy = contrast^2 * pixel_area
contrast = (contrast_energy/area_in_pixels)**0.5
fg_luminance = bg_luminance*(1+contrast)/(1-contrast)
print area_in_pixels
print contrast
print fg_luminance

im ="L", (N,N), bg_luminance)
#im is now a NxN luminance image with luminance set to bg_luminance

draw = ImageDraw.Draw(im)
#now we can draw on this

draw.text(((N-sz[0])/2, (N-sz[1])/2), letter, font=font, fill=fg_luminance)
#this centers the letter

if noise > 0:
pix = im.load()
#pix is now an addressable array of pixel values

rd = numpy.random.normal(scale=noise, size=(N,N))
for row in xrange(N):
for col in xrange(N):
pix[row,col] += rd[row,col]

Saturday, August 2, 2008

Python Imaging Library

There is a list here of how to get distributions of the python imaging library for different OS. For mac you can the PIL from here (same place as you can get matplotlib etc).

Friday, August 1, 2008

Alternatives to latex

From a thread on slashdot:
  1. lout
  2. xetex
  3. wyneken
  4. ant

Eject disc from command line

I had an issue where I clicked the disc icon on the desktop to eject the disk, the icon disappeared but the disk did not eject. The following command will eject the disk:

drutil eject

Laptop saga III

Well, a month or two ago HP came good with their promise to replace the busted laptop [post 1, 2] and they sent over a dv2000 replacement for the old one. However, I read here (electronista) that several of their models have been affected by bad nvidia chips (this was the problem I was facing) - and the dv2000 (the replacement I got) was one of them. So.. the replacement is subject to the same problem eh? I gotta ask HP what to do...

Wednesday, July 30, 2008

Macbook Uptime

12:24 up 15 days, 4:54, 7 users, load averages: 0.37 0.34 0.37

The 7 users are merely me logged into different terminals...

Monday, July 28, 2008

Unix 'touch' and directory modification times

'touch'-ing a file will change its last modified time, but NOT that of its super directory...

Monday, July 21, 2008

Eclipse workspaces

Eclipse allows you to place your files into projects and projects into a workspace. You can also create different workspaces, but be aware that you have to setup things for each workspace like setting the spelling dictionary and setting any external tools you may want to use. Eclipse generates a directory called .metadata in the folder you select as the workspace folder. It stores a bunch of information in the .metadata folder

Wednesday, July 16, 2008

Eclipse is awesome

A LOT of thought went into this IDE. I highly recommend it. I have NO complaints. Really.

Tuesday, July 15, 2008

Eclipse and mysterious commits

Take a look at line 127 and line 300. Either some hacker has gained access to my laptop and has corrected spelling errors in the comments in my code, or else eclipse makes automatic spelling corrections in comments when committing... this is a little hair raising. I can't remember making those changes...

Sunday, July 13, 2008

Groceries in the Malden area

We haven't found something like Aldi's in Malden yet. We have tried Stop N Shop in Malden, Market Basket in Revere, Foodmaster in Melrose and Super 88 in Malden. Super 88 is perhaps the cheapest, but they lack a bit in variety - you can however get an amazing assortment of Chinese condiments.

Tuesday, July 8, 2008

Command line version of Unison on Mac OS X as regular user (not root)

  1. From a hint here, go here and grab the appropriate console version of unison. Thank Shuly Wintner
  2. Copy it to your user directory, say under YourUserName/bin
  3. make sure this is on your path by modifying your .bashrc file (not .bash_profile) to include:
    export PATH

    Tip from a discussion here.
  4. make sure all works by doing:
    ssh unison -version [here]
  5. run unison as usual
Yes, I'm a bad postdoc Jon.

Auto accident notes

  1. Phone police. If no injuries police may not come
  2. Get other car's license number
  3. Get other drivers info:
    Phone Number
    Driver's license
    Insurance company name and phone number
  4. Insurance co reccomends but does not require police report
  5. Take photos of damage
  6. Phone insurance company and report
  7. If its the other guy's fault, go through their insurance co
  8. Phone other insurance co and file claim. Do it soon
  9. They will appraise the damage and give a check
  10. Ask for rental car
  11. Ask for diminished value compensation
  12. Ask for body shop to check for other damage

Monday, July 7, 2008

The double click

Myself, I like the double click. I also like the left and right clicks. I was programming something using the QT frame work and I realized - hey waitaminuite: if I had a double click, its gonna first go through the single click process, there's got to be a way around this. Apparently not, double-clicks are supposed to be extensions of a single click. Oh, well, their house their rules...

UPDATE: This seems to be a common thing. The best answer I found was to use a timer to check for single vs double click. Chhobi will just not use double clicks - too much trouble... OK, OK, chhobi will toe the official line, single click selects, double click opens... sheesh.

Making a mix tape for the sweetie on a mac

Sometimes you need to make a mix-tape for the sweetie. Its the digital age now, surely there is a way to do it digitally. There is:
  1. Soundflower - acts as a virtual audio patchboard, allows you to 'rewire' the output of an app from the speakers (i.e. soundcard) to some other app. GPL
  2. Audacity - can record and edit sounds and save them as mp3, aiff, ogg whatever. GPL
Make way for video games sound effects + karaoke + background traffic sounds. What? Whaddyamean "Am I sure she will like it?"

Remove file from CVS on eclipse

From here: Just delete the file and then team->commit. If the file comes back (e.g. its an autogenerated file) right click to add it to .cvsignore.

I'm writing a QT project and there are all these moc_ and ui_ files that are autogenerated...

Thursday, July 3, 2008


Its nice to work in a vision lab: you can do searches for things like 'best LCD monitor for gaming' and still claim to be working.

Two delays in LCD display chain
  1. Input lag - time lag between the video card sending a frame to the LCD and it actually getting displayed on the screen.
  2. Response time - time it takes for a pixel to flip on screen. Two figures are quoted BWB (Black White Black) and GTG (Grey to grey). BWB has a black and white definition - the time it takes for the pixel to go from 10% (Black) to 90% (White) ON [here]. GTG is more gray - basically manufacturers put in what they want.
Like in gaming, the response time is important in vision research, if you have a moving stimulus.

Unlike in gaming, input lag, as long as it is constant, is not a big problem - you just factor that into your latency data

Wednesday, July 2, 2008

Environment variables and aqua

Instead of making a proper *nix box, those bright fellas at apple had to go make this frankenfiend of mac and *nix called OS X. Anyhoo, when you launch a mac os x app it can't see the environment variables defined in .bash_profile or .cshrc . This came to my attention as I struggled with running Unison over dhcp (my local hostname kept changing, setting the UNISONLOCALHOSTNAME variable did not help - see thread).

From the apple's mouth we see that we can "...define the variables in a Terminal session and then launch the application from the same session. When launched from Terminal, the application inherits the session settings, including any environment variables defined there." which works on 10.5.4

10 odd linux commands

From bash cures cancer.

Safari, history and security

Safari has a 'private browsing' option which prevents any state information from being stored in the browser. If you don't, good lord, Safari keeps more tabs on where you've been and what you've done than the FBI agents on the train. You think you can hide your dark secrets by clicking on 'reset safari'. You THINK. Then you glibly type in something in your spotlight window and BOOM, there's your recent visit to your retirement fund.

Spotlight keeps track of where you've been and what you've done under ~/Library/Caches/Metadata/Safari/History in a slew of .webhistory files and these are NOT cleared when you clear Safari.

Just so you know.

Not that you have anything to hide.


Tuesday, July 1, 2008

Ethernet card won't grab new IP on new network

Occasional problem: when waking up computer at work after its been on the home network, the ethernet card will refuse to grab the new ip from the dns.

From here:

sudo ifconfig en0 down
sudo ifconfig en0 mtu 1500 up

Make sure of your mtu value by doing
ifconfig en0

Result will be of the form


Saturday, June 28, 2008

Firefox 3 on mac os X

I'm happy with FF3.
  1. The intelligent address bar is nice. I can see it eventually making bookmarks obsolete
  2. The new bookmark maanger is great. On mac I missed the ability to drag/drop reorganize my bookmarks, I'm glad its back.
  3. Bookmarks, thanks to the address bar history - and now the intelligent address bar -, are now only really needed for those pages I only visit like once a month, like you know to pay bills, and really I don't WANT a bookmark for those pages...

Thursday, June 26, 2008

TV converter box

Looked at consumer reports and decided to get the Insignia NS-DXA1 which is the same as the Zenith DTT900. Some reports say that there is an audio problem, and some guys actually did an fft of the signal output and showed that there are mysterious peaks at 12kHz and 16kHz. I'll be able to tell later tonight if this is gonna be a problem. Isn't it convenient that this simple piece of electronics is prices around $60? Which comes to $20 after our pooled tax money supplies $40? I think the guys at the company decided that people would be willing to pay $20 for this thing, and hence the price.

UPDATE: One trick for the sound apparently to bump up your TV volume all the way and use the Insignia to control the volume. [here] See my experience below

UPDATE: The box works well
  1. I got 22 channels. This depends on antenna positioning. With another position I got 19
  2. The signal is really really clear. We used to get grain all the time with analog
  3. Sound doesn't have a hiss problem. I boost the converter volume to 100% and adjust the TV volume.
  4. The hiss problem goes away when audio is set to Mono.

Aspell on Mac os

  1. Get cocoAspell
  2. mount the dmg, install the package
  3. go to /Library/Application Support/cocoAspell/ and find any dictionaries that are install, or go to and install some new dicts
  4. go into the dictionary directory and do
    sudo ./configure
    sudo make
    sudo make install
  5. aspell is now ready

Wednesday, June 25, 2008

Incremental backups

From here:
rshargs = -C

perms = 1
path = Unison-test

backup = Name *
#backuplocation = local
backupdir = Laptop-Backup/ZZ-Old-versions --> NOTE RELATIVE PATH!!!
backupprefix =
backupsuffix = .$VERSION
maxbackups = 100

root = /Users/kghose/
root = ssh://**.**.**//Volumes/Blur File Server/Users/kghose/Laptop-Backup

Tuesday, June 24, 2008

Icons on mac

  1. Crop square image file from photo or from scratch using a picture editor e.g. GIMP
  2. Open up Icon Composer (Comes with xcode, /Developer/Applications/Utilities)
  3. Drag and drop the image file onto Icon Composer
  4. Save the file (say 'myicon.icns')
  5. Open myicon.icns in preview
  6. Copy the image
  7. Select the folder/file whose icon you want to change
  8. Right click and 'get info'
  9. Click and highlight the small icon at the top left (just above 'spotlight comments')
  10. 'Paste'

TeXlipse (aspell for Mac)

Eclipse is an IDE for everything. There are at least two plugins for Latex. I'm using texlipse. You need aspell and can get a Mac OS X version here. [cocoAspell]. After installation it will be available at /usr/local/bin/aspell

  1. There is a nice simple table editor. Yay!
  1. There is a small bug in the project setup. I like to keep projects under my directory structure, not under .eclipse. In texlipse if you click 'Create project at external location' and select a folder, then fill out project name, it will get created under .eclipse. You need to first fill out project name, then click 'Create ...' and then choose the directory.
  2. When you create a new file, it tries to open the editor but dies with some error. Closing the editor window and double clicking on the file opens it
  3. Outline view does not work
Too many bugs, things not working, going back to texmaker... The good thing is that I found aspell for Mac, that integrates nicely with the system preferences etc.

Friday, June 20, 2008

QT designer

  1. Can no longer add arbitrary slots to a widget, do that through the subclass [here].
  2. Add menu items my clicking on the 'type here' text on the widget [here].

QT on mac

#include <QtGui> //For the GUI components

#include "ui_main_window.h" //generated from QT Designer

void setup_menu_bar(QMainWindow *mw) {
QMenu *fileMenu = mw->menuBar()->addMenu("&File") ;

//QT on Mac automagically moves these to the application menu item because
//they have the strings 'quit', 'about' etc. in them

fileMenu->addAction("&About", mw, SLOT(close()));
fileMenu->addAction("&Quit", mw, SLOT(close()));

int main(int argc, char *argv[]) {

QApplication app(argc, argv);

QMainWindow *mw = new QMainWindow;

Ui::MainWindow ui;

//putting this line before setupUi causes menubar to be erased

return app.exec();

[code -> html conversion using Francois' tool]

Thursday, June 19, 2008

  1. Reinstalling steam does not wipe your downloaded games
  2. Bittorrent downloads can be resumed even after a reinstall of windows and bittorrent, because there are no messy states that bittorrent keeps lying around.
  3. Windows can be reinstalled without wiping the data

Wednesday, June 18, 2008

Google sketchup hints

  1. If updating gets slow, go to View and turn off 'section planes' and 'section cuts'
  2. For the tape measure tool hitting 'option' (on Mac) will allow you to add guides
  3. Measuring from a guide line results in a infinite guide line parallel to the starting guideline, measuring from a component point results in a finite guideline in the direction chosen
  4. Panning and rotating with any tool active slows things down - it could be that sketchup is doing a lot of computations with tools active. When I need to pan, I just switch to the pan/zoom/rotate tool.
  5. Drawing plane depends on where the horizon is. If Horizon is high ('ground' fills 2/3 or more of the screen) drawing happens on the horizontal plane. If the horizon is low ('sky' fills most of screen) drawing will happen on the vertical plane

Tuesday, June 17, 2008

Unison on Mac OS X

Works swimmingly. I have 10.5 on my laptop (Darwin Kernel Version 9.3.0) and there is 10.4 on the lab server (Darwin Kernel Version 8.11.0) and Unison synchs just fine over ssh. Thanks to Alan Schmitt for the binaries.


lsof is a fun tool to use. It lists files opened by a process.

Man page here.

Example usage

lsof -p 6415 (list files open by given process)

Thanks to Jon Hendry for introducing me to this tool!

Monday, June 16, 2008

Sourceforge wiki space

is nice but has some annoyances:
  1. Its a great place to put project notes. Saves the trouble of having a separate space on the local computer where notes are stored and have to synched etc etc.
  2. Its a great place for documentation and manuals etc.

  1. It will not warn you if you have lost your session - if you save your work, it will lose the draft and say you need to be logged in to edit
  2. Its slow
  3. It has annoying ads on top. Almost half the screen is taken up by non-wiki stuff

Sunday, June 15, 2008

Mounting isos

MagicIso Maker - windows (works on vista)
Loopback device ? mount -o loop -t iso9660 filename.iso /mnt/iso ?

Friday, June 13, 2008

Mime type modif on FF2

Firefox 2 allows you to modify which application opens what, but not add new mime types [here]. There is an add-on that allows you do do this [here].

No filing system compares to the Human brain

In the end, no electronic or physical filing system can keep up with the magic of the human brain.... ah if only we did not forget what we wanted to remember...

Thursday, June 12, 2008

In some ways Macs are well thought out

  1. The multiple monitor handling is well done:
    multiple desktops are handled seamlessly over two monitors
    a screen shot will result in two images, one for each monitor
  2. The operation animations are not only eye candy, but assist the brain by creating a continuous change rather than an abrupt one
  3. Fan exhaust is aimed backwards, not intakes/outtakes on the bottom.
  4. The magnetic power plug
  5. LED on power plug changes color when the computer is fully charged
  6. The battery has a LED charge indicator
  7. The decent battery life

Archery in Boston

In Maryland there was a public archery range 5min walk from home. Its not that simple up here. From here, we see that MIT has a club, but it is restricted to MIT affiliates. Harvard has a club, and they meet at the QRAC. I will try that out. Their mailing list is here.

There is a group doing outdoor practice, but that's far away.

Now, if you go to the national rifle association's webpage (thereby losing all your 'liberal' credentials) you find that Massachusetts has 95 gun ranges. (Compared to California which has 212, beating out Texas 179). Surely some of them should be closeby and should allow a meek archer to practice once a week...

Well if you go down the list there are 16 public ranges, of which 6 have archery:

Edgartown - Martha's Vineyard Rod & Gun Club , 265 The Boulevard, Edgartown, MA 02539.
Phone: 508-627-3537
Facilities include: Outdoor Pistol (50 yds), Pistol Silhouette, Muzzleloading, Trap, Skeet, Archery, Airgun
Range Access: Public
Web Site:

Gloucester - Cape Ann Sportsman's Club, PO Box 301, Gloucester, MA 01931.
Phone: 978-283-0304
Facilities include: Outdoor Pistol (100 yds), Indoor Pistol (50 ft), Outdoor Rifle (100 yds), Indoor Rifle (50 ft), Muzzleloading, Trap, Sporting Clays, Archery, Airgun
Hours of Operation: Call
Range Access: Public
Web Site:

Lee - Lee Sportsmen's Association, 565 Fairview Street, Lee, MA 01238.
Phone: 413-243-9721
Facilities include: Indoor Pistol (50 feet), Outdoor Rifle (200 yds.), Indoor Rifle (50 feet), Muzzleloading, Trap, Skeet, Archery
Range Access: Public

North Harwich - Cape Cod Fish & Game Association, Depot Street, North Harwich, MA 02645.
Phone: 508-430-0973
Facilities include: Outdoor Pistol, Outdoor Rifle, Muzzleloading, Trap, Archery
Range Access: Public

Westport - Fall River Rod & Gun Club, 309 Sanford Rd., Westport, MA 02790.
Phone: 508-673-4535
Facilities include: Indoor Pistol (50 Ft.), Trap, Skeet, Sporting Clays, Archery
Range Access: Public
Web Site:

Worcester - The Boston Gun Range, 225 Grafton St., Worcester, MA 01604.
Phone: 508-755-9955
Facilities include: Indoor Pistol (100 ft), Indoor Rifle (100 ft), Rifle Silhouette, Pistol Silhouette, Archery
Range Access: Public

Public ranges without archery are:

Granville - Wester Mass Bird Dog Club, 87 Farnum Lane, Granville, MA 01034.
Phone: 413-786-0773
Facilities include: Sporting Clays
Range Access: Public

Leyden - Leyden Rifle Range, Inc., 24 Old Frizzell Hill Dr., Leyden, MA 01337.
Phone: 413-773-3548
Facilities include: Outdoor Pistol (50yd), Outdoor Rifle (200yd), Indoor Rifle (50ft), Sporting Clays
Range Access: Public

North Attleboro - American Firearms School, 5 John Dietsch Square, North Attleboro, MA 02763.
Phone: 508-695-5869
Facilities include: Indoor Pistol (75 ft), Indoor Rifle (75 ft), Rifle Silhouette, Pistol Silhouette, Airgun
Hours of Operation: m-f 9-9 s/s 9-6
Range Access: Public
Web Site:

North Dartmouth - High Hill Fox and Coon Club, P.O.Box 541, North Dartmouth, MA 02747.
Phone: 508-995-7461
Facilities include: Outdoor Pistol, Outdoor Rifle (100 yds), Trap, Airgun
Range Access: Public

Princeton - Norco Sportsman's Club, Inc., 91 Houghton Rd., Princeton, MA 01541.
Phone: 508-795-5406
Facilities include: Outdoor Pistol (25 yds), Outdoor Rifle (25, 50 & 100 yds), Muzzleloading, Trap, Airgun
Range Access: Public

Rehoboth - South Seekonk Gun Club, 61 Reed St., Rehoboth, MA 02769.
Phone: 508-336-7282
Facilities include: Outdoor Pistol (50 yds), Outdoor Rifle (75 yds), Muzzleloading, Skeet
Range Access: Public

Salisbury - Bay State Arms LLC, 90 Lafayette Road, Salisbury, MA 01950.
Phone: 978-465-5561
Facilities include: Indoor Pistol (75 feet), Indoor Rifle (75 feet)
Hours of Operation: 7 days 10-9
Range Access: Public
Web Site:

Southampton - Easthampton Fish & Game Association, Inc., 92 College Highway, Southampton, MA 01073.
Facilities include: Outdoor Pistol (40 yds), Outdoor Rifle ( 200 yds), Muzzleloading, Trap, Skeet, Airgun
Range Access: Public

Springfield - Shooting Sports Center, 299 Page Blvd., Springfield, MA 01104.
Phone: 413-846-6400
Facilities include: Indoor Pistol (25 yards)
Hours of Operation: M-F 12pm - 8:30pm
Range Access: Public
Web Site:

Worcester - Boston Gun Range Inc., 317 Southwest Cutoff, Route 20, Worcester, MA 01604.
Phone: (508)755-9955
Facilities include: Indoor Pistol (75 ft.), Indoor Rifle (75 ft.), Airgun
Hours of Operation: seven days a week
Range Access: Public
Web Site:

Boston Commute

I commute between the Malden area and the Longwood area. There are several ways to solve this problem:
  1. Orange Line to Ruggles (30min) + walk (10-15min) ~ 45min
  2. Orange line to Ruggles + Free Longwood area shuttle (No ID required) - 35min to 45min
  3. Orange line to Ruggles + Bike (Haven't tried this, wouldn't work during peak)
  4. Orange line to North Sta (15min) + Green (Heath) to Longwood (20min to 1hr)
  5. Orange line to Ruggles (30min) + walk one block (5min) + Green (Heath) to Longwood (10min to 20min)
The Green line is a bit of a crapshoot. Some days its just fine, some days it crawls. The commute is faster/more reliable if you can put it out of the equation. The Orange line is fast, reliable, and during peak hours, very frequent. I would say near Malden, about 1 every 5min. In the evening, at North Station, perhaps one every 10min

The great thing about trains is that you can read on 'em. I get a paper a trip (about), which is decent.

Wednesday, June 11, 2008

HTML code in Blogger post

Use Francois' applet.

Web gallery with Image Magick

I had trouble getting Gimp to do my bidding via the console for batch processing. Learn Scheme? Yet another language? Well, Image Magick is amazing, and Darwin comes with a version of it. So, from here (IM tutorial) and here (Bash scripting guide) we have a pretty simple script to make a quick and dirty image gallery:

#Call using say ./ "*.JPG"

mkdir Thumbs
mogrify -format jpg -path Thumbs -auto-orient -thumbnail 100x100 *.JPG
echo "
<body>" > $gfn

for img in $1
echo "<a href=\"$img\"><img src=\"Thumbs/$img\"></a>" >> $gfn

echo "
</html>" >> $gfn
And BTW, putting code in Blogger is a pain, because blogger interprets the html, so here is an applet from Francois to do the conversions. Thanks Francois!

Tuesday, June 10, 2008

GIMP in batch mode on OS X 10.5

Gimp has a batch mode. On Mac calling Gimp as

Applications/ -b

Brings up the whole GUI and not interactive mode. from a hint here, we see that we can do

/Applications/ -b -

which does not bring up the GUI and puts gimp in batch mode.

Removing fink

sudo rm -r /sw

If you need to get rid of XFree too

sudo rm -rf /usr/X11R6 /etc/X11 /Applications/

From here.

Monday, June 9, 2008

Mac OS X software equivalents to some windows software

tortoiseCVS -> eclipse's built in CVS interface
winCVS -> Cyber Duck
SciTE -> smultron
bloodshed dev cpp -> eclipse
texniccentre -> texmaker

jollysvnc -> a vnc client (From Jon)
omnidisksweeper -> a gui for du (From Jon)


The post Nick mentions in the comments is here.

Opensource Mac OS X scp client : Cyber Duck

The replacement for winSCP is Cyber Duck. Its very nice, and its released under the GPL.

I also tried out Fugu. It looks elegant, and it has the respectability of a copyleft software hosted under a .edu domain, but you can't store sessions in it (i.e. setup things os you can login to a particular server into a particular local and remote directory).

Finding OSS for Mac OS is a bit of a hurdle. Mostly they have commercial stuff. magicpubs carries some listings of Mac OS software, but not exclusively OSS.

setup CVS on eclipse

xattr @ HFS and the junk Mac OS X puts on top of *nix

  1. ls will sometimes yield a '@' in the file permissions string. This means that the file has extended attributes - a new feature of HFS
  2. Its supposed to be cool - you can add metadata to your files - that only Mac OS can understand - not so cool [here]
  3. Use xattr -d to get rid of these things, especially if you didn't put them there in the first place. e.g. xattr -d IMG_7086.JPG

Sunday, June 8, 2008

Adding libraries to QT pro file

qmake -project is great. You can also add non QT libraries to be included into the .pro file [from here, and here]


qmake -project "LIBS+=-lexiv2"

Friday, June 6, 2008


  1. QT projects can be made from this
  2. Does have code completion - hit f5, haven't figured out how to get QT classes etc to be included in this
  3. Will do code completion for Python
  4. Will not do code completion for Ruby

Xcode and QT

qmake is a powerful thing. QT is serious about the cross platform thing.

Adapted from hints here [Qt-interest Archive]:

qmake -project
qmake -spec macx-xcode

This will produce myproject.xcodeproj, which can be opened in xcode

Setting default application on mac

  1. For single file:
    Right click on file, open with, choose app
  2. For every file of give type:
    Pick an instance of the type (eg a .txt file)
    Right click on file, get info
    Under 'Open with', select the correct app
    Click 'change all'

Tip from drcombie [here]

Right click to create new file

is missing from Mac OS. The following apps try to cover this mistake (yes, you heard me, mistake)

  1. Document palette (donationware, closed source) - can do templates, keywboard shortcut driven
  2. NuFile (donationware, closed source) - right click context menu


  1. Remembers last directory
  2. Last opened file history
  3. Can change line endings
  4. Has projects
  5. No code completion
  6. Tabs (implemented as a side pane)
  7. Syntax highlighting

Looks like a SciTE replacement for me

Wednesday, June 4, 2008

Nexiuz is fun...

...because of the grappling hook

Free Multiplayer Online games

There is a nice big list here.

KumaWar is a kind of ad supported valve. The games are based off the source engine, so they have a counter strikey feel to them, but most of them are just big frag fests.

Some of the MMPORPGs look interesting

Securing a wireless router

  1. Disable SSID broadcast. Router still remains discoverable but not by general users. Causes intermittent problems on Mac OS X but not Vista
    UPDATE: Windows machines expose the SSID when they connect, so Microsoft suggests that the SSID broadcast is kept enabled and encryption turned on [here].
  2. Enable MAC address filtering. MAC addresses can still be spoofed, but not by general users.
  3. Use WPA or WPA2 rather than WEP. Vista and Mac OS X support WPA2

From practically networked.

Saturday, May 31, 2008

Compiling with Exiv2

  1. make install puts
    library in /usr/local/lib
    includes in /usr/local/include/exiv2
  2. To the eclipse
    Project->Properties->C/C++ general/Paths and Symbols/GNU C++ /usr/local/include/exiv2
    Project->Properties->C/C++ Build/Settings/MacOS X C++ Linker/Libraries
This is a little tricky - the Makefile calls a bunch of things including libtool to set thinks up for the linker. My green horn way of compiling arbitrary source files was to copy


to a directory and then put the new source file under src/

Setting up a C++/QT project on eclipse under Mac OS X

The compile steps with Qt4 are:
  1. qmake -project [generates a .pro file based on the files you have in the root directory]
  2. qmake [genrates the Makefile from the .pro file]
  3. make [gnu make that uses the Makefile to generate your project as a *.app folder]
To get eclipse to follow this chain I did
  1. Fire up eclipse and choose File->New->C++ Project
  2. Uncheck 'use default location' and browse to the root of your code tree
  3. Enter a Project name e.g. ChhobiQT
  4. Pick Empty Project (leave MavOSX GCC as is)
    At this stage eclipse will find your files/subdirectories and try and compile and probably give you an error. Ignore this smart ass behavior or uncheck Project->Build automatically
  5. Project->Properties (If this is grayed out, make sure to click and highlight ChhobiQT)
  6. ->C/C++ Build : Uncheck 'Generate Makefiles automatically'
  7. 'Build directory' set it to the variable ${project_loc}
  8. Run->External Tools Dialog
  9. Under program create a new entry and set:
    Name : qmake1
    Location : location of qmake on your system e.g. /usr/local/Trolltech/Qt-4.4.0/bin/qmake
    Working directory : ${project_loc}
    Arguments : -project
    This 'External program' will enable you to generate a *.pro file when you need it
  10. Make an identical entry but name is qmake2 and make Arguments blank
    This entry will let you generate a Makefile when you add files to the project
  11. Now click Run->External Tools->qmake1 and then qmake2
  12. Hit F5 to refresh the Project explorer
    You should see a .pro file and a Makefile
  13. Project->Build Project
    You should now have a *.app file
  14. Run->Run
    Your application should now run
Each time you add a new file to the configuration you need to rerun qmake -project and qmake.

Note on Code Completion:
Go to Project->Properties->C/C++ General->Paths and Symbols
In the GNU C++ tab add the following paths (depending on the version of QT)
/usr/local/Trolltech/Qt-4.4.1/include/QtSql (if you use sql)

The rebuild code index
This will take care of code competion and things like Q_OBJECT being not recognized

Friday, May 30, 2008

Install QT on mac os

  1. Download QT/Mac OS edition [here]
  2. ./configure
    sudo make install
  3. Add to path (bash shell)
    export PATH
  4. In project directory do [from here]
    qmake -project
And there! You have an honest to goodness for Mac...

Eclipse and code directory/folder structure

Eclipse apparently requires (or required) a fixed directory structure [the mailing list rant, the bug report, the project proposal]. There is a short tutorial on setting up projects to pull in existing files from arbitrary locations [here, basically File->New->File click advanced]. In a recent version of eclipse 3.3.2 you can specify any root for the project, but your files have to all be under that root.

Photo organizer for Mac III

Ok, I'm gonna write my own.
  1. GUI will be done in C++/QT -
    I'm familiar with coding GUIs using this combination
    C++ should give the necessary snappy response such an app needs for comfort
  2. The database will be sqlite (the database will mirror the metadata for speedy searching and organizing)
  3. The core will be built around
    libiptcdata OR
    Both libraries are self contained, but I'm leaning towards exiv2 because libiptcdata can not read/write Exiv info
Project road map:
  1. Put down on paper what the program will do and what its interface will look like
  2. Download, compile and install QT
  3. Figure out API for exiv2
  4. Write a baby program to read and write metadata using exiv2. The baby program should use a text based interface but have all the functionality of the final product
  5. Implement the full design

My new direction, instead of messing around with exiv2's C code, is to go back to the idea of building an interface around exiftool.

To start with I'll do batch operations to speed things up:
  1. The application (Chhobi) will import the picture library (batch read relevant metadata into its sqlite database)
  2. Accessing pictures will pull the data from the sqlite database
  3. Editing metadata will modify the sqlite database and set modified flags
  4. On command (or in the background, periodically) the modified metadata will be batch written to the actual images.
Now alive and kicking on github Moving this to sourceforge ( ...

Thursday, May 29, 2008

Back to Eclipse

Joon was using Eclipse and I looked over his shoulder and saw code completion. My eyes popped. Wha? I left Eclipse because it didn't have code completion rant rant. Turns out my memory was half right. Eclipse will do code completion only for registered modules. Some modules are registered by default and I saw code completion for those, but not for the ones I wrote and imported in my code.

Komodo has this nice feature that it will parse every file you import and generate the tables for code completion on the fly.

It seems that Pydev (Eclipse plugin for Python) requires you to register the module by going to Eclipse->Preferences->Pydev->Interpreter-Python and add the module directory to PYTHONPATH. [from here]

But, open source is open source. Komodo edit is nice, but its not the full thing - which costs money. So I think I will take up eclipse again...

Wednesday, May 28, 2008

Inkscape and Latex

One class of solutions (EQTeXSVG, InkLaTeX, Textext) generates a dvi file using latex, then converts the dvi to svg using pstoedit. pstoedit is a bit of a pain to get working on mac.

pydvi2svg is a python script that can do the dvi to svg conversion without recourse to pstoedit. It works just fine on Mac OS X (I just had to download the two archives on that site).

Now I just gotta plug it into inkscape as an extension...

Point to focus

There are several annoyances with Mac OS (No, it does not 'just work' anymore than Vista and XP 'just work' i.e. you should not stray too far from the fold) but my biggest goat is with focus changes.

Mac OS has click to focus. Fine. Just don't have the cursor blinking on a unfocused window pretending its ready to accept input.

Also, if you are gonna have Unix run in the background, do it properly. Don't let Mac OS X mess with good old Unix by adding all these strange permission bits that can even override the super user. That's terrible. If you can't do it from the command line, you shouldn't be able to do it at all.

Monday, May 26, 2008

Photo organizer for Mac II

cocoviewx allows you to manipulate metadata with a nice GUI, adding comments keywords etc. What is missing is the ability to search via keyword or comments.

Sunday, May 25, 2008

Spicy Sushi and sweet chinese

When ordering a chinese dish you can ask for 'no sugar' because some dishes come with too much of it, even if they are spicy.

When ordering sushi, if it is spicy sushi it can be pretty spicy and take away the sushi taste.

Saturday, May 24, 2008

Powerpoint to svg : posters

Neooffice (and probably openoffice) can load ppt files and export them to svg. Neooffice's svg export works fine from a ppt produced on a windows machine. Neooffice can not adjust the page size.

Wednesday, May 21, 2008

Sunday, May 18, 2008

Nationalgrid good, Verizon not so

National grid is the electric and gas supplier. Not having paid utility bills for 7 years I don't know if this is the norm now, but I am VERY impressed with their online accounts system and the ease with which payments can be setup and made.

Verizon on the other hand, an Internet Service Provider, has a lousy account management system. There all all sorts of Bill not found, service not found errors, to start with when I log in. I'm trying to set up home voice mail, and after a lot of searching (its even easier to find journal papers online) it turns out that I need an access number. No one gave that to me! So I gotta now PHONE their online support. That is another PhD project...

Verizon phone seems to be more oriented towards phone based support (1-888-553-1555). Their automated phone system quickly gave me my needed access number

Moving costs

Moving from a small 2 bedroom apartment with a few pieces of furniture (sofa-bed, 2 shelves, dining table, 2 desks, easy chair, misc tables/cabinets) and many books: about 100-120 boxes of medium size.

Truck (one way, Penske, 3 days) $290
Gas (~500mi) 60 gallons $223
Hotel room (1 night) $130
Movers $96 + tip
Total ~ $780

Moving to Boston : Penske is good

Of all the services I had to deal with during the move Penske truck rentals had the fastest and most pleasant phone response time by far. I phoned them several times (mostly to make changes and additions) and it was always fast and done right.

The truck was just fine : we had a small (700sq ft) two bedroom and we got a 16ft truck (that's what the Penske operator recommended). With our inefficient packing the truck was just filled. We did throw out a big couch, but that would have fit fine too. It cost $290

So two bedroom (700 sq ft) = 16" truck.

The gas cost was within expectation. It took three fillups (~500mi drive) totalling 60 gallons costing $225

The only jarring note was that a strange charge of $210 appeared two days after we returned the truck. I phoned Penske and they quickly looked into it and the guy said that there had been a mistake in logging the return and they were correcting the charge.

Bengali (bangla) fonts on mac

Get the fonts from the Free Bangla Fonts project. Uncompress the tarballs, drag and drop the fonts onto the /Library/Fonts folder.

Saturday, May 17, 2008

Komodo edit is great

You can code html and Ruby with it too and it does sweet things like close your <div> tags and put in 'end' to your 'def's.

I just gotta convinve John to order Komodo Ide for the lab

Friday, May 16, 2008

CVS force commit

cvs -d commit -f -R

Electronic vs paper organizers

I spent $135 (or somewhat) to buy a Casio electronic organizer, and when that died I spent $200 to buy a Handspring visor. This was when I was a grad student and I really couldn't afford it. But electronic organizers were so shiny! The gadgets were fun for a while but then got old. In the end, I find that for todo lists the little paper notebook my better half gave me works the best. There's something to paper and pen that I can't figure out. For scheduling its google calendar, and now the new online calendar they have at work. I just couldn't figure out how to use electronic organizers effectively

Annotating pdfs with skim

For Mac there is this nice shiny aplication called skim, that looks very nice. You can add notes, highlight (two-column does not work) and export the notes. The notes appear as a list in a sidebar as you work. Importantly skim stores the annotations in the file itself. So why am I not using smim yet? Unfortunately the annotations seem to be in a skim specific format, so that preview can not pick it up (and so acrobat reader might not either). Skim is not available for windows, so I'm not sure if I should lock myself in.

Thursday, May 15, 2008

Don't use google scholar to calculate your H-index

or any other index of academic performance, because you will rank lower than Drs A Potential NN Blog and D Discovery, for sure...

Thursday, May 8, 2008

Python webserver

A python webserver can be a pretty short file [fragments], but an interesting tidbit on linux (and Darwin):

From [here]:
If you are trying to run a server on a port < 1024 on linux, you need to
be root (they are "priviledged ports").
Otherwise you will get
socket.error:(13,'Permission denied')

Another implementation of a webserver [aspn cookbook]

Wednesday, May 7, 2008

Still searching for a photo organizer

mapivi didn't quite cut it - it stores organizational data in a database file

Tried imgseek (there is a nice mac port for it) but again the metadata (keywords captions) are stored in a local database.

mapivi does store info in the metadata

Organizing photos into folders by date taken

Aaah, the command line. After downloading from the camera I wanted to move photos into separate directories based on their date


#This is a somewhat inefficent (calls exiftool many times) script that will put pictures
#into a date based directory structure. The script will use exiftool to read the date the
#picture was taken and then move the picture into an apropriate directory

#Requires bash, exiftool
#Works on Darwin and most probbaly any *nix distribution

shopt -s nullglob #if no file is found the pattern *.jpg will expand to itself, but this prevents that

for file in *.[jJ][pP][gG]
date=`exiftool -d "%Y-%m-%d" -s -s -s -DateTimeOriginal "$file"`
mkdir -p $year/$date
mv $file $year/$date/


Hah! This whole script can be replaced by the following exiftool command

exiftool -d %Y/%Y-%m-%d "-directory<datetimeoriginal" *.JPG

Man, exiftool is a powerful program!

UPDATE: Jan 2010
exiftool works with RAW files too

exiftool -d %Y/%Y-%m-%d "-directory<datetimeoriginal" *.JPG
exiftool -d %Y/%Y-%m-%d "-directory<datetimeoriginal" *.AVI
exiftool -d %Y/%Y-%m-%d "-directory<datetimeoriginal" *.NEF

Bash scripting guide

is at

There are pdf versions too (700 pages!)


looks more professional than blogger, but you have to pay to customize your css, so its back to blogger.

Tag cloud on blogspot

Phydeausx3 has a script that you can put in your blog template that generates a tag cloud. Works as advertised [phy3blog].

Tuesday, May 6, 2008

Time computations in excel

If you subtract/add two cells with time format you will get back an answer that is interpreted as a clock time, rather than a time interval. Format the cell to show the data as [h]:mm or some such. [From]

Monday, May 5, 2008

commands module

The commands module enables us execute a shell command and suck the stdout response into python.


import commands
commands.getoutput('exiftool -Subject -s -s -s IMG_6754.JPG')

Sunday, May 4, 2008

Read image metadata in Python

Install iptcinfo package:
easy_install iptcinfo

from iptcinfo import IPTCInfo
info = IPTCInfo('test.jpg')
print info.keywords, info.supplementalCategories, info.contacts
caption =['caption/abstract']

info = IPTCInfo('test.jpg')['caption/abstract'] = 'Witty caption here'['supplemental category'] = ['portrait']
info.saveAs('test_out.jpg') # keep original safe

But this will not read arbitrary tags, like exiftool will

Deus Ex was so immersive

for many touches big and small. One of the small but important and subtle touches was the ability to read email at terminals you hacked. It gave the impression that characters had lives.

Also look up
  1. Hotel Carone
  2. redsun 2020
  3. zodiac

Photo organizer for Mac

I really miss MS Photo Gallery. iPhoto and KodakEasyShare do not read Photo Gallery's metadata. iPhoto does not store info in the image metadata, it uses an xml file instead.

I'm now trying out mapivi. Its written in perl/Tk.

Getting Tk setup on mac [Bug's mac page]
  1. Mac OS 10.5 has perl 5.8.8
  2. Download Tk tarball from cpan [current version]
  3. perl Makefile.PL
    make test [This is FUN to watch]
    sudo make install
Get Image::MetaData::JPEG and follow the above steps to install.

mapivi is neat, but does not read the windows photo gallery metadata. I'm begining to think I need to cobble together a script that will move metadata around from one tag to another in order to make my pictures usable across applications.

Saturday, May 3, 2008

Finding the closest public library

is easy. Type in your address into and then 'search for' public library

Verizon FiOS 20/5 serivice

Verizon supplies an Actiontec M1424WR Router. The defaults are:
User: admin
Pass: password1

[cbuck03's blog]

Friday, April 25, 2008

HP laptop service chain

  1. The INVENT number given out for service questions connects you with the first tier service who have no powers and really just repeat the info on the website.
  2. You can ask (at the central HP number) for a senior case manager. They claim to have more powers, but so far have done nothing of note
  3. HP's service is taking VERY long:
    I sent in the unit on March 24th their revised repair estimates go:
    April 7th
    April 15th
    April 29th

I will stop buying HP.

Tuesday, April 22, 2008

Windows photo gallery metadata tag names

  1. Windows photo gallery reportedly stores metadata like captions and tags in the metadata, so that you keep all your hard done organization when you move your pictures from one folder to another, one computer to another, one program to another, one OS to another...
  2. So where does Windows Photo Gallery store all that organizational data
  3. Using Phil Harvey's great ExifTool [queens U] I dumped jpg metadata and found that:
  4. Tags are stored in
    Last Keyword XMP
  5. Captions are stored in
    XP Title

I will top-post no more

From the wikipedia article on posting etiquette
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
But what to do about impatient people like myself who don't want to scroll down a lot of junk to get at an answer? The old dilemma remains...

See all files in Finder and searches (Mac)

From an awesome hint here [macworld].

Want to see all the files, but finder won't let you? Break out of the Nanny State of Mac OS X. Change the appropriate key in Finder's preferences

defaults write AppleShowAllFiles YES

Then kill the finder process to restart it. This will let you see . files (preferences etc)

This will still not show you system files. For that, in the finder window, underneath the search string, drop down the 'kind' box, select other, then add 'System'

EEPC in a hamster ball : xkcd

But, I don't understand why the webcam is outside the hamster ball, unless, of course, its there because putting it inside makes too much sense...

PS. Colloquy is a nice mac OS IRC client, but you can do IRC over telnet.

Monday, April 21, 2008


is a great game - you gotta hop your character around the screen on a pogo stick. Getting hit on the head hurts! Get it here.

Mac sound files are in


Reading excel spreadsheets into Python

sudo python install

xlrd - works as advertized, no mess, no fuss. "There are no dependencies on modules or packages outside the standard Python distribution." - that's what we like to hear.

Quick start is here.
    import xlrd
book = xlrd.open_workbook("myfile.xls")
print "The number of worksheets is", book.nsheets
print "Worksheet name(s):", book.sheet_names()
sh = book.sheet_by_index(0)
print, sh.nrows, sh.ncols
print "Cell D30 is", sh.cell_value(rowx=29, colx=3)
for rx in range(sh.nrows):
print sh.row(rx)

Reading dates is here.
xlrd.xldate_as_tuple(sh.cell_value(rowx=120, colx=0),1) (1 for Mac OS)

Opensource games on mac

There's a nice list of free games for mac here [macrumors], mostly open source. Beyond the red line looks nice.

Video chat app shootout mac

  1. iChat
    Native mac chat program
    Does not play well with PC
    Rumored to work with AIM
  2. MSN Messenger
    Does not have video chat
  3. Mercury messenger
    Has video chat, but frame rate is very jerky
    Works with MSN messenger
  4. aMSN
    Decent video framerate
    Works with MSN messenger
    Can not do audio!

Sunday, April 20, 2008

Python IDE shootout (Mac)

  1. Eclipse + PyDev
    Code folding
    Code browser
    Syntax highlighting
    Nag screen (PyDev extensions)
    No code completion
  2. Xcode + Marxy's scripts
    Code section highlighting (rather than folding)
    Syntax highlighting
    No code completion
    No code browsing
    Not a tabbed interface
  3. Komodo Edit
    Code folding
    Syntax highlighting
    Code completion (but doesn't work on pylab for some reason)
    No code browsing
  4. PIDA
    To try out

Expose & Spaces - screen corners

  1. In system preferences -> Expose & Spaces you can set up 'active screen corners' which will allow you to do various actions my moving the mouse pointer to one of the four screen corners. This is great to cut down on keystrokes to say, see all your desktops and move windows between them
  2. Use 'ctrl' + cursor key to shift between desktops
  3. Drag a window to the edge of the screen (your mouse pointer must be at the edge of the screen) and wait momentarily: your window will be moved to the adjacent desktop

Mencoder on mac

I've switched to ffmpeg

tar -xvf freetype-2.3.9.tar.bz2
cd freetype-2.3.9
make -j8
sudo make install

tar -xvf mplayer-export-snapshot.tar.bz2
cd mplayer-export-2009-03-24/
make -j4
sudo make install
sudo installer -pkg Essential\ Codecs\ Package\ \(Intel\).pkg -target "/"

Image sequence to movie that QuickTime can play

mencoder mf://*.JPG -mf fps=2:type=jpg -ovc lavc -o rig.avi -vf scale=600:450 -ffourcc DX50

Saturday, April 19, 2008

Mac broken in

  1. After three days the mac has been set up.
  2. What is missing is a good photo album app. iPhoto is fancy, but it keeps all these copies of photos around (even with the 'copy' option unchecked, and the originals unmodified) and it can not read the IPCT metadata that windows photo gallery has written.
  3. Firefox editor shows some visual glitches
  4. Thunderbird composer garbles text, and the cursor is not positioned correctly.
    UPDATE - Only Ariel does not have this problem:

  5. RRiki is much, much faster - instantaneous response, even when it has been inactive for a while. This could be the larger memory, faster processor or the different OS

/tmp on finder

Finder (which is what the folder navigation thing is called on a mac) does not show you the /tmp folder, and there is no option that will reveal such dangerous system folders to you apple users - move along. From a tip here [metafilter], you need to hit the 'go' menu and type in /tmp

UPDATE: Or change Finder's Nanny programming by

defaults write AppleShowAllFiles YES

(This post)

LaTeX on mac

  1. This page [pennstate] has a great comparison of latex related stuff on macs.
  2. I went with the MacTeX-2007 package [] - this seems to have EVERYTHING, since my thesis compiles just fine, and I recall vaguely I used a bunch of extra styles and packages.
  3. I'm used to Texniccenter, which helps organize files into projects and uses \section, \chapter etc. commands to build a document structure. TeXShop lacks in that. I'm trying out Texmaker.
  4. Follow texmaker's instructions to set up the paths
  5. use fink to install aspell
    sudo fink install aspell (this will require a few dependencies)
    sudo fink install aspell-en (this will install the english dictionaries)
    the path to set is /sw/bin/aspell

Friday, April 18, 2008

Startup programs/services on Mac OS 10.5

UPDATE: This page has a better tutorial which I have adapted in this post.

From this page []:
  1. Startup commands are found under /Library/StartupItems/
  2. Each application has its own folder
  3. The folder has:
    XXX - A startup shell script
    StartupParameters.plist - A message and information file
    Resources - A folder with translations for strings etc.
  4. XXX is a shell script with root ownership e.g.:
    . /etc/rc.common
    ConsoleMessage "Starting RRiki"
    cd /path/to/rriki/
    rrikiserver &
  5. StartupParameters.plist is a text file with some info:
    Description = "RRiki server";
    Provides = ("RRiki");
    Requires = ("MySQL");
    Uses = ("Ruby");
    OrderPreference = "Last"; (can be Late,Last,None)
    Messages =
    start = "Starting RRiki server";
    stop = "Stopping RRiki server";

  6. sudo /sbin/service
    is the commandline way of manipulating services.

Enabling root on Mac OS 10.5

From this great page []:

% sudo passwd root
Enter Password: -enter your current admin pwd-
Changing password for root
New password: -enter password for your new root act-
Verify password: -repeat it-

Thursday, April 17, 2008

Firefox and Thunderbird migration vista to OS X

  1. Links are in this post.
  2. Firefox - ~/Library/Application Support/Firefox/profiles.ini
  3. Thunderbird - ~/Library/Thunderbird/profiles.ini (Note the difference, which is not given correctly)
  4. Firefox + extensions seem to port with the profile just fine onto mac,
  5. Thunderbird's tags etc work fine, the lightning layout seems a bit wierd...I uninstalled lightning and installed the mac version, and my panes look better now
And can I just state here, for the record, that I'm becoming a mac fan not because of the mac eye candy (which vista has) but because of the bash shell in which I used vi to edit the profile files. Yee Hah, back to Unix! Basically, finally! A laptop that's running *nix out of the box ;-)

RRiki on Mac

Install MySQL

Ruby comes installed with Mac OS 10.5 [].
sudo gem update rails --include-dependencies

Download the BlueCloth gem and do
sudo gem update bluecloth-XXXX from the directory you downloaded the gem in

To set up RRiki as a service see this post.

MySQL on mac

  1. Download the community server .dmg from the mysql website. Install as usual.
  2. Download mysql gui tools (if you are too lazy to use the command line stuff) and its a lot like MySQL on windows
  3. Setting up the service is involved, see here [osxfaq] and this post.
Mysql is installed under /usr/local/mysql/bin

MySQL provides binaries for the great GUI tools for Mac OS 10.4 only, and I had some mysterious crashed when creating/editing tables. Downloading and installing the fixed prefpane [here] seems to have fixed that.

Inkscape on mac

Runs fine using X11. Some default mouse shortcuts are different:

Zoom in -> ctrl + right click
Zoom out -> shift + right click

Monitoring the Mac

One must keep an eye on things, so iStat menubar [on] is nice unobtrusive widget that sits on your status bar and gives you, among other things, temperature, memory and CPU usage.

Transparency in plots

Set the alpha parameter:


Wednesday, April 16, 2008

The "We only use ten percent of our brain" Myth

Barry L. Beyerstein tries to dig a bit into this myth. [pdf]

Opening a bank account

Bank of America, somewhere in the Boston region. Took me 10 minutes to open the account. I needed my driver's license and my existing BOA debit card. They opened it even though I snuck in just at closing time.

Tuesday, April 15, 2008

Internet connection speed test II

From work:

Installing python and friends on a mac

  1. Get the latest python interpreter and some packages from here [from a pointer on]
  2. To get matplotlib installed you will need pytz and dateutil, both found on the above mentioned page [].
  3. SciPy is notably missing - get the source and the fortran compiler from here and compile as acc to the instructions.
  4. There are several IDEs, I'm giving eclipse and xcode a whirl. This [showmedo] is an excellent video tutorial on how to get PyDev for eclipse all set up. Also see this for PyDev installation. PyDev has a really annoying nag screen now. I'm stopping using it.
  5. Eclipse does not play sensibly with matplotlib - I'm using ipython to actually run the scripts and eclipse for the editing environment. Eclipse beats Xcode because eclipse will layout your methods and classes for browsing (like pyscripter).
  6. Marxy has some scripts for Python on Xcode here.
  7. ipython should be installed from source as detailed here.

EEK: A Mac!

  1. Use 'command' or 'apple' key instead of CTRL for copy and paste operations
  2. 'end' is 'command'+'right cursor', 'home' is 'command'+'left cursor'
  3. 'backspace' is Mac 'delete' and 'delete' is Mac 'fn'+'delete'
  4. On firefox (which is what I have used the most) moving the cursor quickly sometimes causes the cursor to have afterimages.
  5. Programs are sometimes installed by dragging the dmg into the applications folder (e.g. when you get Firefox for mac), but are sometimes installed by double clicking the .dmg file (which is basically an archive file of sorts) and then double clicking the .mpkg file which does the actual installation. e.g. for the python installer
  6. Create a shortcut to the applications folder on your desktop - now you can drag applications into this shortcut to install - e.g. firefox/mysql
  7. Screen shots are taken using command+shift+4 or 3 [from here]
  8. Finder doesn't show folders like /tmp, and there is no option to reveal it - you need to type in the folder name after hitting 'go'

Saturday, April 12, 2008

Internet connection speed test

The internet service at Graduate Hills, which is student housing at the university of Maryland and has internet service through the university is [from]:

6561 kb/s download
2428 kb/s upload

calculated with a server at Frederick Maryland

Other servers:

Wednesday, April 9, 2008

Remove field code from Word document

e.g. before submitting a MS, or hand manipulating some formatting because Word does things (like cross-references) so half-assed [from here]

Select all the text (CTRL-A)
Press Ctrl+Shift+F9

Editing to remove anonymous comments that only contain thanks. I really appreciate the thanks, but it makes it harder to find comments that carry pertinent information. I'm also going to try and paste informative comments in the body of the post to make them easier to find.

Sunday, April 6, 2008

Which animals have Milk teeth?

Milk teeth, baby teeth, primary teeth or deciduous teeth [wikipedia].

As far as I could find out; all placental mammals.

Thursday, April 3, 2008

Lighting change at UMD

They replaced all the lights in the corridor with these very depressing blue fluorescent lights. Apparently they're going to save a lot of money on the electric bill the environment and prevent our recovery from the last ice age.

Kevin Galloway was joking that he wondered if the univ. was also going to foot the counseling fees for the depression this was going to cause.

The logical solution would have been to have on-demand lighting, e.g. motion sensor activated etc. This will probably save a lot more power, and not skimp on the lighting quality.

But hey, its easy to whine after the fact. Who do we complain to? Hmm. There's a project. Who was the genius who thought of this any way, and have their lights been replaced?

Will your answer to this question be in the negative?

From recfunny

The Usenet Oracle has pondered your question deeply.
Your question was: Will your answer to this question be in the negative?
And in response, thus spake the Oracle: Memory fault. Core dumped

Firefox and Thunderbird Extensions

  1. Permit cookies - adds a button on Firefox status bar to adjust cookie preferences for current page
  2. Reminder Fox - simple and effective todo and reminder gadget - sits in Firefox status bar
  3. Lightning - calendar extension for Thunderbird - talks with your google calendar
  4. Provider for google calendar - needed by Lightining for google calendar access
  5. Nightly tester tools -
  6. SQLite Manager - wow! a sqlite databse manager in your browser! Can create databases, add tables.