Friday, August 27, 2010

Taskpaper vim script to insert @done tags


While I by no means think this will be WILDLY popular, screw it, I like it so I'm posting it here.

Perhaps you use the Taskpaper iPhone app. You want your notes everywhere so you sync your notes with Dropbox. You might even use a judicious symlink. I use a Notational Velocity fork and sync with that as well.

You might end up using Vim or MacVim to edit. You want to complete those notes using the @done(YYYY-mm-dd) tag.

And now you can with just one keypress! Insert this handy function in your .vimrc! And the @done tag with date will be inserted after the current line.

Oh my god this is niche.

But here it is:


:fu! Taskpaper()
:return setline(line("."), getline(line(".")) . "@done(" . strftime("%Y-%m-%d") . ")")
:endf
:map <F8> <ESC>:call Taskpaper()<CR><ESC>
:imap <F8> <ESC>:call Taskpaper()<CR><ESC>


love,
@themachackshack

Saturday, July 24, 2010

Cheap git repositories with Dropbox

If you want professional source code repository hosting there are great providers like http://github.com out there where you can create free public or cheap private repositories.

But if you want something to back up local development or to collaborate in a small team for free, you might consider Dropbox and git.

Now one (perhaps big) proviso - you may have data sync issues if using this between more than one person so you'd have to coordinate commits.

You can download git for mac, pc or linux. See here:

http://git-scm.com/

There's a on OS/X git installer available on google code:


I use Gitbox app for the Mac:

http://gitbox.pierlis.com

And msysgit for Windows:

http://code.google.com/p/msysgit/

So you'll want to put your project under git source control first. There are plenty of tutorials to tell you how to do that.

Let's call the project mygitproject. Let's assume we're using a Mac to do this. Back up your source before trying this in case of errors.

Now, create a cloned git repository in our Dropbox account. The repository doesn't use a working folder as well, it just has the git system files. We will use this cloned repository to push changes to from our local project folder and it'll eventually sync to the Dropbox servers.

Change directory to your Dropbox folder:

$ cd ~/Dropbox

create a folder to hold the git repositories

$ mkdir git
$ cd git

create a folder for mygitproject

$ mkdir mygitproject

