Showing posts with label google api. Show all posts
Showing posts with label google api. Show all posts

Sunday, June 15, 2008

Some Feed Reader Gadgets Broken

Update 7/2/08 - My OEDILF Widget works again... so the problem must be fixed. Yay!
Last week I noticed that the Google gadget I had created to display limericks from the OEDILF Limerictionary had stopped working. Bummer! Yesterday I finally got around to investigating. Turns out, nothing is wrong with my gadget, rather Google broke some stuff in their API. As of recently if you use the IG_FetchFeedAsJSON() function, you always get an empty response. This is broken in the "sandbox". Supprisingly blogger is in the sandbox, because any gadgets implementing this call are broken on blogger. My gadget still works correctly when viewed from iGoogle and other such non-sandboxy places. I'm not the only one this is affecting, many of the RSS based gadgets I tried are broken including BBC news, NY Times, Wall St. Journal. According to Google this should all be fixed sometime next week. In the meantime I'll have to get my limerick fix some other way.

Wednesday, January 30, 2008

OEDILF Google Widget


I've been wanting a way to link my OEDILF contributions to my blog and finally got around to figuring out how. The result is a Google Gadget that displays OEDILF limericks! I had a blast making this. What is so exciting about using Google's API is that it really makes you feel like you are programming on a grand scale. They have the distribution channel and the libraries all there. You just need an idea. Anyway, to cut to the chase, here is how to embed my gadget onto your blog (it is a bit clunky to do this because using gadgets in blogger is a bit of a new thing):

  1. Since the feature that allows putting google gadgets into blogger is still very new you need to log into your blog via this URL.
  2. Go to Template > Add a Page Element > Gadget (Add to Blog) > Add your own
  3. Then paste in this url http://hosting.gmodules.com/ig/gadgets/file/113358134765646390343/oedilf.xml
By default the gadget will pull down the most recent 20 approved OEDILF limericks and display a random one from that set. You can turn off the randomization so it always displays the latest submission. You can also enter a particular author's OEDILF ID to get a stream of just the limericks from that author.

Here is a button that will add the gadget directly to your iGoogle home page. Add to Google

If you are interested in how all this works you can view the code for this gadget here. And here is a link to the gadget API. The library is pretty nice and makes things like grabbing RSS feeds a piece of cake. Happy coding, or limericking, whatever you plan to do after reading this. Edit: 1/30/08 - Gadget checked into subversion. Project page is here.

Sunday, May 13, 2007

Migrating from Wordpress to Blogger


A general trend in my techno-lifestyle has been the move from do-it-myself, to FREE services. Take my email for example. I used to refuse to use Hotmail or Yahoo! because I didn't trust my communications to some company, and I wanted to use Imap. Along came gmail, and suddenly I could get tons of space, and an awesome client for free. Bye-bye exim and bye-bye Thunderbird. What about storing my photos online? No way was I going to put all my personal photos on some company's servers. Then Flickr began offering Unlimited storage at an amazingly low price, and their software made sharing a joy. Bye-bye jigl and my ever increasing storage woes. I guess what is driving my adoption of these services is the maturity they have achieved. Ajax makes the interfaces useable and with prices hovering just above free nothing else makes any sense.

So I recently realized that I was really not using my virtual server anymore. Google gives you free subversion repositories, free email, and free blogs. So the time had come to kill my server and the only thing standing in my way was migrating my blog from wordpress to blogger. It turns out this is not a straightforward thing to do.

Step 1: see if anyone else had done it. Of course others have done it, but there is no automatic solution (that works). There are dozens of how to documents on moving from blogger to wordpress, but I found only 1 useful for doing the opposite. It also came with a pretty well made Java tool. Here is a link to the tool. Too bad it errored out when I tried migrating my blog. It wasn't open source either so I couldn't try to fix it. I think it is designed to move a wordpress.com blog, not a standalone hosted instance of wordpress. In any case after fiddling with it for half an hour I thought I had better start rolling my own solution.

Step 2: I used mysqldump to grab my WP database from my server and then imported it into a local mysql database.

Step 3: I downloaded the python version of Google Blogger API and used it to create a few dummy posts and comments.

Step 4: I wrote a python script and migrated my entire blog comments and all in about 20 seconds.

Lessons learned:
  • The Blogger API wasn't intended for migrations. You can't set the author of the comments programmatically. They belong to the person you login as. You can't backdate comments, so they appear anachronistic on the site. This is too bad, because there were some interesting folks who had left me comments. I would have liked to preserve that history.
  • Python is a nice language, but I hate, hate, hate the whitespace sensitive nature of it. I also find it a bit less elegant than Ruby. Google, you need to stop pretending that Python is so great and get your API out there in Ruby.
  • I'm never going to use this code again, thus it ain't very reuseable. My unit tests depend on my specific wordpress database. Stuff is just hardcoded in. I totally ripped off some of the sample code that came with the api download. For what it is worth I threw it up on my google code site. Feel free to check it out. It would be easy to make it better, but I don't want to mess with it.