Skip to main content


Showing posts from 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.

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.

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: (RadRails) - Check 'Features', but uncheck 'Studio professional', Check support for 'scriptaculous' (pyDev)Let aptana download its own variant of svn for subclipse

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
* Professiona…

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 th…

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

Correcting those banner ads

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:// runs right off the bat. The things I didn't like

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

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)

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)

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.

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.

Some one has a sense of humor...

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.

"Instruments" : Memory leak tracking on Mac

Instruments is a Mac GUI tool "...for dynamically tracing and profiling Mac OS X code." Jon says Instruments uses dtrace.I wanted a tool to track memory leaks in a c++ application I wroteI 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.

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)
Get numpy 1.1 from here [sourceforge]. Use the disk image version. Mount and then double-click the package installer
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.

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)

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

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

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.

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

From a hint here, go here and grab the appropriate console version of unison. Thank Shuly WintnerCopy it to your user directory, say under YourUserName/binmake sure this is on your path by modifying your .bashrc file (not .bash_profile) to include:
export PATH
Tip from a discussion here.make sure all works by doing:
ssh unison -version [here]run unison as usual
Yes, I'm a bad postdoc Jon.

Auto accident notes

Phone police. If no injuries police may not comeGet other car's license numberGet other drivers info:
Phone Number
Driver's license
Insurance company name and phone number
Insurance co reccomends but does not require police reportTake photos of damage
Phone insurance company and reportIf its the other guy's fault, go through their insurance coPhone other insurance co and file claim. Do it soonThey will appraise the damage and give a checkAsk for rental car
Ask for diminished value compensationAsk for body shop to check for other damage

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:
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
Audacity - can record and edit sounds and save them as mp3, aiff, ogg whatever. GPLMake 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...


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
Input lag - time lag between the video card sending a frame to the LCD and it actually getting displayed on the screen.
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

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

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.


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


Firefox 3 on mac os X

I'm happy with FF3.
The intelligent address bar is nice. I can see it eventually making bookmarks obsoleteThe new bookmark maanger is great. On mac I missed the ability to drag/drop reorganize my bookmarks, I'm glad its back.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...

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
I got 22 channels. This depends on antenna positioning. With another position I got 19The signal is really really clear. We used to get grain all the time with analogSound doesn't have a hiss problem. I boost t…

Aspell on Mac os

Get cocoAspellmount the dmg, install the packagego to /Library/Application Support/cocoAspell/ and find any dictionaries that are install, or go to and install some new dictsgo into the dictionary directory and do
sudo ./configure
sudo make
sudo make installaspell is now ready

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

Icons on mac

Crop square image file from photo or from scratch using a picture editor e.g. GIMPOpen up Icon Composer (Comes with xcode, /Developer/Applications/Utilities)Drag and drop the image file onto Icon ComposerSave the file (say 'myicon.icns')
Open myicon.icns in previewCopy the imageSelect the folder/file whose icon you want to changeRight click and 'get info'Click and highlight the small icon at the top left (just above 'spotlight comments')'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

There is a nice simple table editor. Yay!BUGS:
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.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 itOutline view does not workUPDATE:
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 preferenc…

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]
Reinstalling steam does not wipe your downloaded gamesBittorrent downloads can be resumed even after a reinstall of windows and bittorrent, because there are no messy states that bittorrent keeps lying around.Windows can be reinstalled without wiping the data

Google sketchup hints

If updating gets slow, go to View and turn off 'section planes' and 'section cuts'For the tape measure tool hitting 'option' (on Mac) will allow you to add guidesMeasuring 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 chosenPanning 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.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

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!

Sourceforge wiki space

is nice but has some annoyances:
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.
Its a great place for documentation and manuals etc.

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 editIts slowIt has annoying ads on top. Almost half the screen is taken up by non-wiki stuff

