Adam Jarret

Blog

Internet Blackout

| Tags: s92a

New Zealand's new Copyright Law presumes 'Guilt Upon Accusation' and will Cut Off Internet Connections without a trial. Join the black out protest against it!

Make way for the thought police - who the hell thinks guilt upon accusation is a good idea?

Top

Twitter + Google Reader

| Tags: google-reader, php, projects, twitter, twitterfeed, web-dev

Update 3/5/09: Twitterfeed has become GTweet and has moved to it's own domain. See gtweet.net for more details.

I love Twitter. A lot.

That said, I'm not wild about being plugged into it 24/7. I typically read my Twitter feed as though it were a (non-micro) blog. I don't have a dedicated app to alert me when someone posts something, instead I prefer to aggregate a few tweets to have ready when I'm looking for a distraction.

For a while I was using the RSS reader built into Apple Mail to keep up on Twitter. This proved to be an exercise in vexation and I quickly found myself looking for another way.

I played with a few of the dedicated Twitter clients, but I really wasn't looking to have another app running all the time on my aging Mac (the Adobe AIR ones in particular are so SLOW).

The ideal solution, it seemed, was to add the Twitter RSS feed to my Google Reader and call it a day. My hopes were dashed when it became apparent that Google Reader does not support feeds that require authentication.

After a little Googling, I found freemyfeed.com which creates a bridge between password protected feeds and RSS readers that do not support authentication - I was back in business!

Sadly, even after getting Reader to parse the feed, the experience left much to be desired. There was no easy way to reply to tweets and worse yet, the entire tweet was displayed as the "title" of the post. This meant that if someone tooted a link, I had to click on the tweet in Reader which brought me to the Twitter web site where I could finally click the link. This proved to be extremely annoying.

In an attempt to alleviate the problem, I set about hacking together Twitterfeed (I decided against calling it Twitfeed in deference to @LeoLapport) and before long I had turned this:

Before Twitterfeed

into this:

After Twitterfeed

Essentially, the freemyfeed hash is piped through the script which requests the feed and extracts any links from each tweet. The "description" of each tweet is overwritten with a reply link and the list of links that appear in the body of the tweet. When the processed feed is displayed through Google reader (or presumably any RSS reader), the links appears below the text of the toot.

I should probably admit that I'm not the heaviest of Twitter users - a tweet or two every other day or so seems to be my average rate. Most of my enjoyment comes from following the likes of @Ihnatko, @stephenfry, @lonelysandwich and @darthvader (to name a few) for their bits of wit and wisdom throughout the day.

For this purpose, I find the script to suit my needs beautifully. If others find it useful I might bother to battle test it and class it up a bit. If you have a use for it, please let me know in the comments!

Top

Gmail + Apple Mail - Headache

| Tags: apple-mail, fyi, gmail

Like many people, I check several e-mail addresses regularly. To consolidate this process I use Apple Mail, my favorite e-mail client on the Mac platform.

I use (and love) Gmail for my main personal address, but rarely use the online interface. I poked around with it when I first signed up in 2005, but since I almost always check my e-mail from one computer and like having a local copy of everything, I never really felt the pressure to ditch the desktop app.

After reading about the new "offline" Gmail feature provided by Google Labs I re-visited the idea of moving to the Gmail web interface as my primary e-mail client.

Ultimately, I decided to continue to use Apple Mail so that I could check my work e-mail along side my personal messages and not have to migrate my existing local cache of messages, but I did take the opportunity to update the way I use Gmail.

First and foremost I now connect to Gmail via IMAP as opposed to POP. I attempted this once before when IMAP first became available for Gmail, but quickly went back to POP after all the Gmail tags and Apple Mail folders attacked each other. IMAP is preferable to POP for many reasons (most obviously because it syncs mail read status across clients) and I'm happy to report that this time, with a little tweaking, it was pretty much smooth sailing (see caveats below).

I also disabled all other personal accounts in Apple Mail and I set up Gmail to pull messages from all my other personal accounts via POP. This has the two-fold benefit of providing a unified world-class webmail experience for all my personal accounts, and allows me to keep a local copy of all my messages in Apple Mail, synched over IMAP. All my personal e-mail being routed through Gmail also has the benefit/privacy concern of google having a back-up of all my messages.

