<?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>Allen Day's Blog &#187; Software</title>
	<atom:link href="http://www.spicylogic.com/allenday/blog/category/computing/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.spicylogic.com/allenday/blog</link>
	<description>♥data♥</description>
	<lastBuildDate>Mon, 21 Jun 2010 23:28:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to fix the meetup.com broken exported calendars.</title>
		<link>http://www.spicylogic.com/allenday/blog/2010/01/15/how-to-fix-the-meetupcom-broken-exported-calendars/</link>
		<comments>http://www.spicylogic.com/allenday/blog/2010/01/15/how-to-fix-the-meetupcom-broken-exported-calendars/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 08:57:12 +0000</pubDate>
		<dc:creator>allenday</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.spicylogic.com/allenday/blog/?p=112</guid>
		<description><![CDATA[I&#8217;m a big fan of meetup.com, but they&#8217;re so tragically unhip when it comes to mashups/integration/web 2.0.  One of my biggest gripes until about 6 months ago was that they had no facility (besides API) for exporting a calendar of meetups to my calendar app (I use Google Calendar), or any other calendar app for [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a big fan of <a href="http://meetup.com">meetup.com</a>, but they&#8217;re so tragically unhip when it comes to mashups/integration/web 2.0.  One of my biggest gripes until about 6 months ago was that they had no facility (besides API) for exporting a calendar of meetups to my calendar app (I use Google Calendar), or any other calendar app for that matter.</p>
<p>They introduced an export feature recently, but it&#8217;s pretty useless.  Here&#8217;s why: they offer two calendars</p>
<ul>
<li>[Calendar A] contains all upcoming items in all your meetup groups</li>
<li>[Calendar B] contains upcoming items which you have RSVP&#8217;d with &#8220;yes&#8221; or &#8220;maybe&#8221;.</li>
</ul>
<p>That&#8217;s it.  The calendars exported don&#8217;t even contain links that allow you to RSVP from directly inside your calendar &#8212; you have click through to the meetup.com site, log in, then RSVP.  Ugh.</p>
<p> </p>
<p>Come on, product guys.  What&#8217;s really called for is 4 separate calendars.</p>
<ul>
<li>[Calendar "yes"] All groups, &#8220;yes&#8221; events</li>
<li>[Calendar "maybe"] All groups, &#8220;maybe&#8221; events</li>
<li>[Calendar "no"] All groups, &#8220;no&#8221; events</li>
<li>[Calendar "none"] All groups, events to which I have not yet submitted an RSVP.</li>
</ul>
<p>I was finally just pissed off enough about the status quo that I fixed it for myself, and below I share the code.  You can try it out here: <a href="http://spicylogic.com/allenday/cgi-bin/mu.cgi?key=&lt;your_api_key&gt;&amp;cal=&lt;calendar&gt;">http://spicylogic.com/allenday/cgi-bin/mu.cgi?key=&lt;your_api_key&gt;&amp;cal=&lt;calendar&gt;</a> </p>
<p>where &lt;your_api_key&gt; can be found <a href="http://www.meetup.com/account/oauth_apps/">here</a> and &lt;calendar&gt; is one of &#8220;yes&#8221;, &#8220;no&#8221;, &#8220;none&#8221;, &#8220;maybe&#8221;.</p>
<p>Okay, here&#8217;s the code.  Install it on your own machine if possible, my ISP will appreciate it.  If you find fuckups, let me know and I&#8217;ll update the post.</p>

<div class="wp_syntax"><div class="code"><pre class="perl"><span style="color: #808080; font-style: italic;">#!/usr/bin/perl</span>
<span style="color: #000000; font-weight: bold;">use</span> strict;
<span style="color: #000000; font-weight: bold;">use</span> CGI <span style="color: #000066;">qw</span><span style="color: #66cc66;">&#40;</span>:standard<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">use</span> Date::<span style="color: #006600;">Manip</span> <span style="color: #000066;">qw</span><span style="color: #66cc66;">&#40;</span>ParseDate ParseDateString ParseDateDelta DateCalc UnixDate<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">use</span> Date::<span style="color: #006600;">Parse</span>;
<span style="color: #000000; font-weight: bold;">use</span> HTML::<span style="color: #006600;">Entities</span>;
<span style="color: #000000; font-weight: bold;">use</span> LWP::<span style="color: #006600;">Simple</span> <span style="color: #000066;">qw</span><span style="color: #66cc66;">&#40;</span>get<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">use</span> XML::<span style="color: #006600;">DOM</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> constant URL_EVENTS =<span style="color: #66cc66;">&amp;</span>gt; <span style="color: #ff0000;">'http://api.meetup.com/events?key=%s&amp;amp;member_id=%d&amp;amp;format=xml'</span>;
&nbsp;
<span style="color: #000066;">print</span> header<span style="color: #66cc66;">&#40;</span><span style="color: #000066;">q</span><span style="color: #66cc66;">&#40;</span>text<span style="color: #66cc66;">/</span>calendar<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$parser</span> = <span style="color: #000000; font-weight: bold;">new</span> XML::<span style="color: #006600;">DOM</span>::<span style="color: #006600;">Parser</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$mode</span> = param<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'cal'</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$key</span>  = param<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'key'</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$user</span> = param<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'user'</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">!</span> <span style="color: #0000ff;">$mode</span> <span style="color: #66cc66;">||</span> <span style="color: #66cc66;">!</span> <span style="color: #0000ff;">$key</span> <span style="color: #66cc66;">||</span> <span style="color: #66cc66;">!</span> <span style="color: #0000ff;">$user</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000066;">die</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$events_url</span> = <span style="color: #000066;">sprintf</span><span style="color: #66cc66;">&#40;</span> URL_EVENTS, <span style="color: #0000ff;">$key</span>, <span style="color: #0000ff;">$user</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">#warn $events_url;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$events_txt</span> = get<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$events_url</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">#warn $events_txt;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$events_dom</span> = <span style="color: #0000ff;">$parser</span>-<span style="color: #66cc66;">&amp;</span>gt;parse<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$events_txt</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">#warn $events_dom;</span>
&nbsp;
<span style="color: #000066;">print</span> <span style="color: #000066;">qq</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">BEGIN</span>:VCALENDAR\nPRODID:-<span style="color: #66cc66;">//</span>Meetup Inc<span style="color: #66cc66;">//</span>RemoteApi<span style="color: #66cc66;">//</span>EN\nVERSION:<span style="color: #cc66cc;">2.0</span>\nMETHOD:PUBLISH\nCALSCALE:GREGORIAN\nX-ORIGINAL-URL:http:<span style="color: #66cc66;">//</span>www.meetup.com<span style="color: #66cc66;">/</span>\nX-WR-CALNAME:mu <span style="color: #0000ff;">$mode</span>\n<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$events</span> = <span style="color: #0000ff;">$events_dom</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'item'</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$i</span> = <span style="color: #cc66cc;">0</span> ; <span style="color: #0000ff;">$i</span> <span style="color: #66cc66;">&amp;</span>lt; <span style="color: #0000ff;">$events</span>-<span style="color: #66cc66;">&amp;</span>gt;getLength<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> ; <span style="color: #0000ff;">$i</span>++ <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$event</span> = <span style="color: #0000ff;">$events</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$i</span> <span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_id</span>    = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'id'</span>             <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_rsvp</span>  = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'myrsvp'</span>         <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_addr0</span> = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'venue_name'</span>     <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_addr1</span> = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'venue_address1'</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_addr2</span> = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'venue_address2'</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_addr3</span> = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'venue_address3'</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_addr4</span> = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'venue_city'</span>     <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_addr5</span> = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'venue_state'</span>    <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_addr6</span> = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'venue_zip'</span>      <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_desc</span>  = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'description'</span>    <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_link</span>  = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'event_url'</span>      <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_name</span>  = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'name'</span>           <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_lat</span>   = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'venue_lat'</span>      <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_lon</span>   = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'venue_lon'</span>      <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$n_start_time</span>  = <span style="color: #0000ff;">$event</span>-<span style="color: #66cc66;">&amp;</span>gt;getElementsByTagName<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'time'</span>           <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;item<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&amp;</span>gt;getFirstChild<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$start_time</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$end_time</span>;
&nbsp;
  <span style="color: #808080; font-style: italic;">#my $dummy_time = &quot;20000101T000000Z&quot;;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$sec</span>,<span style="color: #0000ff;">$min</span>,<span style="color: #0000ff;">$hour</span>,<span style="color: #0000ff;">$mday</span>,<span style="color: #0000ff;">$mon</span>,<span style="color: #0000ff;">$year</span>,<span style="color: #0000ff;">$wday</span>,<span style="color: #0000ff;">$yday</span>,<span style="color: #0000ff;">$isdst</span><span style="color: #66cc66;">&#41;</span> = <span style="color: #000066;">localtime</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">time</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$dummy_time</span> = <span style="color: #000066;">sprintf</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000066;">q</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">%</span>04d<span style="color: #66cc66;">%</span>02d<span style="color: #66cc66;">%</span>02dT<span style="color: #66cc66;">%</span>02d<span style="color: #66cc66;">%</span>02d<span style="color: #66cc66;">%</span>02dZ<span style="color: #66cc66;">&#41;</span>, <span style="color: #0000ff;">$year</span> + <span style="color: #cc66cc;">1900</span>, <span style="color: #0000ff;">$mon</span> + <span style="color: #cc66cc;">1</span>, <span style="color: #0000ff;">$mday</span>, <span style="color: #0000ff;">$hour</span>, <span style="color: #0000ff;">$min</span>, <span style="color: #0000ff;">$sec</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$n_start_time</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ss</span>,<span style="color: #0000ff;">$mm</span>,<span style="color: #0000ff;">$hh</span>,<span style="color: #0000ff;">$day</span>,<span style="color: #0000ff;">$month</span>,<span style="color: #0000ff;">$year</span>,<span style="color: #0000ff;">$zone</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$ss</span>,<span style="color: #0000ff;">$mm</span>,<span style="color: #0000ff;">$hh</span>,<span style="color: #0000ff;">$day</span>,<span style="color: #0000ff;">$month</span>,<span style="color: #0000ff;">$year</span>,<span style="color: #0000ff;">$zone</span><span style="color: #66cc66;">&#41;</span> = strptime<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$n_start_time</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0000ff;">$start_time</span> = <span style="color: #000066;">sprintf</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000066;">q</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">%</span>04d<span style="color: #66cc66;">%</span>02d<span style="color: #66cc66;">%</span>02dT<span style="color: #66cc66;">%</span>02d<span style="color: #66cc66;">%</span>02d<span style="color: #66cc66;">%</span>02dZ<span style="color: #66cc66;">&#41;</span>, <span style="color: #0000ff;">$year</span> + <span style="color: #cc66cc;">1900</span>, <span style="color: #0000ff;">$month</span> + <span style="color: #cc66cc;">1</span>, <span style="color: #0000ff;">$day</span>, <span style="color: #0000ff;">$hh</span>, <span style="color: #0000ff;">$mm</span>, <span style="color: #0000ff;">$ss</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$eday</span> = <span style="color: #0000ff;">$day</span>;
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$hh</span> == <span style="color: #cc66cc;">23</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      <span style="color: #0000ff;">$eday</span> = <span style="color: #0000ff;">$day</span> + <span style="color: #cc66cc;">1</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$ehh</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$hh</span> + <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">%</span> <span style="color: #cc66cc;">24</span>;
    <span style="color: #0000ff;">$end_time</span>   = <span style="color: #000066;">sprintf</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000066;">q</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">%</span>04d<span style="color: #66cc66;">%</span>02d<span style="color: #66cc66;">%</span>02dT<span style="color: #66cc66;">%</span>02d<span style="color: #66cc66;">%</span>02d<span style="color: #66cc66;">%</span>02dZ<span style="color: #66cc66;">&#41;</span>, <span style="color: #0000ff;">$year</span> + <span style="color: #cc66cc;">1900</span>, <span style="color: #0000ff;">$month</span> + <span style="color: #cc66cc;">1</span>, <span style="color: #0000ff;">$eday</span>, <span style="color: #0000ff;">$ehh</span>, <span style="color: #0000ff;">$mm</span>, <span style="color: #0000ff;">$ss</span> <span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #0000ff;">$start_time</span> = <span style="color: #ff0000;">''</span>;
    <span style="color: #0000ff;">$end_time</span> = <span style="color: #ff0000;">''</span>;
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$mode</span> eq <span style="color: #0000ff;">$n_rsvp</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$id</span>   = <span style="color: #0000ff;">$n_id</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$name</span> = <span style="color: #0000ff;">$n_name</span> ? <span style="color: #0000ff;">$n_name</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #ff0000;">&quot;&quot;</span>;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$desc</span> = <span style="color: #0000ff;">$n_desc</span> ? <span style="color: #0000ff;">$n_desc</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #ff0000;">&quot;&quot;</span>;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$addr</span> = <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$n_addr0</span> ? <span style="color: #0000ff;">$n_addr0</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">', '</span> : <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">&#41;</span>
             . <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$n_addr1</span> ? <span style="color: #0000ff;">$n_addr1</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">', '</span> : <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">&#41;</span>
             . <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$n_addr2</span> ? <span style="color: #0000ff;">$n_addr2</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">', '</span> : <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">&#41;</span>
             . <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$n_addr3</span> ? <span style="color: #0000ff;">$n_addr3</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">', '</span> : <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">&#41;</span>
             . <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$n_addr4</span> ? <span style="color: #0000ff;">$n_addr4</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">', '</span> : <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">&#41;</span>
             . <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$n_addr5</span> ? <span style="color: #0000ff;">$n_addr5</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">', '</span> : <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">&#41;</span>
             . <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$n_addr6</span> ? <span style="color: #0000ff;">$n_addr6</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #808080; font-style: italic;">#$desc =~ s/(.)/(ord($1) &amp;gt; 127) ? &quot;&quot; : $1/egs;</span>
&nbsp;
    <span style="color: #0000ff;">$name</span> = HTML::<span style="color: #006600;">Entities</span>::<span style="color: #006600;">decode_entities</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$name</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0000ff;">$desc</span> = HTML::<span style="color: #006600;">Entities</span>::<span style="color: #006600;">decode_entities</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$desc</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0000ff;">$addr</span> = HTML::<span style="color: #006600;">Entities</span>::<span style="color: #006600;">decode_entities</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$addr</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0000ff;">$name</span> =~ <span style="color: #000066;">s</span><span style="color: #66cc66;">/</span>,<span style="color: #66cc66;">/</span>\\,<span style="color: #66cc66;">/</span>g;
    <span style="color: #0000ff;">$desc</span> =~ <span style="color: #000066;">s</span><span style="color: #66cc66;">/</span>,<span style="color: #66cc66;">/</span>\\,<span style="color: #66cc66;">/</span>g;
    <span style="color: #0000ff;">$addr</span> =~ <span style="color: #000066;">s</span><span style="color: #66cc66;">/</span>,<span style="color: #66cc66;">/</span>\\,<span style="color: #66cc66;">/</span>g;
&nbsp;
    <span style="color: #0000ff;">$desc</span> =~ <span style="color: #000066;">s</span><span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;">#\\n#gs;</span>
    <span style="color: #0000ff;">$desc</span> .= <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>n<span style="color: #000099; font-weight: bold;">\\</span>n<span style="color: #000099; font-weight: bold;">\\</span>nGoing?<span style="color: #000099; font-weight: bold;">\\</span>n<span style="color: #000099; font-weight: bold;">\\</span>n&quot;</span>;
    <span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$response</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #000066;">qw</span><span style="color: #66cc66;">&#40;</span> yes <span style="color: #000066;">no</span> maybe <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      <span style="color: #0000ff;">$desc</span> .= <span style="color: #000066;">uc</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$response</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066;">qq</span><span style="color: #66cc66;">&#40;</span>: http:<span style="color: #66cc66;">//</span>api.meetup.com<span style="color: #66cc66;">/</span>rsvp?event_id=<span style="color: #0000ff;">$id</span><span style="color: #66cc66;">&amp;</span>amp;key=<span style="color: #0000ff;">$key</span><span style="color: #66cc66;">&amp;</span>amp;rsvp=<span style="color: #0000ff;">$response</span>\\n<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$geo</span> = <span style="color: #0000ff;">$n_lat</span> <span style="color: #66cc66;">&amp;</span>amp;<span style="color: #66cc66;">&amp;</span>amp; <span style="color: #0000ff;">$n_lon</span> ? <span style="color: #ff0000;">&quot;GEO:&quot;</span> . <span style="color: #0000ff;">$n_lat</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">&quot;;&quot;</span> . <span style="color: #0000ff;">$n_lon</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> : <span style="color: #000066;">undef</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">#print sprintf( qq(BEGIN:VEVENT\nSUMMARY:%s\nDESCRIPTION:%s\nLAST-MODIFIED:%s\nUID:%s\nCLASS:%s\nCREATED:%s\nDTSTAMP:%s\nDTSTART:%s\nDTEND:%s\nLOCATION:%s\n\nURL:%s\nEND:VEVENT\n),</span>
    <span style="color: #000066;">print</span> <span style="color: #000066;">sprintf</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000066;">qq</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">BEGIN</span>:VEVENT\nSUMMARY:<span style="color: #0000ff;">%s</span>\nDESCRIPTION:<span style="color: #0000ff;">%s</span>\nLAST-MODIFIED:<span style="color: #0000ff;">%s</span>\nUID:<span style="color: #0000ff;">%s</span>\nCLASS:<span style="color: #0000ff;">%s</span>\nCREATED:<span style="color: #0000ff;">%s</span>\nDTSTAMP:<span style="color: #0000ff;">%s</span>\nDTSTART:<span style="color: #0000ff;">%s</span>\nDTEND:<span style="color: #0000ff;">%s</span>\n<span style="color: #0000ff;">%sLOCATION</span>:<span style="color: #0000ff;">%s</span>\nURL:<span style="color: #0000ff;">%s</span>\nEND:VEVENT\n<span style="color: #66cc66;">&#41;</span>,
      <span style="color: #0000ff;">$name</span>,
      <span style="color: #0000ff;">$desc</span>,
      <span style="color: #0000ff;">$start_time</span>,
      <span style="color: #ff0000;">&quot;event_$id<span style="color: #000099; font-weight: bold;">\@</span>meetup.com&quot;</span>,
      <span style="color: #ff0000;">&quot;PUBLIC&quot;</span>,
      <span style="color: #0000ff;">$dummy_time</span>,
      <span style="color: #0000ff;">$dummy_time</span>,
      <span style="color: #0000ff;">$start_time</span>,
      <span style="color: #0000ff;">$end_time</span>,
      <span style="color: #0000ff;">$geo</span>,
      <span style="color: #0000ff;">$addr</span>,
      <span style="color: #0000ff;">$n_link</span> ? <span style="color: #0000ff;">$n_link</span>-<span style="color: #66cc66;">&amp;</span>gt;toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #ff0000;">&quot;&quot;</span>,
    <span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000066;">print</span> <span style="color: #000066;">qq</span><span style="color: #66cc66;">&#40;</span>END:VCALENDAR\n<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.spicylogic.com/allenday/blog/2010/01/15/how-to-fix-the-meetupcom-broken-exported-calendars/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Synthetic GFF Dataset for Genome Browser Benchmark</title>
		<link>http://www.spicylogic.com/allenday/blog/2009/04/07/synthetic-gff-dataset-for-genome-browser-benchmark/</link>
		<comments>http://www.spicylogic.com/allenday/blog/2009/04/07/synthetic-gff-dataset-for-genome-browser-benchmark/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 08:01:52 +0000</pubDate>
		<dc:creator>allenday</dc:creator>
				<category><![CDATA[Genomics]]></category>
		<category><![CDATA[Informatics]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Scalability]]></category>
		<category><![CDATA[Science]]></category>

		<guid isPermaLink="false">http://www.spicylogic.com/allenday/blog/2009/04/07/synthetic-gff-dataset-for-genome-browser-benchmark/</guid>
		<description><![CDATA[I deployed a Gbrowse/Chado installation last week at Dow Agrosciences.  It got me thinking about how slow and basic the searches are with the Bio::DB::Das::Chado* adaptor, and wouldn&#8217;t it be nice to use SOLR here?
I made up a test dataset of gene/mRNA/exon 3-tiered feature groups by permuting some gene model data from the knownGene annotation [...]]]></description>
			<content:encoded><![CDATA[<p>I deployed a Gbrowse/Chado installation last week at <a href="http://www.dowagro.com/">Dow Agrosciences</a>.  It got me thinking about how slow and basic the searches are with the Bio::DB::Das::Chado* adaptor, and wouldn&#8217;t it be nice to use <a href="http://lucene.apache.org/solr/">SOLR</a> here?</p>
<p>I made up a test dataset of gene/mRNA/exon 3-tiered feature groups by permuting some gene model data from the <a href="http://hgdownload.cse.ucsc.edu/goldenPath/hg18/database/">knownGene annotation set</a> of the Hg18 build of the human genome.  You can grab the data set and script used to generate it <a href="http://www.spicylogic.com/allenday/images/knownGene/">here</a>.  There are several files mRNA.E<strong>N</strong>.txt.gz that contain gzipped gene models, where <strong>N</strong>=3..7 indicates there are 10^<strong>N</strong> models in the file, uniformly distributed across a 500-megabase reference sequence.</p>
<p>I&#8217;m planning to load these data into a couple of different systems and then compare performance on some of the typical Bio::DB::GFF API calls.  I can personally test on:</p>
<ul>
<li>Chado</li>
<li>The default Bio::DB::GFF schema (does it have a name?)</li>
<li>The SOLR backend I&#8217;m about to implement</li>
</ul>
<p>I know there are other feature DBs out there.  It would be good to include them as well in a later pass or to have someone else contribute the data once I get the benchmarking script written.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spicylogic.com/allenday/blog/2009/04/07/synthetic-gff-dataset-for-genome-browser-benchmark/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Taste item-item recommender example</title>
		<link>http://www.spicylogic.com/allenday/blog/2009/02/11/taste-item-item-recommender-example/</link>
		<comments>http://www.spicylogic.com/allenday/blog/2009/02/11/taste-item-item-recommender-example/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 22:10:00 +0000</pubDate>
		<dc:creator>allenday</dc:creator>
				<category><![CDATA[Analytics]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mahout]]></category>

		<guid isPermaLink="false">http://www.spicylogic.com/allenday/blog/2009/02/11/taste-item-item-recommender-example/</guid>
		<description><![CDATA[I threw together a Mahout/Taste based item-item based recommender last night.

	public static void itemItemRecommendations&#40;String path, String file&#41; &#123;
		File f = new File&#40;path, file&#41;;
	    try &#123;
			DataModel model = new FileDataModel&#40;f&#41;;
			model.refresh&#40;null&#41;;
		    ItemSimilarity itemSimilarity = new LogLikelihoodSimilarity&#40;model&#41;;
		    ItemBasedRecommender itemRecommender = new GenericItemBasedRecommender&#40;model, itemSimilarity&#41;;
		    for &#40; Item [...]]]></description>
			<content:encoded><![CDATA[<p>I threw together a Mahout/Taste based item-item based recommender last night.</p>

<div class="wp_syntax"><div class="code"><pre class="java">	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #993333;">void</span> itemItemRecommendations<span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">String</span> path, <span style="color: #aaaadd; font-weight: bold;">String</span> file<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #aaaadd; font-weight: bold;">File</span> f = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">File</span><span style="color: #66cc66;">&#40;</span>path, file<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
	    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>
			DataModel model = <span style="color: #000000; font-weight: bold;">new</span> FileDataModel<span style="color: #66cc66;">&#40;</span>f<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
			model.<span style="color: #006600;">refresh</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		    ItemSimilarity itemSimilarity = <span style="color: #000000; font-weight: bold;">new</span> LogLikelihoodSimilarity<span style="color: #66cc66;">&#40;</span>model<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		    ItemBasedRecommender itemRecommender = <span style="color: #000000; font-weight: bold;">new</span> GenericItemBasedRecommender<span style="color: #66cc66;">&#40;</span>model, itemSimilarity<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span> Item i : model.<span style="color: #006600;">getItems</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>
			    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span> RecommendedItem j : itemRecommender.<span style="color: #006600;">mostSimilarItems</span><span style="color: #66cc66;">&#40;</span>i.<span style="color: #006600;">getID</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>
			    	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> j.<span style="color: #006600;">getValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&gt;</span>= <span style="color: #cc66cc;">0.7</span> <span style="color: #66cc66;">&#41;</span>
			    		<span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>i.<span style="color: #006600;">getID</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> + j.<span style="color: #006600;">getItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getID</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> + <span style="color: #aaaadd; font-weight: bold;">String</span>.<span style="color: #006600;">format</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;%.3f&quot;</span>, j.<span style="color: #006600;">getValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">FileNotFoundException</span> e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// TODO Auto-generated catch block</span>
			e.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span>TasteException e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// TODO Auto-generated catch block</span>
			e.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>This outputs item1 &#8211;recommends&#8211;>item2 pairs with a weight.  I&#8217;m taking this and putting it into a solr document so I can display related item2s alongside item1 when it&#8217;s viewed.</p>
<p>Input data are comma-delimited <userID,itemID,score> tuples like so:</p>
<pre>
1fe7401b81eed49353d0cbeba5383848,5212,0.6
3c1832954a6e8781836fed670bb37b24,5212,1
70273e4c7c77700ee97acb8d0306c405,5213,0.8
1f057ccde135acbc881008bbf466e7e1,5213,1
51d44c7baca65ad39d11ba87bf2d438b,5213,1
adc924559b37114cd97d1f5cf7c71419,5213,1
78e254b4a11e61d76ff63cea02de4de8,5213,1
5c373ec7d9ad4a6f392c291d8ccba5ce,5213,0.2
fab8537564094fa8885f6214e6b682e1,5213,1
127f46aabcdbc2d2d04da8398a996c75,5213,1
</pre>
<p>Works great.  Thanks Sean.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spicylogic.com/allenday/blog/2009/02/11/taste-item-item-recommender-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upcoming AI / Machine Learning Conferences</title>
		<link>http://www.spicylogic.com/allenday/blog/2008/12/05/upcoming-ai-machine-learning-conferences/</link>
		<comments>http://www.spicylogic.com/allenday/blog/2008/12/05/upcoming-ai-machine-learning-conferences/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 19:49:13 +0000</pubDate>
		<dc:creator>allenday</dc:creator>
				<category><![CDATA[Analytics]]></category>
		<category><![CDATA[Informatics]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://www.spicylogic.com/allenday/blog/2008/12/05/upcoming-ai-machine-learning-conferences/</guid>
		<description><![CDATA[A (partial) list I found today.  Doesn&#8217;t include NIPS, so I&#8217;m not sure how exhaustive it is, but it has a bunch I haven&#8217;t seen before.
http://www.kmining.com/info_conferences.html
]]></description>
			<content:encoded><![CDATA[<p>A (partial) list I found today.  Doesn&#8217;t include NIPS, so I&#8217;m not sure how exhaustive it is, but it has a bunch I haven&#8217;t seen before.</p>
<p><a href="http://www.kmining.com/info_conferences.html">http://www.kmining.com/info_conferences.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.spicylogic.com/allenday/blog/2008/12/05/upcoming-ai-machine-learning-conferences/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parallel DNS reverse lookups</title>
		<link>http://www.spicylogic.com/allenday/blog/2008/11/10/parallel-dns-reverse-lookups/</link>
		<comments>http://www.spicylogic.com/allenday/blog/2008/11/10/parallel-dns-reverse-lookups/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 20:43:53 +0000</pubDate>
		<dc:creator>allenday</dc:creator>
				<category><![CDATA[Distributed Systems]]></category>
		<category><![CDATA[Hadoop]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.spicylogic.com/allenday/blog/2008/11/10/parallel-dns-reverse-lookups/</guid>
		<description><![CDATA[Need to do lots of reverse DNS lookups for some reason?  Maybe b/c you&#8217;re trying to get a seed list for a web crawl or hack attempt on a bunch of ISPs.  Who cares.  Here&#8217;s a quick way to generate names from a big list of IPs like:

1.1.1.1
1.1.1.2
[...]
254.254.254.253
254.254.254.254

We can use hadoop streaming [...]]]></description>
			<content:encoded><![CDATA[<p>Need to do lots of reverse DNS lookups for some reason?  Maybe b/c you&#8217;re trying to get a seed list for a web crawl or hack attempt on a bunch of ISPs.  Who cares.  Here&#8217;s a quick way to generate names from a big list of IPs like:</p>
<pre>
1.1.1.1
1.1.1.2
[...]
254.254.254.253
254.254.254.254
</pre>
<p>We can use hadoop streaming to chunk the list so we can do the DNS lookups in parallel.  Easy and requires little to know thought:</p>

<div class="wp_syntax"><div class="code"><pre class="bash">.<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>hadoop jar contrib<span style="color: #000000; font-weight: bold;">/</span>streaming<span style="color: #000000; font-weight: bold;">/*</span>-streaming.jar -input <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>aday<span style="color: #000000; font-weight: bold;">/</span>classC.dat -output <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>aday<span style="color: #000000; font-weight: bold;">/</span>classC_dns.dat -mapper <span style="color: #ff0000;">'perl -ne '</span>\<span style="color: #ff0000;">''</span>print `host <span style="color: #007800;">$_</span>`<span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\'</span>'</span><span style="color: #ff0000;">' -numReduceTasks 0</span></pre></div></div>

<p>We wrap the <code>host</code> call in backticks so we can trap non-zero exit codes and get an error message on stdout courtesy of perl.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spicylogic.com/allenday/blog/2008/11/10/parallel-dns-reverse-lookups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ZIP code demographic data with Perl</title>
		<link>http://www.spicylogic.com/allenday/blog/2008/10/29/zip-code-demographic-data-with-perl/</link>
		<comments>http://www.spicylogic.com/allenday/blog/2008/10/29/zip-code-demographic-data-with-perl/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 07:45:04 +0000</pubDate>
		<dc:creator>allenday</dc:creator>
				<category><![CDATA[Analytics]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://www.spicylogic.com/allenday/blog/2008/10/29/zip-code-demographic-data-with-perl/</guid>
		<description><![CDATA[I needed some demographics data earlier this week and tried using the SF3 files from census.gov&#8217;s &#8220;Census 2000&#8243; data set.
What a time sink.  Ugh.
The methods used are very well documented, and I learned a lot about the census.  What I was not able to learn, however, was how to actually extract the data [...]]]></description>
			<content:encoded><![CDATA[<p>I needed some demographics data earlier this week and tried using the SF3 files from <a href="http://census.gov">census.gov</a>&#8217;s &#8220;Census 2000&#8243; data set.</p>
<p>What a time sink.  Ugh.</p>
<p>The methods used are very well documented, and I learned a lot about the census.  What I was not able to learn, however, was how to <i>actually extract the data</i> from the flat files.  Look at what <a href="http://www.rdfabout.com/demo/census/">Joshua Tauberer</a> went through to get some idea of the pain level.</p>
<p>Finally I got fed up and wrote a screen scraper for <a href="http://zipskinny.com">ZIPskinny.com</a> in Perl.  It&#8217;s one-off crappy code.  You can get it from CPAN under namespace <a href="http://search.cpan.org/~allenday/Geo-Demo-Zipskinny-0.01/">Geo::Demo::Zipskinny</a>.</p>
<p>Hope it saves you some time.  Leave me a comment if you have <i>working code</i> that can deal with SF3 files.</p>
<p>Here&#8217;s a little ZIP code to rich-vs-poor plot I made earlier.<br />
<img src='http://img362.imageshack.us/img362/9338/incomeeu3.png' alt='' width='600' class='alignnone' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.spicylogic.com/allenday/blog/2008/10/29/zip-code-demographic-data-with-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java port of GNU getopt</title>
		<link>http://www.spicylogic.com/allenday/blog/2008/10/22/java-port-of-gnu-getopt/</link>
		<comments>http://www.spicylogic.com/allenday/blog/2008/10/22/java-port-of-gnu-getopt/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 02:12:10 +0000</pubDate>
		<dc:creator>allenday</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.spicylogic.com/allenday/blog/2008/10/22/java-port-of-gnu-getopt/</guid>
		<description><![CDATA[This looks useful
http://www.urbanophile.com/arenn/hacking/getopt/gnu.getopt.Getopt.html
]]></description>
			<content:encoded><![CDATA[<p>This looks useful<br />
<a href="http://www.urbanophile.com/arenn/hacking/getopt/gnu.getopt.Getopt.html">http://www.urbanophile.com/arenn/hacking/getopt/gnu.getopt.Getopt.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.spicylogic.com/allenday/blog/2008/10/22/java-port-of-gnu-getopt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webserver logs access time by region/language</title>
		<link>http://www.spicylogic.com/allenday/blog/2008/10/22/webserver-logs-access-time-by-regionlanguage/</link>
		<comments>http://www.spicylogic.com/allenday/blog/2008/10/22/webserver-logs-access-time-by-regionlanguage/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 02:09:39 +0000</pubDate>
		<dc:creator>allenday</dc:creator>
				<category><![CDATA[Analytics]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://www.spicylogic.com/allenday/blog/2008/10/22/webserver-logs-access-time-by-regionlanguage/</guid>
		<description><![CDATA[As anyone with a popular website knows, there&#8217;s a big difference in the resources required for peak vs. off-peak hours and you typically have to pay for peak usage even if you don&#8217;t always use it (e.g. 95th percentile bandwidth billing)
Frugal as I am, I was curious to see if I could increase traffic during [...]]]></description>
			<content:encoded><![CDATA[<p>As anyone with a popular website knows, there&#8217;s a big difference in the resources required for peak vs. off-peak hours and you typically have to pay for peak usage even if you don&#8217;t always use it (e.g. 95th percentile bandwidth billing)</p>
<p>Frugal as I am, I was curious to see if I could increase traffic during what are off-peak hours.  Seemed sensible that people in different regions of the world might be accessing during off-hours.</p>
<p>So I aggregated data by country code/language and 10-minute time segment.  Applied a Daniell smoothing kernel (a sliding window) of 6 segments (1 hour) and plotted a a row-scaled heatmap in R.  Rows are clustered so similar access patterns are next to one another, with the left-hand-side dendrogram indicating dissimilarity between rows.  Yellow-white is a traffic burst.  I&#8217;ll post the code and data later for how I made this.</p>
<p><a href="http://img80.imageshack.us/img80/6247/l10naccesslb0.png"><img width="300" src='http://img80.imageshack.us/img80/6247/l10naccesslb0.png' alt='access times by country/language' class='alignnone' /></a></p>
<p>As it turns out, the main off-peak trough corresponds to the middle of the Pacific ocean.  Kinda watery for people to live there.  Oh well, I tried.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spicylogic.com/allenday/blog/2008/10/22/webserver-logs-access-time-by-regionlanguage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>R Matrix sparseVector operations</title>
		<link>http://www.spicylogic.com/allenday/blog/2008/10/22/r-matrix-sparsevector-operations/</link>
		<comments>http://www.spicylogic.com/allenday/blog/2008/10/22/r-matrix-sparsevector-operations/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 01:57:49 +0000</pubDate>
		<dc:creator>allenday</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://www.spicylogic.com/allenday/blog/?p=84</guid>
		<description><![CDATA[I&#8217;ve only done minus(vec1,vec2) so far.  More to come.

library(Matrix);
&#160;
#F = strsplit(as.character(mm[1,2]),', ')[[1]]
#G = matrix( as.numeric(unlist(strsplit(F[c(-1,-length(F))],':'))), nrow=2 )
#tt = new('dsparseVector', x=G[2,], i=as.integer(G[1,]), length=max(as.integer(G[1,])))
&#160;
minus = function(v1,v2) {
  i = sort(union(v1@i,v2@i));
  s = length(i);
&#160;
  x = vector(mode='numeric',length=s);
  for ( k in 1:s ) {
    z = i[k];
    [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve only done minus(vec1,vec2) so far.  More to come.</p>

<div class="wp_syntax"><div class="code"><pre>library(Matrix);
&nbsp;
#F = strsplit(as.character(mm[1,2]),', ')[[1]]
#G = matrix( as.numeric(unlist(strsplit(F[c(-1,-length(F))],':'))), nrow=2 )
#tt = new('dsparseVector', x=G[2,], i=as.integer(G[1,]), length=max(as.integer(G[1,])))
&nbsp;
minus = function(v1,v2) {
  i = sort(union(v1@i,v2@i));
  s = length(i);
&nbsp;
  x = vector(mode='numeric',length=s);
  for ( k in 1:s ) {
    z = i[k];
    if ( z &lt; length(v1) ) {
      x[k] = as.numeric(v1[z]);
    }
    if ( z &lt; length(v2) ) {
      x[k] = x[k] - as.numeric(v2[z]);
    }
  }
  new(&quot;dsparseVector&quot;, x=x, i=i, length=max(v1@i,v2@i))
}</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.spicylogic.com/allenday/blog/2008/10/22/r-matrix-sparsevector-operations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress &#8211; collapse redundant tags</title>
		<link>http://www.spicylogic.com/allenday/blog/2008/10/19/wordpress-collapse-redundant-tags/</link>
		<comments>http://www.spicylogic.com/allenday/blog/2008/10/19/wordpress-collapse-redundant-tags/#comments</comments>
		<pubDate>Sun, 19 Oct 2008 08:27:10 +0000</pubDate>
		<dc:creator>allenday</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.spicylogic.com/allenday/blog/?p=75</guid>
		<description><![CDATA[I&#8217;ve been experimenting with automation of WordPress posts.  Probably I&#8217;m doing something wrong with the way I make the XML RPC calls, but I find that I end up with redundant tags in my database.  For instance, if I tagged two separate, RPC-posted posts with &#8220;orange&#8221;, I get two different tags both called [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been experimenting with automation of WordPress posts.  Probably I&#8217;m doing something wrong with the way I make the XML RPC calls, but I find that I end up with redundant tags in my database.  For instance, if I tagged two separate, RPC-posted posts with &#8220;orange&#8221;, I get two different tags both called &#8220;orange&#8221;.  Until I figure out how to fix this properly, here&#8217;s a little script that will clean up the database by consolidating all redundantly named tags to one tag.  You might want to back up your database before using this&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="perl"><span style="color: #808080; font-style: italic;">#!/usr/bin/perl</span>
<span style="color: #000000; font-weight: bold;">use</span> strict;
<span style="color: #000000; font-weight: bold;">use</span> DBI;
&nbsp;
<span style="color: #808080; font-style: italic;">######configuration</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$PREFIX</span> = <span style="color: #ff0000;">'wp_h5otpn_'</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$DB</span> = <span style="color: #ff0000;">''</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$HOST</span> = <span style="color: #ff0000;">''</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$USER</span> = <span style="color: #ff0000;">''</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$PASS</span> = <span style="color: #ff0000;">''</span>;
<span style="color: #808080; font-style: italic;">######</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$dbh</span> = DBI-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">connect</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">qq</span><span style="color: #66cc66;">&#40;</span>dbi:mysql:database=<span style="color: #0000ff;">$DB</span>;host=<span style="color: #0000ff;">$HOST</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #0000ff;">$USER</span>, <span style="color: #0000ff;">$PASS</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">or</span> <span style="color: #000066;">die</span> $<span style="color: #66cc66;">!</span>;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$term_sth</span>   = <span style="color: #0000ff;">$dbh</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">qq</span><span style="color: #66cc66;">&#40;</span>SELECT <span style="color: #66cc66;">*</span> FROM <span style="color: #66cc66;">&#40;</span>SELECT name, count<span style="color: #66cc66;">&#40;</span>name<span style="color: #66cc66;">&#41;</span> AS c FROM $<span style="color: #66cc66;">&#123;</span>PREFIX<span style="color: #66cc66;">&#125;</span>terms GROUP BY name<span style="color: #66cc66;">&#41;</span> AS d WHERE d.c <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$name_sth</span>   = <span style="color: #0000ff;">$dbh</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">qq</span><span style="color: #66cc66;">&#40;</span>SELECT term_id FROM $<span style="color: #66cc66;">&#123;</span>PREFIX<span style="color: #66cc66;">&#125;</span>terms WHERE name = ?<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$update_sth</span> = <span style="color: #0000ff;">$dbh</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">qq</span><span style="color: #66cc66;">&#40;</span>UPDATE $<span style="color: #66cc66;">&#123;</span>PREFIX<span style="color: #66cc66;">&#125;</span>term_relationships SET term_taxonomy_id = <span style="color: #66cc66;">&#40;</span>SELECT term_taxonomy_id FROM $<span style="color: #66cc66;">&#123;</span>PREFIX<span style="color: #66cc66;">&#125;</span>term_taxonomy WHERE term_id = ?<span style="color: #66cc66;">&#41;</span> WHERE term_taxonomy_id = <span style="color: #66cc66;">&#40;</span>SELECT term_taxonomy_id FROM $<span style="color: #66cc66;">&#123;</span>PREFIX<span style="color: #66cc66;">&#125;</span>term_taxonomy WHERE term_id = ?<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$delete1_sth</span> = <span style="color: #0000ff;">$dbh</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">qq</span><span style="color: #66cc66;">&#40;</span>DELETE FROM $<span style="color: #66cc66;">&#123;</span>PREFIX<span style="color: #66cc66;">&#125;</span>term_taxonomy WHERE term_id = ?<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$delete2_sth</span> = <span style="color: #0000ff;">$dbh</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">qq</span><span style="color: #66cc66;">&#40;</span>DELETE FROM $<span style="color: #66cc66;">&#123;</span>PREFIX<span style="color: #66cc66;">&#125;</span>terms WHERE term_id = ?<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$term_sth</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #b1b100;">my</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$name</span>, <span style="color: #0000ff;">$count</span> <span style="color: #66cc66;">&#41;</span> = <span style="color: #0000ff;">$term_sth</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">fetchrow_array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #0000ff;">$name_sth</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$name</span> <span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$new</span> = <span style="color: #000066;">undef</span>;
  <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #b1b100;">my</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$term_id</span> <span style="color: #66cc66;">&#41;</span> = <span style="color: #0000ff;">$name_sth</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">fetchrow_array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">!</span> <span style="color: #0000ff;">$new</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      <span style="color: #0000ff;">$new</span> = <span style="color: #0000ff;">$term_id</span>;
      <span style="color: #b1b100;">next</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #000066;">warn</span> <span style="color: #ff0000;">&quot;$name<span style="color: #000099; font-weight: bold;">\t</span>$term_id<span style="color: #000099; font-weight: bold;">\t</span>-&gt;<span style="color: #000099; font-weight: bold;">\t</span>$new&quot;</span>;
    <span style="color: #0000ff;">$update_sth</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$new</span>, <span style="color: #0000ff;">$term_id</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0000ff;">$delete1_sth</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$term_id</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0000ff;">$delete2_sth</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$term_id</span> <span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">__DATA__</span>
SELECT t.term_id, t.name, r.<span style="color: #66cc66;">*</span>, <span style="color: #000066;">s</span>.<span style="color: #66cc66;">*</span> FROM wp_h5otpn_terms AS t, wp_h5otpn_term_taxonomy AS r, wp_h5otpn_term_relationships AS <span style="color: #000066;">s</span> WHERE <span style="color: #000066;">s</span>.term_taxonomy_id = r.term_taxonomy_id AND r.term_id = t.term_id AND r.taxonomy = <span style="color: #ff0000;">'post_tag'</span> AND t.name = <span style="color: #ff0000;">'whatever'</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.spicylogic.com/allenday/blog/2008/10/19/wordpress-collapse-redundant-tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
