<?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>No One Is Perfect &#187; swing</title>
	<atom:link href="http://watchitlater.com/blog/tag/swing/feed/" rel="self" type="application/rss+xml" />
	<link>http://watchitlater.com/blog</link>
	<description>A reluctant foray into the world of blogging.</description>
	<lastBuildDate>Tue, 08 Nov 2011 12:32:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>S3DropBox is now on GitHub</title>
		<link>http://watchitlater.com/blog/2011/04/s3dropbox-is-now-on-github/</link>
		<comments>http://watchitlater.com/blog/2011/04/s3dropbox-is-now-on-github/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 13:12:57 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[My Code]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[dropbox]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[S3]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://watchitlater.com/blog/?p=268</guid>
		<description><![CDATA[I&#8217;ve released a new version of my S3DropBox on GitHub. I&#8217;ve moved the project to GitHub so that I can have all my current active projects in one place. Check it out in its new home at https://github.com/tomcz/s3dropbox. This release uses the AWS java libraries. They are finally good enough for me to stop creating [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve released a new version of my S3DropBox on GitHub. I&#8217;ve moved the project to GitHub so that I can have all my current active projects in one place. Check it out in its new home at <a href="https://github.com/tomcz/s3dropbox">https://github.com/tomcz/s3dropbox</a>.</p>
<p>This release uses the AWS java libraries. They are finally good enough for me to stop creating my own wheels and vulcanising my own rubber. As a bonus the S3DropBox creates URLs in virtual hosted format (eg. https://mybucket.s3.amazonaws.com/myobject) if the bucket name permits that, uses HTTPS by default and is able to perform multipart uploads so that large files get uploaded faster.</p>
]]></content:encoded>
			<wfw:commentRss>http://watchitlater.com/blog/2011/04/s3dropbox-is-now-on-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>From Java to Groovy</title>
		<link>http://watchitlater.com/blog/2009/12/from-java-to-groovy/</link>
		<comments>http://watchitlater.com/blog/2009/12/from-java-to-groovy/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 00:15:00 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[My Code]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Closure]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://watchitlater.com/blog/?p=125</guid>
		<description><![CDATA[Recently I&#8217;ve been playing with some old Java Swing applications and I found myself wishing that I could replace all the anonymous inner-classes with some clean Groovy closures. The job of converting a java source file to a groovy source file is pretty simple and eminently scriptable. Here&#8217;s my take on a python script to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been playing with some old Java Swing applications and I found myself wishing that I could replace all the anonymous inner-classes with some clean Groovy closures. The job of converting a java source file to a groovy source file is pretty simple and eminently scriptable. Here&#8217;s my take on a python script to do just that:</p>
<pre name="code" class="py:nogutter">
from optparse import OptionParser
from subprocess import Popen, PIPE
import os

def rename(src, dest, use_svn):
    if use_svn:
        output = Popen(['svn', 'rename', src, dest], stdout=PIPE).communicate()
        print output[0]
    else:
        print 'mv', src, dest
        os.rename(src, dest)

def process_file(src, use_svn):
    if src.endswith('.java'):
        print 'Processing', src
        fd = open(src, 'r')
        lines = fd.readlines()
        fd.close()
        fd = open(src, 'w')
        for line in lines:
            text = line.rstrip()
            if text.endswith(';'):
                text = text[:-1]
            fd.write(text)
            fd.write('\n')
        fd.close()
        root = os.path.dirname(src)
        filename = os.path.basename(src)
        dest = os.path.join(root, filename[:-5] + '.groovy')
        rename(src, dest, use_svn)

def process_dir(dir_path, use_svn):
    for root, dirs, files in os.walk(dir_path):
        for filename in files:
            src = os.path.join(root, filename)
            process_file(src, use_svn)

if __name__ == '__main__':
    parser = OptionParser()
    parser.add_option('-s', '--svn', action='store_true', dest='use_svn', help='use svn to rename files')
    (options, args) = parser.parse_args()
    if len(args) > 0:
        target = args[0]
        if os.path.isfile(target):
            process_file(target, options.use_svn)
        else:
            process_dir(target, options.use_svn)
    else:
        process_dir(os.getcwd(), options.use_svn)
</pre>
<p>This means that I can now replace this:</p>
<pre name="code" class="java:nogutter">
public void actionPerformed(ActionEvent e) {
    executor.execute(new Runnable() {
        public void run() {
            controller.showBuckets();
        }
    });
}
</pre>
<p>with this:</p>
<pre name="code" class="java:nogutter">
public void actionPerformed(ActionEvent e) {
    executor.execute { controller.showBuckets() }
}
</pre>
<p>Now that&#8217;s refactoring <img src='http://watchitlater.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://watchitlater.com/blog/2009/12/from-java-to-groovy/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>S3DropBox 1.2 is now released</title>
		<link>http://watchitlater.com/blog/2009/05/s3dropbox-12-is-now-released/</link>
		<comments>http://watchitlater.com/blog/2009/05/s3dropbox-12-is-now-released/#comments</comments>
		<pubDate>Sat, 16 May 2009 11:17:39 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[My Code]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[HTTPS]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[NTLM]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[S3]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://watchitlater.com/blog/?p=38</guid>
		<description><![CDATA[I love feedback &#8230; including bugs (thanks Cam). The S3DropBox will now only permit the creation of a bucket when Amazon S3 returns a HTTP 404 status code in response to a HTTP HEAD request for the bucket prior to creation. The new version can now be downloaded from http://code.google.com/p/s3dropbox/.]]></description>
			<content:encoded><![CDATA[<p>I love feedback &#8230; including bugs (thanks Cam). The S3DropBox will now only permit the creation of a bucket when Amazon S3 returns a HTTP 404 status code in response to a HTTP HEAD request for the bucket prior to creation. The new version can now be downloaded from <a href="http://code.google.com/p/s3dropbox/">http://code.google.com/p/s3dropbox/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://watchitlater.com/blog/2009/05/s3dropbox-12-is-now-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

