Archive Page 4



Now, I am rather overdue for an update on my upcoming book. I’ll be posting details soon. However, in the course of finishing up a chapter on String parsing, I discovered that my good friend, the Google SOAP API is no longer being supported (obviously, I’m a little late on the ball here.)

So, I quickly whipped up a Processing library to make use of the Yahoo Search API. Now, you can access the Yahoo! API directly in Processing. There’s even an example here. However, you would have to write your own thread if you wanted to search asynchronously. In addition, if you’re not comfortable diving into outside Java APIs, you might struggle to figure out the syntax. (Switchboard also provides an interface to the Yahoo! API.)

So I set out (as an example for my book) to make a quick and easy bridge to the Yahoo API.

  • Download the library here
  • Go and get a developer ID
  • Download the Yahoo! Search SDK Find the file: yahoo_search-2.X.X.jar and put it in the library folder (along with the above download).
  • Finally, take a peek at this example code.

    // Import the library
    import pyahoo.*;
    
    YahooSearch yahoo;
    
    void setup() {
      size(400,400);
      // Make a search object
      yahoo = new YahooSearch(this,"YOUR API KEY HERE");
    
    }
    
    void mousePressed() {
      yahoo.search("processing.org");
      // You can request more results like so (the default is 10):
      // yahoo.search("processing.org",30);
    }
    
    void draw() {
      noLoop();
    }
    
    // The searches will come in one at a time to here when finished
    void searchEvent(YahooSearch yahoo) {
      // You can get the titles, URLs, or Summaries back as an array of Strings
      String[] titles = yahoo.getTitles();
      String[] urls = yahoo.getUrls();
      println("\nI searched for " + yahoo.getSearchString());
      println("There are a total of " + yahoo.getTotalResultsAvailable() + " results available");
      println("Here are the first " + yahoo.getNumberRequested());
      for (int i = 0; i < titles.length; i++) {
        println("___________");
        println("Item # " + i);
        println(titles[i]);
        println(urls[i]);
      }
    
      // You can also access the Yahoo API Directly by asking for the WebSearchResult object:
      // WebSearchResults results = yahoo.getResults();
      // WebSearchResult[] results = yahoo.getResultsArray();
      // In this mode, make sure to import the Yahoo library up topl
      // import com.yahoo.search.WebSearchResults;
      // See Yahoo API documentation for more
    }
    

    There’s also a fancier example (mostly uncommented, sorry) that produced the image at the top of this post here.

    Thoughts? Helpful? Useful?

    Voronoi Video

    Download higher quality quicktime

    I’ve been revisiting Voronoi Diagrams after seeing flight 404’s post and continuing amazing work. Started out by duplicating Golan Levin’s portraits (see image below) with the idea of developing some sort of voronoi-esque video filter (see sample above). I’m planning on trying a few things to make the Voronoi cells interpolate nicely as the video image changes. It’s just so spastic looking. . .

    Thanks to Paul Chew for a great Java implementation (beat the hell out of whatever I did a few years ago).

    Baby

    TERMINAL ZERO ONE
    Digital Art Exhibition at Toronto Pearson International Airport
    Terminal 1 – Level 3 Terrace, Departures Level
    July 1, 2007 – January 13, 2008

    Terminal Zero One (T01) is a site-specific digital art exhibition of five projects exploring themes of contemporary air travel and the architecture of airports. Airports are networks, information is increasingly networked, the T01 exhibit examines people as data, motion as trajectories and the symbiosis of virtual and actual.

    Sample images and video from my contribution are below. Happy Canada Day!

    frame0020.jpg frame0140.jpg frame0150.jpg frame0160.jpg
    frame0170.jpg frame0190.jpg frame0210.jpg frame0310.jpg

    watch video

    qrcode

    From: http://qrcode.sourceforge.jp/:

    “QR Code is a two-dimensional barcode, used widely in Japan. The advantage of QR Code from well-known barcode is larger data capacity (more than 100 bytes, typically) and error correction.”

    Thanks to an idea from Tom Igoe, I make a quick and dirty interface for Processing for QRCode decoding. The Pqrcode library page is here.

    Also, qrcode images can be generated here.

    Metropolis Magazine

    A nice article by Peter Hall about the IAC video wall is out in the June issue of Metropolis Magazine. The article mentions our work at ITP on the “most pixels ever” Processing library . . . which we will release soon for beta experimentation!

    I know, I know, you’ve been waiting your whole life for this.

    Download beta SFTP Processing library (source included in zip).

    Download example Processing sketch.

    The library uses JSch (Java Secure Channel).
    Copyright (c) 2002,2003,2004,2005,2006,2007 Atsuhiko Yamanaka, JCraft, Inc.

    import sftp.*;
    
    Sftp sftp;
    
    void setup() {
      size(200,200);
      background(0);
      // Create the SFTP object
      // if 3rd arg = false, you must set the password in your code
      // if 3rd arg = true, you will be prompted to enter your password
      sftp = new Sftp("www.hostname.com","login", true);
      // sftp.setPassword("XXXXXX");
      sftp.start(); // start the thread
      noLoop();
    }
    
    void mousePressed() {
      // At any point you can execute an SFTP command
      // Not all commands are currently implemented
      // but you do have "ls" and "get"
      // Gosh, I should implement "put", sorry!
      sftp.executeCommand("ls");
      sftp.executeCommand("get file.txt");
    }
    

    My 2002 (my goodness, that’s 5 years ago!) piece Swarm is part of Right click - Open source new art media exhibition at the Kapok gallery in Hong Kong. Swarm uses an implementation of Craig Reynolds’ flocking algorithm and the Processing source is available in my nature of code tutorials. The show also includes Josh Minor’s wonderfully addictive Video Pong.

    I miss Hong Kong!

    I’m working on an interactive kiosk for the Toronto Airport, part of Terminal Zero One. Two early sketches:

    download

    download

    ITP in the NY Times

    “Tradition being what it is, even organizations that pine for new ideas struggle with how to change their cultures to support them. The Interactive Telecommunications Program at New York University provides a longstanding example of why they should keep trying.”

    Read the article here. If you are in the NYC area, drop by and check out the the Spring Show!