No Mod Required

Archive for October, 2008

Happy Halloween!

This is my first brush and ink drawing in probably a year. Sad fact, that.

Twitter Search Results With JSON and Callbacks

A question was posed in the comments on my JSON Feeds For Fun and Profit Part 2 - Callbacks with Twitter post about handling Twitter search results for a #hashtag. As with the rest of Twitter's API, dealing with search results is relatively straightforward. This post will examine how to handle a #hashtag search.

If you're not familiar with JSON or callbacks you might want to read the above referenced post to get up to speed.

Otherwise… it's on.

With the previous example in mind, the only real difference between this and the status request is the format of the returned object. Let's take a look that should clarify the differences.

This is the status structure:

  • anonymous array with one member containing…
    • anonymous object(s) representing returned statuses
      • created_at
      • user
      • anonymous object
        • followers_count
        • description
        • screen_name
        • url
        • name
        • protected
        • profile_image_url
        • location
        • id
      • truncated
      • in_reply_to_status_id
      • favorited
      • id
      • source
      • text

And here's the structure for the search object:

  • anonymous object containing
    • results which contains an…
      • Anonymous array(s) representing matching tweets
        • text
        • to_user_id
        • from_user
        • id
        • from_user_id
        • iso_language_code
        • profile_image_url
        • created_at
      • since_id
      • max_id
      • refresh_url
      • results_per_page
      • next_page
      • page
      • query

As you can see they're related, but different. So need to use a different approach to get to the data. Here's how I'm doing it…

function twitterSearch(obj) {	
    //this is the div I'm writing the content to	
    var tDiv = document.getElementById("twitter");	
    var user, bgcolor, tweet, postedAt, icon, userURL;	
    //start the ul	
    tDiv.innerHTML = "<ul>"	
    for (i=0;i<obj.results.length;i++) {	
    	//Look at me use the JavaScript modulus operator to do even/odd rows.
      	if(i % 2) {
        	bgcolor="#efefef"
        } else {
       		bgcolor="#ddd"	
        }
        //we need to get some data out of the object
        //and populate some variables.
        //i could do this inline in the string below, 
        //but this is way easier for you to read
        icon = obj.results[i].profile_image_url;
        user = obj.results[i].from_user;
        userURL = "http://twitter.com/"+user;
        tweet = obj.results[i].text;
        postedAt = obj.results[i].created_at;
	    //and here I mash it all up into a fancy li
   		tDiv.innerHTML +="<li style='background-color:"+bgcolor+"; background-image: url("+icon+")'><strong><a href='"+userURL+"'>"+user+"</a></strong>: "+tweet+" <span class='time'>("+postedAt+" GMT)</span> </li>";
	}	
    //and close the UL
    tDiv.innerHTML += "</ul>";
}
//this is basically the same function I was using before
//with the changed search URL
function twitter() { 
    var twitterJSON = document.createElement("script"); 
    twitterJSON.type="text/javascript" 
    //here's the search URL
    twitterJSON.src="http://search.twitter.com/search.json?callback=twitterSearch&q=%23css"
    document.getElementsByTagName("head")[0].appendChild(twitterJSON);
    return false;
}

And this is what it looks like (click the link for twitter magic):

I'm Seriously Confused After Having Watched This Ad

What mad genius made this and called it a commercial?

And for a bank?

It's actually quite a memorable spot, but… for HSBC? Seriously?

via via via

A Couple of Links and Random Thoughts, Dropped on You Out of the Blue

I haven't shared random bits of Internet with you for months. That changes right now.

Technology

Music

  • I am old, I remember when all of this was going on

    Start here:
    Obscure Roxanne battle records fortnight part 1:

    and finish here:
    Roxanne Battle Records

  • Jeff Mangum has been spotted in the wild. Here he is playing "Engine" last week in Columbus, Ohio. If he'd show up at the Boston version of this show, I'd still be kicking myself right now for missing it. He sounds great.

Sports

  • Ivan Basso is back and wasted no time getting back into the swing of things. Just days after finishing his suspension the Italian finished third at the Japan Cup, behind the Little Prince.

    Cunego wins Japan Cup

  • Speaking of Basso, the former Giro winner is focusing his whole return season on La Corsa Rosa this year. No surprise there.

    Know who else is eying the Giro? None other than American Lance Armstrong…

    Which means the Giro will be nuts this year. The Italian press was going to be there in droves anyway, covering Basso's return with real intensity. Now, with Lance showing up with his sights on winning, the rest of the world will be there as well.

    It will be a zoo.

    Can't wait.

  • How must it feel to be one of those fans in Indianapolis or New York who cheered when Tom Brady went down in the first game of the season. So far both teams are looking up at the Patriots. I'm wondering if that's the result they expected when Brady went down?

    It's been a very interesting season so far.

  • With the Red Sox, the Yankees and the Rays all in the same division there's a chance that the three best teams in baseball could all be in the same division one year and only one of them would make the playoffs.

    Nutty, I know, but imagine the three teams cannibalize themselves going 10-9 in their respective season series and in a weaker division the second place team swoops in to steal the Wild Card.

That'll do for now. More later.

Books 2008 #12 Against the Day

Against the Day Pynchon is a madman. This work, more than 1000 pages of meandering epic, is all the evidence one could ever need of that. Frighteningly dense and wildly imaginative, Against the Day spans three continents, more than 25 years and features a dizzying cast of characters. Shifts in tone, style and focus are commonplace and serious answers to questions as basic as "what is the plot" and "who is the protagonist" would take far more space than I'm planning on devoting to this particular review.

And therein lies some of the appeal of this book for me. It's a delirious intellectual exercise trying to keep up with Pynchon on this journey through time, space, and world history. The uncertain footing and the massive breadth of the book make for challenging reading. You're constantly questioning and evaluating everything.

On the flip side, would I recommend it to other people? If you've already experienced and anjoyed Pynchon I'd say "give it a shot." It's not as good as something like Gravity's Rainbow, but it's still Pynchon.

For everyone else, I'd say "probably not." It's not a masterpiece like the aforementioned Gravity's Rainbow, so the payoff for all the hard work probably wouldn't be worth the effort for most folks.

Banksy in NYC

I hope all my NYC people are going to make it over there to check it out.

The Village Pet Store and Charcoal Grill

As a side note, the cover story this month in ArtNews is about Street Art. Cool.

I Got a New Toy- a Dell Mini Inspiron

Quick review?

It kicks ass.

It's tiny but comfortable, looks really nice and I'm happy to be able to mess around with Ubuntu whenever I want to scratch the Linux itch without relying on virtual machines.

It will also travel really well. Compare it to my workhorse:

ebony-and-ivory

Which would you rather have in your carry-on?

I Promised Some Skate Photos

Here they are:

Boston City Hospital awesome I dont know who this is

And this gem:

sean waters, goofing off

Killer Old School Boston Skateboarding Photos Coming Soon

I just got a package in the mail full of some incredible photos of me and my cohorts skating in the 1980s. I'm going to be slightly off the grid for a couple of days, but when I get back prepare to be amazed.

Okay, maybe not amazed, but they're really cool photos. I swear.

Yeah. Swamp Thing.

I've said it before. I'll say it again. I love drawing Swamp Thing.

I've got a lot of good written content coming up over the next few weeks and I don't think the imagery is going to slow down either so keep your eyes peeled for some cool stuff around here.