A Modest Introduction to the Internet

The web is a big place, full of information flying around. You want to snatch some of that information up and make sense out of it. The best way to snag some of that info is not to write something that scrapes web pages or intercepts bits on the line, but to use an API.


API stands for Application Programming Interface, but that is a little verbose for use with the web. I look at a web API as a standard way to retrieve information from a specific source. Each website that offers an API has a different way of doing things, but they all boil down to the same general concept of getting the data you care about. Some examples of APIs are Facebook's Graph API, the Last.Fm API, or Twitter's REST API. Feel free to check the documentation linked to the API's to get a better sense of what information is available to you through these services.

REST is for the weak

Each of these APIs are examples of REST APIs. REST is another acronym for Representational State Transfer. Again, this makes it sound much more complicated than it really is. What REST really means is that the internet is full of (among many other things) resources, and operations you can do to those resources. The operations you can do on those resources in a REST architecture are GET, POST, PUT, DELETE. What each of these operations do is pretty intuitive, but I will only go over GET pretty thoroughly. The other ones kind of suck anyway

GET me some pie, woman

The GET operation is definitely the easiest and most common operation in REST architectures. It retrieves information from a given resource.

Let's look at the Twitter statuses/user_timeline method and use that as a resource to 'get' some information about my tweets. If you browse through the documentation for the statuses/user_timeline method, you'll notice that it uses the format:

Also there are some parameters that can be included to scope the range of data to retrieve. A good REST API follows this kind of format:

The parameter string [params] for a GET request follows a specific format. It begins with the '?' character and separates each parameter with an '&' character assigning values to parameters with the '=' character. Here's a Bono inspired example of a parameter string:

Using the statuses/user_timeline method and our fresh knowledge of parameter scoping, let's list my last 20 tweets. Constructing the url using the user_timeline method as a resource and setting some specific parameters get's us to the url

Open a new tab, copy that bad boy into the address bar and hit enter. Voila! My last 20 tweets. I apologize in advance if there is anything offense in there, I have a tendency to drunk tweet. If the response is hard to read since it is unformatted download a JSON Viewer plugin for your broswer. Here's a link to a plugin for chrome.

Looking at the response, you'll notice that it repeats information about me as a user for every tweet. Get rid of that by adding the trim_user parameter to the parameter string and set it to true. Also, notice that if you change the '.json' part of the url to '.xml' you'll get a response back in a different format. Both of these formats are ways to structure data. They both work, but JSON is XML's skinnier, smarter, better looking cousin with a bigger rack.

JSON, she's a bit out of your league

Both XML and JSON focus on a the same type of abstraction, but since JSON is a bit more desirable, let's talk about her. JSON stands for JavaScript Object Notation and is becoming the standard for serializing data for transfer over the wire. JSON has three components: Objects, Arrays and Attributes. Using these three components and nesting them within each other, you can represent pretty much any kind of information you want. An object is encapsulated by the characters '{ }', an array by '[ ]', and an attribute has the format ' "key":value ' with each attribute separated by a ','. Combing all of these we can build a data structure to represent a basketball team:
  "type":"Basketball Team",
    {"position":"Point Guard","name":"Ty Lawson"},
    {"position":"Shooting Guard","name":"Arron Afflalo"},
    {"position":"Small Forward","name":"Al Harrington"},
    {"position":"Power Forward","name":"Nene Hilario"},
    {"position":"Center","name:"Timofey Mozgov"}

You can read more about JSON here or see a beautiful example here.


OMFGLWSC is the final acronym I'll introduce. It stands for Oh My Fucking God Let's Write Some Code and means basically, you're sick of reading and want to do something neat. I hope you're familiar with Python and if not install it and figure things out from python.org.

What I want you to do is to write a python script that gets my last 20 tweets, but only prints out what I said and not all the metadata around it. Use the urllib module to get a response from twitter and the json module to parse it. Here's some pseudocode to get you started:
import json, urllib
url = 'someurl.com/what/i/want?howiwantit=hot'
response = urllib.urlopen(url).read()
data = json.loads(response)
for datum in data:
  something_i_care_about = datum['nonsense']
  something_about_what_i_care_about = something_i_care_about['nonesensical nonsense']

A Recap, bitches

We went over the basics of web APIs and why they are around and worked through some examples. Let me know if you have any questions about this stuff by emailing me at tmbuckheroux@gmail.com with the a subject of 'You're introduction to the internet sucked and you're a dick. Love, [insert your name here]'

BuffTweet Android Install

BuffTweet Install Package

Android Workshop

I will be presenting a workshop on how to build an Android application

Here's a synopsis:
You will be building a useful Android App from the ground up. This will demonstrate the workflow of an Android application and will harness some other useful web technologies such as OAUTH and JSON. By the end, everyone will have built an Android-based Twitter client that they can load onto a phone and add to a resumé.

Thursday, March 10 in Business 203 at CU-Boulder and free pizza!

Come join me if you'd like to ramp up your dev skills

Link For fmStalker Demo

fmStalker Android SuperBeta

Best of 2010: tunes

A year filled with oil, foreign miners, and the death of the greatest alcoholic drink ever had to make for some good music, right?

10) Subiza: Delorean

