<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>blprnt.blg &#187; Processing</title>
	<atom:link href="http://blog.blprnt.com/topic/Processing/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.blprnt.com</link>
	<description>Jer Thorp &#124; There is an art to evolution...</description>
	<lastBuildDate>Fri, 03 Feb 2012 18:44:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Tutorial: Processing, Javascript, and Data Visualization</title>
		<link>http://blog.blprnt.com/blog/blprnt/tutorial-processing-javascript-and-data-visualization</link>
		<comments>http://blog.blprnt.com/blog/blprnt/tutorial-processing-javascript-and-data-visualization#comments</comments>
		<pubDate>Sat, 03 Sep 2011 02:16:55 +0000</pubDate>
		<dc:creator>Jer</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.blprnt.com/?p=1375</guid>
		<description><![CDATA[[The above graphic is an interactive 3D bar graph. If you can't see it, it's probably because your browser sucks can't render WebGL content. Maybe try Chrome or Firefox?] Ben Fry and Casey Reas, the initiators of the Processing project, announced at the Eyeo Festival that a new version of Processing, Processing 2.0, will be [...]]]></description>
			<content:encoded><![CDATA[<p><script src="http://blprnt.com/js/processing.js"></script> </p>
<div id="pjs" width="500" height="500" style="padding-bottom:20px">
<canvas data-processing-sources="http://blog.blprnt.com/pde/tutorial.pde"></canvas>
</div>
<p><em>[The above graphic is an interactive 3D bar graph. If you can't see it, it's probably because your browser <del>sucks</del> can't render WebGL content. Maybe try <a href="http://www.google.com/chrome">Chrome</a> or <a href="http://www.mozilla.org/en-US/firefox/new/">Firefox</a>?]</em></p>
<p><a href="http://fathom.cc/">Ben Fry</a> and <a href="http://reas.com/">Casey Reas</a>, the initiators of the <a href="http://processing.org">Processing project</a>, announced at the <a href="http://eyeofestival.com">Eyeo Festival</a> that a n<a href="http://vimeo.com/28117873">ew version of Processing, Processing 2.0, will be released in the fall (VIDEO)</a>. This 2.0 release brings a lot of really exciting changes, including vastly improved 3D performance, and a brand-new high-performance video library. Perhaps most interesting is the addition of publishing modes &#8211; Processing sketches can now be published to other formats other than the standard Java applet. The mode that is going to cause the most buzz around the interweb is Javascript mode: yes, Processing sketches can now be published, with one click, to render in pretty much any web browser. This is very exciting news for those of us who use Processing for data visualization &#8211; it means that our sketches can reach a much broader audience, and that the visual power of Processing can be combined with the interactive power of Javascript.</p>
<p>While preview releases of Processing 2.0 will be available for download very soon, you don&#8217;t have to wait to experiment with Processing and Javascript. The upcoming JS mode comes thanks to the team behind <a href="http://processingjs.org">Processing.js</a>, and we can use it to build sketches for the browser right now.</p>
<p>To get started, you can <a href="http://blprnt.com/tutorials/PJStutorial.zip">download this sample file</a>. When you unzip the file, you&#8217;ll see a directory with three files &#8211; the index.html page, processing.js, and our sketch file, called tutorial.pde. If you open the sketch file in a text editor, you&#8217;ll see something like this:</p>
<pre class="brush: java; title: ; notranslate">
void setup() {
  //instructions in here happen once when the sketch is run
  size(500,500);
  background(0);
}

void draw() {
  //instructions in here happen over and over again
}
</pre>
<p>If you&#8217;re a Processing user, you&#8217;ll be familiar with the setup and draw enclosures. If you&#8217;re not, the notes inside of each one explain what&#8217;s going on: when we run the sketch, the size is set to 500px by 500px, and the background is set to black. Nothing is happening (yet) in the draw enclosure.</p>
<p>You can see this incredibly boring sketch run if you open the index.html file in your browser (this will work in Firefox and Safari, but not in Chrome due to security settings). </p>
<p>Processing.js is a fully-featured port of Processing &#8211; all of the things that you&#8217;d expect to be able to do in Processing without importing extra libraries can be done in Processing.js. Which, quite frankly, is amazing! This means that many of your existing sketches will run, with no changes, in the browser.</p>
<p>Since this is a data visualization tutorial, let&#8217;s look at a simple representation of numbers. To keep it simple, we&#8217;ll start with a set of numbers: 13.4, 14.5, 15.0, 23.2, 30.9, 31.3, 32.9 35.1, 34.3. (These numbers are obesity percentages in the U.S. population, between the 1960s and the present &#8211; but we&#8217;re really going to use them without context).</p>
<p>Typically, if we were to put these numbers into a Processing sketch, we&#8217;d construct an array of floating point numbers (numbers with a decimal place), which would look like this:</p>
<pre class="brush: java; title: ; notranslate">
float[] myNumbers = {13.4, 14.5, 15.0, 23.2, 30.9, 31.3, 32.9, 35.1, 34.3};
</pre>
<p>However, we&#8217;re not in Java-land anymore, so we can make use of Javascript&#8217;s easier syntax (one of the truly awesome things about Processing.js is that we can include JS in our sketches, inline):</p>
<pre class="brush: java; title: ; notranslate">
var numbers = [13.4, 14.5, 15.0, 23.2, 30.9, 31.3, 32.9, 35.1, 34.3];
</pre>
<p>Our .pde file, then, looks like this:</p>
<pre class="brush: java; title: ; notranslate">

var numbers = [13.4, 14.5, 15.0, 23.2, 30.9, 31.3, 32.9, 35.1, 34.3];

void setup() {
  //instructions in here happen once when the sketch is run
  size(500,500);
  background(0);
}

void draw() {
  //instructions in here happen over and over again
}
</pre>
<p>Now that we have our helpful list of numbers (called, cleverly, &#8216;numbers&#8217;), we can access any of the numbers using its <em>index</em>. Indexes in Processing (and Javascript) are zero-based, so to get the first number out of the list, we&#8217;d use numbers[0]. To get the fourth one, we&#8217;d use numbers[3]. Let&#8217;s use those two numbers to start doing some very (very) simple visualization. Indeed, the first thing we&#8217;ll do is to draw a couple of lines:</p>
<pre class="brush: java; title: ; notranslate">
var numbers = [13.4, 14.5, 15.0, 23.2, 30.9, 31.3, 32.9, 35.1, 34.3];

void setup() {
  //instructions in here happen once when the sketch is run
  size(500,500);
  background(0);

  //Draw two lines
  stroke(255);
  line(0, 50, numbers[0], 50);
  line(0, 100, numbers[4], 100);
}

void draw() {
  //instructions in here happen over and over again
}
</pre>
<p><a href="http://blog.blprnt.com/blog/blprnt/tutorial-processing-javascript-and-data-visualization/screen-shot-2011-09-02-at-8-23-32-pm" rel="attachment wp-att-1378"><img src="http://blog.blprnt.com/wp-content/uploads/2011/09/Screen-shot-2011-09-02-at-8.23.32-PM-500x498.png" alt="" title="Screen shot 2011-09-02 at 8.23.32 PM" width="500" height="498" class="alignnone size-medium wp-image-1378" /></a></p>
<p>OK. I&#8217;ll admit. That&#8217;s a pretty crappy sketch. But, we can build on it. Let&#8217;s start by making those lines into rectangles:</p>
<pre class="brush: java; title: ; notranslate">
var numbers = [13.4, 14.5, 15.0, 23.2, 30.9, 31.3, 32.9, 35.1, 34.3];

void setup() {
  //instructions in here happen once when the sketch is run
  size(500,500);
  background(0);

  //Draw two lines
  stroke(255);
  rect(0, 50, numbers[0], 20);
  rect(0, 100, numbers[4], 20);
}

void draw() {
  //instructions in here happen over and over again
}
</pre>
<p>At this point, I&#8217;m going to introduce my very best Processing friend, <a href="http://processing.org/reference/map_.html">the map() function</a>. What the map() function allows us to do is to adjust a number that exists in a certain range so that it fits into a new range. A good real-world example of this would be converting a number (0.5) that exists in a range between 0 and 1 into a percentage:</p>
<pre class="brush: java; title: ; notranslate">
50 = map(0.5, 0, 1, 0, 100);
</pre>
<p>We can take any number inside any range, and map it to a new range. Here are a few more easy examples:</p>
<pre class="brush: java; title: ; notranslate">
500 = map(5, 0, 10, 0, 1000);
0.25 = map(4, 0, 16, 0, 1);
PI = map(180, 0, 360, 0, 2 * PI);
</pre>
<p>In our sketch, the list of numbers that we&#8217;re using ranges from 13.4 to 34.3. This means that our rectangles are pretty short, sitting in the 500 pixel-wide sketch. So, let&#8217;s map those numbers to fit onto the width of our screen (minus 50 pixels as for a buffer):</p>
<pre class="brush: java; title: ; notranslate">
var numbers = [13.4, 14.5, 15.0, 23.2, 30.9, 31.3, 32.9, 35.1, 34.3];

void setup() {
  //instructions in here happen once when the sketch is run
  size(500,500);
  background(0);

  //Draw two rectangles
  rect(0, 50, map(numbers[0], 0, 34.3, 0, width - 50), 20);
  rect(0, 100, map(numbers[4], 0, 34.3, 0, width - 50),  20);
}

void draw() {
  //instructions in here happen over and over again
}
</pre>
<p>Two bars! Wee-hoo! Now, let&#8217;s use a simple loop to get all of our numbers on the screen (this time we&#8217;ll use the max() function to find the biggest number in our list):</p>
<pre class="brush: java; title: ; notranslate">
var numbers = [13.4, 14.5, 15.0, 23.2, 30.9, 31.3, 32.9, 35.1, 34.3];

void setup() {
  //instructions in here happen once when the sketch is run
  size(500,500);
  background(0);

  for (var i = 0; i &lt; numbers.length; i++) {
    //calculate the width of the bar by mapping the number to the width of the screen minus 50 pixels
    var w = map(numbers[i], 0, max(numbers), 0, width - 50);
    rect(0, i * 25, w, 20);
  }
}

void draw() {
  //instructions in here happen over and over again
}
</pre>
<p><a href="http://blog.blprnt.com/blog/blprnt/tutorial-processing-javascript-and-data-visualization/screen-shot-2011-09-02-at-8-40-04-pm" rel="attachment wp-att-1379"><img src="http://blog.blprnt.com/wp-content/uploads/2011/09/Screen-shot-2011-09-02-at-8.40.04-PM-500x498.png" alt="" title="Screen shot 2011-09-02 at 8.40.04 PM" width="500" height="498" class="alignnone size-medium wp-image-1379" /></a></p>
<p>We&#8217;re still firmly in Microsoft Excel territory, but we can use some of Processing&#8217;s excellent visual programming features to make this graph more interesting. For starters, let&#8217;s change the colours of the bars. Using the map() function again, we&#8217;ll colour the bars from red (for the smallest number) to yellow (for the biggest number):</p>
<pre class="brush: java; title: ; notranslate">
var numbers = [13.4, 14.5, 15.0, 23.2, 30.9, 31.3, 32.9, 35.1, 34.3];

void setup() {
  //instructions in here happen once when the sketch is run
  size(500,500);
  background(0);

  for (var i = 0; i &lt; numbers.length; i++) {
    //calculate the amount of green in the colour by mapping the number to 255 (255 red &amp;amp; 255 green = yellow)
    var c = map(numbers[i], min(numbers), max(numbers), 0, 255);
    fill(255, c, 0);
    //calculate the width of the bar by mapping the number to the width of the screen minus 50 pixels
    var w = map(numbers[i], 0, max(numbers), 0, width - 50);
  	rect(0, i * 25, w, 20);
  }
}

void draw() {
  //instructions in here happen over and over again
}
</pre>
<p><a href="http://blog.blprnt.com/blog/blprnt/tutorial-processing-javascript-and-data-visualization/screen-shot-2011-09-02-at-8-39-38-pm" rel="attachment wp-att-1380"><img src="http://blog.blprnt.com/wp-content/uploads/2011/09/Screen-shot-2011-09-02-at-8.39.38-PM-500x500.png" alt="" title="Screen shot 2011-09-02 at 8.39.38 PM" width="500" height="500" class="alignnone size-medium wp-image-1380" /></a></p>
<p>This process of mapping a number to be represented by a certain dimension (in this case, the width of the bars along with the colour) is the basic premise behind data visualization in Processing. Using this simple framework, we can map to a whole variety of dimensions, including size, position, rotation, and transparency. </p>
<p>As an example, here is the same system we saw above, rendered as a radial graph (note here that I&#8217;ve added a line before the loop that moves the drawing point to the centre of the screen; I&#8217;ve also changed the width of the bars to fit in the screen):</p>
<pre class="brush: java; title: ; notranslate">
var numbers = [13.4, 14.5, 15.0, 23.2, 30.9, 31.3, 32.9, 35.1, 34.3];

void setup() {
  //instructions in here happen once when the sketch is run
  size(500,500);
  background(0);

  //move to the center of the sketch before we draw our graph
  translate(width/2, height/2);
  for (var i = 0; i &lt; numbers.length; i++) {
    //calculate the amount of green in the colour by mapping the number to 255 (255 red &amp;amp; 255 green = yellow)
    var c = map(numbers[i], min(numbers), max(numbers), 0, 255);
    fill(255, c, 0);
    //calculate the width of the bar by mapping the number to the half the width of the screen minus 50 pixels
    var w = map(numbers[i], 0, max(numbers), 0, width/2 - 50);
  	rect(0, 0, w, 20);
  	//after we draw each bar, turn the sketch a bit
  	rotate(TWO_PI/numbers.length);
  }
}

void draw() {
  //instructions in here happen over and over again
}
</pre>
<p><a href="http://blog.blprnt.com/blog/blprnt/tutorial-processing-javascript-and-data-visualization/screen-shot-2011-09-02-at-8-48-30-pm" rel="attachment wp-att-1381"><img src="http://blog.blprnt.com/wp-content/uploads/2011/09/Screen-shot-2011-09-02-at-8.48.30-PM-500x498.png" alt="" title="Screen shot 2011-09-02 at 8.48.30 PM" width="500" height="498" class="alignnone size-medium wp-image-1381" /></a></p>
<p>So far we&#8217;ve been keeping things very simple. But the possibilities using Processing and Javascript are really exciting. It&#8217;s very easy to add interactivity, and it&#8217;s even possible to take advantage of Processing&#8217;s 3D functionality <strong>in the browser</strong>. </p>
<p>Here&#8217;s our numbers again, rendered in 3D (note the change to the size() function), with the rotation controlled by the mouse (via our new friend the map() function):</p>
<pre class="brush: java; title: ; notranslate">
var numbers = [13.4, 14.5, 15.0, 23.2, 30.9, 31.3, 32.9, 35.1, 34.3];

void setup() {
  //instructions in here happen once when the sketch is run
  size(500,500,P3D);
  background(0);

}

void draw() {
  //instructions in here happen over and over again
  background(0);
  //turn on the lights so that we see shading on the 3D objects
  lights();
  //move to the center of the sketch before we draw our graph
  translate(width/2, height/2);
  //Tilt about 70 degrees on the X axis - like tilting a frame on the wall so that it's on a table
  rotateX(1.2);
  //Now, spin around the Z axis as the mouse moves. Like spinning that frame on the table around its center
  rotateZ(map(mouseX, 0, width, 0, TWO_PI));
  for (var i = 0; i &lt; numbers.length; i++) {
    //calculate the amount of green in the colour by mapping the number to 255 (255 red &amp;amp; 255 green = yellow)
    var c = map(numbers[i], min(numbers), max(numbers), 0, 255);
    fill(255, c, 0);
    //calculate the height of the bar by mapping the number to the half the width of the screen minus 50 pixels
    var w = map(numbers[i], 0, max(numbers), 0, width/2 - 50);
    //move out 200 pixels from the center
  	pushMatrix();
  		translate(200, 0);
  		box(20,20,w);
  	popMatrix();
  	//after we draw each bar, turn the sketch a bit
  	rotate(TWO_PI/numbers.length);
  }
}
</pre>
<p>Thirty lines of code, and we have an interactive, 3D data visualization (you can see this sketch running inline in the header). Now, I understand that this isn&#8217;t the best use of 3D, and that we&#8217;re only visualizing a basic dataset, but the point here is to start to imagine the possibilities of using Processing with Javascript in the browser. </p>
<p>For starters, Javascript lets us <em>very</em> easily import data from any JSON source with no parsing whatsoever &#8211; this means we can create interactive graphics that load dynamic data on the fly (more on this in the next tutorial). On top of that, because we can write Javascript inline with our Processing code, and we can integrate external Javascript functions and libraries (lie JQuery) to our sketches, we can incorporate all kinds of advanced interactivity. </p>
<p>I suspect that the release of Processing 2.0 will lead to a burst of Javascript-based visualization projects being released on the web. In the meantime, we can use the basic template from this tutorial to work with Processing.js &#8211; have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blprnt.com/blog/blprnt/tutorial-processing-javascript-and-data-visualization/feed</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>All The Names: Algorithmic Design and the 9/11 Memorial</title>
		<link>http://blog.blprnt.com/blog/blprnt/all-the-names</link>
		<comments>http://blog.blprnt.com/blog/blprnt/all-the-names#comments</comments>
		<pubDate>Fri, 10 Jun 2011 09:40:31 +0000</pubDate>
		<dc:creator>Jer</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Project]]></category>
		<category><![CDATA[9/11]]></category>
		<category><![CDATA[Algorithm]]></category>
		<category><![CDATA[Computer Assisted Design]]></category>
		<category><![CDATA[New York]]></category>
		<category><![CDATA[World Trade Center]]></category>

		<guid isPermaLink="false">http://blog.blprnt.com/?p=1272</guid>
		<description><![CDATA[In late October, 2009, I received an e-mail from Jake Barton from Local Projects, titled plainly &#8216;Potential Freelance Job&#8217;. I read the e-mail, and responded with a reply in two parts: First, I would love to work on the project. Second, I wasn&#8217;t sure that it could be done. The project was to design an algorithm [...]]]></description>
			<content:encoded><![CDATA[<div>
<p><a rel="attachment wp-att-1277" href="http://blog.blprnt.com/blog/blprnt/all-the-names/picture-2-3"><img title="Picture 2" src="http://blog.blprnt.com/wp-content/uploads/2011/03/Picture-2-500x320.png" alt="" width="500" height="320" /></a></p>
<p>In late October, 2009, I received an e-mail from Jake Barton from <a href="http://localprojects.net/">Local Projects</a>, titled plainly &#8216;Potential Freelance Job&#8217;. I read the e-mail, and responded with a reply in two parts: First, I would love to work on the project. Second, I wasn&#8217;t sure that it could be done.</p>
<p>The project was to design an algorithm for placement of names on the 9/11 memorial in New York City. In architect <a href="http://en.wikipedia.org/wiki/Michael_Arad">Michael Arad</a>&#8216;s vision for the memorial, the names were to be laid according to where people were and who they were with when they died &#8211; not alphabetical, nor placed in a grid. Inscribed in bronze parapets, almost three thousand names would stream seamlessly around the memorial pools. Underneath this river of names, though, an arrangement would provide a meaningful framework; one which allows the names of family and friends to exist together. Victims would be linked through what Arad terms &#8216;meaningful adjacencies&#8217; &#8211; connections that would reflect friendships, family bonds, and <a href="http://www.fastcodesign.com/1663780/at-911-memorial-name-placements-reflect-bonds-between-victims-thanks-to-algorithm">acts of heroism</a>. through these connections, the memorial becomes a permanent embodiment of not only the many individual victims, but also of the relationships that were part of their lives before those tragic events.</p>
<p>Over several years, staff at the 9/11 Memorial Foundation undertook the painstaking process of collecting adjacency requests from the next of kin of the victims, creating a massive database of requested linkages. Often, several requests were made for each victim. There were more than one thousand adjacency requests in total, a complicated system of connections that all had to be addressed in the final arrangement. In mathematical terms, finding a layout that satisfied as many of these adjacency requests as possible is an optimization problem &#8211; a problem of finding the best solution among a myriad of possible ones. To solve this problem and to produce a layout that would give the Memorial Designers a structure to base their final arrangement of the names upon, we built a software tool in two parts: First, an arrangement algorithm that optimized this adjacency problem to find the best possible solution. And second, an interactive tool that allowed for human adjustment of the computer-generated layout.</p>
<p><strong>The Algorithm</strong></p>
<p>The solution for producing a solved layout for the names arrangement sat at the bottom of a precariously balanced stack of complex requirements.</p>
<p>First, there was the basic spatial problem &#8211; the names for each pool had to fit, evenly, into a set of 76 panels (18 panels per side plus one corner). 12 of these panels were irregularly shaped (the corners and the panels adjacent to the corners, as seen in the image at the top of this post). Because the names were to appear in one continuous flowing group around each pool, some names had to overlap between panels, crossing a thin, invisible expansion joint between the metal plates. This expansion joint was small enough it would fit in the space between many of the first and last names (or middle initials), but with certain combinations of letterforms (for example, a last name starting with a J, or a first name ending with a y), names were unable to cross this gap. As a result, the algorithm had to consider the typography of each name as it was placed into the layout.</p>
<p>Of course, the most challenging problem was to place the names within the panels while satisfying as many of the requested adjacencies as possible. There were more than 1200 adjacency requests that needed to be addressed. One of the first things that I did was to get an idea of how complex this network of relations was by building some radial maps:</p>
<p><a rel="attachment wp-att-1345" href="http://blog.blprnt.com/blog/blprnt/all-the-names/wtc_11_27__20_54_56"><img class="alignnone size-medium wp-image-1345" title="WTC_11_27__20_54_56" src="http://blog.blprnt.com/wp-content/uploads/2011/05/WTC_11_27__20_54_56-500x285.png" alt="" width="500" height="285" /></a></p>
<p>Clearly, there was a dense set of relations that needed to be considered. On top of that, the algorithm needed to be aware of the physical form of each of the names, since longer names could offer more space for adjacency than smaller ones. Because each person could have more than one adjacency request, there were groups of victims who were linked together into large clusters of relationship &#8211; the largest one of these contained more than 70 names. Here is a map of the adjacency clusters within one of the major groupings:</p>
<p><a rel="attachment wp-att-1344" href="http://blog.blprnt.com/blog/blprnt/all-the-names/adjacencymap_grouping1"><img class="alignnone size-medium wp-image-1344" title="AdjacencyMap_Grouping1" src="http://blog.blprnt.com/wp-content/uploads/2011/05/AdjacencyMap_Grouping1-500x285.png" alt="" width="500" height="285" /></a></p>
<p>On top of these crucial links between victim names, there were a set of larger groupings in which the names were required to be placed: affiliations (usually companies), and sub-affiliations (usually departments within companies). To complicate matters, many of the adjacency requests linked people in different affiliations and subaffiliations, so the ordering of these groupings had to be calculated in order to satisfy both the adjacency requests and the higher-level relationships.</p>
<p>At some point I plan on detailing the inner workings of the algorithm (built in <a href="http://www.processing.org">Processing</a>). For the time being, I&#8217;ll say that the total process is in fact a combination of several smaller routines: first, a clustering routine to make discrete sets of names in which the adjacency requests are satisfied. Second, a space filling process which places the clusters into the panels and fills available space with names from the appropriate groupings. Finally, there is a placement routine which manages the cross-panel names, and adjusts spacing within and between panels.</p>
<p>The end result from the algorithm is a layout which completes as many of the adjacency requests as completely as possible. With this system, we were able to produce layouts which satisfied more than 98% of the requested adjacencies.</p>
<p><strong>The Tool</strong></p>
<p>Early on in the project, it became clear that the final layout for the names arrangement would not come directly from the algorithm. While the computerized system was able to solve the logistical problems underlying the arrangement, it was not as good at addressing the myriad of aesthetic concerns. The final layout had to be reviewed by hand &#8211; the architects needed to be able to meticulously adjust spacing and placement so that the final layout would be precisely as they wanted it. With this in mind, we built a custom software tool which allowed the memorial team to make custom changes to the layout, while still keeping track of all of the adjacencies.</p>
<p><a rel="attachment wp-att-1333" href="http://blog.blprnt.com/blog/blprnt/all-the-names/wtc_full"><img title="WTC_Full" src="http://blog.blprnt.com/wp-content/uploads/2011/05/WTC_Full-500x314.png" alt="" width="500" height="314" /></a></p>
<p>The tool, again built in <a href="http://www.processing.org">Processing</a>, allowed users to view the layouts in different modes, easily move names within and between panels, get overall statistics about adjacency fulfillment, and export SVG versions of the entire system for micro-level adjustments in Adobe Illustrator. In the image above, we see an early layout for the South Pool. The colouring here represents two levels of grouping within the names. Main colour blocks represent affiliations, while shading within those colour blocks represents sub-affiliations. Below, we see a close-up view of a single panel, with several names placed in the &#8216;drawer&#8217; below. Names can be placed in that space when they need to be moved from one panel to another. Note that adjacency indications remain active while the names are in the drawer.</p>
<p><a rel="attachment wp-att-1332" href="http://blog.blprnt.com/blog/blprnt/all-the-names/wtc_drawer3"><img title="WTC_Drawer3" src="http://blog.blprnt.com/wp-content/uploads/2011/05/WTC_Drawer3-500x314.png" alt="" width="500" height="314" /></a></p>
<p>Other features were built in to make the process of finalizing the layout as easy as possible: users could search for individual names, as well as affiliations and sub-affiliations; a change-tracking system allowed users to see how a layout had changed over multiple saved versions, and a variety of interface options allowed for precise placement of names within panels. Here is a video of the tool in use, again using a preliminary layout for the South Pool:</p>
<p><iframe src="http://player.vimeo.com/video/23444105?title=0&amp;byline=0&amp;portrait=0" width="550" height="330" frameborder="0"></iframe></p>
<p><strong> Computer Assisted Design</strong></p>
<p>It would be misleading to say that the layout for the final memorial was produced by an algorithm. Rather, the underlying framework of the arrangement was solved by the algorithm, and humans used that framework to design the final result. This is, I think, a perfect example of something that I&#8217;ve believed in for a long time: we should let computers do what computers do best, and let humans do what humans do best. In this case, the computer was able to evaluate millions of possible solutions for the layout, manage a complex relational system, and track a large set of important variables and measurements. Humans, on the other hand, could focus on aesthetic and compositional choices. It would have been very hard (or impossible) for humans to do what the computer did. At the same time, it would have been very difficult to program the computer to handle the tasks that were completed with such dedication and precision by the architects and the memorial team.</p>
<p><strong>The Weight of Data</strong></p>
<p>This post has been a technical documentation of a very challenging project. Of course, on a emotional level, the project was also incredibly demanding. I was very aware throughout the process that the names that I was working with were the names of fathers and sons, mothers, daughters, best friends, and lovers.</p>
<p>Lawrence Davidson. Theresa Munson. Muhammadou Jawara. Nobuhiro Hayatsu. Hernando Salas. Mary Trentini.</p>
<p>In the days and months that I worked on the arrangement algorithm and the placement tool, I found myself frequently speaking these names out loud. Though I didn&#8217;t personally know anyone who was killed that day, I would come to feel a connection to each of them.</p>
<p>This project was a very real reminder that information carries weight. While names of the dead may be the heaviest data of all, almost every number or word we work with bears some link to a significant piece of the real world. It&#8217;s easy to download a data set &#8211; <a href="http://2010.census.gov/2010census/data/">census information</a>, <a href="http://earthquake.usgs.gov/regional/neic/">earthquake records</a>, <a href="http://www.guardian.co.uk/news/datablog/2011/jun/09/homelessness-england-data">homelessness figures </a>- and forget that the numbers represent real lives. As designers, artists, and researchers, we always need to consider the true source of data, and the moral responsibility which they carry.</p>
<p>Ultimately, my role in the construction of the memorial was a small, and largely invisible one. Rightly, visitors to the site will never know that an algorithm assisted in its design. Still, it is rewarding to think that my work with Local Projects has helped to add meaning to such an important monument.</p>
<p><a href="http://911memorial.org">The 9/11 Memorial</a> will be dedicated on September 11, 2011 and opens to the public with the reservation of a visitor pass on September 12th.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.blprnt.com/blog/blprnt/all-the-names/feed</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>Text Comparison Tool: SOURCE CODE</title>
		<link>http://blog.blprnt.com/blog/blprnt/text-comparison-tool-source-code</link>
		<comments>http://blog.blprnt.com/blog/blprnt/text-comparison-tool-source-code#comments</comments>
		<pubDate>Wed, 17 Nov 2010 23:57:58 +0000</pubDate>
		<dc:creator>Jer</dc:creator>
				<category><![CDATA[Information Visualization]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[text analysis]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://blog.blprnt.com/?p=1214</guid>
		<description><![CDATA[About this time last year, I built a light-weight tool in Processing to compare two articles that I read about head injuries in the NFL. Later, I extended the tool to compare any two texts, and promised a source release. Well, it only took 12 months, but I&#8217;ve finally cleaned up the code to a [...]]]></description>
			<content:encoded><![CDATA[<p>About this time last year, I built a light-weight tool in <a href="http://www.processing.org">Processing</a> to compare two articles that I read about <a href="http://blog.blprnt.com/blog/blprnt/two-sides-of-the-same-story-laskas-gladwell-on-cte-the-nfl">head injuries in the NFL</a>. Later, I extended the tool to <a href="http://blog.blprnt.com/blog/blprnt/tokyo-cairo-comparing-obamas-foreign-policy-speeches">compare any two texts</a>, and promised a source release.</p>
<p>Well, it only took 12 months, but I&#8217;ve finally cleaned up the code to a point where I think it will be reasonably easy to use and helpful for those who might want to learn a bit more about the code.</p>
<p>I always find myself in a tricky position with source releases. Often, as in the case of this tool, I have ideas about what the project should look like before it gets released. Here, I wanted to build an interface to allow people to select different text sources within the app, so that people could use the app without having to compile it from Processing. This is what delayed the release of the code for a year &#8211; I was waiting for the time to get this last piece done.</p>
<p>Two weeks ago, though, I has a chance to speak at an event with Tahir Hemphill. I had sent Tahir a messy version of the project for use with his <a href="http://staplecrops.com/index.php/hiphop_wordcount/">Hip Hop Word Count</a> initiative a few months back, and he used it to analyze a famous rap battle between Nas and Jay-Z:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="225" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=16296054&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed type="application/x-shockwave-flash" width="400" height="225" src="http://vimeo.com/moogaloop.swf?clip_id=16296054&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><a href="http://vimeo.com/16296054">Text Correlation Tool: Nas Versus Jay / Ether Versus The Takeover</a> from <a href="http://vimeo.com/user3482749">Staple Crops</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>This reminded me of a fairly valuable lesson as far as source code is concerned: <strong>If it works, it&#8217;s probably good enough to release.</strong></p>
<p>So, without too much further ado, here&#8217;s a link to download the Text Comparison Tool:</p>
<p><a href="http://www.blprnt.com/source/TextComparison.zip">Text Comparison Tool (1.1MB)</a></p>
<p>It&#8217;s pretty easy to use. First, you&#8217;ll need <a href="http://processing.org/download">Processing</a> to open and work with the sketch. Also, you&#8217;ll need the <a href="http://toxiclibs.org/downloads">toxiclibs</a> core library installed. Assuming you have those two things, these are the steps:</p>
<p><strong>1.</strong> Drag the unzipped folder into your sketchbook.<br />
<strong> 2.</strong> Place your text files in the sketch&#8217;s data folder.<br />
<strong>3.</strong> Open the sketch.<br />
<strong>4.</strong> Look for the code block at the top of the main tab where the article information is set. It&#8217;s pretty clearly marked, and looks like this:</p>
<pre class="brush: java; title: ; notranslate">
String title1 = &quot;Tokyo&quot;;
String url1 = &quot;asia.txt&quot;;
String desc1 = &quot;Suntory Hall&quot;;
String date1 = &quot;November 14th, 2009&quot;;
color color1 = #140047;

String title2 = &quot;Cairo&quot;;
String url2 = &quot;cairo.txt&quot;;
String desc2 = &quot;Cairo University&quot;;
String date2 = &quot;June 4th, 2009&quot;;
color color2 = #680014;
</pre>
<p><strong>5.</strong> Replace the information here with appropriate information for your files.<br />
<strong>6.</strong> Run the sketch!</p>
<p>That&#8217;s it. If you are getting strange results, you can tweak the clean() and cleanBody() methods at the bottom of the main tab to control how your text is filtered.</p>
<p>Hopefully I&#8217;ll still find the time to package this thing up in a bit more of a user-friendly form. But, in the meantime, hopefully people will find this useful as an exploratory tool. Note that at any time you can press the &#8216;s&#8217; key to save out an image &#8211; if you find some interesting texts to compare, let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blprnt.com/blog/blprnt/text-comparison-tool-source-code/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Processing Tip: Rendering Large Amounts of Text&#8230; Fast!</title>
		<link>http://blog.blprnt.com/blog/blprnt/processing-tip-rendering-large-amounts-of-text-fast</link>
		<comments>http://blog.blprnt.com/blog/blprnt/processing-tip-rendering-large-amounts-of-text-fast#comments</comments>
		<pubDate>Sun, 14 Nov 2010 21:54:22 +0000</pubDate>
		<dc:creator>Jer</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Andres Colubri]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[processing.org]]></category>
		<category><![CDATA[technique]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://blog.blprnt.com/?p=1206</guid>
		<description><![CDATA[I&#8217;ve been working on a project at the New York Times R&#38;D Lab which involves rendering a fair amount of text to screen, which needs to be animated smoothly in real time. I&#8217;ve never had much luck working with large amounts of text in Processing, using the traditional approach. But I&#8217;ve found a nice way [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-1207" href="http://blog.blprnt.com/blog/blprnt/processing-tip-rendering-large-amounts-of-text-fast/lots"><img class="alignnone size-medium wp-image-1207" title="lots" src="http://blog.blprnt.com/wp-content/uploads/2010/11/lots-500x281.png" alt="" width="500" height="281" /></a></p>
<p>I&#8217;ve been working on a project at the New York Times R&amp;D Lab which involves rendering a fair amount of text to screen, which needs to be animated smoothly in real time. I&#8217;ve never had much luck working with large amounts of text in <a href="http://processing.org">Processing</a>, using the traditional approach. But I&#8217;ve found a nice way using an external library and a old trick, which allows for the rendering of large amounts of text at high framerates (the image above shows 1000+ text blocks running at ~50fps on my two-year-old MacBook).</p>
<p><strong>How does it work?</strong></p>
<p>Well, let&#8217;s first talk about how we&#8217;d typically approach this problem. Because they need to be animated independently, each of the text blocks is a member of a custom Class. Once per frame, we loop through all of the text objects, and ask them to render. In the old-school way, each of these text blocks would render using Processing&#8217;s text() method, and all of the shapes would be drawn to screen. While this works well with limited amounts of text, if we add more text objects to the sketch, things start to slow down at an alarming rate:</p>
<p><a rel="attachment wp-att-1208" href="http://blog.blprnt.com/blog/blprnt/processing-tip-rendering-large-amounts-of-text-fast/some"><img class="alignnone size-medium wp-image-1208" title="some" src="http://blog.blprnt.com/wp-content/uploads/2010/11/some-500x281.png" alt="" width="500" height="281" /></a></p>
<p>Here, I&#8217;ve barely added 200 objects, and the frame rate has crawled down to a measly 10fps. Clearly not good.</p>
<p><strong>Blit it.</strong></p>
<p>The first part of the solution is to use an old-school technique called &#8216;blitting&#8217;. Now, before all of you demo-scene kids get all worked up, I know this isn&#8217;t really blitting, but I like the sound of the word, and it&#8217;s my tutorial, so deal with it. Instead of drawing every letter of every text block every frame, what we&#8217;re going to do is this:</p>
<ol>
<li>Render the text once to an off-screen graphics object</li>
<li>Transfer the pixels from this off-screen object to a PImage</li>
<li>Render that PImage every frame</li>
</ol>
<p>The core reason this works is that Processing is much better at rendering hundreds of images than it is at rendering hundreds of text objects. With this implemented, we can get many, many more objects onto our screen:</p>
<p><a rel="attachment wp-att-1209" href="http://blog.blprnt.com/blog/blprnt/processing-tip-rendering-large-amounts-of-text-fast/more"><img class="alignnone size-medium wp-image-1209" title="more" src="http://blog.blprnt.com/wp-content/uploads/2010/11/more-500x281.png" alt="" width="500" height="281" /></a></p>
<p>Here, we&#8217;ve got about 550 objects on the screen, at full framerate. But, at least on my Mac, this system seems to collapse after about 600 objects. So, how can we get up to the 1000 objects that I showed in the first image in this post?</p>
<p><strong>Let&#8217;s push it a little.</strong></p>
<p>The last step of this process owes its existence to <a href="http://codeanticode.wordpress.com/">Andres Colubri</a>, who has built an excellent library called <a href="http://glgraphics.sourceforge.net/">GLGraphics</a> which lets us do all kinds of things in Processing that get accelerated by the super-fancy graphics cards (GPUs) which most of us are lucky enough to have in our computers (Andres is also responsible for all of the tasty Processing for Android 3D stuff which I&#8217;ll be posting about later this week). In this case, the final step involves rendering all of the text blocks as GL Textures, instead of as PImages (note that this will give you a performance boost in any case where you are using images &#8211; yay!)</p>
<p>Around now you&#8217;re probably asking about the code. Well, here it is. I&#8217;ve tried to make it as simple as possible &#8211; just remember that you need the <a href="http://glgraphics.sourceforge.net/">GLGraphics</a> library installed.</p>
<p><a href="http://www.blprnt.com/source/GLText.zip">GL Text Example</a> (4kb)</p>
<p>This solution isn&#8217;t perfect &#8211; it doesn&#8217;t allow for perfect scaling, or dynamic effects within the text objects. But is does solve the basic problem, and also gives us a set of GLTextures which are ready to be used in whatever wacky 3D system we want to put them in. Let me know how it works for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blprnt.com/blog/blprnt/processing-tip-rendering-large-amounts-of-text-fast/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Processing &amp; Android: Mobile App Development Made (Very) Easy</title>
		<link>http://blog.blprnt.com/blog/blprnt/processing-android-mobile-app-development-made-very-easy</link>
		<comments>http://blog.blprnt.com/blog/blprnt/processing-android-mobile-app-development-made-very-easy#comments</comments>
		<pubDate>Sat, 25 Sep 2010 20:44:55 +0000</pubDate>
		<dc:creator>Jer</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.blprnt.com/?p=1118</guid>
		<description><![CDATA[Those of you who have read this blog before will know that I do most of my work using Processing, an open-source programming language that was specifically created for artists and designers. It&#8217;s easy enough that you can learn the basics a day or two, but powerful enough to use for any number of applications, [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-1159" href="http://blog.blprnt.com/blog/blprnt/processing-android-mobile-app-development-made-very-easy/processindroid2"><img class="alignnone size-medium wp-image-1159" title="ProcessinDroid2" src="http://blog.blprnt.com/wp-content/uploads/2010/09/ProcessinDroid2-500x339.jpg" alt="" width="500" height="339" /></a></p>
<p>Those of you who have read this blog before will know that I do most of my work using <a href="http://www.processing.org">Processing</a>, an open-source programming language that was specifically created for artists and designers. It&#8217;s easy enough that you can learn the basics a day or two, but powerful enough to use for any number of applications, ranging from interactive installations to architecture to generative visual systems, and beyond. I&#8217;ve used it to visualize huge sets of data, to design a 1000 square-metre playground, and to create hundreds of small digital &#8216;sketches&#8217;. Over the last few months, Processing has gained yet another appealing attribute &#8211; you can now use it to quickly and easily create apps for mobile devices that use the <a href="http://en.wikipedia.org/wiki/Android_(operating_system)">Android operating system</a>.</p>
<p>Creating apps for Android with processing is ridiculously easy. How easy? Let&#8217;s get a from-scratch Android app working on a device in 25 minutes (15 of those minutes will be spent installing software).</p>
<p><em>** You don&#8217;t need to have an Android device to do this tutorial, since we can see the app that we&#8217;ll build in a software emulator. But it&#8217;s much cooler if it&#8217;s on a device.<a href="http://www.java.com/en/download/manual.jsp"></a></em></p>
<p><em>** Before you start on this tutorial, I&#8217;d recommend that you make sure you have a recent version of Java installed. Mac users can run Software Update &#8211; Windows folks should <a href="http://www.java.com/en/download/manual.jsp">go here and download the latest Java version.</a></em></p>
<p><strong>Step One: Install the Android SDK</strong></p>
<p>I promise. This isn&#8217;t going to be one of those tutorials that is full of three-letter acronyms that you don&#8217;t understand. But before we get started building our app in Processing, we need to download some software that will allow us to author Android applications (Processing manages all of the tricky bits of this, and will eventually download and install the SDK for you as well &#8211; for now we have to do a tiny bit of manual labour). This bundle of software is called a &#8216;Software Development Kit&#8217; and is fairly easy to get and install.</p>
<p>First, go to the URL below, and download the appropriate SDK for your operating system:</p>
<p><a href="http://developer.android.com/sdk">http://developer.android.com/sdk</a></p>
<p>This download should un-zip to a folder called something like &#8216;android-sdk-mac_x86&#8242;. Move that folder to a safe location on your machine , and then open the &#8216;tools&#8217; directory inside of it. Double-click on the file named &#8216;android&#8217; &#8211; on a Mac this will fire up Terminal and in turn will open the Android SDK and AVD manager, which looks something like this:</p>
<p><a rel="attachment wp-att-1119" href="http://blog.blprnt.com/blog/blprnt/processing-android-mobile-app-development-made-very-easy/picture-1-3"><img class="alignnone size-medium wp-image-1119" title="Picture 1" src="http://blog.blprnt.com/wp-content/uploads/2010/09/Picture-1-500x304.png" alt="" width="500" height="304" /></a></p>
<p>We&#8217;re going to use the manager to install the Android packages that we need to build our apps. Click on the left menu option &#8216;Available Packages&#8217; and check the box that appears in the centre window. The manager will check with the Android repository and then list all of the packages and tools that are available for download:</p>
<p><a rel="attachment wp-att-1123" href="http://blog.blprnt.com/blog/blprnt/processing-android-mobile-app-development-made-very-easy/picture-2-2"><img class="alignnone size-medium wp-image-1123" title="Picture 2" src="http://blog.blprnt.com/wp-content/uploads/2010/09/Picture-2-500x354.png" alt="" width="500" height="354" /></a></p>
<p>We can install all of the packages &#8211; that way we know we&#8217;ll get everything we need. Click &#8216;Install Selected&#8217;. In the next window, click &#8216;Accept All&#8217;, and then &#8216;Install&#8217;. That&#8217;s it! We now have the Android SDK files that we need to work with Processing Android. Now we need to download the latest and greatest version of Processing.</p>
<p><strong>Step Two: Get an Android-enabled Version of Processing</strong></p>
<p>Existing Processing users (unless they&#8217;re a Processing fan(boy/girl)), will probably still have the same version of Processing that they installed when they first learned how to use the software. This will be a good chance, then, for all of you laggers-behind to get with the program. For those of you who don&#8217;t have Processing yet, here&#8217;s your chance to get in on the fun.</p>
<p>Now normally, as a sane person, I&#8217;d ask you to download the rock-solid, tested, official release from the main Processing.org downloads page. But we want to play with some new features here, so we&#8217;ll download the freshest, most exciting, and hopefully functional version of Processing from this secret-squirrel Processing Android Wiki Page:</p>
<p><a href="http://wiki.processing.org/w/Android">http://wiki.processing.org/w/Android</a></p>
<p>Download and install whatever the latest version is for your operating system (at the time of writing, the version number was 0190). Once it&#8217;s installed, open up Processing, and let&#8217;s get Android-ing!</p>
<p><strong>Step Three: Make an Android App</strong></p>
<p>Before we do anything even somewhat complicated, let&#8217;s take the time to learn how Processing Android works. Let&#8217;s start with a really simple sketch, which draws a white square in the middle of an orange field:</p>
<pre class="brush: java; title: ; notranslate">
void setup() {
   size(480,800);

   smooth();
   noStroke();
   fill(255);
   rectMode(CENTER);     //This sets all rectangles to draw from the center point
};

void draw() {
   background(#FF9900);
   rect(width/2, height/2, 150, 150);
};
</pre>
<p><a rel="attachment wp-att-1129" href="http://blog.blprnt.com/blog/blprnt/processing-android-mobile-app-development-made-very-easy/picture-4"><img class="alignnone size-medium wp-image-1129" title="Picture 4" src="http://blog.blprnt.com/wp-content/uploads/2010/09/Picture-4-500x413.png" alt="" width="500" height="413" /></a></p>
<p>If we press the run button (or hit Apple-R), Processing compiles our sketch to run as a temporary Java applet, which we see running in a separate window (go ahead and try this). This is the basic Processing behaviour. I have a few other options for compiling my little sketch. I could select &#8216;Sketch &gt; Present&#8217; from the menubar to present the sketch in fullscreen, I could select &#8216;File &gt; Export&#8217; to compile my sketch as a Java applet to display in the browser, or I could select &#8216;File &gt; Export Application&#8217; to produce a stand-alone file to launch like a &#8216;real&#8217; application. These three basic options for compiling (run, present, export) have slightly different functions in Android Mode.</p>
<p>Wait. What? Android Mode? Here we discover the genius of our new, super Processing &#8211; we can build sketches the same way that we are normally used to, then switch into Android Mode to preview and publish our droidified sketches. Let&#8217;s do that with our simple rectangle sketch.</p>
<p>From the shiny new &#8216;Android&#8217; menubar heading, select Android mode. Let&#8217;s first see what the sketch looks like in the emulator, by pressing the run button:</p>
<p><a rel="attachment wp-att-1130" href="http://blog.blprnt.com/blog/blprnt/processing-android-mobile-app-development-made-very-easy/picture-5-3"><img class="alignnone size-medium wp-image-1130" title="Picture 5" src="http://blog.blprnt.com/wp-content/uploads/2010/09/Picture-5-500x463.png" alt="" width="500" height="463" /></a></p>
<p><em>* The first time you try this you might get an error message telling you that the Android SDK hasn&#8217;t been installed. Press &#8216;yes&#8217; and locate the Android SDK folder that you downloaded in Step One. Then run the sketch again.</em></p>
<p><em> </em></p>
<p><em>** Be patient! The emulator can take a while to get started. You might have to run the sketch again one the desktop appears in the emulator.<br />
</em></p>
<p>Exciting, right? Right?</p>
<p>OK. Maybe not. It&#8217;s just a white square. But&#8230; let&#8217;s make it a white square <em>on an Android Device!!</em></p>
<p><strong>Step Four: Running the App on a Device</strong></p>
<p><strong>Very Important: To get the app running on your device, you&#8217;ll first have to make sure that USB debugging is turned on. You can do this from the Settings&gt;Applications&gt;development menu on your device. If you&#8217;re on Windows, you might have to do <a href="http://developer.android.com/guide/developing/device.html">some other setup, too</a></strong><strong>.</strong></p>
<p>Connect your Android device, and then select &#8216;Sketch&gt;Present&#8217; from the menubar (or, press Shit-Apple-R).</p>
<p><a rel="attachment wp-att-1141" href="http://blog.blprnt.com/blog/blprnt/processing-android-mobile-app-development-made-very-easy/p5androidsimple"><img class="alignnone size-medium wp-image-1141" title="P5AndroidSimple" src="http://blog.blprnt.com/wp-content/uploads/2010/09/P5AndroidSimple-500x375.jpg" alt="" width="500" height="375" /></a></p>
<p>Yahoo!</p>
<p>Now that we know that everything is working, let&#8217;s add a little bit of interactivity. We&#8217;ll make the box rotate as we slide our finger left to right, and make the background color change as we move our finger up and down. We&#8217;ll also add a little ball-and-stick indicator to show where the &#8216;mouse&#8217; is:</p>
<pre class="brush: java; title: ; notranslate">
/*

World's simplest Android App!
blprnt@blprnt.com
Sept 25, 2010

*/

//Build a container to hold the current rotation of the box
float boxRotation = 0;

void setup() {
  //Set the size of the screen (this is not really necessary in Android mode, but we'll do it anyway)
  size(480,800);
  //Turn on smoothing to make everything pretty.
  smooth();
  //Set the fill and stroke colour for the box and circle
  fill(255);
  stroke(255);
  //Tell the rectangles to draw from the center point (the default is the TL corner)
  rectMode(CENTER);

};

void draw() {
  //Set the background colour, which gets more red as we move our finger down the screen.
  background(mouseY * (255.0/800), 100, 0);
  //Chane our box rotation depending on how our finger has moved right-to-left
  boxRotation += (float) (pmouseX - mouseX)/100;

  //Draw the ball-and-stick
  line(width/2, height/2, mouseX, mouseY);
  ellipse(mouseX, mouseY, 40, 40);

  //Draw the box
  pushMatrix();
    translate(width/2, height/2);
    rotate(boxRotation);
    rect(0,0, 150, 150);
  popMatrix();
};
</pre>
<p>Again, we can use Present (Shift-Apple-R) to run the sketch on our device:<br />
<a rel="attachment wp-att-1142" href="http://blog.blprnt.com/blog/blprnt/processing-android-mobile-app-development-made-very-easy/p5androidtouch"><img class="alignnone size-medium wp-image-1142" title="P5AndroidTouch" src="http://blog.blprnt.com/wp-content/uploads/2010/09/P5AndroidTouch-500x375.jpg" alt="" width="500" height="375" /></a></p>
<p>At this point, the world is our proverbial oyster. Those of you who have already worked with Processing are probably already loading your archived sketches onto your phone. If you don&#8217;t know much about Processing, you can learn a lot from the <a href="http://www.processing.org">Processing website</a>, from the <a href="http://www.processing.org/learning/books/">excellent books</a> that are available, and from doing some exploring on your own.</p>
<p>I am very (very) excited about Processing for Android. It enables students, artists, activists &#8211; everyone &#8211; to make and distribute their own mobile-based software. While we&#8217;ve kept things pretty simple in this tutorial, later in the week, I&#8217;ll be showing you some nifty Android-specific Processing features, and exploring how to integrate sketches with the device hardware (camera, accelerometer, etc.). We&#8217;ll also look at how to package up Processing sketches for distribution.</p>
<p>Stay tuned!</p>
<p>Some helpful tips when you&#8217;re working with Processing &amp; Android:</p>
<p>- I know I&#8217;ve said this before, but be patient. Canceling a process (ie. the emulator load or a device compile) can cause problems. If you do this inadvertently, you&#8217;re best off restarting Processing.</p>
<p>- RTFW &#8211; make sure to check out the <a href="http://wiki.processing.org/w/Android">Processing Android Wik</a>i, where you&#8217;ll find some troubleshooting advice, and some tips on how to get your sketches working properly on your device.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blprnt.com/blog/blprnt/processing-android-mobile-app-development-made-very-easy/feed</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>Wired UK, Barabási Lab and BIG data</title>
		<link>http://blog.blprnt.com/blog/blprnt/wired-uk-barabasi-lab-and-big-data</link>
		<comments>http://blog.blprnt.com/blog/blprnt/wired-uk-barabasi-lab-and-big-data#comments</comments>
		<pubDate>Mon, 12 Jul 2010 19:37:52 +0000</pubDate>
		<dc:creator>Jer</dc:creator>
				<category><![CDATA[data]]></category>
		<category><![CDATA[Information Visualization]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[barabasi]]></category>
		<category><![CDATA[big data]]></category>
		<category><![CDATA[infoviz]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[wireduk]]></category>

		<guid isPermaLink="false">http://blog.blprnt.com/?p=1093</guid>
		<description><![CDATA[Over the last year, I&#8217;ve produced five data-driven pieces for Wired UK. Four of them have been for the two-page infoporn spread that can be found in every issue. I&#8217;ve looked at the UK&#8217;s National DNA Database, used mined Twitter data to find people&#8217;s travel paths, and mapped traffic in some of the world&#8217;s busiest [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last year, I&#8217;ve produced five data-driven pieces for <a href="http://www.wired.co.uk">Wired UK</a>. Four of them have been for the two-page infoporn spread that can be found in every issue. I&#8217;ve looked at the <a href="http://blog.blprnt.com/blog/blprnt/wired-uk-july-09-visualizing-a-nations-dna">UK&#8217;s National DNA Database</a>, used mined Twitter data to find people&#8217;s travel paths, and mapped traffic in some of the world&#8217;s busiest sea ports. </p>
<p>In <a href="http://www.wired.co.uk/wired-magazine">the August issue</a>, out on newsstands right now, I had a chance to work with some spectacular data and extremely talented people. The piece looks at a very, very big data set &#8211; cellular phone records from a pool of 10 million users in an anonymous European country. This data came (under a very strict layer of confidentiality) from Barabási Lab in Boston, where they have been using this information to find out some <a href="http://www.barabasilab.com/pubs-humandynamics.php">fascinating things about human mobility patterns</a>. </p>
<p>In this post, I&#8217;ll walk through the process of creating this piece. Along the way, I&#8217;ll show some draft images and unused experiments that eventually evolved into the final project.</p>
<p><strong>Working With Big Data</strong></p>
<p>I can&#8217;t get into a lot of detail about the specifics of the data set, but needless to say, phone records for 10 million individuals take up a lot of space. All told, the data for this project consisted of more than 5.5GB of flattened text files. I should say, at this point, that I don&#8217;t work on a supercomputer &#8211; I churn out all of my work from an often overheated 2.33GHZ MacBook Pro. Since the deadline was reasonably tight on this project, I decided to rule out a distributed computing approach to get at all of this data, and instead chose to work with a subset of the full list of records. Working in <a href="http://www.processing.org">Processing</a>, I built a simple script that could filter out a smaller dataset from the complete files. I built several of these at varying file sizes, giving me a nice set of data to work with both in prototyping and in production stages. This is a strategy that I often employ, even with more minimal datasets &#8211; save the heavy lifting until the final render.</p>
<p>The first thing I did with the trimmed-down data was to construct &#8216;call histories&#8217; for each user in the set. I rendered out these histories as stacked bars of individual calls, which could then be placed into a histogram. Here&#8217;s a graph of about 10,000 users, sorted by their total time spent on the phone :</p>
<p><a title="Wired UK &amp;amp; Barabási Lab: Process by blprnt_van, on Flickr" href="http://www.flickr.com/photos/blprnt/4787589444/"><img src="http://farm5.static.flickr.com/4122/4787589444_b482b8ec16.jpg" alt="Wired UK &amp;amp; Barabási Lab: Process" width="500" height="313" /></a></p>
<p>Here we see a very obvious power law distribution, with a few people talking a lot (really, a lot &#8211; 28.3 hours a week), and most callers talking relatively little (these is also a tail of text-only users at the very end). The problem here, of course, is that on a computer screen &#8211; or even in print &#8211; it&#8217;s hard to get into the data to learn anything useful. When I zoom into the graph, we can start to see the individual call histories (I&#8217;ve enlarged a few columns for detail). Here, long calls are rendered yellow, short calls are rendered red, and text messages are flat blue rectangles:</p>
<p><a title="Wired UK &amp;amp; Barabási Lab: Process by blprnt_van, on Flickr" href="http://www.flickr.com/photos/blprnt/4787589478/"><img src="http://farm5.static.flickr.com/4096/4787589478_61aa14b599.jpg" alt="Wired UK &amp;amp; Barabási Lab: Process" width="500" height="180" /></a></p>
<p>I took the same graph as above, and added another set of columns extending below &#8211; here the white bars show us how many &#8216;friends&#8217; the individual callers had &#8211; ie. how many people they are regularly talking to over the week:</p>
<p><a title="Wired UK &amp;amp; Barabási Lab: Process by blprnt_van, on Flickr" href="http://www.flickr.com/photos/blprnt/4786958611/"><img src="http://farm5.static.flickr.com/4139/4786958611_9d5d074bb1.jpg" alt="Wired UK &amp;amp; Barabási Lab: Process" width="500" height="313" /></a></p>
<p>If I sort this graph by number of friends (rather than total call time), we can see that the two measures (talkativeness, and number of friends) don&#8217;t seem to be strongly correlated:</p>
<p><a title="Wired UK &amp;amp; Barabási Lab: Process by blprnt_van, on Flickr" href="http://www.flickr.com/photos/blprnt/4787590016/"><img src="http://farm5.static.flickr.com/4076/4787590016_f6aa8869a5.jpg" alt="Wired UK &amp;amp; Barabási Lab: Process" width="500" height="313" /></a></p>
<p>It&#8217;s interesting to note here as well, that the data set includes linkage information &#8211; so I can also visualize who is calling who within our group of individuals:</p>
<p><a title="Wired UK &amp;amp; Barabási Lab: Process by blprnt_van, on Flickr" href="http://www.flickr.com/photos/blprnt/4786958691/"><img src="http://farm5.static.flickr.com/4076/4786958691_d3c245980b.jpg" alt="Wired UK &amp;amp; Barabási Lab: Process" width="500" height="313" /></a></p>
<p>There is some interesting information to be dug up in here, but the long aspect of the graph and the general over-detail involved makes it not very usable &#8211; particularly for a magazine piece.</p>
<p><strong>Ooh, and then Aaah.</strong></p>
<p>The Infoporn section in Wired is a two page spread;  I always think of it as needing to serve two separate purposes for two different kinds of readers. First, it needs to be visually pleasing. I want people to say &#8216;Oooh&#8230;!&#8217; when they turn the page to it. Once they&#8217;re hooked, though, I want them to learn something &#8211; the &#8216;Aaah!&#8217; moment.</p>
<p>The data used in the graphs above seemed too complex to do anything truly revealing with &#8211; so perhaps it could be built into something sexy enough to draw an &#8216;Oooh!&#8217; or two? In order to fit the long tails of these graphs onto the page, I wondered if I could add a bit of a curl to them. To make this structural change evident, I turned the graphs on a slight angle and rendered them in 3D. Here, we see five of these graphs, totaling about a million individual users, arranged into a single, tower-like shape:</p>
<p><a title="Wired UK &amp;amp; Barabási Lab: Process by blprnt_van, on Flickr" href="http://www.flickr.com/photos/blprnt/4787001405/"><img src="http://farm5.static.flickr.com/4137/4787001405_ffc546ccfa.jpg" alt="Wired UK &amp;amp; Barabási Lab: Process" width="500" height="313" /></a></p>
<p>While these structures took a little while to render, I could quite easily generate a unique set of them, which I assembled as a line trailing off to the page edge on the left:</p>
<p><a title="Wired UK &amp;amp; Barabási Lab: Process by blprnt_van, on Flickr" href="http://www.flickr.com/photos/blprnt/4786959411/"><img src="http://farm5.static.flickr.com/4114/4786959411_e108b3d5df.jpg" alt="Wired UK &amp;amp; Barabási Lab: Process" width="500" height="283" /></a></p>
<p><strong>Getting Personal</strong></p>
<p>So far, the visuals for this project only tell a part of the story: that our individual calling habits fall into predictable patterns when placed with the larger whole (some excellent text from <a href="http://lobstermedia.com/">Michael Dumiak</a> helps clarify this in the final piece). There&#8217;s another crucial piece, though. Cel phone usage data is inherently locative, since our provider always knows from which of their cel towers we are placing the call.</p>
<p>This is where the fun starts &#8211; we can use this locative data to track the mobility patterns of individual people (it&#8217;s worth saying here that all of the data the I worked with was anonymized). To do this, I created a tool (again, in Processing) to make &#8216;mobility cubes&#8217; &#8211; which show a history of an individual&#8217;s movements over time:</p>
<p><a href="http://www.flickr.com/photos/blprnt/4787590038/" title="Wired UK &amp;amp; Barabási Lab: Process by blprnt_van, on Flickr"><img src="http://farm5.static.flickr.com/4143/4787590038_e6399346de.jpg" width="470" height="500" alt="Wired UK &amp;amp; Barabási Lab: Process"></a></p>
<p>The individual above, for example, travels around an area less than a square kilometer over a period of just under three days. If I flatten this graph, we can see that this person travels mostly between two locations:</p>
<p><a href="http://www.flickr.com/photos/blprnt/4787589416/" title="Wired UK &amp;amp; Barabási Lab: Process by blprnt_van, on Flickr"><img src="http://farm5.static.flickr.com/4116/4787589416_8169d2a72e.jpg" width="446" height="424" alt="Wired UK &amp;amp; Barabási Lab: Process"></a></p>
<p>From the data, we can identify a lot of individuals like this &#8211; commuters &#8211; who travel short distances between two places (home, and work). We can also find travelers (people who cover a long distance in a short period of time):</p>
<p><a href="http://www.flickr.com/photos/blprnt/4787077865/" title="Wired UK &amp;amp; Barabási Lab: Process by blprnt_van, on Flickr"><img src="http://farm5.static.flickr.com/4073/4787077865_4321ce49ae.jpg" width="500" height="352" alt="Wired UK &amp;amp; Barabási Lab: Process"></a></p>
<p>And others who seem to follow more elaborate (but often still regular) mobility patterns:</p>
<p><a href="http://www.flickr.com/photos/blprnt/4787589582/" title="Wired UK &amp;amp; Barabási Lab: Process by blprnt_van, on Flickr"><img src="http://farm5.static.flickr.com/4081/4787589582_05fda2b088.jpg" width="500" height="497" alt="Wired UK &amp;amp; Barabási Lab: Process"></a></p>
<p>We can assemble a &#8216;mobility cube&#8217; for each individual in the database &#8211; and very quickly gain a mechanism for recognizing patterns amongst these people:</p>
<p><a href="http://www.flickr.com/photos/blprnt/4787590370/" title="Wired UK &amp;amp; Barabási Lab: Process by blprnt_van, on Flickr"><img src="http://farm5.static.flickr.com/4076/4787590370_e721ae5268.jpg" width="500" height="281" alt="Wired UK &amp;amp; Barabási Lab: Process"></a></p>
<p>Which brings us to the underlying point of the piece &#8211; we are all leaving digital trails behind us, as we make our way around our individual lives. These trails are largely considered individual &#8211; even ethereal &#8211; yet technology is making these trails more visible and more readable everyday.</p>
<p>Of course, to see the final piece &#8211; the polished assembly of some of the drafts and artifacts you&#8217;ve seen in this post &#8211; you&#8217;ll have to buy the magazine. Wired UK is available on newsstands in the UK, and to <a href="https://www.magazineboutique.co.uk/secureonline/quicksubs_tpl.asp?m=1207&#038;src=W321">all of our clever subscribers</a>.</p>
<p>If you want to read more about this &#8211; and you should &#8211; I&#8217;d highly recommend Albert-László Barabási&#8217;s <a href="http://www.amazon.com/Bursts-Hidden-Pattern-Behind-Everything/dp/0525951601">Bursts</a>, which goes into much more detail about human mobility &#038; predictability.</p>
<p>Finally, huge thanks have to go out to László and his team at the lab, without whom this piece would have never made it to print!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blprnt.com/blog/blprnt/wired-uk-barabasi-lab-and-big-data/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Your Random Numbers &#8211; Getting Started with Processing and Data Visualization</title>
		<link>http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization</link>
		<comments>http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization#comments</comments>
		<pubDate>Mon, 12 Apr 2010 02:56:54 +0000</pubDate>
		<dc:creator>Jer</dc:creator>
				<category><![CDATA[data]]></category>
		<category><![CDATA[Information Visualization]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[numbers]]></category>
		<category><![CDATA[pedagogy]]></category>
		<category><![CDATA[teaching]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://blog.blprnt.com/?p=1046</guid>
		<description><![CDATA[Over the last year or so, I&#8217;ve spent almost as much time thinking about how to teach data visualization as I&#8217;ve spent working with data. I&#8217;ve been a teacher for 10 years &#8211; for better or for worse this means that as I learn new techniques and concepts, I&#8217;m usually thinking about pedagogy at the [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last year or so, I&#8217;ve spent almost as much time thinking about how to teach data visualization as I&#8217;ve spent working with data. I&#8217;ve been a teacher for 10 years &#8211; for better or for worse this means that as I learn new techniques and concepts, I&#8217;m usually thinking about pedagogy at the same time. Lately, I&#8217;ve also become convinced that this massive &#8216;open data&#8217; movement that we are currently in the midst of is sorely lacking in educational components. The amount of available data, I think, is quickly outpacing our ability to use it in useful and novel ways. How can basic data visualization techniques be taught in an easy, engaging manner?</p>
<p>This post, then, is a first sketch of what a lesson plan for teaching <a href="http://www.processing.org">Processing</a> and data visualization might look like. I&#8217;m going to start from scratch, work through some examples, and (hopefully) make some interesting stuff. One of the nice things, I think, about this process, is that we&#8217;re going to start with fresh, new data &#8211; I&#8217;m not sure what kind of things we&#8217;re going to find once we start to get our hands dirty. This is what is really exciting about data visualization; the chance to find answers to your own, possibly novel questions.</p>
<p><strong>Let&#8217;s Start With the Data</strong></p>
<p>We&#8217;re not going to work with an old, dusty data set here. Nor are we going to attempt to bash our heads against an unnecessarily complex pile of numbers. Instead, we&#8217;re going to start with a data set that I made up &#8211; with the help of a couple of hundred of my <a href="http://www.twitter.com/blprnt">Twitter</a> followers. Yesterday morning, I posted this request:</p>
<p><a rel="attachment wp-att-1047" href="http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization/picture-5-2"><img class="alignnone size-full wp-image-1047" title="Picture 5" src="http://blog.blprnt.com/wp-content/uploads/2010/04/Picture-5.png" alt="" width="500" height="88" /></a></p>
<p>Even on a Saturday, a lot of helpful folks pitched in, and I ended up with about 225 numbers. And so, we have the easiest possible dataset to work with &#8211; a single list of whole numbers. I&#8217;m hoping that, as well as being simple, this dataset will turn out to be quite interesting &#8211; maybe telling us something about how the human brain thinks about numbers.</p>
<p>I wrote a quick Processing sketch to scrape out the numbers from the post, and then to put them into a Google Spreadsheet. You can see the whole dataset here: <a href="http://spreadsheets.google.com/pub?key=t6mq_WLV5c5uj6mUNSryBIA&amp;output=html">http://spreadsheets.google.com/pub?key=t6mq_WLV5c5uj6mUNSryBIA&amp;output=html</a></p>
<p>I chose to start from a Google Spreadsheet in this tutorial, because I wanted people to be able to generate their own datasets to work with. Teachers &#8211; you can set up a spreadsheet of your own, and get your students to collect numbers by any means you&#8217;d like. The &#8216;User&#8217; and &#8216;Tweet&#8217; columns are not necessary; you just need to have a column called &#8216;Number&#8217;.</p>
<p>It&#8217;s about time to get down to some coding. The only tricky part in this whole process will be connecting to the Google Spreadsheet. Rather than bog down the tutorial with a lot of confusing semi-advanced code, I&#8217;ll let you download <a href="http://www.blprnt.com/tutorials/MyRandom.zip">this sample sketch</a> which has the Google Spreadsheet machinery in place.</p>
<p>Got it? Great. Open that sketch in Processing, and let&#8217;s get started. Just to make sure we&#8217;re all in the same place, you should see a screen that looks like this:</p>
<p><a rel="attachment wp-att-1049" href="http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization/picture-7"><img class="alignnone size-medium wp-image-1049" title="Picture 7" src="http://blog.blprnt.com/wp-content/uploads/2010/04/Picture-7-500x365.png" alt="" width="500" height="365" /></a></p>
<p>At the top of the sketch, you&#8217;ll see three String values that you can change. You&#8217;ll definitely have to enter your own Google username and password. If you have your own spreadsheet of number data, you can enter in the key for your spreadsheet as well. You can find the key right in the URL of any spreadsheet.</p>
<p>The first thing we&#8217;ll do is change the size of our sketch to give us some room to move, set the background color, and turn on smoothing to make things pretty. We do all of this in the setup enclosure:</p>
<pre class="brush: java; title: ; notranslate">
void setup() {
  //This code happens once, right when our sketch is launched
 size(800,800);
 background(0);
 smooth();
};
</pre>
<p>Now we need to get our data from the spreadsheet. One of the advantages of accessing the data from a shared remote file is that the remote data can change and we don&#8217;t have to worry about replacing files or changing our code.</p>
<p>We&#8217;re going to ask for a list of the &#8216;random&#8217; numbers that are stored in the spreadsheet. The most easy way to store lists of things in Processing is in an Array. In this case, we&#8217;re looking for an array of whole numbers &#8211; integers. I&#8217;ve written a function that gets an integer array from Google &#8211; you can take a look at the code on the &#8216;GoogleCode&#8217; tab if you&#8217;d like to see how that is done. What we need to know here is that this function &#8211; called getNumbers &#8211; will return, or send us back, a list of whole numbers. Let&#8217;s ask for that list:</p>
<pre class="brush: java; title: ; notranslate">
void setup() {
  //This code happens once, right when our sketch is launched
 size(800,800);
 background(0);
 smooth();

 //Ask for the list of numbers
 int[] numbers = getNumbers();
};
</pre>
<p>OK.</p>
<p><strong>World&#8217;s easiest data visualization!</strong></p>
<pre class="brush: java; title: ; notranslate">
 fill(255,40);
 noStroke();
 for (int i = 0; i &lt; numbers.length; i++) {
   ellipse(numbers[i] * 8, width/2, 8,8);
 };
</pre>
<p>What this does is to draw a row of dots across the screen, one for each number that occurs in our Google list. The dots are drawn with a low alpha (40/255 or about 16%), so when numbers are picked more than once, they get brighter. The result is a strip of dots across the screen that looks like this:</p>
<p><a rel="attachment wp-att-1054" href="http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization/picture-15"><img class="alignnone size-medium wp-image-1054" title="Picture 15" src="http://blog.blprnt.com/wp-content/uploads/2010/04/Picture-15-500x38.png" alt="" width="500" height="38" /></a></p>
<p>Right away, we can see a couple of things about the distribution of our &#8216;random&#8217; numbers. First, there are two or three very bright spots where numbers get picked several times. Also, there are some pretty evident gaps (one right in the middle) where certain numbers don&#8217;t get picked at all.</p>
<p>This could be normal though, right? To see if this distribution is typical, let&#8217;s draw a line of &#8216;real&#8217; random numbers below our line, and see if we can notice a difference:</p>
<pre class="brush: java; title: ; notranslate">
fill(255,40);
 noStroke();
 //Our line of Google numbers
 for (int i = 0; i &lt; numbers.length; i++) {
   ellipse(numbers[i] * 8, height/2, 8,8);
 };
 //A line of random numbers
 for (int i = 0; i &lt; numbers.length; i++) {
   ellipse(ceil(random(0,99)) * 8, height/2 + 20, 8,8);
 };
</pre>
<p>Now we see the two compared:</p>
<p><a rel="attachment wp-att-1055" href="http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization/picture-16"><img class="alignnone size-medium wp-image-1055" title="Picture 16" src="http://blog.blprnt.com/wp-content/uploads/2010/04/Picture-16-500x33.png" alt="" width="500" height="33" /></a></p>
<p>The bottom, random line doesn&#8217;t seem to have as many bright spots or as evident of gaps as our human-picked line. Still, the difference isn&#8217;t that evident. Can you tell right away which line is our line from the group below?</p>
<p><a rel="attachment wp-att-1056" href="http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization/picture-17"><img class="alignnone size-medium wp-image-1056" title="Picture 17" src="http://blog.blprnt.com/wp-content/uploads/2010/04/Picture-17-500x157.png" alt="" width="500" height="157" /></a></p>
<p>OK. I&#8217;ll admit it &#8211; I was hoping that the human-picked number set would be more obviously divergent from the sets of numbers that were generated by a computer. It&#8217;s possible that humans are better at picking random numbers than I had thought. Or, our sample set is too small to see any kind of real difference. It&#8217;s also possible that this quick visualization method isn&#8217;t doing the trick. Let&#8217;s stay on the track of number distribution for a few minutes and see if we can find out any more.</p>
<p>Our system of dots was easy, and readable, but not very useful for empirical comparisons. For the next step, let&#8217;s stick with the classics and</p>
<p><strong>Build a bar graph.</strong></p>
<p>Right now, we have a list of numbers. Ours range from 1-99, but let&#8217;s imagine for a second that we had a set of numbers that ranged from 0-10:</p>
<p>[5,8,5,2,4,1,6,3,9,0,1,3,5,7]</p>
<p>What we need to build a bar graph for these numbers is a list of <em>counts</em> &#8211; how many times each number occurs:</p>
<p>[1,2,1,2,1,3,1,1,1,1]</p>
<p>We can look at this list above, and see that there were two 1s, and three 5s.</p>
<p>Let&#8217;s do the same thing with our big list of numbers &#8211; we&#8217;re going to generate a list 99 numbers long that holds the counts for each of the possible numbers in our set. But, we&#8217;re going to be a bit smarter about it this time around and package our code into a function &#8211; so that we can use it again and again without having to re-write it. In this case the function will (eventually) draw a bar graph &#8211; so we&#8217;ll call it (cleverly) barGraph:</p>
<pre class="brush: java; title: ; notranslate">
void barGraph( int[] nums ) {
  //Make a list of number counts
 int[] counts = new int[100];
 //Fill it with zeros
 for (int i = 1; i &lt; 100; i++) {
   counts[i] = 0;
 };
 //Tally the counts
 for (int i = 0; i &lt; nums.length; i++) {
   counts[nums[i]] ++;
 };
};
</pre>
<p>This function constructs an array of counts from whatever list of numbers we pass into it (that list is a list of integers, and we refer to it within the function as &#8216;nums&#8217;, a name which I made up). Now, let&#8217;s add the code to draw the graph (I&#8217;ve added another parameter to go along with the numbers &#8211; the y position of the graph):</p>
<pre class="brush: java; title: ; notranslate">

void barGraph(int[] nums, float y) {
  //Make a list of number counts
 int[] counts = new int[100];
 //Fill it with zeros
 for (int i = 1; i &lt; 100; i++) {
   counts[i] = 0;
 };
 //Tally the counts
 for (int i = 0; i &lt; nums.length; i++) {
   counts[nums[i]] ++;
 };

 //Draw the bar graph
 for (int i = 0; i &lt; counts.length; i++) {
   rect(i * 8, y, 8, -counts[i] * 10);
 };
};
</pre>
<p>We&#8217;ve added a function &#8211; a set of instructions &#8211; to our file, which we can use to draw a bar graph from a set of numbers. To actually draw the graph, we need to call the function, which we can do in the setup enclosure. Here&#8217;s the code, all together:</p>
<pre class="brush: java; title: ; notranslate">

/*

 #myrandomnumber Tutorial
 blprnt@blprnt.com
 April, 2010

 */

//This is the Google spreadsheet manager and the id of the spreadsheet that we want to populate, along with our Google username &amp; password
SimpleSpreadsheetManager sm;
String sUrl = &quot;t6mq_WLV5c5uj6mUNSryBIA&quot;;
String googleUser = &quot;YOUR USERNAME&quot;;
String googlePass = &quot;YOUR PASSWORD&quot;;

void setup() {
  //This code happens once, right when our sketch is launched
 size(800,800);
 background(0);
 smooth();

 //Ask for the list of numbers
 int[] numbers = getNumbers();
 //Draw the graph
 barGraph(numbers, 400);
};

void barGraph(int[] nums, float y) {
  //Make a list of number counts
 int[] counts = new int[100];
 //Fill it with zeros
 for (int i = 1; i &lt; 100; i++) {
   counts[i] = 0;
 };
 //Tally the counts
 for (int i = 0; i &lt; nums.length; i++) {
   counts[nums[i]] ++;
 };

 //Draw the bar graph
 for (int i = 0; i &lt; counts.length; i++) {
   rect(i * 8, y, 8, -counts[i] * 10);
 };
};

void draw() {
  //This code happens once every frame.
};
</pre>
<p>If you run your code, you should get a nice minimal bar graph which looks like this:</p>
<p><a rel="attachment wp-att-1065" href="http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization/picture-18"><img class="alignnone size-medium wp-image-1065" title="Picture 18" src="http://blog.blprnt.com/wp-content/uploads/2010/04/Picture-18-500x90.png" alt="" width="500" height="90" /></a></p>
<p>We can help distinguish the very high values (and the very low ones) by adding some color to the graph. In Processing&#8217;s standard RGB color mode, we can change one of our color channels (in this case, green) with our count values to give the bars some differentiation:</p>
<pre class="brush: java; title: ; notranslate">

 //Draw the bar graph
 for (int i = 0; i &lt; counts.length; i++) {
   fill(255, counts[i] * 30, 0);
   rect(i * 8, y, 8, -counts[i] * 10);
 };
</pre>
<p>Which gives us this:</p>
<p><a rel="attachment wp-att-1066" href="http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization/picture-19"><img title="Picture 19" src="http://blog.blprnt.com/wp-content/uploads/2010/04/Picture-19-500x66.png" alt="" width="500" height="66" /></a></p>
<p>Or, we could switch to Hue/Saturation/Brightness mode, and use our count values to cycle through the available hues:</p>
<pre class="brush: java; title: ; notranslate">
//Draw the bar graph
 for (int i = 0; i &lt; counts.length; i++) {
   colorMode(HSB);
   fill(counts[i] * 30, 255, 255);
   rect(i * 8, y, 8, -counts[i] * 10);
 };
</pre>
<p>Which gives us this graph:</p>
<p><a rel="attachment wp-att-1067" href="http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization/picture-20"><img class="alignnone size-medium wp-image-1067" title="Picture 20" src="http://blog.blprnt.com/wp-content/uploads/2010/04/Picture-20-500x67.png" alt="" width="500" height="67" /></a></p>
<p>Now would be a good time to do some comparisons to a real random sample again, to see if the new coloring makes a difference. Because we defined our bar graph instructions as a function, we can do this fairly easily (I built in an easy function to generate a random list of integers called getRandomNumbers &#8211; you can see the code on the &#8216;GoogleCode&#8217; tab):</p>
<pre class="brush: java; title: ; notranslate">
void setup() {
  //This code happens once, right when our sketch is launched
 size(800,800);
 background(0);
 smooth();

 //Ask for the list of numbers
 int[] numbers = getNumbers();
 //Draw the graph
 barGraph(numbers, 100);

 for (int i = 1; i &lt; 7; i++) {
 int[] randoms = getRandomNumbers(225);
 barGraph(randoms, 100 + (i * 130));
 };
};
</pre>
<p><a rel="attachment wp-att-1070" href="http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization/picture-21"><img title="Picture 21" src="http://blog.blprnt.com/wp-content/uploads/2010/04/Picture-21-498x500.png" alt="" width="498" height="500" /></a></p>
<p>I know, I know. Bar graphs. Yay. Looking at the graphic above, though, we can see more clearly that our humanoid number set is unlike the machine-generated sets. However, I actually think that the color is more valuable than the dimensions of the bars. Since we&#8217;re dealing with 99 numbers, maybe we can display these colours in a grid and see if any patterns emerge? A really important thing to be able to do with data visualization is to</p>
<p><strong>Look at datasets from multiple angles.</strong></p>
<p>Let&#8217;s see if the grid gets us anywhere. Luckily, a function to make a grid is pretty much the same as the one to make a graph (I&#8217;m adding two more parameters &#8211; an x position for the grid, and a size for the individual blocks):</p>
<pre class="brush: java; title: ; notranslate">
void colorGrid(int[] nums, float x, float y, float s) {
 //Make a list of number counts
 int[] counts = new int[100];
 //Fill it with zeros
 for (int i = 0; i &lt; 100; i++) {
   counts[i] = 0;
 };
 //Tally the counts
 for (int i = 0; i &lt; nums.length; i++) {
   counts[nums[i]] ++;
 };

//Move the drawing coordinates to the x,y position specified in the parameters
 pushMatrix();
 translate(x,y);
 //Draw the grid
 for (int i = 0; i &lt; counts.length; i++) {
   colorMode(HSB);
   fill(counts[i] * 30, 255, 255, counts[i] * 30);
   rect((i % 10) * s, floor(i/10) * s, s, s);

 };
 popMatrix();
};
</pre>
<p>We can now do this to draw a nice big grid:</p>
<pre class="brush: java; title: ; notranslate">
 //Ask for the list of numbers
 int[] numbers = getNumbers();
 //Draw the graph
 colorGrid(numbers, 50, 50, 70);
</pre>
<p><a rel="attachment wp-att-1075" href="http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization/picture-22"><img class="alignnone size-medium wp-image-1075" title="Picture 22" src="http://blog.blprnt.com/wp-content/uploads/2010/04/Picture-22-499x500.png" alt="" width="499" height="500" /></a></p>
<p>I can see some definite patterns in this grid &#8211; so let&#8217;s bring the actual numbers back into play so that we can talk about what seems to be going on. Here&#8217;s the full code, one last time:</p>
<pre class="brush: java; title: ; notranslate">

/*

 #myrandomnumber Tutorial
 blprnt@blprnt.com
 April, 2010

 */

//This is the Google spreadsheet manager and the id of the spreadsheet that we want to populate, along with our Google username &amp; password
SimpleSpreadsheetManager sm;
String sUrl = &quot;t6mq_WLV5c5uj6mUNSryBIA&quot;;
String googleUser = &quot;YOUR USERNAME&quot;;
String googlePass = &quot;YOUR PASSWORD&quot;;

//This is the font object
PFont label;

void setup() {
  //This code happens once, right when our sketch is launched
 size(800,800);
 background(0);
 smooth();

 //Create the font object to make text with
 label = createFont(&quot;Helvetica&quot;, 24);

 //Ask for the list of numbers
 int[] numbers = getNumbers();
 //Draw the graph
 colorGrid(numbers, 50, 50, 70);
};

void barGraph(int[] nums, float y) {
  //Make a list of number counts
 int[] counts = new int[100];
 //Fill it with zeros
 for (int i = 1; i &lt; 100; i++) {
   counts[i] = 0;
 };
 //Tally the counts
 for (int i = 0; i &lt; nums.length; i++) {
   counts[nums[i]] ++;
 };

 //Draw the bar graph
 for (int i = 0; i &lt; counts.length; i++) {
   colorMode(HSB);
   fill(counts[i] * 30, 255, 255);
   rect(i * 8, y, 8, -counts[i] * 10);
 };
};

void colorGrid(int[] nums, float x, float y, float s) {
 //Make a list of number counts
 int[] counts = new int[100];
 //Fill it with zeros
 for (int i = 0; i &lt; 100; i++) {
   counts[i] = 0;
 };
 //Tally the counts
 for (int i = 0; i &lt; nums.length; i++) {
   counts[nums[i]] ++;
 };

 pushMatrix();
 translate(x,y);
 //Draw the grid
 for (int i = 0; i &lt; counts.length; i++) {
   colorMode(HSB);
   fill(counts[i] * 30, 255, 255, counts[i] * 30);
   textAlign(CENTER);
   textFont(label);
   textSize(s/2);
   text(i, (i % 10) * s, floor(i/10) * s);
 };
 popMatrix();
};

void draw() {
  //This code happens once every frame.

};
</pre>
<p>And, our nice looking number grid:</p>
<p><a rel="attachment wp-att-1076" href="http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization/picture-23"><img class="alignnone size-medium wp-image-1076" title="Picture 23" src="http://blog.blprnt.com/wp-content/uploads/2010/04/Picture-23-500x487.png" alt="" width="500" height="487" /></a></p>
<p><strong>BINGO!</strong></p>
<p>No, really. If this was a bingo card, and I was a 70-year old, I&#8217;d be rich. Look at that nice line going down the X7 column &#8211; 17, 27, 37, 47, 57, 67, 77, 87, and 97 are all appearing with good frequency. If we rule out the Douglas Adams effect on 42, it is likely that most of the top 10 most-frequently occurring numbers would have a 7 on the end. Do numbers ending with 7s &#8216;feel&#8217; more random to us? Or is there something about the number 7 that we just plain like?</p>
<p>Contrasting to that, if I had played the x0 row, I&#8217;d be out of luck. It seems that numbers ending with a zero don&#8217;t feel very random to us at all. This could also explain the black hole around the number 50 &#8211; which, in a range from 0-100, appears to be the &#8216;least random&#8217; of all.</p>
<p>Well, there we have it. A start-to finish example of how we can use Processing to visualize simple data, with a goal to expose underlying patterns and anomalies. The techniques that we used in this project were fairly simple &#8211; but they are useful tools that can be used in a huge variety of data situations (I use them myself, all the time).</p>
<p>Hopefully this tutorial is (was?) useful for some of you. And, if there are any teachers out there who would like to try this out with their classrooms, I&#8217;d love to hear how it goes.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization/feed</wfw:commentRss>
		<slash:comments>76</slash:comments>
		</item>
		<item>
		<title>The Missing Piece of the OpenData / OpenGov Puzzle: Education</title>
		<link>http://blog.blprnt.com/blog/blprnt/the-missing-piece-of-the-opendata-opengov-puzzle-education</link>
		<comments>http://blog.blprnt.com/blog/blprnt/the-missing-piece-of-the-opendata-opengov-puzzle-education#comments</comments>
		<pubDate>Sun, 07 Mar 2010 23:46:35 +0000</pubDate>
		<dc:creator>Jer</dc:creator>
				<category><![CDATA[data]]></category>
		<category><![CDATA[Information Visualization]]></category>
		<category><![CDATA[Journalism]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[opendata]]></category>
		<category><![CDATA[opengov]]></category>
		<category><![CDATA[pipedream]]></category>
		<category><![CDATA[policy]]></category>

		<guid isPermaLink="false">http://blog.blprnt.com/?p=1019</guid>
		<description><![CDATA[Yesterday, I tweeted a quick thought that I had, while walking the dog: A few people asked me to expand on this, so let&#8217;s give it a try: We are facing a very different data-related problem today than we were facing only a few years ago. Back then, the call was solely for more information. [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I <a href="http://www.twitter.com/blprnt">tweeted</a> a quick thought that I had, while walking the dog:</p>
<p><img class="alignnone size-medium wp-image-1020" title="Picture 5" src="http://blog.blprnt.com/wp-content/uploads/2010/03/Picture-5-500x67.png" alt="Picture 5" width="500" height="67" /></p>
<p>A few people asked me to expand on this, so let&#8217;s give it a try:</p>
<p>We are facing a very different data-related problem today than we were facing only a few years ago. Back then, the call was solely for more information. Since then, corporations and governments have started to answer this call and the result has been a flood of data of all shapes and sizes. While it&#8217;s important to remain on track with the goal of making data available, we are now faced with a parallel and perhaps more perplexing problem: What do we do with it all?</p>
<p>Of course, an industry has developed around all of this data; start-ups around the world are coming up with new ideas and data-related products every day. At the same time, open-sourcers are releasing helpful tools and clever apps by the dozen. Still, in a large part these groups are looking at the data with fiscal utility in mind. It seems to me that if we are going to make the most of this information resource, it&#8217;s important to bring more people in on the game &#8211; and to do that requires education.</p>
<p>At the post-secondary level, efforts should be made to educate academics for whom this new pile of data could be useful: journalists, social scientists, historians, contemporary artists, archivists, etc. I could imagine cross-disciplinary workshops teaching the basics:</p>
<ol>
<li>A survey of what kind of data is available, and how to find it.</li>
<li>A brief overview of common data formats (CSV, JSON, XML, etc).</li>
<li>An introduction to user-friendly exploration tools like <a href="http://manyeyes.alphaworks.ibm.com/manyeyes/">ManyEyes</a> &amp; <a href="http://www.tableausoftware.com/public/">Tableau</a></li>
<li>A primer in <a href="http://www.processing.org">Processing</a> and how it can be used to quickly prototype and build specialized visualization tools.</li>
</ol>
<p>The last step seems particularly important to me, as it encourages people to think about new ways to engage with information. In many cases, datasets that are becoming available are novel in their content, structure, and complexity &#8211; encouraging innovation in an academic framework is essential. Yes, we do need to teach people how to make bar graphs and scatter charts; but let&#8217;s also facilitate exploration and experimentation.</p>
<p>Why workshops? While this type of teaching could certainly be done through tutorials, or with a well-written text book, it&#8217;s my experience that teaching these subjects is much more effective one-on-one. This is particularly true for students who come at data from a non-scientific perspective (and these people are the ones that we need the most).</p>
<p>The long-term goal of such an initiative would be to increase data-literacy. In a perfect world, this would occur even earlier &#8211; at the highschool level. Here&#8217;s where I put on my utopian hat: teaching data literacy to young people would mean that they could find answers to their own questions, rather than waiting for the media to answer those questions for them. It also teaches them, in a practical way, about transparency and accountability in government. The education system is already producing a generation of bloggers and citizen journalists &#8211; let&#8217;s make sure they have the skills they need to be dangerous. Veering a bit to the right, these are hugely valuable skills for workers in an &#8216;idea economy&#8217; &#8211; a nation with a data-literate workforce is a force to be reckoned with.</p>
<p>Ideally this educational component would be build in to government projects like data.gov or data.hmg.gov.uk (are you listening, Canada?). More than that, it would be woven into the education mandate of governments at federal and local levels. Of course, I&#8217;m not holding my breath.</p>
<p>Instead, I&#8217;ve started to plan a bit of a project for the summer. Like last year, I taught a series of workshops at my studio in Vancouver, which were open to people of all skill levels. This year, I&#8217;m going to extend my reach a bit and offer a couple of <strong>free</strong>, online presentations covering some of the things that I&#8217;ve talked about in this post. One of these workshops will be specifically targeted to youth. At the same time, I&#8217;ll be publishing course outlines and sample materials for my sessions so that others can host similar events.</p>
<p>Stay tuned for details &#8211; and if you have any questions or would like to lend a hand, feel free to leave a comment or <a href="mailto:blprnt@blprnt.com">get in touch</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blprnt.com/blog/blprnt/the-missing-piece-of-the-opendata-opengov-puzzle-education/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>State of the Union(s)</title>
		<link>http://blog.blprnt.com/blog/blprnt/state-of-the-unions</link>
		<comments>http://blog.blprnt.com/blog/blprnt/state-of-the-unions#comments</comments>
		<pubDate>Thu, 28 Jan 2010 06:12:21 +0000</pubDate>
		<dc:creator>Jer</dc:creator>
				<category><![CDATA[data]]></category>
		<category><![CDATA[Journalism]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[data visualization]]></category>
		<category><![CDATA[nytimes]]></category>
		<category><![CDATA[obama]]></category>
		<category><![CDATA[state of the union]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://blog.blprnt.com/?p=1015</guid>
		<description><![CDATA[I was asked at the end of last week to produce a graphic for the Opinion page today &#8211; the idea was to compare the texts of various &#8216;state of the union&#8217; addresses from around the world. The final result (pictured above) is not extraordinarily data-heavy. It worked quite nicely in the printed layout, where [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/blprnt/4309607264/" title="New York Times, 01/27/10 - State of the Union Graphic by blprnt_van, on Flickr"><img src="http://farm5.static.flickr.com/4034/4309607264_03b98784d8.jpg" width="500" height="465" alt="New York Times, 01/27/10 - State of the Union Graphic" /></a></p>
<p>I was asked at the end of last week to produce a graphic for <a href="http://www.nytimes.com/2010/01/27/opinion/27state-of-the-world.html">the Opinion page toda</a>y &#8211; the idea was to compare the texts of various &#8216;state of the union&#8217; addresses from around the world. The final result (pictured above) is not extraordinarily data-heavy. It worked quite nicely in the printed layout, where the individual &#8216;tentacles&#8217; trailed to the text of the speeches that they index.</p>
<p>The process behind this piece was relatively simple. Each speech was indexed using a Processing application that I wrote which counts the frequency of individual names (the program ignores commonly used or unimportant words). The words for each speech were then ranked by mentions per thousand words (you can see a version of the piece with numbers <a href="http://www.flickr.com/photos/blprnt/4308870277/in/photostream/">here</a>)</p>
<p>Almost every project I work on involves a period of &#8216;data exploration&#8217; in which I try shake as many interesting things out of the information as I can. Even though this piece had a short turn-around, I did a fair amount of poking around, generating some simple bar graphs:</p>
<p><a href="http://www.flickr.com/photos/blprnt/4310264839/" title="State of the Union Graphs by blprnt_van, on Flickr"><img src="http://farm5.static.flickr.com/4046/4310264839_bfaab20523.jpg" width="500" height="499" alt="State of the Union Graphs" /></a></p>
<p>Another avenue I explored was to use the word weights to determine a &#8216;score&#8217; for each sentence. By doing this, I can try to find the &#8216;kernel&#8217; of the speech &#8211; the sentence that sums up the entire text in the most succinct way. This, I think was fairly successful. Here are the &#8216;power sentences&#8217; for the UK:</p>
<p><a href="http://www.flickr.com/photos/blprnt/4310297221/" title="SOTU analysis - Sentence Weighting- UK by blprnt_van, on Flickr"><img src="http://farm3.static.flickr.com/2721/4310297221_451b40a12d.jpg" width="500" height="103" alt="SOTU analysis - Sentence Weighting- UK" /></a></p>
<p>The Netherlands:</p>
<p><a href="http://www.flickr.com/photos/blprnt/4311034678/" title="SOTU analysis - Sentence Weighting - Netherlands by blprnt_van, on Flickr"><img src="http://farm3.static.flickr.com/2760/4311034678_604e9bc7ae.jpg" width="500" height="87" alt="SOTU analysis - Sentence Weighting - Netherlands" /></a></p>
<p>And Botswana:</p>
<p><a href="http://www.flickr.com/photos/blprnt/4310297241/" title="SOTU analysis - Sentence Weighting - Botswana by blprnt_van, on Flickr"><img src="http://farm5.static.flickr.com/4030/4310297241_4600853a10.jpg" width="500" height="86" alt="SOTU analysis - Sentence Weighting - Botswana" /></a></p>
<p>Which brings us to tonight&#8217;s State of the Union Address by Barack Obama. What was the &#8216;power sentence&#8217; from this speech? I ran the weighting algorithm on the address and this is what it came up with:</p>
<p><a href="http://www.flickr.com/photos/blprnt/4310312761/" title="The Most Important Sentence From Obama's State of the Union Address? by blprnt_van, on Flickr"><img src="http://farm3.static.flickr.com/2802/4310312761_e47b9a0ed0.jpg" width="500" height="74" alt="The Most Important Sentence From Obama's State of the Union Address?" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blprnt.com/blog/blprnt/state-of-the-unions/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Unlucky Haiti (1981-2009)</title>
		<link>http://blog.blprnt.com/blog/blprnt/unlucky-haiti-1981-2009</link>
		<comments>http://blog.blprnt.com/blog/blprnt/unlucky-haiti-1981-2009#comments</comments>
		<pubDate>Thu, 14 Jan 2010 06:01:51 +0000</pubDate>
		<dc:creator>Jer</dc:creator>
				<category><![CDATA[Information Visualization]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[data vizualization]]></category>
		<category><![CDATA[disaster]]></category>
		<category><![CDATA[haiti]]></category>
		<category><![CDATA[new york times]]></category>

		<guid isPermaLink="false">http://blog.blprnt.com/?p=995</guid>
		<description><![CDATA[I was very much moved by Maggie Steber&#8217;s photo essay in The New York Times, titled &#8216;No End of Trouble. Ever.&#8216; The essay talks about Haiti&#8217;s violent history, and of the countries incredible tendency towards misfortune: &#8220;How can nature or God or the fates or the universe do this to a country that has borne [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Unlucky Haiti (1981-2010) by blprnt_van, on Flickr" href="http://www.flickr.com/photos/blprnt/4272834797/"><img src="http://farm5.static.flickr.com/4037/4272834797_eaa39f95fc.jpg" alt="Unlucky Haiti (1981-2010)" width="500" height="443" /></a></p>
<p>I was very much moved by Maggie Steber&#8217;s photo essay in The New York Times, titled &#8216;<a href="lens.blogs.nytimes.com/2010/01/13/showcase-109/">No End of Trouble. Ever.</a>&#8216;</p>
<p>The essay talks about Haiti&#8217;s violent history, and of the countries incredible tendency towards misfortune:</p>
<blockquote><p>&#8220;How can nature or God or the fates or the universe do this to a country that has borne far too much sadness? An earthquake has now devastated the capital; claiming lives, hopes and the pitifully small dreams that people have held on to, despite political violence, unimaginable poverty, disease, corruption, dictators and nature’s full force of four hurricanes in a row.&#8221;</p></blockquote>
<p>I built this very quick visualization to explore this topic a little further. Specifically, I wanted to compare Haiti to its Caribbean neighbours to see if the country is indeed as unlucky as it seems.</p>
<p>This visualization compares Haiti to 12 other Caribbean nations. It looks at articles published in the New York Times mentioning those countries between 1981 and 2010, and measures the occurence of specific words in those articles.</p>
<p>The pie charts in each row show the percentage of total articles on each country which contain the words in question. For example, we can see that about 25% of articles published about Haiti mention the word &#8216;violence&#8217; &#8211; twice the frequency of any other country on the list.</p>
<p>Haiti has the highest frequency of the words &#8216;coup&#8217;, &#8216;violence&#8217;, &#8216;disease&#8217;, and &#8216;strife&#8217;. It is second or third in mentions of &#8216;death&#8217;, &#8216;unrest&#8217; and &#8216;famine&#8217;.</p>
<p>Likely this week&#8217;s events will lead to many more mentions of these words. As you&#8217;re likely aware, many NGOs small and large are organizing to help Haitians &#8211; both through emergency assistance and through long-term rebuilding. If you want to donate, I&#8217;d highly recommend considering <a href="http://www.architectureforhumanity.org/">Architecture for Humanity</a> (for long-term projects) or <a href="http://www.pih.org/">Partners in Health</a> (for emergency assistance). Both organizations are accepting donations through their websites.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blprnt.com/blog/blprnt/unlucky-haiti-1981-2009/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

