<?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>Threepress Consulting blog &#187; twitter</title>
	<atom:link href="http://blog.threepress.org/tag/twitter/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.threepress.org</link>
	<description>Threepress creates software for publishers, educators and authors.</description>
	<lastBuildDate>Mon, 09 Jan 2012 13:02:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tools of Change twitter visualization</title>
		<link>http://blog.threepress.org/2009/02/15/tools-of-change-twitter-visualization/</link>
		<comments>http://blog.threepress.org/2009/02/15/tools-of-change-twitter-visualization/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 18:51:42 +0000</pubDate>
		<dc:creator>Liza Daly</dc:creator>
				<category><![CDATA[geek]]></category>
		<category><![CDATA[toc]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://blog.threepress.org/?p=342</guid>
		<description><![CDATA[Geeks love raw data, so I couldn&#8217;t resist a text dump of all #toc tweets that occurred during the conference.
Here&#8217;s the quick visualization I threw together (warning, it loads very slowly):

It skips any images that are broken or any that were listed as having the Twitter default icon.  For some reason the raw data [...]]]></description>
			<content:encoded><![CDATA[<p>Geeks love raw data, so I couldn&#8217;t resist a <a href="http://toc.oreilly.com/2009/02/very-raw-dump-of-all-toc-2009.html">text dump of all #toc tweets</a> that occurred during the conference.</p>
<p>Here&#8217;s the quick visualization I threw together (warning, it loads very slowly):</p>
<p><a href="http://threepress.org/static/toctweets/"><img src="http://blog.threepress.org/wp-content/uploads/2009/02/picture-71-300x235.png" alt="TOC tweet visualization" title="TOC tweet visualization" width="300" height="235" class="aligncenter size-medium wp-image-343" /></a></p>
<p>It skips any images that are broken or any that were listed as having the Twitter default icon.  For some reason the raw data included a lot of default icons it shouldn&#8217;t have &#8212; for example, all of my tweets were listed with the default instead of my profile photo.  Those are missing.  I recommend starting with the XML instead (posted after I wrote this) and getting the profile icons directly via Twitter.</p>
<p>Source code that generates this from the raw text (not from the XML) follows:</p>
<p><span id="more-342"></span></p>
<pre class="brush: plain;">
#!/usr/bin/python
import re, copy, urllib, sys

# Pattern-match the twitter username
p = re.compile('^([^:]+):(.*)$')

data = []
tweet = None

for line in open('toc-tweets.txt'):

    # If we're not currently in a tweet, start a new record
    if not tweet:
        tweet = {}

    # Skip the useless relative date values
    if line.endswith('ago'):
        continue

    # This is an end-of-tweet marker, so push it on the stack
    # and reset the temporary datastore
    if line.startswith('*'):
        data.append(copy.deepcopy(tweet))
        tweet = None
        continue

    # Grab the user's image
    if line.startswith('http://'):
        tweet['img'] = line
        continue

    m = p.search(line)
    if m:
        # If we matched the regexps then we have a line containing a valid tweet
        tweet['name'] = m.group(1)
        tweet['message'] = m.group(2).replace('&amp;', '&amp;amp;')

# Put in chronological order
data.reverse()

print '''&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
  &lt;head&gt;
    &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html;charset=UTF-8&quot; /&gt;
    &lt;title&gt;#toc timeline&lt;/title&gt;
    &lt;script src=&quot;http://www.google.com/jsapi&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
      google.load(&quot;jquery&quot;, &quot;1.3&quot;);
    &lt;/script&gt;
    &lt;script src=&quot;jqueryui/jquery-ui-personalized-1.6rc6.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;style type=&quot;text/css&quot;&gt;
       .tweet span { display: none; width: 300px; height:200px;  }
       .tweet { display: inline; z-index: -1;}
       .drop { width: 240px; height: 135px; padding: 0.4em; position:absolute;background:white;z-index:99;}
       .drop h3 { margin: 0; padding: 0.4em; text-align: center; }

    &lt;/style&gt;
    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;jqueryui/theme/ui.all.css&quot;&gt;&lt;/link&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    jQuery(document).ready(function() {
      $('.tweet').click(function() {
        $(this).find('span').toggle('fast');
      });
    });
    &lt;/script&gt;
   &lt;/head&gt;
&lt;body&gt;
'''

images = {}

for t in data:
    if 'default_profile' in t['img']:
        continue
    image = t['img'].replace('mini', 'bigger')
    if image not in images:
        sys.stderr.write(&quot;Checking %s\n&quot; % image)
        i = urllib.urlopen(image).read()
        if 'Error' in i:
            sys.stderr.write(&quot;Skipping...&quot;)
            continue
        images[image] = 1

    print '''
&lt;span class=&quot;tweet&quot;&gt;
  &lt;img src=&quot;%s&quot; alt=&quot;%s&quot; width=&quot;73&quot; height=&quot;73&quot; /&gt;
  &lt;span class=&quot;ui-widget-content ui-corner-all drop&quot;&gt;
    &lt;h3 class=&quot;ui-widget-header ui-corner-all&quot;&gt;&lt;a href=&quot;http://twitter.com/%s&quot;&gt;%s&lt;/a&gt;&lt;/h3&gt;
    &lt;blockquote&gt;%s&lt;/blockquote&gt;
  &lt;/span&gt;
&lt;/span&gt;
''' % ( t['img'].replace('mini', 'bigger'),
       t['name'],
       t['name'],
       t['name'],
       t['message'])

print '''
&lt;/body&gt;
&lt;/html&gt;
'''
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.threepress.org/2009/02/15/tools-of-change-twitter-visualization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