Unfortunately, Apple Mail is not completely without its quirks when it comes to dealing with Gmail and IMAP. Google "ToDo.mbox" and you will find long rants about phantom labels that will not go away, and duplicate messages being downloaded.

I never did find a solution to the "ToDo.mbox" problem (I tried this and stopped short of trying this), but by enabling Advanced IMAP Controls from the Labs tab in Gmail Settings, and using it to stop the "All Mail" mailbox from appearing in Apple Mail, I convinced myself that the whole set up was a good idea.

It might sound like a needless step to have Gmail pull messages from my other accounts only to read the Gmail messages through Apple Mail, but I like having the option of using the slick Gmail web interface if I am away from home. I love my web host (Brinkster) dearly, but the web mail provided is a joke, and not a particularly funny one. By accessing everything through Gmail, I get the best of all possible worlds.

Update: I set up Gmail to tag the messages it retrieves from my other accounts. These tags show up as folders in Apple Mail (yay!) but the app also caches the messages in two different locations on my hard drive (boo!) so I went back to Advanced IMAP Controls and have now also unsubscribed from the tags relating to my other accounts. The messages still appear in my Inbox and I set up a "Smart Mailbox" in Mail for each account to find the messages associated with that account. Obviously the "Smart Mailboxes" do not appear if I access my mail via the Gmail web interface, but in that case I can still use the Labels to filter by tag, so the experience is practically the same from the web to the desktop.

Top

Proud to be an American

| Tags: obama

I'm about to watch the inauguration of the first president I've ever been excited about (I was too young to get amped for Clinton).

2009 Inaugural Address on YouTube

Top

Search locally hosted books in Coda when offline

| Tags: coda, fyi, php, web-dev

In my last post I detailed how to create a custom book in Coda using a locally hosted web site, for offline browsing.

After successfully bypassing the warning that I was offline, I could finally browse the local documentation, but was left with no way to search it.

To solve this problem I wrote a simple php page that greps through the html files and displays the results ordered by the number times the search term appears.

It's a minimalist concept that was hacked together in about an hour, but it gets the job done. More elaborate site searches could be implemented that could display the actual matching string or the title of the file containing the match, but my code is simple and offloads the task of actually finding text within files to grep, so it is relatively fast.

You can see the php source code here: grep.php.txt.

After writing the script I was annoyed to discover that the cool "command+double click to search" feature was set to use the online version of the php docs when editing in PHP-HTML mode. I could not give my custom offline book priority even after selecting PHP-HTML from the "use for mode" drop down.

So now I can view and search offline documentation from within Coda and even though I can't use my custom book for in-code searches, two out of three ain't bad.

Coda by Panic

Top

View locally hosted books in Coda when offline

| Tags: coda, fyi, php, web-dev

I've been developing php applications with Coda for the last week and have been absolutely loving it.

Coda has the ability to display online reference manuals as searchable "books" and comes loaded with The Web Programmer's Desk Reference and the complete PHP Documentation. Users can add custom books and can even search the documentation from an editor window by command+double clicking highlighted text.

The feature is nice, but I felt as though it would be more useful to have locally stored books that could be referenced when offline.

It occurred to me that I was running Apache on my Mac and therefore could probably get Coda to display a locally hosted web site as a book, so I downloaded the full php documentation and placed the html files in a folder called "php" within the Sites folder in my home directory.

NOTE: If you don't have a web host running locally, Coda books can also be made to use a URL that specifies a file (i.e. "file:///Users/username/Sites/php/index.html") but there are disadvantages to this that I will cover in my next post.

After creating the custom book in Coda, specifying http://localhost/~username/php as the URL, everything worked as expected until I attempted to view the book when offline. In theory, Coda should still be able to open the book with no problem, but instead I was presented with a friendly message informing me that I was not connected to the internet.

Being a developer, I understand the importance of giving users clear and consistent error messages as opposed to displaying a blank screen, but I was disappointed that the overzealous warning prevented me from viewing local content.

I wrote an e-mail to Panic (I hadn't yet discovered this mailing list), but before they could even write back I solved my own problem.

I discovered that I could get Coda to retry connecting to the local site by refreshing the book viewer window. This is accomplished by holding down the command key and pressing 'r' when presented with the "not connected" screen.

After banishing the warning, I was free to browse the locally hosted documentation with no problem.

Coda by Panic