GMail IMAP in Mail.app Slow?

GMail IMAP downloading at 1.1 KB/s

I never download anything in Safari this slow. It’s easily hundreds of times faster. It’s been well over a month since I setup my GMail IMAP. I’ve done some initial investigation, but nothing concrete showed up that I hadn’t tried. Any ideas?

Using Google’s Chart API to Create Sparklines

Just a couple weeks ago I was wondering how Google made its sparklines for Google Analytics. I was creating a Health Page of sorts for my application (a rudimentary listing of recent performance statistics, like how long it took to get a DB connection). I had designed my stats collection piece to keep track of data over the last 15 minutes or so, hoping to show a chart of recent activity when I hit my health page. I had plugged in the Colt statistics library to perform some calculations on the set of measurements in each minute. I had a lot of data points ready to display.

But I didn’t like how the Java Sparklines library worked, and I couldn’t see an easy way to mimic Google. Then just a short time later, they released their Chart API. So this morning I put my data into their API and the charts came out pretty decent (ignoring the fonts, decimal formatting, and alignment of my other stuff):

Sparklines using Google's Chart API

I can’t figure out how to get rid of the x and y axes entirely. I mimicked the Analytics chart size of 75×18 (or thereabouts), and it’s close. The Analytics charts also seem to have a minimum 2px buffer of fill along the bottom, so even 0 has some fill below it. They also seem to auto-size so the max measurement it at the top. There are several ways to refine what I’ve started with, but for an admin page that’s full of 80-150 charts, and only viewed by a few people, it’s a decent start.

Please leave a comment if you’ve got any tips on how you use Google’s Chart API to create sparklines.

How to Setup Google Apps Chat SRV Records For iChat and xmpp4r-simple

I’ve registered several domains using Google Apps. Lately I’ve been fiddling with using Jabber with those domains, and I wanted to have a program be able to interact on IM using an account like tim@example.com. Furthermore, I wanted to have everything Just Work.

The place to start was with DNS. Google has a help page about how to setup your DNS so that your Google Apps accounts can be federated with other non-Google Jabber communities. The problem is that neither xmpp4r-simple nor iChat simply work if I use tim@example.com as my JID. Then I stumbled across this post that connected the dots for me.

Here’s a screenshot of how I setup my SRV records over at eNom:

DNS SRV records for XMPP federation and client setup.

After that, my simple chat listener worked:

require rubygems
require xmpp4r-simple

im = Jabber::Simple.new(tim@example.com, secret-password)
puts im.connected?
im.accept_subscriptions = true

while true
  sleep(5) unless im.received_messages?

  im.received_messages { |msg| puts msg.body if msg.type == :chat }
end

My little “bot” silently accepted new buddy requests, and printed out recent messages every 5 seconds.

UPDATE: Something’s amiss here, I think. I’ll update when I have more details. Guess not. I tried this out on another domain, and thought that things didn’t work right. But I was mistaken. Everything looks good.