In some ways Macs are well thought out

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
The operation animations are not only eye candy, but assist the brain by creating a continuous change rather than an abrupt oneFan exhaust is aimed backwards, not intakes/outtakes on the bottom.
The magnetic power plugLED on power plug changes color when the computer is fully chargedThe battery has a LED charge indicator
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: www.mvroda…

Boston Commute

I commute between the Malden area and the Longwood area. There are several ways to solve this problem:
Orange Line to Ruggles (30min) + walk (10-15min) ~ 45min
Orange line to Ruggles + Free Longwood area shuttle (No ID required) - 35min to 45minOrange line to Ruggles + Bike (Haven't tried this, wouldn't work during peak)
Orange line to North Sta (15min) + Green (Heath) to Longwood (20min to 1hr)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.

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!

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.

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.

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

ls will sometimes yield a '@' in the file permissions string. This means that the file has extended attributes - a new feature of HFS
Its supposed to be cool - you can add metadata to your files - that only Mac OS can understand - not so cool [here]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


QT projects can be made from thisDoes have code completion - hit f5, haven't figured out how to get QT classes etc to be included in thisWill do code completion for PythonWill 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


Remembers last directoryLast opened file historyCan change line endingsHas projectsNo code completionTabs (implemented as a side pane)
Syntax highlighting
Looks like a SciTE replacement for me

Securing a wireless router

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].
Enable MAC address filtering. MAC addresses can still be spoofed, but not by general users.Use WPA or WPA2 rather than WEP. Vista and Mac OS X support WPA2
From practically networked.

Compiling with Exiv2

make install puts
library in /usr/local/lib
includes in /usr/local/include/exiv2To 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:
qmake -project [generates a .pro file based on the files you have in the root directory]qmake [genrates the Makefile from the .pro file]make [gnu make that uses the Makefile to generate your project as a *.app folder]
To get eclipse to follow this chain I did
Fire up eclipse and choose File->New->C++ ProjectUncheck 'use default location' and browse to the root of your code treeEnter a Project name e.g. ChhobiQT
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
Project->Properties (If this is grayed out, make sure to click and highlight ChhobiQT)->C/C++ Build : Uncheck 'Generate Makefiles automatically''Build directory' set it to the variable ${project_loc}Run->External Tools DialogUnder program create a new entry and set:
Name : qmake1
Location : …

Install QT on mac os

Download QT/Mac OS edition [here]./configure
sudo make installAdd to path (bash shell)
export PATHIn 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.
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 comfortThe database will be sqlite (the database will mirror the metadata for speedy searching and organizing)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:
Put down on paper what the program will do and what its interface will look likeDownload, compile and install QTFigure out API for exiv2Write 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 productImplement the full design UPDATE:

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 t…

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

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.

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.

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.

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

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]

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/

bash string manipulationexiftool manualadvanced bash scripting guideUPDATE:

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 po…

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')

Read image metadata in Python

Install iptcinfo package:
easy_install iptcinfo

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

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]
Mac OS 10.5 has perl 5.8.8Download Tk tarball from cpan [current version]perl Makefile.PL
make test [This is FUN to watch]
sudo make installGet 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.

Verizon FiOS 20/5 serivice

Verizon supplies an Actiontec M1424WR Router. The defaults are:
User: admin
Pass: password1
[cbuck03's blog]

HP laptop service chain

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.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 noteHP'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.

Windows photo gallery metadata tag names

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...So where does Windows Photo Gallery store all that organizational dataUsing Phil Harvey's great ExifTool [queens U] I dumped jpg metadata and found that:Tags are stored in
Last Keyword XMPCaptions 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'

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)

Video chat app shootout mac

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

Python IDE shootout (Mac)

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

Expose & Spaces - screen corners

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 themUse 'ctrl' + cursor key to shift between desktopsDrag 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

Mac broken in

After three days the mac has been set up. 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.Firefox editor shows some visual glitchesThunderbird composer garbles text, and the cursor is not positioned correctly.
UPDATE - Only Ariel does not have this problem:

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