15 March 2011

Commenting multiple photos in iPhoto ’11

When the App Store for Mac came out, I was excited at the chance to buy iPhoto without paying for the other apps that I didn't need. My excitement quickly turned to remorse as I encountered bug after bug after bug. Additionally, iPhoto removed useful functionality like the ability to use command shortcuts to switch between photos in "View" mode: in iPhoto it is now impossible to add comments to a number of photos in succession without a lot of mousing around.

I wrote an Applescript to partially overcome this limitation. It takes the selection and gives a dialog box for commenting each one. If the selection is contiguous it will properly display the photos in full screen mode as you comment them.

(*
Quickly comment the selected photos in iPhoto '11, viewing them in full screen if the selection is contiguous. Authored by Seth R Johnson, licensed under Simplified BSD.
*)
tell application "iPhoto"
 activate
 -- this works best with contiguous photos
 set sel_photos to selection
 if number of sel_photos is 0 or (class of item 1 of sel_photos is not photo) then
  error "Please make sure photos are selected."
 end if
 -- press the space bar to make the photos full screen
 tell application "System Events" to keystroke " "
 repeat with this_photo in sel_photos
  tell this_photo
   set c to comment of this_photo
   display dialog "Enter the comment for photo '" & (title of this_photo) & "':" default answer c buttons {"Cancel", "Apply"} default button 2
   set new_comment to text returned of result
   if c is not new_comment then
    set the comment of this_photo to new_comment
   end if
  end tell
  -- Press the right arrow key to advance to the next photos in the album
  tell application "System Events" to keystroke (ASCII character 29)
 end repeat
end tell

02 March 2011

Sharing research code

The more I work on my research code, PyTRT (a research code with several dozen transport methods—diffusion, Monte Carlo, P1, SN, IMC, etc.—implemented in 1D and 2D), the more I'm convinced this could be a useful tool to many people in methods development. I'm forced to ask myself what I should do with it after I graduate. It's entirely likely that I will continue to use it in my next career, but should I release it to the public, or to my department, or to whom? Should I try to sell it?

It was developed using funds from an NSF GRF, which "encourages Fellows to share software and inventions, once appropriate protection for them has been secured, and otherwise act to make the innovations they embody widely useful and usable," and from an NEUP fellowship, under which the "DOE claims no rights to any inventions or writings that might result from its fellowship awards." That seems to leave me all the flexibility I need.

Does anyone have an opinion to offer?