The Spanish quartet create a synthesis of sunsets and foreign pop that may just be an acquired taste. I have acquired the shit out of said taste.

9) Astrocoast: Surfer Blood

I directly tie Astrocoast to coffee at 8:30 in the morning swimming between the twin peaks of Anchorage. You know, where the action is.

8) The Way Out: The Books

An eclectic composition of minimalism and samples. It's like listening to a Gertrude Stein poem with its decontextualizational nature and disjointed structure. A very refreshing listen considering how fed up I've been getting with the appearance of depth in music, when much of it tends to be as shallow as Nick Cage's ability to play a role that doesn't have something to do with national security.

7) Swim: Caribou

Solid grooves with all the bells and whistles, minus the whomp.

6) Clinging to a Scheme: The Radio Dept

Authentic indie rock with some pretty blatant themes of distaste for the class hierarchy juxtaposed with it's dream-pop sound makes for an interesting experience.

5) The Age of Adz: Sufjan Stevens

While not quite up to par with Chicago, Sufjan deals with his issues on a cosmic level and makes me a believer. His sound is generally less folky and he even drops the F-bomb a number of times towards the end of the CD. A solid intro and a spiraling ending pin The Age of Adz as one of my favorites.

4) My Beautiful Dark Twisted Fantasy: Kanye West

I eat Kanye's ego up like Kirstie Alley eats Bon Bons. He continues to flaunt it throughout the album in his usual style of big-headedness epitomized with Power. Monster is a novelty saved by Nicki Minaj. Hova is a big disappointment and his verses are the lowlights of Kanye's Fantasy. That and Chris Rock. Seriously, stop these skits. They are dumb. Period.

3) Odd Blood: Yeasayer

The title track is simply brilliant, but the following songs slip up only to be saved by the bubbling culmination of ONE. Love Me Girl then creates an organic transition that builds and pops into a notable decrescendo for the rest of the album. Seriously underrated.

2) Fang Island: Fang Island

Take a watermelon. Fill it with confetti and whipped cream. Line the outside of it with M80s. Give it to Bill Murray. Light it up and have the best fucking time ever. That's Fang Island.

1) This is Happening: LCD Soundsystem

Oh James Murphy you are just too god-damn cool. Can we like, hang out, or something?

The Definitive Guide of !

The ! is a cultural phenomenon, and by using this simple guide you too can be part of the fun!

Single !:

    A mild rise in frequency towards the end of the phrase
    Syntax: "Brownies make people fat!"
    Semantics: Denotes playfulness and a general interest to continue conversation
    Use: Whenever possible to seem fun and exciting

Triple !!!:

    A mild rise in frequency towards the end of the phrase elongating the last vowel to
    create heavy emphasis
    Syntax: "Brownies make people fat!!!"
    Semantics: Denotes a point that needs to taken account of
    Use: Whenever possible to seem more fun and more exciting

Lack of !:

    A cold and monotonous tone throughout the duration of the phrase
    Syntax: "Brownies make people fat"
    Semantics: Denotes someone is not fun and thinks they are better than you
    Use: Whenever you want to be a pretentious asshole

Use your new knowledge wisely!
Next week: CAAAAAAPS

LCD Soundsystem Live

Goddamn brilliant. James Murphy knows how to put a show together.

Dance Yrself Clean is a great opener. The entire crowd chanted along with the lines "Acting like a jerk, except you are an actual jerk and living proof that sometimes friends are mean" and said crowd went nuts on the drop.

While definitely not being one of my favorite songs, Drunk Girls still had a serious impact on the direction of the show. Dance Yrself Clean and Drunk Girls are a great one-two punch.

From here it gets a little hazy, but I will go over some of the highlights. Most of the set list naturally came from This is Happening, very little Sound of Silver (but I think these were some of the best songs) and a handful from the self-titled.

My top three were Someone Great, All My Friends, and Yeah. I simply love Someone Great, probably my favorite LCD song, and All My Friends and Yeah were just great live.

I was surprised to hear Losing My Edge and think its pretty funny how stoked people can get just by hearing the words Daft Punk.

The songs from the self-titled were a little rougher and if I'm not mistaken a pit broke out during Movement.

I would have liked to hear more from Sound of Silver, namely North American Scum and a killer ending to the set would have been New York I Love You.

I was a little confused at the end as I didn't think that they played an encore, but apparently they had left stage and returned earlier.

Great Show: 5/5

Android App In-Game Thread


Founders At Work

Do your self a favor and go get a copy.

It's a series of interviews from the most successful tech companies around proctored by the co-founder of Ycombinator.

Seriously a great read. Looking at the various ways that startups can form and develop into multi-national corporations is authentically inspiring.

Why are you still reading this? Go. Buy. It.

Fall '10 Classes

The Postmodern
Artificial Intelligence
Embedded Systems Design
Senior Project
Brain Control Interface Research