<?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>Steven She at woggie.net</title>
	<atom:link href="http://www.woggie.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.woggie.net</link>
	<description>The life of a PhD Candidate in Software Engineering</description>
	<lastBuildDate>Wed, 16 Jun 2010 22:12:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Converting PDFs to SWF</title>
		<link>http://www.woggie.net/2010/05/24/converting-pdfs-to-swf-for-adobe-connect/</link>
		<comments>http://www.woggie.net/2010/05/24/converting-pdfs-to-swf-for-adobe-connect/#comments</comments>
		<pubDate>Tue, 25 May 2010 02:39:11 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.woggie.net/?p=237</guid>
		<description><![CDATA[Update: This doesn&#8217;t work for Adobe Connect. I uploaded the converted SWF to Connect only to lose the keyboard input necessary for changing pages. I ended up using the old Macromedia FlashPaper on Windows to create a usable SWF. A basic SWFTools viewer with several mouse buttons for navigation would be a nice solution, but [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update</strong>: This doesn&#8217;t work for Adobe Connect. I uploaded the converted SWF to Connect only to lose the keyboard input necessary for changing pages. I ended up using the old <a href="http://www.adobe.com/products/flashpaper/">Macromedia FlashPaper</a> on Windows to create a usable SWF. A basic SWFTools viewer with several mouse buttons for navigation would be a nice solution, but I haven&#8217;t found one just yet.</p>
<p>We&#8217;ve been using Adobe Connect in the lab recently, but, ironically, our version of Adobe Connect did not support PDFs (I suppose this is a remnant of the old Macromedia buyout). In any case, a nice solution is to convert the PDF to a SWF. Lucky for us, there is an OSS tool just for that. Enter, <a href="http://http://www.swftools.org">SWFTools</a>. The suite contains the tool, <code>pdf2swf</code> designed just the purpose. The default settings for the tool progress through the pages in the PDF like a slideshow; definately not what we want for a presentation. We can, however, specify a viewer to use. SWFTools ship with a keyboard viewer that work great for presentations. Execute this command (on Arch Linux, change the location of <code>keyboard_viewer.swf</code> for other distributions accordingly) to convert a PDF:</p>
<pre>
pdf2swf -B /usr/share/swftools/swfs/keyboard_viewer.swf doc.pdf
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2010/05/24/converting-pdfs-to-swf-for-adobe-connect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t make a class with the same name okay</title>
		<link>http://www.woggie.net/2010/05/05/dont-make-a-class-with-the-same-name-okay/</link>
		<comments>http://www.woggie.net/2010/05/05/dont-make-a-class-with-the-same-name-okay/#comments</comments>
		<pubDate>Wed, 05 May 2010 18:16:54 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Asides]]></category>

		<guid isPermaLink="false">http://www.woggie.net/?p=235</guid>
		<description><![CDATA[Note to self: when working when multi-module maven projects, do not have a class with the same fully-qualified name in another module. Be prepared for obscure run-time errors causing immense frustration otherwise.]]></description>
			<content:encoded><![CDATA[<p>Note to self: when working when multi-module maven projects, do <strong>not</strong> have a class with the same fully-qualified name in another module. Be prepared for obscure run-time errors causing immense frustration otherwise.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2010/05/05/dont-make-a-class-with-the-same-name-okay/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing Skype lag with Pulseaudio 0.9.21</title>
		<link>http://www.woggie.net/2010/04/20/fixing-skype-lag-with-pulseaudio-0-9-21/</link>
		<comments>http://www.woggie.net/2010/04/20/fixing-skype-lag-with-pulseaudio-0-9-21/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 22:29:23 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.woggie.net/2010/04/20/fixing-skype-lag-with-pulseaudio/</guid>
		<description><![CDATA[I had some trouble with my audio output lagging for a couple seconds when using my USB headset with Pulseaudio 0.9.21 on Arch Linux. It turned out to be a problem with the Pulseaudio suspending the USB headset when it was idle. Commenting out module-suspend-on-idle in /etc/pulse/system.pa and /etc/pulse/default.pa is a quick fix, but it [...]]]></description>
			<content:encoded><![CDATA[<p>I had some trouble with my audio output lagging for a couple seconds when using my USB headset with Pulseaudio 0.9.21 on Arch Linux. It turned out to be a problem with the Pulseaudio suspending the USB headset when it was idle. Commenting out <code>module-suspend-on-idle</code> in /etc/pulse/system.pa and /etc/pulse/default.pa is a quick fix, but it removes support to USB suspend. </p>
<p>It turns out that there was a <a href="http://www.mail-archive.com/pulseaudio-commits@mail.0pointer.de/msg02490.html">bug in Pulseaudio</a> that&#8217;s fixed in git upstream, but not yet released. Apply the patch to 0.9.21 and re-compile to fix the problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2010/04/20/fixing-skype-lag-with-pulseaudio-0-9-21/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generating LKC Parser</title>
		<link>http://www.woggie.net/2010/02/04/generating-lkc-parser/</link>
		<comments>http://www.woggie.net/2010/02/04/generating-lkc-parser/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 00:25:02 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Asides]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.woggie.net/?p=193</guid>
		<description><![CDATA[A quick hint for compiling the LKC parser. The kbuild system requires that bison 2.3 is used. Newer versions (in my case, 2.4) generate code that throw a compilation error.]]></description>
			<content:encoded><![CDATA[<p>A quick hint for compiling the LKC parser. The kbuild system requires that bison 2.3 is used. Newer versions (in my case, 2.4) generate code that throw a compilation error.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2010/02/04/generating-lkc-parser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Goodbye Leipzig and Linz</title>
		<link>http://www.woggie.net/2010/01/31/goodbye-linz/</link>
		<comments>http://www.woggie.net/2010/01/31/goodbye-linz/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 00:33:50 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.woggie.net/2010/01/31/goodbye-linz/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<div class="photo-wrapper" style="text-align: center;">
<a href="http://www.flickr.com/photos/mentosfreshness/4320762920/" title="photo sharing"><img src="http://farm5.static.flickr.com/4039/4320762920_6946709cb8.jpg" class="photo" alt="" /></a></p>
<p><a href="http://www.flickr.com/photos/mentosfreshness/4301293195/" title="photo sharing"><img src="http://farm3.static.flickr.com/2723/4301293195_62e20ac30e_m.jpg" class="photo" alt="" /></a>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2010/01/31/goodbye-linz/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In Linz</title>
		<link>http://www.woggie.net/2010/01/27/in-linz/</link>
		<comments>http://www.woggie.net/2010/01/27/in-linz/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 20:06:07 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.woggie.net/2010/01/27/in-linz/</guid>
		<description><![CDATA[Arrived in Linz yesterday night by train. Getting from tram station to the hotel was difficult since the wheel&#8217;s didn&#8217;t really work with all the snow on the group. I had completely overlooked the fact that there might be snow when packing in Toronto. This shot was taken during the lunch break at the Vamos [...]]]></description>
			<content:encoded><![CDATA[<div class="photo-wrapper">
<a href="http://www.flickr.com/photos/mentosfreshness/4309917064/" title="photo sharing"><img src="http://farm5.static.flickr.com/4067/4309917064_968cf76b3e.jpg" class="photo" alt="" /></a>
</div>
<p>
Arrived in Linz yesterday night by train. Getting from tram station to the hotel was difficult since the wheel&#8217;s didn&#8217;t really work with all the snow on the group. I had completely overlooked the fact that there might be snow when packing in Toronto. This shot was taken during the lunch break at the Vamos workshop today. The pond must have been deep since it was definitely below zero yet the water wasn&#8217;t frozen over.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2010/01/27/in-linz/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Monument of the Battle of Nations</title>
		<link>http://www.woggie.net/2010/01/24/the-monument-of-the-battle-of-nations/</link>
		<comments>http://www.woggie.net/2010/01/24/the-monument-of-the-battle-of-nations/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 12:31:53 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.woggie.net/2010/01/24/the-monument-of-the-battle-of-nations/</guid>
		<description><![CDATA[Thorsten and Maria brought me to the Monument of the Battle of Nations today. I went with the expectation of seeing a statue, only to find this monolithic structure overlooking a frozen-over lake. It looked as if it could have been out of the Lord of the Rings.]]></description>
			<content:encoded><![CDATA[<div class="photo-wrapper">
<a href="http://www.flickr.com/photos/9814557@N05/4300402856/" title="photo sharing"><img src="http://farm5.static.flickr.com/4014/4300402856_7e9de3cf7f.jpg" class="photo" alt="" /></a>
</div>
<p>
Thorsten and Maria brought me to the Monument of the Battle of Nations today. I went with the expectation of seeing a statue, only to find this monolithic structure overlooking a frozen-over lake. It looked as if it could have been out of the Lord of the Rings.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2010/01/24/the-monument-of-the-battle-of-nations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wicd Template for University of Leipzig</title>
		<link>http://www.woggie.net/2010/01/20/wicd-template-for-university-of-leipzig/</link>
		<comments>http://www.woggie.net/2010/01/20/wicd-template-for-university-of-leipzig/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 11:44:08 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[wicd]]></category>

		<guid isPermaLink="false">http://www.woggie.net/?p=181</guid>
		<description><![CDATA[Here&#8217;s a wicd template for the EAP-TTLS + PAP setup at the University of Leipzig. This was just a small customization of the template from Shawn MacLean, so all credit goes to him. Create the file /etc/wicd/encryption/templates/eap-ttls containing: name = EAP-TTLS with PAP author = Shawn MacLean version = 1 require identity *Identity password *Password [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a wicd template for the EAP-TTLS + PAP setup at the University of Leipzig. This was just a small customization of <a href="http://wicd.net/punbb/viewtopic.php?id=514">the template from Shawn MacLean</a>, so all credit goes to him. Create the file <code>/etc/wicd/encryption/templates/eap-ttls</code> containing:</p>
<pre>name = EAP-TTLS with PAP
author = Shawn MacLean
version = 1
require identity *Identity password *Password ca_cert *Path_to_CA_Cert
-----
network={
    ssid="$_ESSID"
    scan_ssid="$_SCAN"
    proto=WPA
    key_mgmt=WPA-EAP
    pairwise=TKIP
    group=TKIP
    eap=TTLS
    ca_cert="$_CA_CERT"
    identity="$_IDENTITY"
    password="$_PASSWORD"
    phase2="auth=PAP"
}
</pre>
<p>Add <code>eap-ttls</code> to <code>/etc/wicd/encryption/templates/active</code>, restart the GUI and the settings should now appear in the dropdown menu.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2010/01/20/wicd-template-for-university-of-leipzig/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>In Leipzig</title>
		<link>http://www.woggie.net/2010/01/20/in-leipzig/</link>
		<comments>http://www.woggie.net/2010/01/20/in-leipzig/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 05:30:55 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.woggie.net/2010/01/20/in-leipzig/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<div class="photo-wrapper">
<a href="http://www.flickr.com/photos/9814557@N05/4289129571/" title="photo sharing"><img src="http://farm5.static.flickr.com/4065/4289129571_f65ff26f89.jpg" class="photo" alt="" /></a>
</div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2010/01/20/in-leipzig/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Learning Photography</title>
		<link>http://www.woggie.net/2010/01/15/learning-photography/</link>
		<comments>http://www.woggie.net/2010/01/15/learning-photography/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 06:28:21 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.woggie.net/2010/01/15/learning-photography/</guid>
		<description><![CDATA[I&#8217;ve been getting into photography lately, and it&#8217;s been quite an interesting process so far. It&#8217;s incredible how a photograph can capture all the little details that you just didn&#8217;t notice when you were there in person. I&#8217;m only at the start of this journey (or addiction)&#8230; it&#8217;ll be interesting to see where I end [...]]]></description>
			<content:encoded><![CDATA[<div class="photo-wrapper">
<a href="http://www.flickr.com/photos/9814557@N05/4253247750/" title="photo sharing"><img src="http://farm3.static.flickr.com/2782/4253247750_df2a03d503.jpg" class="photo" alt="" /></a>
</div>
<p>
I&#8217;ve been getting into photography lately, and it&#8217;s been quite an interesting process so far. It&#8217;s incredible how a photograph can capture all the little details that you just didn&#8217;t notice when you were there in person. I&#8217;m only at the start of this journey (or addiction)&#8230; it&#8217;ll be interesting to see where I end up a year from now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2010/01/15/learning-photography/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Migrating to WordPress 2.9</title>
		<link>http://www.woggie.net/2010/01/14/migrating-to-wordpress-2-9/</link>
		<comments>http://www.woggie.net/2010/01/14/migrating-to-wordpress-2-9/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 23:51:06 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.woggie.net/2010/01/14/migrating-to-wordpress-2-9/</guid>
		<description><![CDATA[I haven&#8217;t spent much time on this blog lately and now I&#8217;ve run into the classic migration problem. I&#8217;ll be slowly updating in the next couple days.]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t spent much time on this blog lately and now I&#8217;ve run into the classic migration problem. I&#8217;ll be slowly updating in the next couple days.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2010/01/14/migrating-to-wordpress-2-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Editing Canada&#8217;s Copyright Bill</title>
		<link>http://www.woggie.net/2009/07/05/editing-canadas-copyright-bill/</link>
		<comments>http://www.woggie.net/2009/07/05/editing-canadas-copyright-bill/#comments</comments>
		<pubDate>Sun, 05 Jul 2009 19:51:32 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Asides]]></category>

		<guid isPermaLink="false">http://www.woggie.net/?p=139</guid>
		<description><![CDATA[The Globe and Mail placed the Canadian Copyright reform bill on a wiki for users to edit. I think this is a great use of a wiki and gives us an opportunity to read up on our rights and (maybe) make a change.]]></description>
			<content:encoded><![CDATA[<p>The Globe and Mail placed the <a href="http://policywiki.theglobeandmail.com/tiki-index.php?page=Download+Decade">Canadian Copyright reform bill on a wiki</a> for users to edit. I think this is a great use of a wiki and gives us an opportunity to read up on our rights and (maybe) make a change.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2009/07/05/editing-canadas-copyright-bill/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Confluence using Apache Tomcat 6 and Ubuntu</title>
		<link>http://www.woggie.net/2009/03/26/installing-confluence-using-apache-tomcat-6-and-ubuntu/</link>
		<comments>http://www.woggie.net/2009/03/26/installing-confluence-using-apache-tomcat-6-and-ubuntu/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 04:44:14 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[confluence]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.woggie.net/?p=129</guid>
		<description><![CDATA[Here&#8217;s a short guide for installing Confluence on a shared Tomcat server instance on Ubuntu 8.10. Apache Tomcat 6 can be installed using a simple apt-get command: sudo apt-get install tomcat6 Next, we&#8217;ll need to raise the Tomcat heap size for confluence. Edit /etc/default/tomcat6 and add the line: JAVA_OPTS="-Xms128m -Xmx1024m -XX:MaxPermSize=256m $JAVA_OPTS -Djava.awt.headless=true" Now, we&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a short guide for installing <a href="http://www.atlassian.com/software/confluence/">Confluence</a> on a shared Tomcat server instance on Ubuntu 8.10. Apache Tomcat 6 can be installed using a simple apt-get command:</p>
<pre>sudo apt-get install tomcat6</pre>
<p>Next, we&#8217;ll need to raise the Tomcat heap size for confluence. Edit <code>/etc/default/tomcat6</code> and add the line:</p>
<pre>JAVA_OPTS="-Xms128m -Xmx1024m -XX:MaxPermSize=256m $JAVA_OPTS -Djava.awt.headless=true"</pre>
<p>Now, we&#8217;ll need to grant security permissions to the Confluence webapp. To do this, create a file <code>/etc/tomcat6/policy.d/05confluence.policy</code> and place the following text in it:</p>
<pre>grant codeBase "file:${catalina.home}/webapps/confluence/-" {
permission java.security.AllPermission;
};

grant {
permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission java.lang.RuntimePermission "defineCGLIBClassInJavaPackage";
};</pre>
<p>Finally, we can restart Tomcat using the command:</p>
<pre>/etc/init.d/tomcat6 restart</pre>
<p><strong>References</strong></p>
<ul>
<li><a href="http://confluence.atlassian.com/display/DOC/Installing+the+Confluence+EAR-WAR+Edition">Confluence installation guide</a></li>
<li><a href="http://confluence.atlassian.com/display/CONF27/Known+Issues+with+Enterprise+or+Webhosting+environments">Confluence security policy</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2009/03/26/installing-confluence-using-apache-tomcat-6-and-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lesson to Self</title>
		<link>http://www.woggie.net/2009/03/11/lesson-to-self/</link>
		<comments>http://www.woggie.net/2009/03/11/lesson-to-self/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 06:43:33 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Asides]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.woggie.net/2009/03/11/lesson-to-self/</guid>
		<description><![CDATA[I was debugging a seemingly random crash in some graph layout code. An hour later&#8230; feeling proud of myself for having fixed the problem, I wanted to file the problem in the bug tracker, only to find a bug report with the exact problem and resolution. Lesson learned: Always, always, check the bug tracker before [...]]]></description>
			<content:encoded><![CDATA[<p>I was debugging a seemingly random crash in some graph layout code. An hour later&#8230; feeling proud of myself for having fixed the problem, I wanted to file the problem in the bug tracker, only to find <a href="http://code.google.com/p/daglayout/issues/detail?id=3">a bug report with the exact problem</a> and resolution. Lesson learned: Always, always, check the bug tracker before trying to debug broken code yourself. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2009/03/11/lesson-to-self/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TSX Halts Trading</title>
		<link>http://www.woggie.net/2008/12/17/tsx-halts-trading/</link>
		<comments>http://www.woggie.net/2008/12/17/tsx-halts-trading/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 20:57:31 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Asides]]></category>
		<category><![CDATA[Presentations]]></category>

		<guid isPermaLink="false">http://www.woggie.net/?p=114</guid>
		<description><![CDATA[Computers fail again. The TSX halted its trading for an entire day due to problems with its data feeds. What sort of problem with data feeds could be so horrible to require an entire day to fix? Source.]]></description>
			<content:encoded><![CDATA[<p>Computers fail again. The TSX halted its trading for an entire day due to problems with its data feeds. What sort of problem with data feeds could be so horrible to require an entire day to fix? <a href="http://www.canada.com/topics/news/national/story.html?id=1086132">Source</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2008/12/17/tsx-halts-trading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Groovy Combinations Generator</title>
		<link>http://www.woggie.net/2008/12/13/groovy-combinations-generator/</link>
		<comments>http://www.woggie.net/2008/12/13/groovy-combinations-generator/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 20:14:49 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[choose]]></category>
		<category><![CDATA[closures]]></category>
		<category><![CDATA[combinations]]></category>
		<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://www.woggie.net/?p=106</guid>
		<description><![CDATA[Ever needed to find all  k-combinations of a set? Of course! I&#8217;m pretty sure everybody has run into this problem one way or another, as part of your development work, a combinatorics assignment (eek!) or in every day life. For me, I needed to implement this for generating association rules. What better way to prototype [...]]]></description>
			<content:encoded><![CDATA[<p>Ever needed to find all  k-combinations of a set? Of course! I&#8217;m pretty sure everybody has run into this problem one way or another, as part of your development work, a combinatorics assignment (eek!) or in every day life. For me, I needed to implement this for generating association rules. What better way to prototype my eventual Java implementation than to use <a href="http://groovy.codehaus.org/">Groovy</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">def</span> choose<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">def</span> itemset, <span style="color: #993333;">int</span> choose<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">def</span> choose<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">def</span> itemset, <span style="color: #993333;">int</span> choose<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">def</span> results <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">//Initialize indices</span>
    <span style="color: #993333;">int</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> indices <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #993333;">int</span><span style="color: #66cc66;">&#91;</span>choose<span style="color: #66cc66;">&#93;</span>
    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i <span style="color: #b1b100;">in</span> 0..<span style="color: #66cc66;">&lt;</span>choose<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        indices<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> i
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #993333;">boolean</span> hasMore <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">;</span>
    <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>hasMore<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">def</span> combo <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>
        <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i <span style="color: #b1b100;">in</span> 0..<span style="color: #66cc66;">&lt;</span>indices.<span style="color: #663399;">size</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>
            combo <span style="color: #66cc66;">&lt;&lt;</span> itemset<span style="color: #66cc66;">&#91;</span>indices<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>
        <span style="color: #66cc66;">&#125;</span>
        results <span style="color: #66cc66;">&lt;&lt;</span> combo
        hasMore <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">/* Closure to move the right-most index */</span>
            <span style="color: #993333;">int</span> rightMostIndex <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">/* Closure to find the right-most index */</span>
                    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i <span style="color: #b1b100;">in</span> choose<span style="color: #66cc66;">-</span>1..0<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
                        <span style="color: #993333;">int</span> bounds <span style="color: #66cc66;">=</span> itemset.<span style="color: #663399;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">-</span> choose <span style="color: #66cc66;">+</span> i
                        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>indices<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&lt;</span> bounds<span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> i
                    <span style="color: #66cc66;">&#125;</span>
                    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span>
            <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">// execute closure</span>
&nbsp;
            <span style="color: #808080; font-style: italic;">// increment all indices</span>
            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>rightMostIndex <span style="color: #66cc66;">&gt;=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                indices<span style="color: #66cc66;">&#91;</span>rightMostIndex<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">++</span>
                <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i <span style="color: #b1b100;">in</span> rightMostIndex<span style="color: #66cc66;">+</span>1..<span style="color: #66cc66;">&lt;</span>choose<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    indices<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> indices<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">;</span>
                <span style="color: #66cc66;">&#125;</span>
                <span style="color: #808080; font-style: italic;">// there are still more combinations</span>
                <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">true</span> 
            <span style="color: #66cc66;">&#125;</span>
            <span style="color: #808080; font-style: italic;">// reached the end, no more combinations</span>
            <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">false</span>
        <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">// execute closure</span>
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">return</span> results
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>I&#8217;ve based my implementation off one from <a href="http://www.amazon.ca/Applied-Combinatorics-Alan-Tucker/dp/0471735078">Applied Combinatorics by Alan Tucker</a>. First, there is an <code>indice</code> array that stores the k positions in the itemset. The items at these index locations are the k-combinations. The algorithm increases the right-most index until it reaches the last element of the itemset, then increases, the second right-most index and so on.</p>
<p>I wouldn&#8217;t recommend this implementation when dealing with large itemsets. A deficiency with this one-method approach is that a single list is constructed containing all of the combinations. This list can grow to be very large, very fast. It can be easily adapted to provide one combination at a time by refactoring the <code>hasMore</code> check into a separate method. This way, it would act like an iterator.  It&#8217;s too bad that Groovy doesn&#8217;t have support for the do-while loop as well, otherwise the <code>hasMore</code> closure could have been factored out into a really cool while check. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2008/12/13/groovy-combinations-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Opening a Marker in an Eclipse Java Editor</title>
		<link>http://www.woggie.net/2008/12/06/opening-a-marker-in-a-java-editor/</link>
		<comments>http://www.woggie.net/2008/12/06/opening-a-marker-in-a-java-editor/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 19:16:24 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">http://www.woggie.net/?p=100</guid>
		<description><![CDATA[Markers are a great feature of Eclipse and there are some great articles on creating Markers. However, I couldn&#8217;t find a good article on opening markers in an editor. So, here&#8217;s the best call sequence that I could figure out: IJavaElement element = ...; IEditorInput input = EditorUtility.getEditorInput&#40;element&#41;; IEditorPart editor = getSite&#40;&#41;.getPage&#40;&#41;.openEditor&#40;input, &#40;input instanceof FileEditorInput&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>Markers are a great feature of Eclipse and there are some great articles on creating Markers. However, I couldn&#8217;t find a good article on opening markers in an editor. So, here&#8217;s the best call sequence that I could figure out:</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;">IJavaElement element = ...<span style="color: #339933;">;</span>
IEditorInput input = EditorUtility.<span style="color: #006633;">getEditorInput</span><span style="color: #009900;">&#40;</span>element<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
IEditorPart editor = getSite<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">openEditor</span><span style="color: #009900;">&#40;</span>input,
    <span style="color: #009900;">&#40;</span>input <span style="color: #000000; font-weight: bold;">instanceof</span> FileEditorInput<span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> : JavaUI.<span style="color: #006633;">ID_CU_EDITOR</span> 
            : JavaUI.<span style="color: #006633;">ID_CF_EDITOR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
IDE.<span style="color: #006633;">gotoMarker</span><span style="color: #009900;">&#40;</span>editor, sNode.<span style="color: #006633;">getMarker</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>EditorUtility is an internal JDT class, but I couldn&#8217;t find a better way of doing this. A check on the return type of the <code>getEditorInput</code> call is necessary to since it can return either a file editor (for compilation units) or a class file editor.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2008/12/06/opening-a-marker-in-a-java-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Second Star Trek Trailer</title>
		<link>http://www.woggie.net/2008/11/18/second-star-trek-trailer/</link>
		<comments>http://www.woggie.net/2008/11/18/second-star-trek-trailer/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 05:50:04 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Asides]]></category>

		<guid isPermaLink="false">http://www.woggie.net/?p=96</guid>
		<description><![CDATA[The second trailer for the next Star Trek movie is out. I looks like quite an exciting action movie. The trailer almost has the same tone as the Transformers movie. Definitely not the Star Trek I used to know and love, but hey, I&#8217;m open to a series &#8220;reboot&#8221;.]]></description>
			<content:encoded><![CDATA[<p>The second trailer for the next Star Trek movie <a href="http://www.apple.com/trailers/paramount/startrek/">is out</a>. I looks like quite an exciting action movie. The trailer almost has the same tone as the Transformers movie. Definitely not the Star Trek I used to know and love, but hey, I&#8217;m open to a series &#8220;reboot&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2008/11/18/second-star-trek-trailer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yet Another Groovy Spelling Corrector</title>
		<link>http://www.woggie.net/2008/11/05/spelling-corrector-implementation/</link>
		<comments>http://www.woggie.net/2008/11/05/spelling-corrector-implementation/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 05:48:04 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.woggie.net/?p=74</guid>
		<description><![CDATA[I&#8217;ve taken some time implementing Peter Norvig&#8217;s spelling corrector in an attempt to learn Groovy, a dynamic language that compiles to bytecode and is compatible with standard Java classes and libraries. There are a couple differences (most likely deficiencies) with my implementation. First, I use a list instead of a set when constructing the candidate [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve taken some time implementing <a href="http://norvig.com/spell-correct.html">Peter Norvig&#8217;s spelling corrector</a> in an attempt to learn <a href="http://groovy.codehaus.org/">Groovy</a>, a dynamic language that compiles to bytecode and is compatible with standard Java classes and libraries.</p>
<p>There are a couple differences (most likely deficiencies) with my implementation. First, I use a list instead of a set when constructing the candidate word list. Second, I created a separate occurrence function in order to provide the smoothing capability for our occurrence distribution. Third, I didn&#8217;t really care much for a low line count. It&#8217;s not the LOC that matter in the end, it&#8217;s how easily <em>you</em> can comprehend the code! <img src='http://www.woggie.net/wp-content/plugins/tango-smilies/tango/face-smile.png' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SpellingCorrector <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">def</span> wordoccur <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>:<span style="color: #66cc66;">&#93;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">def</span> words<span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">File</span> file<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    Scanner scanner <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Scanner<span style="color: #66cc66;">&#40;</span>file<span style="color: #66cc66;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">def</span> words <span style="color: #66cc66;">=</span> scanner.<span style="color: #663399;">findAll</span><span style="color: #66cc66;">&#123;</span> x <span style="color: #66cc66;">-&gt;</span> x.<span style="color: #006600;">toLowerCase</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">==</span>~ ~/<span style="color: #66cc66;">&#91;</span>a<span style="color: #66cc66;">-</span>z<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">+</span>/  <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">def</span> train<span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">List</span> words<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    words.<span style="color: #663399;">each</span> <span style="color: #66cc66;">&#123;</span>
      wordoccur<span style="color: #66cc66;">&#91;</span>it<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> wordoccur.<span style="color: #006600;">containsKey</span><span style="color: #66cc66;">&#40;</span>it<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">?</span> wordoccur<span style="color: #66cc66;">&#91;</span>it<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">1</span> : <span style="color: #cc66cc;">1</span>
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">def</span> edits1<span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">String</span> word<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">def</span> results <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>
    <span style="color: #993333;">int</span> n <span style="color: #66cc66;">=</span> word.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #808080; font-style: italic;">//Deletion. Remove a character.</span>
    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i <span style="color: #b1b100;">in</span> 0..<span style="color: #66cc66;">&lt;</span>n<span style="color: #66cc66;">&#41;</span>
      results <span style="color: #66cc66;">&lt;&lt;</span> word<span style="color: #66cc66;">&#91;</span>0..<span style="color: #66cc66;">&lt;</span>i<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">+</span> word<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">+</span>1..<span style="color: #66cc66;">&lt;</span>n<span style="color: #66cc66;">&#93;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">//Transposition. Swap adjacent characters.</span>
    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i <span style="color: #b1b100;">in</span> 0..<span style="color: #66cc66;">&lt;</span>n<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
      results <span style="color: #66cc66;">&lt;&lt;</span> word<span style="color: #66cc66;">&#91;</span>0..<span style="color: #66cc66;">&lt;</span>i<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">+</span> word<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">+</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">+</span> word<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">+</span> word<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">+</span>2..<span style="color: #66cc66;">&lt;</span>n<span style="color: #66cc66;">&#93;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">//Alteration. Change one character for another letter.</span>
    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i <span style="color: #b1b100;">in</span> 0..<span style="color: #66cc66;">&lt;</span>n<span style="color: #66cc66;">&#41;</span>
      <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>c <span style="color: #b1b100;">in</span> <span style="color: #ff0000;">'a'</span>..<span style="color: #ff0000;">'z'</span><span style="color: #66cc66;">&#41;</span>
        results <span style="color: #66cc66;">&lt;&lt;</span> word<span style="color: #66cc66;">&#91;</span>0..<span style="color: #66cc66;">&lt;</span>i<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">+</span> c <span style="color: #66cc66;">+</span> word<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">+</span>1..<span style="color: #66cc66;">&lt;</span>n<span style="color: #66cc66;">&#93;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">//Insertion. Add a letter in between the others.</span>
    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i <span style="color: #b1b100;">in</span> 0..<span style="color: #66cc66;">&lt;</span>n<span style="color: #66cc66;">&#41;</span>
      <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>c <span style="color: #b1b100;">in</span> <span style="color: #ff0000;">'a'</span>..<span style="color: #ff0000;">'z'</span><span style="color: #66cc66;">&#41;</span>
        results <span style="color: #66cc66;">&lt;&lt;</span> word<span style="color: #66cc66;">&#91;</span>0..<span style="color: #66cc66;">&lt;</span>i<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">+</span> c <span style="color: #66cc66;">+</span> word<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">+</span>1..<span style="color: #66cc66;">&lt;</span>n<span style="color: #66cc66;">&#93;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">return</span> results
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">def</span> knownedits2<span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">String</span> word<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">def</span> candidates <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>
    edits1<span style="color: #66cc66;">&#40;</span>word<span style="color: #66cc66;">&#41;</span>.<span style="color: #663399;">each</span> <span style="color: #66cc66;">&#123;</span>
      candidates.<span style="color: #006600;">addAll</span><span style="color: #66cc66;">&#40;</span> edits1<span style="color: #66cc66;">&#40;</span>it<span style="color: #66cc66;">&#41;</span>.<span style="color: #663399;">findAll</span> <span style="color: #66cc66;">&#123;</span> wordoccur.<span style="color: #006600;">containsKey</span><span style="color: #66cc66;">&#40;</span>it<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#125;</span> <span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">return</span> candidates
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/**
   * Smoothing distribution. If the word hasn't been encountered (novel words),
   *  we give it an occurence value of 1.
   */</span>
  <span style="color: #000000; font-weight: bold;">def</span> <span style="color: #993333;">int</span> occurrence<span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">String</span> word<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> wordoccur<span style="color: #66cc66;">&#91;</span>word<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">==</span> <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">?</span> <span style="color: #cc66cc;">1</span> : wordoccur<span style="color: #66cc66;">&#91;</span>word<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">;</span>  
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">def</span> <span style="color: #aaaadd; font-weight: bold;">List</span> known<span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">List</span> words<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> words.<span style="color: #663399;">findAll</span> <span style="color: #66cc66;">&#123;</span> wordoccur.<span style="color: #006600;">containsKey</span><span style="color: #66cc66;">&#40;</span>it.<span style="color: #006600;">toLowerCase</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</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;">def</span> correct<span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">String</span> word<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">def</span> candidates <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>word<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">+</span> known<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>word<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> known<span style="color: #66cc66;">&#40;</span>edits1<span style="color: #66cc66;">&#40;</span>word<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> knownedits2<span style="color: #66cc66;">&#40;</span>word<span style="color: #66cc66;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">return</span> candidates.<span style="color: #663399;">max</span> <span style="color: #66cc66;">&#123;</span>  occurrence<span style="color: #66cc66;">&#40;</span>it<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>First, we don&#8217;t attempt to split words into two sub-words. For example, a common typo may be &#8220;Ihave&#8221; rather than &#8220;I have&#8221;. Second, the training and known function can definitely be improved to with support for proper nouns, stemming, and more. I think it would be a fun exercise to try and to create a simple implementation of these features, much like the SpellingCorrector.</p>
<p>So, Groovy has great support for regular expressions, list construction and compositions and best of all, <em>closures</em>! I also had a chance to play with the Groovy NodeBuilder (on a separate program), which is a great way for constructing tree structures. All said and done, I would <em>hate</em> to implement this in Java.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2008/11/05/spelling-corrector-implementation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Phone Obsession</title>
		<link>http://www.woggie.net/2008/10/21/phone-obsession/</link>
		<comments>http://www.woggie.net/2008/10/21/phone-obsession/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 16:22:28 +0000</pubDate>
		<dc:creator>Steven She</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.woggie.net/?p=64</guid>
		<description><![CDATA[I think some of you can relate. I know I can, but which character? Maybe all three!]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">I think some of you can relate. I know I can, but which character? Maybe all three!</p>
<p><a title="Dilbert.com" href="http://dilbert.com/strips/comic/2008-10-20/"><img src="http://dilbert.com/dyn/str_strip/000000000/00000000/0000000/000000/20000/9000/000/29061/29061.strip.gif" border="0" alt="Dilbert.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.woggie.net/2008/10/21/phone-obsession/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
