Processing and Twitter

Screen shot 2013-03-06 at 1.06.42 AM

Recently I’ve been looking into creating some design that is heavily reliant on code and coding. I’m absolutely amazed by all the people out there willing to post the entire code of their sketches, or post regularly to help forums.. I don’t think I’d be able to get through an inch of the world of code without all these amazing and helpful people. Which got me to thinking that perhaps in return when I stumble on things that work I should also share my learning with people so they can gain from it too.

So, this week I was interested in collecting data off of twitter through processing. I found a really straight forward tutorial by Jer Thorp and through tinkering for a few hours I was able to get the sketch to function and collect tweets #Tasmeem.

This is the link to the original post, where you can find all the steps. I am only going to be writing about the things I needed to tweak to get it to run for me, and where I found those tweaks online:

Regarding the twitter oAuth process there are a few steps that are different, but its not something you can’t just messing around and figure out. Don’t forget you need all four codes for this to run.

To import the twitter4j library you can’t just simply drag and drop the file into the sketch as is it mentioned on Jer’s blog. You need to manually install the library following the steps listed here:

Here is an image, all the highlighted text had to be edited after I unzipped the twitter4j file, and placed into my sketch folder.

Screen shot 2013-03-07 at 12.16.51 AM

Over and over again I got the error “Cannot find a class or type named Tweet”. I found two really helpfully links:

Which made me add the following code:

import twitter4j.*;

import twitter4j.conf.*;

And switch out the lines of code about Tweet t = (tweet).. to:

Status t=(Status) tweets.get(i);
User u=(User) t.getUser();
String user=u.getName();

[If you are getting an error about setRpp the last link above had a solution to that also, I didn't]

Here is the edited code:

import twitter4j.*;

import twitter4j.conf.*;

import java.util.List;

//Build an ArrayList to hold all of the words that we get from the imported tweets
ArrayList<String> words = new ArrayList();

void setup() {
  //Set the size of the stage, and the background to black.

  ConfigurationBuilder cb = new ConfigurationBuilder();

  //Make the twitter object and prepare the query
  Twitter twitter = new TwitterFactory(;
  Query query = new Query("#tasmeem");

  //Try making the query request.
  try {
    QueryResult result =;
    ArrayList tweets = (ArrayList) result.getTweets();

    for (int i = 0; i < tweets.size(); i++) {
Status t=(Status) tweets.get(i);
User u=(User) t.getUser();
String user=u.getName();
      String msg = t.getText();
      Date d = t.getCreatedAt();
      println("Tweet by " + user + " at " + d + ": " + msg);
      //Break the tweet into words
      String[] input = msg.split(" ");
      for (int j = 0;  j < input.length; j++) {
       //Put each word into the words ArrayList
  catch (TwitterException te) {
    println("Couldn't connect: " + te);

void draw() {
  //Draw a faint black rectangle over what is currently on the stage so it fades over time.

  //Draw a word from the list of words that we've built
  int i = (frameCount % words.size());
  String word = words.get(i);

  //Put it somewhere random on the stage, with a random size and colour
  text(word, random(width), random(height));


Day 48 – Strangers

Messages like these scare and fascinate me.. I mean we live in the first real age in which a total and complete stranger can reach out to you from no where.. its interesting.. and bizarre.. I almost want to create a fake account just study these people.. What does it mean to them to connect with strangers? Do they really form genuine feelings for these people? What drives them to do this? Boredom? Sex? An inability to reach out to people in the flesh? So interesting, so bizarre..

F is for Faculty

I stopped by the annual faculty exhibition the night it opened, and it was packed! I liked all (ok most) of the faculty work, but I really appreciated the print by Michael Hersrud (speaks to my photography side), and the drawing by Zach Stensen (speaks to my quiet side). If you haven’t stopped by yet you should go, its open until the 21st of January.


VCUQ Painting and Printmaking Open House

I stopped by the painting and printmaking open house yesterday. I finally know why my linoleum prints didn’t work last year.. I didn’t own a fancy printing press! I’m glad I stopped by.. even though I won’t have time next semester to take a printmaking class, I think I might look into a summer class or something. The prints that were on display were breathtaking..


Get Tested by Reza Doust

24th – 26th May, 2011 @ The Sultan Gallery. Click on the image for more details.


The Future of A Promise

The Future of a Promise will be the largest Pan-Arab show of contemporary art at the 54th International Art Exhibition – la Biennale di Venezia. It will run from 2 June to 20 November.

From Tunisia all the way to Saudi Arabia, this landmark exhibition brings together more than twenty-five recent works and commissions by some of the foremost artists from the Arab world.

Presenting important works that range from installation, performance and photography, to video, sculpture and painting, The Future of a Promise includes the following artists: Ziad Abillama (Lebanon), Manal Al- Dowayan (Saudi Arabia), Ahmed Alsoudani (Iraq), Ziad Antar (Lebanon), Ayman Baalbaki (Lebanon), Lara Baladi (Egypt/Lebanon), Fayçal Baghriche (Algeria), Yto Barrada (Morocco), Taysir Batniji (Palestine), Abdelkader Benchamma (France/Algeria), Ayman Yossri Daydban (Palestine/Jordan), Mounir Fatmi (Morocco), Abdulnasser Gharem (Saudi Arabia), Mona Hatoum (Lebanon), Raafat Ishak (Egypt), Emily Jacir (Palestine), Yazan Khalili (Palestine), Ahmed Mater (Saudi Arabia), and Driss Ouadahi (Algeria), as well as three Abraaj Capital Art Prize Winners, Jananne Al-Ani (Iraq), Kader Attia (Algeria), and Nadia Kaabi-Linke (Tunisia).

The exhibition is being curated by Lina Lazaar, produced by Edge of Arabia and supported by Abdul Latif Jameel Community Initiatives and Abraaj Capital, three newly partnered organisations whose commitment to contemporary art practice in the Middle East is at the heart of a current artistic renaissance in the region.

Follow this link to view this events facebook page.


Trippin….Inside A World Within A World By -Bader Qabazard

I am looking forward to this opening night at Dar AlFunoon on Monday, May 23 at 7:00pm – June 9 at 7:00pm. See you there?


“Neither Here Nor There”

The lovely people over at Confashions From Kuwait have posted images from their trip to see the Neither Here Nor There art exhibit that is going on at Dar AlFunoon until May 19th. I wasn’t sure if I was going to be able to stop by before the show ends, but now I plan to definitely stop by. Amazing photos, Confashions.


Current Events

I have updated the Current Events page in the links above. If you’d like me to add your event to the list please contact me directly using the “contact me” page.