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
    libexiv2.a
UPDATE:
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

libtool
config/
src/
xmpsdk/

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
/usr/local/Trolltech/Qt-4.4.1/include/QtGui
/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
    make
    sudo make install
  3. Add to path (bash shell)
    PATH="/usr/local/Trolltech/Qt-4.4.0/bin:${PATH}"
    export PATH
  4. In project directory do [from here]
    qmake -project
    qmake
    make
And there! You have an honest to goodness program.app 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
    exiv2
    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
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 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.
UPDATE:
Now alive and kicking on github Moving this to sourceforge (chhobi.sf.net) ...

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

UPDATE:
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 :ext:kghose@rubyforge.org:/var/cvs/rriki 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.

UPDATE:
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

#!/bin/bash

#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]
do
date=`exiftool -d "%Y-%m-%d" -s -s -s -DateTimeOriginal "$file"`
year=${date%%-*}
mkdir -p $year/$date
mv $file $year/$date/
done

UPDATE:

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

#!/bin/bash
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 tldp.org.

There are pdf versions too (700 pages!)

Wordpress

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 mrexcel.com]

Monday, May 5, 2008

commands module

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

e.g.

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

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

Add/Edit
info = IPTCInfo('test.jpg')
info.data['caption/abstract'] = 'Witty caption here'
info.data['supplemental category'] = ['portrait']
info.save()
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
    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 maps.google.com and then 'search for' public library

Verizon FiOS 20/5 serivice

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

[cbuck03's blog]