Sunday, April 04, 2010
iPad review
Sunday, March 28, 2010
Convert your mail.app notes to text files for use with Notational Velocity and sync
Recently I wanted to move my notes from mail.app and the notes app on the iPhone to text files. This would then allow me to use Notational Velocity with markdown hack and simpletext.ws that I use with the excellent Taskpaper iphone app by Hogg Bay Software.
You can download the script files here or copy and paste from the article.
Here’s how I got it to work. I really hope I’m not missing a trivially easy way to do this but this way did work for me!
- Export from Mail to an archive. This is a plain text file.
- Download MacVim
- Run a script over archive file to reduce it to text
- Run ruby script in new folder to convert notes to text files
Export from Mail.app to an archive
- Click on notes
- Mailbox | Archive Mailbox
- Choose a new empty folder like ~/Downloads/Notes
- Copy the Notes.mbox/mbox file to ~/Downloads/Notes. You won’t need the table
_of_contents file.
The ~/Downloads/Notes/mbox file contains all the notes in a single text file with a bunch of markup.
Download MacVim
- Download MacVim
- Drag to applications folder and open
Run vim script to convert mbox text file
The script:
:%s/ / /g
:%s/<br class="[^"]*">//g
:%s/<br>//g
:%s/=\n/ /g
:%s/<div>\([^<]*\)<\/div>/\r\1/g
:%s/^X-Universally.*\n//g
:%s/^Content-Type: text\/html;\n//g
:%s/^\tcharset=us-ascii\n//g
:%s/^X-Uniform-Type.*\n//g
:%s/^Message-Id: .*\n//g
:%s/^X-Mail-Created-Date.*\n//g
:%s/^X-Mail-Generated.*\n//g
:%s/^Content-Transfer-Encoding.*\n//g
:%s/^Mime-Version:.*\n//g
:%s/^X-Apple-Base-Url:.*//g
:%s/^X-Apple-Mail-Remote-Attachments:.*//g
:%s/^From: .*\n//g
:%s/ -0400$//g
:%s/<span [^>]*>//g
:%s/<\/span>//g
:%s/=?MACINTOSH?Q?//g
:%s/=CA? Date: .*//g
:%s/^\tcharset=.*\n//g
:%s/<div>\([^<]*\)<\/div>/\r\1/g
:%s/<div>//g
:%s/<\/div>//g
:%s/<[^>]*>//g
:%s/=CA//g
:%s/? //g
:%s/_//g
:%s/=92/'/g
:%s/\s\+$//g
:%s/#\(\a\+\)/@\1/g
:%s/^Subject: /!!!\rSubject: /g
- Save the above vim script to a file, like ~/notes.vim using a text editor.
- Right-click on the plain text mail archive file you created above (~/Downloads/Notes/mbox) and choose: Open With | MacVim. You can also launch MacVim and open the mbox file with File | Open.
Type:
:so ~/notes.vimOr whatever you named the vim script.
- This will convert the file to text. You may need to do some small other adjustments - this script worked well on my file.
What is remaining is a list of Subject: *, Date: * and message body blocks with the !!! separating the entries. We’ll use this in the ruby script to convert them to text files. - Choose File | SaveAs to save the modified file to the filename “notes.text”, let’s say ~/Downloads/Notes/notes.text
Run ruby script to convert to text file
Most mac systems these days have ruby. To test, open the Terminal and type:
ruby --version
It should return something like:
$ ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
Save the script below to ~/Downloads/Notes/n.rb
class WriteNotes
@counter = 0
def WriteNotes.writeout(subject, note, date)
# write out new file
if subject != ""
# make subject the filename
filename = subject
# limit file names to 50 chars - make longer if required
if filename.length > 50
filename = filename[0..50]
end
# strip out filename-unfriendly characters
filename = filename.strip.gsub(/ /,"_")
filename = filename.gsub(/[?:,@="'.\\\/]/,"")
# check if we have a date in the date field (basic check)
d = date[0..1].match(/[0-9]/)
# default a current date if date not found
if !d
date = Time.now.localtime.strftime("%Y-%m-%d")
end
if date.strip.length == 0
date = Time.now.localtime.strftime("%Y-%m-%d")
end
# remove comma from date if it's non-standard, like "Aug, 2"
date = date.gsub(/,/,"")
# filename template - change to taste
filename = "zan-" + date + "-" + filename + ".txt"
# write out file
notefile = File.open(filename, "w")
notefile.puts note
notefile.close
@counter = @counter + 1
# puts "__filename[#{@counter}]: " + filename
puts "Subject: [#{@counter}]" + subject
# puts "__note: " + note
end
end # writeout
subject = ""
note = ""
date = ""
file = File.open("notes.text", "r")
while (line = file.gets)
if line[0..2] == "!!!" # at a new note
# write out new text file
writeout(subject, note, date)
# init vars
subject = ""
note = ""
date = ""
else
# collect data into subject, note, date fields
m = line[0..7]
# puts m
if m == "Subject:"
subject = line[8..line.length].strip
note = ""
else
if line.strip[0..3] == "Date"
date = line.strip[6..15]
date = date.gsub(/:/,"")
date = date.gsub(/ /,"_")
else
note = note + line
end
end
end
end # while
writeout(subject, note, date)
puts "total files: #{@counter}"
file.close
rescue => err
puts "Exception: #{err}"
err
end
Open terminal (under Utilities in Applications folder) and type:
cd ~/Downloads/Notes
Now we can run the script, type:
ruby n.rb
If the script runs correctly, the notes.text file will be processed and each file will be written out in the format:
zan-YYYY-MM-DD-.txt
If there is a problem, just remove the text files generated and start again (rm *.txt)
Good luck! The vim script and ruby script may require a little tweaking. Please leave a note if you found this useful.
Friday, March 19, 2010
Get etude and learn the piano

Want to learn the piano and download free sheet music? This great app will help. etude is US$3 (introductory price) and has a selection of music for free in the in-app store. You can download sheet music like Moonlight Sonata and Fur Elise to your bookshelf. The range is limited, but the app only just came out. The same developer (Wonder Warp Software) has released Shovebox Mobile.
Etude really shines when you open the score. It will play at different speeds and shows a keyboard with lit-up keys. You can move the play cursor along at your own pace and work the keys out or have the app play the music for you.
The app needs better music management and a search feature and it should remember your position when you exit the app but for a beginner learning sheet music, it’s still excellent.
Friday, March 05, 2010
MacHeist NanoBundle
MacHeist is running another bundle for only US$20 for the next couple days.
I am a user of RapidWeaver, which was part of a previous bundle, and can highly recommend it for developing pretty web sites fast.
My main reason for purchasing was the inclusion of MacJournal which looks to be a rather neat way to write and maintain a journal and publish the journal online should you wish.
I am very interested in using the file transfer software Flow. The other utility software, like Tracks and RipIt look cool enough to give a try.
There is also Clips and CoverScout which might be useful to someone.
The Tales of Monkey Island are old games, but damn they were entertaining back in the day. AirBurst Extreme is somewhat awkward to control. Burning Monkey Solitaire is a colourful entertaining version of Solitaire with a very wide range of Solitaire rules and random noises and jokes thrown in - surprisingly fun.
Tuesday, January 12, 2010
To:Mail.app From:MacHackShack.com Subject:Advanced keyword searching with Mail.app and spotlight
Try:
to:someone from:someone subject:something
Wednesday, January 06, 2010
How to restart a hung Finder in Mac OS/X without rebooting
Monday, December 28, 2009
There's a better way to access your emails from everywhere - use IMAP
- You can access and modify your email from web, phone or local computer applications and have the changes synced automatically.
- It's faster and more efficient to access emails and email headers.
- Folders are synced between the server and all clients.
- Move an email to a folder and it gets moved everywhere.
- Most popular email clients support IMAP.
- Emails can be copied between server and locally very easily using drag and drop (even large volumes).
iPhone apps worth looking at
Sunday, December 20, 2009
Upgrading? Archive your old iPhone backup folders and save space
Finding open files on a Mac: lsof
lsof | more
lsof | grep "Volumes"
Friday, November 06, 2009
SQLite database browser
Chrome beta for Mac is available!
Saturday, October 31, 2009
Down memory lane with a TrueType VT 220 Font

Viacheslav Slavinsky created a DEC VT 220 truetype font so you can take a nostalgic trip down memory lane when using Terminal. Just download the font, double-click and install in Font Book. Then go into terminal, duplicate your current profile in preferences and change the font. Size 20 works best on Macs. Change the color to green and we're walking back down memory lane. Or change it to any color you want :)
Tuesday, October 27, 2009
Looking for a free SQLite database manager?
Mike Titlebaum has created the ridiculously literally named: "Mike T's SQLite Database Administrator Tool". It's free and even goes further than the basics to offer an import function, SQL query autocomplete, a comprehensive schema view and export functionality. You can also create new tables and edit data.
It does have its quirks but for a free app it's worth a look.
Monday, October 26, 2009
Snow Leopard disk eject quirkiness
Saturday, October 24, 2009
Convert any text to your own mp3 automatically!

Launch Automator or if in Automator, File | New
- Choose "Service" type of workflow
- Make sure the service receives "text" in "any application"
- Search for "audio" in the Variables pane
- Choose "Text to Audio File" and drag to workflow workspace (right-hand pane)
- Choose a voice (default is Alex)
- Choose a file name: TextRecording
- Choose a location (default is desktop)
- Search for "audio" in the Variables pane
- Drag "Import Audio Files" under the "Text to Audio File" workflow action
- To save space, check "Delete source files after encoding".
- Click Save, call the service "Text to mp3"
If you want to run the automator action, search for "Get Specified Text" from the Actions pane and drag "Get Specified Text" above the "Text to Audio File" action. This will let you type text and run the workflow in Automator. You will have to remove the "Get Specified Text" action to save the workflow as a service.
Thanks Andy and thanks Apple for this amazing, easy feature.
(And if you were wondering where this magically puts the services entry, go to System Preferences, Keyboard, KeyBoard Shortcuts, Services and you'll see a list there you can modify)
Sunday, October 11, 2009
Gatting and iPhone - the joke's on you

Gatting auto-corrects to be farting. The keys are close together... many thanks to my Aussie friend Michael for pointing this out.
Thursday, October 01, 2009
Warning: Parallels 3.0 does NOT work with Snow Leopard and upgrading will cost you $50
Parallels will not support version 3.0 under Snow Leopard in the future according to their website.
So I'm stuck with the forced upgrade. I wonder how many other customers feel annoyed at being forced to spend $50. Not cool Parallels and not appreciated. VMWare Fusion works fine on Snow Leopard. I'll be moving my machine to that as soon as I can.
Taking out the trash - keyboard shortcut to empty the trash
command-shift-delete
empties the trash with prompt.
and if you're really sure:
command-shift-option-delete
empties the trash WITHOUT a prompt.
Note: A friendly warning, if you rely on this too much, it'll become a habit so beware! You might lose something you want.
The most annoying Xcode error ever: The Info.plist for application at (null) specifies a CFBundleExecutable of (null), which does not exist.
“The Info.plist for application at (null) specifies a CFBundleExecutable of (null), which does not exist.”here's how to fix it:
In Xcode, choose "Executables" from the project hierarchy. Click your project executable then press Command-I. Choose the General tab and set the working directory to "Build Products directory".
This fixed the problem. The advisory from Apple did not help much, but did mention the Build Products directory. Under SDK release notes for iPhone OS 3.1, XCode/Developer Tools:
"Changing an iPhone Executable's working directory from “Build Products directory” may cause the application not to install properly with the error message “The Info.plist for application at (null) specifies a CFBundleExecutable of (null), which does not exist.”"Hope this saves you a little time. It frustrated me for a while.