Saturday, January 25, 2014

Compiling progressiveCactus on Mac Mavericks



  1. Follow their instructions for grabbing the source
  2. You will need wget, which is not present. So from here wget is simply curl -O. However there are a bunch of problems with making wget an alias to curl -O from aliases not being expanded in noninteractive shells to some debate about what /bin/sh does on mac. My pragmatic solution was
  3. make a one line script curl -O "$@" and save it as /usr/bin/wget and chmod +x for that file 
  4. Then proceed with make which should conclude successfully

Wednesday, January 22, 2014

Matplotlib animations mac os x (using built in codecs)

Mac OS X (Mavericks) comes with a bunch of built in codecs listed here that people can play with the bundled quicktime application. If you can give people animations in these formats/codecs they don't have to do any work to play them on their mac.

In order to get matplotlib saving animations in these formats you need to do:

  1. Install ffmpeg for mac. I grab Mac binaries from here. You may need 7zX for mac to unzip the file.
  2. Place the binary in a suitable local path and make sure you add the path.
  3. When you call matplotlib.animate pass the arguments extra_args=['-vcodec', 'libxvid']
This should produce a video file that is playable by QT on any standard install of Mac OS X

Monday, January 20, 2014

Preview and signatures

Preview on Mac OS (at least the newer ones) has limited editing options that I find very useful (It's a waste to pay the premium on Adobe Acrobat Pro for the simple editing I need). One major task is to insert signatures on documents that are being passed around electronically (so much better than using mail and hardcopies). Preview has a neat trick where you can create signatures without needing a scanner. You simply sign on a piece of paper and hold it up to the camera and some sophisticated software extracts the signature for you. But like all things Mac, they got too clever. There is no option to load a signature from an existing file. This does not represent any kind of extra security. If you don't have pen and paper handy, or you need to insert some one else's signature (as I did) you would have to find a printer, print out the signature and hold it up to the camera. So I had one of those rare 'smart' moments. I took the signature file, opened it up on my second monitor and then turned the laptop I was using to face the second monitor. This fooled Preview and it captured the signature. I got strange looks from my co-workers but whatever. Here also I ran into another 'too clever' issue with Macs. Preview adds drop shadows to pdfs and images at the page borders. When I used preview to open the signature image the signature capture software detected the drop shadows and page margins and added black borders round the signature. I could not find a convenient way to get rid of the drop shadow and ended up opening the file in a web browser.

Thursday, January 16, 2014

iTunes and multiple monitors

I can not move a regular, unmaximized, un-fullscreened iTunes window (either regular window or mini-player) across two monitors. The iTunes window gets stuck on one monitor. Other applications move across monitors fine. Hmm.

Thursday, January 9, 2014

mmap is not better for sequential reads

From this interesting discussion on stackoverflow we learn that while Python's mmap is great for multiple, simultaneous random access to large files on disk, it does not provide a benefit when reading a file sequentially from disk.