twiiter – john locke http://gracefulspoon.com/blog adventures in architecture Sun, 05 Feb 2012 04:48:21 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.6 void in the center http://gracefulspoon.com/blog/2012/02/04/void-in-the-center/ http://gracefulspoon.com/blog/2012/02/04/void-in-the-center/#respond Sun, 05 Feb 2012 04:47:11 +0000 http://gracefulspoon.com/blog/?p=2480

 

I’m pulling the last 100 tweets from within a half mile radius of latitude 40.800808 x longitude -73.965154 (otherwise known as the desk in my bedroom where I’m typing this now). And right off the bat I can see that the tweeting frequency of some of my neighbors is impressive, out of 100 tweets there were only 42 different users, all of whose profile images are displayed above based on the frequency of their messaging. Voyeurism is something built into New York’s dna, the simultaneous repulsion and attraction of surveillance that was so effectively conveyed in Rear Window. Sometimes when riding the train, on the rare occasions when you’re sans earphones, you can’t help overhearing fragments and context-less snippets of random stranger’s conversation. Most of the time they’re pretty banal, on the order of sports predictions and office gossip, about nothing interesting but still interesting. And that’s what makes the hidden, invisible conversations going on in this five block vicinity so fascinating to me in a way I can’t really describe. 100 random tweets hold no mysteries, but the 100 tweets of the people around me do. A secret knowledge that gives added meaning to the ruby aficionado I see walking down the street or the Mavs fan at the bar, all faces that are part of a huge story that can never end. I’ve started following ThatsOro.

 

Click more for the code. Based on great examples here and here.

 

 

import twitter4j.conf.*;
import twitter4j.internal.async.*;
import twitter4j.internal.org.json.*;
import twitter4j.internal.logging.*;
import twitter4j.json.*;
import twitter4j.internal.util.*;
import twitter4j.management.*;
import twitter4j.auth.*;
import twitter4j.api.*;
import twitter4j.util.*;
import twitter4j.internal.http.*;
import twitter4j.*;
import twitter4j.internal.json.*;

ArrayList username = new ArrayList();
ArrayList imgs = new ArrayList();


double lat;
double lon;
double res;
String resUnit;

PImage twitimg;

void setup() {
  size(990, 480);
  background(255);
  smooth();
  noStroke();

  ConfigurationBuilder cb = new ConfigurationBuilder();
  cb.setOAuthConsumerKey("XXXXX");
  cb.setOAuthConsumerSecret("XXXXX");
  cb.setOAuthAccessToken("XXXXX");
  cb.setOAuthAccessTokenSecret("XXXXX");

  lat = 40.800808;
  lon =73.965154;
  res = 1;
  resUnit="mi";

  try {

    Twitter twitter = new TwitterFactory(cb.build()).getInstance();

    Query query = new Query();
    GeoLocation nyc = new GeoLocation(lat, lon);
    query.setGeoCode(nyc, res, resUnit);
    query.setRpp(200);

    QueryResult result = twitter.search(query);


    ArrayList tweets = (ArrayList) result.getTweets();


    for (int i = 0; i < tweets.size(); i++) {
      Tweet t = (Tweet) tweets.get(i);
      String user = t.getFromUser();
      Long id = t.getFromUserId();
      String url = t.getProfileImageUrl();
      String msg = t.getText();
      Date d = t.getCreatedAt();

      username.add(user);

      imgs.add(url);
    };
  }

  catch (TwitterException te) {
    println("Couldn't connect: " + te);
  };
}


void draw() {

  int k = (frameCount % imgs.size()); 
  String pix = imgs.get(k);
  String users = username.get(k);

  PFont font;
  font = loadFont("FuturaLT-ExtraBoldOblique-18.vlw"); 
  fill(0);
  textFont(font);
  text(k + " " + users, 0, 35);

  fill(255, 200);

  rect(0, 0, 220, 45);

  twitimg = loadImage(pix, "png");
  image(twitimg, random(width), random(height));
  //text(users, twitimg.x, twitimg.y);

  fill(255, 1);
  rect(0, 0, width, height);

  fill(222, random(50, 150));
  textSize(random(10, 30));
}
]]>
http://gracefulspoon.com/blog/2012/02/04/void-in-the-center/feed/ 0