Google AJAX Search API Example Python Code

For whatever reason, there aren’t many examples on the net of Python code that can be used with the Google AJAX Search API. I’m not really sure why this is and perhaps I’m missing something, but for future reference here’s some sample python code.


#!/usr/bin/python
import urllib
import simplejson

query = urllib.urlencode({'q' : 'damon cortesi'})
url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&%s' \
  % (query)
search_results = urllib.urlopen(url)
json = simplejson.loads(search_results.read())
results = json['responseData']['results']
for i in results:
  print i['title'] + ": " + i['url']
Continue reading » · Rating: · Written on: 05-28-08 · 14 Comments »

RSS/Atom Feed view-source Bookmarklet

See, this is why I love Twitter. One of my gripes with Firefox is that it automatically assumes any RSS or atom feed I enter into the address bar is one that I want to subscribe to using some sort of feed reader like Google Reader. While this is true 90% of the time, there is that occasional instance where I actually want to see the plain text of the feed. I posed my question to the Twittersphere and merely moments later, somebody replied with just the right solution:

Picture 4.png

I gave it a shot and it worked perfectly, but the only problem was that it required a few too many keystrokes for my liking. With that in mind, I whipped up a quick bookmarklet to take care of it for me. Here’s the source in, conveniently enough, less than 140 characters.

javascript:(function(){s=location.href;location.href='view-source:'+unescape(s.substr(s.indexOf("feedurl")+8));})();void(0);

You can also just drag this View Feed Source link to your bookmarks.

Thanks, @popthestack!

Continue reading » · Rating: · Written on: 05-21-08 · No Comments »

The Best Time to Visit Croatia

The best time of the year to visit Croatia, at least for me, is sometime in May. The crowds aren’t too thick, the weather is just right and not too hot for this Seattle guy.

Coastal view

Definitely not too bad. I went to Split at the last minute to take advantage of a long weekend. The picture above was not at all the image of Croatia that I had in my mind when somebody on Twitter suggested I visit there for the weekend. One hour after Googling “Split, Croatia” and seeing some of the results on Google Images, I had my ticket and hotel booked within the hour.

I arrived in Split on Saturday morning and even before I landed, I knew I had made the right choice for a relaxing weekend.

Arrival in Croatia

I quickly realized after landing in Croatia that I would need some shades after having lost mine a couple weeks earlier. After finding the hotel (not the easiest task given the streets of Split), checking in and procuring some shades, I started simply wandering the streets of Split. I easily found myself basking under the blue skies both under cover and right on some stairs leading into the Adriatic Sea.

Canvas sky Bar on the coast Stairs into the Sea

And that was really all I ended up doing on my first day. I was pretty tired from all that sun (oh woe is me) and passed out early in the evening only to wake up around 9pm and find someplace to settle down for some fresh octopus.

Day 2 was more of the same with the exception that I got up early intending to go for a run and ended up hiking through a park, finding churches set into cliffsides and relaxing on a beach.

The views are simply dazzling... But then around back, built into the cliff Not getting much closer to my goal...

I settled down into an afternoon pizza, relaxed some more and then checked out a sweet concert by the coast. The band, Kries, was very unique and the bagpipes were the most authentic ones I had ever seen.
Now those are some bagpipes!

The last day was mostly souvenir shopping, checking out the cathedral and the tower next to. Now I’m not usually prone to a fear of heights, but this rickety stairway up the tower definitely made me happy once I was back on solid ground.

Stairs leading to the top of the tower.

You can check out more pictures of my Split, Croatia trip on Flickr.

Continue reading » · Rating: · Written on: 05-20-08 · 5 Comments »

Delete Twitter Direct Messages

*****

This is a hack.
This is not guaranteed to work.
Twitter may change their website at any time.
I am not responsible if something breaks or you decide to delete all your DM’s.
Nor am I responsible if your friends get mad at you for deleting your sent DM’s from their Inbox.

*****

That being said, I’d like to introduce my DM Whacker, DM Deleter, DM Sniper, whatever you want to call it I created a tool to delete your direct messages en-masse on Twitter. After the recent debacle regarding direct messages being exposed, I definitely saw a need amongst some Tweeters do delete their direct messages.

I need to thank @chris4403 who posted his awesome Twitter Translate bookmarklet recently. Were it not for that, I would not have had the motivation nor the codebase off which to build my first bookmarklet.

With that introduction, I’d like to point you in the direction of the new DM Deleter. Simply drag the link that’s in that page up to your Firefox or Safari bookmark bar, navigate to your direct messages, click the bookmark and select your options to delete your DM’s once and for all. The tool allows you to delete all of your messages, or just messages from certain friends.

My apologies for the additional link, but I just wanted to reinforce the point that this tool will delete your direct messages forever. So, use it with care.

Feedback welcome. The ability to delete sent messages will be added in as well soonhas been added in version 0.2.4.

Continue reading » · Rating: · Written on: 05-02-08 · 79 Comments »