Now clone the mygitproject (assume it's in ~/projects folder). The mygitproject has to already be under git source control. Use the --bare switch so the working folder isn't used (just the git system files).

$ git clone --bare ~/projects/mygitproject

This will clone the repository to the ~/Dropbox/git/mygitproject/mygitproject.git folder.

Change to your project folder and to make it easy, create a remote link to your Dropbox repository called dbgp:

$ cd /projects/mygitproject

$ git remote add dbgp ~/Dropbox/git/mygitproject/mygitproject.git

If you want to push changes to the repository, perform your commits to your mygitproject then push them:

$ git push dbgp

You can do any change you like to your local repository and push the changes to your Dropbox account, including branches and tags and all the git magic. It's also pretty fast.

Only one warning - make sure Dropbox has finished caching the changes to its server before trying to refer to the repository from elsewhere.

You could go to another computer that had the same Dropbox account and do a:

$ cd ~/projects
$ git clone ~/Dropbox/git/mygitproject/mygitproject.git

This would check out the mygitproject to the ~/projects/mygitproject folder. You could then push or pull from it to collaborate. Again, beware the sync issues! I know this approach works but I waited for the dropbox syncing to stop first. Another user may not.

You can also share a Dropbox folder out to another Dropbox user and they see it in their ~/Dropbox folder, so this sharing approach might work too (though I haven't tested it).

But anyway, it's useful for making an offsite backup of your git repository.

If you need something more, try github, it's excellent. Dropbox is great software too.

Monday, July 19, 2010

Command-line calendar info goodliness with iCalBuddy

If you want your calendar in text and sent anywhere you like, like to your desktop via Geek Tool then use iCalBuddy. I'm using it and love it.

Another great tip I got from onethingwell - excellent blog: http://onethingwell.org/

Tuesday, July 13, 2010

Open a terminal window from Finder

If you want to open a terminal window in the current Finder folder, this will do it.

Tiny, but handy if you drop to Terminal often.

via @onethingwell

Friday, May 07, 2010

IPad Review 2

The iPad, after a week

So I've had the iPad for a week today. I'm writing this review with the wireless bluetooth keyboard and Pages sitting in a comfortable chair with the device just resting on the arm of the chair and the keyboard on my lap. It's actually pretty comfortable. [And now I'm continuing to write this while sitting on a chair at the airport with the iPad propped up in a baggage trolley and typing on the bluetooth keyboard. Geek points ++]

So what do I think after a week of using the device? I wouldn't be without it now. It definitely is not the best for some tasks, but it's perfect for others. And the flexibility is it's real selling point. There's just so much you can do with this device and it's only been available for a month. To really understand what this means, wait for 2 years and when the weight and price drops to $200. Wait until children are glued to these devices for playing games and learning. And wait until there are apps that make 50 types 30 second tasks almost instant and this device (and the inevitable copies in the market) is here to stay.

First the stuff I don't like. It desperately needs to solve the file system problem. The market is bifurcating around online solutions like Dropbox and that's fine but the connecting interfaces between applications has been purposefully stymied and it shows. Not having a unified approach to filing actually cripples this functionality. I know it'll change, but it's half-baked right now and it's annoying in practice. The iWork apps are great but don't import/export very well and always drop formatting detail or just plain detail. Advanced Excel formulas like sumproduct() just get stripped when converting and most Word styles get stripped too.

Can't wait for the iPhone 4.0 changes, but fall is a long way away. Multitasking and apps that take advantage of the multitasking interfaces will be very welcome as that's one of the constraining characteristics of this device. The other missing piece is having to reach and touch the screen when you've got the bluetooth keyboard activated. Right now you have to do the same with a computer but you have a mouse. While it's totally possible to implement a bluetooth mouse driver and render a mouse cursor on the screen, I really doubt Apple would do that too, even though it would go a long way to not making the user reach up and touch the screen. It would make a lot of sense though as the bluetooth keyboard and stand make this quite a dockable computer. Being able to command-tab would be HUGE although I doubt Apple will implement the support when using a bluetooth keyboard (but how many hundreds of times a day do I use that keyboard combination).

Apps need to catch up, though I'm not complaining much. Wait another 1-3 months and we'll see a landslide of incredible functionality. A big thanks to those people that have made awesome iPad apps already. Here's a list of the apps I use and love:

Kindle, IMDB, At Bat 2010, Now Playing, Amazon.com, Marvel and Comics, Plants vs Zombies HD, GoodReader, Instapaper, Labyrinth 2 HD, ABC Player, Brushes, Pinball HD, Pandora, Bubbles, Time Editor's Choice, Guardian Eyewitness, GoToMeeting and of course my app, Reef Fish Book HD :).

iPhone apps I'd love to see for iPad are:

Skype, Taskpaper, Files, Tweetie, digg, Wired

I was listening to a talk on a gdgt round table podcast and people that had tried to make the iPad a laptop replacement have felt constrained but this device is about context and specific use-cases right now. For example, watching streaming video by just standing the device up against the wall while cleaning the kitchen is totally possible. The speakers are so clear and so good you can hear the video over the sound of running water. The screen is so bright and clear you can see it easily from across the room. It's great for quick google searches for recipes.

I love reading on this device - the huge screen and brightness control means I'm consuming a bunch of material via kindle, safari, instapaper and via twitter. Comics are great to read and there's a few free ones (I'm yet to buy one). It's a far more pleasurable device to read this material on than a laptop screen. You can hold it closer to your face than you would a laptop. The device does get a bit heavy but it's not so bad. You just lean it on things or prop it up.

My wife loves the brushes application. She's artistically inclined and was drawn to this app immediately. Watch out - if you think you won't have to share the iPad with your the family members, think again. This thing is seriously fun.

The pinball HD app with it's speedy graphics and pinball sounds is so great on the iPad. The Labyrinth app is wonderful for kids. And don't get me started on Plants vs Zombies. I have to ration myself on that app because it's so much fun. Your hands blur over the screen in this gameplay - if you think it's the same as a regular computer then imagine using both hands and multiple fingers to capture falling sunlight and using another hand to drag new plants down to the field. It's so much fun and so much more tactile than the ordinary computer experience.

People have complained about needing to touch the screen to do certain things - you can't use the keyboard for everything. But it's not bad - the cursor keys work, as do option-arrow to jump word by word and even option-shift-arrow to highlight by word. So I think keyboard support will get even better over time.

Something else that's really significant is that this is a device that is to be shared with others. I actually prefer to download pictures from my camera to the iPad to view them - it's so much better than on a laptop screen. I guess on a 27" iMac you might find a better experience for viewing but this one is very good. The iPad photo app desperately needs editing and favourites though because it's such a good way to vet photos. If you could mark photos and then upload them to Google/Picasa I'd be in heaven but I may need to wait awhile for that to be a reality.
Okay well we're now at the boarding gate about to head to Australia. While the honeymoon is definitely over, this device is fitting into my life in all sorts of great ways. I'll upload this to the blog over my 3G connection. The tweet about it. Maybe I'll write more later - there's more to say.

Saturday, May 01, 2010

Copying movie files to the iPad from an external hard drive

I know this might seem ridiculously obvious to some but if you need to copy a bunch of movie files from an external drive to your iPad and you don't have space on your laptop, this approach will work.

I use a laptop as my primary iTunes syncing device and even though it has a 300 gig drive, movie files eat that up fast so I use an external Drobo with 6TB of space to hold large media.

If you want to copy your videos to iTunes but don't want to copy the movie file to the local iTunes collection, go into iTunes, Preferences and under the Library tab *uncheck* "Copy media when adding to iTunes library". Then drag your movies directly from the external drive to your iTunes library.

Click on the iPad when connected in iTunes and choose the Movies tab. Check the movies you want on the iPad and click apply. This will copy the movies to the iPad.

Remember to re-check "Copy media" option above if you want this to be the default when adding music (I do this because it's convenient).

If you disconnect the drive and re-sync it throws an error but the movies stay on the iPad and you don't lose all your laptop hard-drive space.

Sunday, April 04, 2010

iPad review

So I finally got to use the iPad. Here are my first impressions.

It's heavier than I thought. At about a pound and a half you really feel it when you hold it continuously for about an hour or so. When you first hold it it just feels slightly heavy, like a hardcover book - you'll definitely want to rest it on your knee when reading a book on this device.

It's fast. Feedback is immediate and highly responsive. There were a couple of situations where button presses didn't respond straight away but for the most part everything screamed.

After launching Safari, the device's speed is immediately apparent - when you two finger pinch to expand the text, you can pan the page while holding the pinch magnification steady. When you drop the pinch, the resolution fills in the detail. Same with Google Maps - pull down and pinch out and the the image balloons under your fingertips like magic, with the map tiles coloring in like patchwork. It's a lazy async loading pattern and beautiful to watch.

The screen is so big and you hold it so close to your face that the apparent size is far bigger than the screen size belies. When you're using a computer you normally sit a lot further back from the glass. It makes for an impression of size that's huge. This is really obvious when playing games. Playing plants vs zombies is so much fun on the big screen. You find your eyes darting all over the real estate. And labyrinth 2 - the marble and wood tilt game - is gorgeous, eye-popping. The unused space while you're concentrating on one corner of the game seems indulgent.

Games are going to be huge on this device. Apple have overcome a bunch of technical hurdles to make handheld gameplay cheap for consumers and given developers the tools and speed they need. The only drawback is the controls, though accelerometer and virtual joysticks go a long way. I couldn't tell you how fast I would buy a bluetooth game controller for the iPad. The car racing game, Real Racing, is so in-your-face, it's hard not to be immediately drawn in to the action. Let's hope Prince of Persia makes it to the iPad!

The book reading app is fast and functional - with special attention paid to the bookshelf, page-turns and searching. The screen is definitely easy to read and if reading my kindle books on the iPhone is anything to go by, it will be pleasant to read on this too, but if you're lying in bed you'll want to rest it on something cause it'll get heavy. The hardware orientation lock will come in handy for books and web browsing - this is a constant frustration in safari on the iPhone (I'm sure we'll see this in the next iteration of the iPhone OS).

The built-in apps are polished and so fast. Photos flick by and load almost instantly, stacks can be opened and closed with a pinch, held and moved about the screen. Touch gestures have been given a very stable state system that allows the users a great deal of control. Given the ad-hoc nature of gestures, this was important for Apple to nail so it felt intuitive and stable.

The maps application is a world in itself (although I'd love to see the ability to change routes or search alternate routes, perhaps draw a projected route on the screen). The calendar app real-estate will be very welcome. The contact app is functional rather than mind-blowing. Notes still has the same lame comic sans font and the text doesn't even line up with the lines so that app is obviously not getting much love. Given the amount of great notes apps (including taskpaper, my favourite), that's fine by me.

There is a new Videos app by itself dedicated to showing movies - despite the squarish aspect ratio, the screen is so crisp they look great. And over 10 hours of battery life with movie playback is very desirable. Many children and adults will use these devices on long trips - unless motion sickness is an issue (that remains to be seen).

The iPhone felt puny when I'd finished using the iPad for a length of time. That's not to say I don't love the speed and richness of functionality I can get on the 3GS but for web browsing, there's not comparison: the iPad is what you want to have in your hands. It will remain to be seen how well that experience plays out for the vast variety of web pages out there. (Can anyone say Chrome for the iPad? Yeah right :)) Interestingly, when I went to google and put safari in landscape mode, google mail had an Apple-like mail web app waiting for me - at iPad launch day, that's pretty impressive. There was a list of mail on the left and detail on the right. I hope I can turn that on in Chrome.

Touch is here to stay. A generation of users, especially children, will be growing up with touch-based computers. We are still at the infancy of this technology but it's clear after using the iPad that you are starting a new paradigm of computer interaction. Gestures are going to become more and more intricate. The computer gurus, instead of using keyboard shortcuts will use little-known gestures and combinations to make the computer fly.

The simplest example of this effect was when I tried to pull up the control menu in Pages. I couldn't get it to work with gestures in the side bar, double-tap, swipe - nothing worked. I then later realized I had it in landscape mode - only turning it to portrait would yield the menu bar and controls. The gestural nomenclature has been extended to orientation.

Keynote, Pages and Numbers are a good reminder of how far this device might be pushed. With a bluetooth keyboard and a way to prop the device up you could easily do basic word processing, write a book or create keynote presentations on the road. People might use it to take meeting minutes and so on. The on-screen keyboard will suffice for short bursts of text or be useful for editing, but is still not so good for touch typing IMHO. (Early hint: take a rubber non-slip mat with you to let you prop the device up against things - would work well on a tray-table in a plane).

I'm holding out for a 3G model. Given the limited options for transferring files on and off the device, I suspect copy and paste mechanisms as well as online services like dropbox and iDisk will become more popular. When opening a keynote/pages/numbers document from mail there was a button to "open in keynote/pages/numbers" for each filetype but it didn't do anything. With any luck this will be enabled so a Dropbox app can use the built-in viewer and then launch pages or keynote and open the file. Without wifi or 3G your options are very limited - you might have a file stuck in the device until you get into wifi range or can connect it to your computer. If you're on the road - get the 3G version.

I've never had a computer experience so responsive and fluid. Perhaps once when playing a first person shooter on a tricked-out PC with a fast graphics card and decent processor, the mouse controls finely tuned, where every twitch yielded instant results. But never with a general user interface. To be able to turn a computer on and immediately get to precisely the task you want is going to be very welcome to most users. Being able to run one app at a time may not bother people too much in this context.

The iPad is an experience as well as a device - I enjoyed every minute of it.

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!

  1. Export from Mail to an archive. This is a plain text file.
  2. Download MacVim
  3. Run a script over archive file to reduce it to text
  4. Run ruby script in new folder to convert notes to text files

Export from Mail.app to an archive

  1. Click on notes
  2. Mailbox | Archive Mailbox
  3. Choose a new empty folder like ~/Downloads/Notes
  4. 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

  1. Download MacVim
  2. Drag to applications folder and open

Run vim script to convert mbox text file

The script:

   :%s/&nbsp;/ /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
  1. Save the above vim script to a file, like ~/notes.vim using a text editor.
  2. 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.
  3. Type:

    :so ~/notes.vim

    Or whatever you named the vim script.

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

Well MacHeist is over, but MacUpdate Promo is now on.

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

Thanks to @rands on twitter, I now realize you can use the gmail-style keyword text search queries in mail (Command-Option-F). This technique also works in spotlight.

Try:
to:someone from:someone subject:something
The "someone" part seems to work with full names or email addresses.

The only confusing thing is the mail search bar should switch to "Entire message" when you're using a keyword-style search rather than the "From", "To" or "Subject" buttons.

It's a very limited syntax and not well publicized but welcome anyway cause what's there works. These tests done in Snow Leopard 10.6.2 and Mail.app 4.2.

Wednesday, January 06, 2010

How to restart a hung Finder in Mac OS/X without rebooting


Warning this is HIGHLY UNAUTHORIZED. Proceed at your own risk.
So: save everything first before going on.

Okay - to do this, it's pretty basic. We're actually not sending it the kill signal, instead telling it to restart itself or in unix signal parlance: SIGHUP. I learnt this doing some BSD coding on HP/UX systems years ago.

So first, we need the Finder's pid. This will get it:
ps -e | grep Finder | grep -v grep | cut -c1-6

And then pass that to the kill command with -sighup switch:
kill -sighup `ps -e | grep Finder.app | grep -v grep | cut -c1-6`

This will clobber Finder and it will reopen fresh(ish) as a daisy.

Put it in a script for reuse call this restartfinder.sh
#!/bin/bash
kill -sighup `ps -e | grep Finder.app | grep -v grep | cut -c1-6`
chmod +x restartfinder.sh

And you're done.