<?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>Big Bad Code &#187; Code</title>
	<atom:link href="http://bigbadcode.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://bigbadcode.com</link>
	<description>Don't blame me, I voted for Kodos</description>
	<lastBuildDate>Wed, 19 Aug 2009 21:49:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How To: Get anti-aliased fonts in the Arduino and Processing IDE&#8217;s</title>
		<link>http://bigbadcode.com/2009/05/20/how-to-get-anti-aliased-fonts-in-the-arduino-and-processing-ides/</link>
		<comments>http://bigbadcode.com/2009/05/20/how-to-get-anti-aliased-fonts-in-the-arduino-and-processing-ides/#comments</comments>
		<pubDate>Wed, 20 May 2009 17:04:58 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/?p=246</guid>
		<description><![CDATA[How to turn on font anti aliasing in the Arduino and Processing IDE's (OSX)]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong>:</p>
<p>Arduino and Processing IDE&#8217;s both are java applications and don&#8217;t use anti-aliasing when displaying fonts on OS X.</p>
<p><strong>Solution</strong>:</p>
<p>Add the Java Swing options to enable anti aliasing to the Info.plist file that OS X uses to launch the IDE&#8217;s.</p>
<p><strong>Steps</strong>:<br />
Right click the Arduino.app in the Finder and select &#8216;Show Package Contents&#8217;, double click the Contents directory and there you will find the Info.plist file. Open it in a text editor of your choice.<br />
Add the following two lines under the Java option. See the screenshot for the exact location.</p>
<p><code><tt> &lt;key&gt;VMOptions&lt;/key&gt;<br />
&lt;string&gt;-Dswing.aatext=true</tt></code><tt>&lt;/string&gt;<br />
</tt><br />
<a href="http://bigbadcode.com/wp-content/uploads/2009/05/addantialiasing.png"><img class="alignnone size-medium wp-image-248" title="UpdatePlistScreenShot" src="http://bigbadcode.com/wp-content/uploads/2009/05/addantialiasing-263x300.png" alt="UpdatePlistScreenShot" width="263" height="300" /></a></p>
<p>Now your code editor goes from looking like this crapness:</p>
<p><a href="http://bigbadcode.com/wp-content/uploads/2009/05/noaliasing.png"><img class="alignnone size-medium wp-image-250" title="noaliasing" src="http://bigbadcode.com/wp-content/uploads/2009/05/noaliasing-279x300.png" alt="noaliasing" width="279" height="300" /></a></p>
<p>To this hotness:</p>
<p><a href="http://bigbadcode.com/wp-content/uploads/2009/05/withantialiasing.png"><img class="alignnone size-medium wp-image-251" title="withantialiasing" src="http://bigbadcode.com/wp-content/uploads/2009/05/withantialiasing-279x300.png" alt="withantialiasing" width="279" height="300" /></a></p>
<p>And even better you can use great looking fonts like <a href="http://www.levien.com/type/myfonts/inconsolata.html">Inconsolata</a> and get an editor that looks this good:<br />
<a href="http://bigbadcode.com/wp-content/uploads/2009/05/inconsolasarduino.png"><img src="http://bigbadcode.com/wp-content/uploads/2009/05/inconsolasarduino-279x300.png" alt="inconsolasarduino" title="inconsolasarduino" width="279" height="300" class="alignnone size-medium wp-image-254" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2009/05/20/how-to-get-anti-aliased-fonts-in-the-arduino-and-processing-ides/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Quick look support for .mxml and .as files</title>
		<link>http://bigbadcode.com/2009/02/22/quick-look-support-for-mxml-and-as-files/</link>
		<comments>http://bigbadcode.com/2009/02/22/quick-look-support-for-mxml-and-as-files/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 04:53:15 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[quicklook]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/?p=235</guid>
		<description><![CDATA[I&#8217;ve recently re-installed OSX and lost my quicklook support for .mxml and .as files. Since I couldn&#8217;t find whatever packages I had installed that allowed that quicklook support, I&#8217;ve modified QLColorCode to add support for previewing both .as files and .mxml files.
It works on my computer and I hope that it&#8217;ll work on yours too.
Please [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently re-installed OSX and lost my quicklook support for .mxml and .as files. Since I couldn&#8217;t find whatever packages I had installed that allowed that quicklook support, I&#8217;ve modified <a href="http://code.google.com/p/qlcolorcode/">QLColorCode</a> to add support for previewing both .as files and .mxml files.</p>
<p>It works on my computer and I hope that it&#8217;ll work on yours too.</p>
<p>Please feel free to download<a href="http://bigbadcode.com/wp-content/uploads/2009/02/qlcolorcodeqlgenerator.zip"> my version, </a><a href="http://bigbadcode.com/wp-content/uploads/2009/02/qlcolorcodeqlgenerator.zip">qlcolorcodeqlgenerator</a> unzip and install, let me know if it doesn&#8217;t work.</p>
<p>Installation instructions for quicklook plugins can be found <a href="http://code.google.com/p/qlcolorcode/">here.</a></p>
<p>-josh</p>
]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2009/02/22/quick-look-support-for-mxml-and-as-files/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Networked Sound Board</title>
		<link>http://bigbadcode.com/2009/01/24/networked-sound-board/</link>
		<comments>http://bigbadcode.com/2009/01/24/networked-sound-board/#comments</comments>
		<pubDate>Sun, 25 Jan 2009 03:59:35 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[flex code python git github]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/?p=222</guid>
		<description><![CDATA[Super fun networked sound board for use any place you have multiple people with computers and a central computer with speakers everyone can hear. ]]></description>
			<content:encoded><![CDATA[<p>Hi Everybody,</p>
<p>I&#8217;ve created a network sound board that you can use to have endless fun with co-workers.</p>
<p>In my office quad we have one OSX machine that is used to play music for everyone, it&#8217;s usually running last.fm, pandora or someones iTunes library as background music for everyone. Occasionally it gets cranked up when it&#8217;s time to get the <a href="http://www.ledzeppelin.com/" target="_blank">led</a> out. I was thinking that it&#8217;d be fun to be able to trigger sound effects on that machine from my machine, kind of like what happens on radio shows, expect that my co-workers wouldn&#8217;t really be able to change the channel.</p>
<p>So the itch was scratched and I&#8217;m proud to present the network sound board. It should run out of the box on any OSX machine with a recent installation of Python. If you&#8217;re on Windows or Linux it&#8217;ll work if you can find a command line audio player.  Anybody on the same network as the music machine will be able to trigger the sound effects from the comfort of their browsers. After you install there is a soundEffects folder that you can place sound files (.wav/mp3) into and they are instantly available, check the documentation for more info.</p>
<p><a href="http://github.com/code128/networkedsoundboard/tree/master">You can git the source from github at http://github.com/code128/networkedsoundboard/tree/master<br />
</a></p>
<p>It looks like this.</p>
<p><a href="http://bigbadcode.com/wp-content/uploads/2009/01/2009-01-24_1632.png"><img class="alignnone size-medium wp-image-224" title="networked_soundboard" src="http://bigbadcode.com/wp-content/uploads/2009/01/2009-01-24_1632-295x300.png" alt="networked_soundboard" width="295" height="300" /></a></p>
<p>If you&#8217;re looking to extend it, adding the ability to upload new sounds from the flex interface would be sweet. If you do let me know.</p>
<p>Have fun.</p>
<p>P.S. If you can get samples of your co-workers saying things and add them to the server that would just be the icing on the comedy cake.</p>
]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2009/01/24/networked-sound-board/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Just sitting here watching the logs go by.</title>
		<link>http://bigbadcode.com/2008/12/22/just-sitting-here-watching-the-logs-go-by/</link>
		<comments>http://bigbadcode.com/2008/12/22/just-sitting-here-watching-the-logs-go-by/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 00:12:01 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/?p=207</guid>
		<description><![CDATA[Some times while working on remote servers I need to watch various log files. Typically for something like this I&#8217;ll create an extremely simple script that watches all the logs at once, since the next time I&#8217;m on that machine I&#8217;ll probably have forgotten the paths in question.
Something like this:
tail -f /var/www/apache/access.log /var/www/apache/error.log
The problem with [...]]]></description>
			<content:encoded><![CDATA[<p>Some times while working on remote servers I need to watch various log files. Typically for something like this I&#8217;ll create an extremely simple script that watches all the logs at once, since the next time I&#8217;m on that machine I&#8217;ll probably have forgotten the paths in question.</p>
<p>Something like this:</p>
<pre>tail -f /var/www/apache/access.log /var/www/apache/error.log</pre>
<p>The problem with that approach is really long lines wrap and I usually just care about the far left of the file, so I&#8217;ve been looking for a way to turn off wrapping in tail. Unfortunately that seems to be impossible. I tried messing with my shell to kill the extra characters with this:</p>
<pre>echo -e "\e[?7l\c"</pre>
<p>But that was messing up other things. The best solution I&#8217;ve found so far is to use less with these options</p>
<pre>less +F -S /var/log/apache/access.log</pre>
<p>+F puts it in a tail like mode and -S chops the line to the screen width, the only drawback is that it doesn&#8217;t intersperse the 2 files like tail does. I was hoping to pipe tails input into less in the this fashion but that didn&#8217;t seem to work right either.</p>
]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2008/12/22/just-sitting-here-watching-the-logs-go-by/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Iterating over a custom object in python</title>
		<link>http://bigbadcode.com/2008/10/22/iterating-over-a-custom-object-in-python/</link>
		<comments>http://bigbadcode.com/2008/10/22/iterating-over-a-custom-object-in-python/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 17:18:55 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/?p=204</guid>
		<description><![CDATA[A coworker recently needed to iterate over a custom object in python. It&#8217;s pretty easy to do, you just need to implement the __iter__ method on your object. 
Here&#8217;s some example code that shows you how to extend your object, returning everything in your objects local dictionary:

class IterableObject&#40;object&#41;:
    def __iter__&#40;self&#41;:
   [...]]]></description>
			<content:encoded><![CDATA[<p>A coworker recently needed to iterate over a custom object in python. It&#8217;s pretty easy to do, you just need to implement the __iter__ method on your object. </p>
<p>Here&#8217;s some example code that shows you how to extend your object, returning everything in your objects local dictionary:</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">class</span> IterableObject<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__iter__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">for</span> item <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">self</span>.<span style="color: #0000cd;">__dict__</span>:
            <span style="color: #ff7700;font-weight:bold;">yield</span> <span style="color: #008000;">self</span>.<span style="color: #0000cd;">__dict__</span><span style="color: black;">&#91;</span>item<span style="color: black;">&#93;</span></pre></div></div>

<p>Now for sample usage:</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;">myObj = IterableObject<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
myObj.<span style="color: black;">name</span> = <span style="color: #483d8b;">&quot;Johnny Hammersticks&quot;</span>
myObj.<span style="color: black;">otherProperty</span> = <span style="color: #483d8b;">&quot;Something Else&quot;</span>
myObj.<span style="color: black;">testList</span> = <span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">2</span>,<span style="color: #ff4500;">3</span>,<span style="color: #ff4500;">4</span><span style="color: black;">&#93;</span>
myObj.<span style="color: black;">testDict</span> = <span style="color: black;">&#123;</span><span style="color: #ff4500;">1</span>:<span style="color: #483d8b;">'one'</span>, <span style="color: #ff4500;">2</span>:<span style="color: #483d8b;">'two'</span><span style="color: black;">&#125;</span>
<span style="color: #808080; font-style: italic;"># Serialize the IterableObject into json</span>
<span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> myObj:
     <span style="color: #ff7700;font-weight:bold;">print</span> x, <span style="color: #008000;">type</span><span style="color: black;">&#40;</span>x<span style="color: black;">&#41;</span></pre></div></div>

<p>which returns:</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;">Something Else <span style="color: #66cc66;">&lt;</span>type <span style="color: #483d8b;">'str'</span><span style="color: #66cc66;">&gt;</span>
<span style="color: black;">&#123;</span><span style="color: #ff4500;">1</span>: <span style="color: #483d8b;">'one'</span>, <span style="color: #ff4500;">2</span>: <span style="color: #483d8b;">'two'</span><span style="color: black;">&#125;</span> <span style="color: #66cc66;">&lt;</span>type <span style="color: #483d8b;">'dict'</span><span style="color: #66cc66;">&gt;</span>
<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">2</span>, <span style="color: #ff4500;">3</span>, <span style="color: #ff4500;">4</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">&lt;</span>type <span style="color: #483d8b;">'list'</span><span style="color: #66cc66;">&gt;</span>
Johnny Hammersticks <span style="color: #66cc66;">&lt;</span>type <span style="color: #483d8b;">'str'</span><span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>Oh and another handy feature of this dictionary style approach, you can do easy string formatting/printing of the object properties in this style.</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Hi %(name)s, your list %(testList)s&quot;</span> <span style="color: #66cc66;">%</span> myObj.<span style="color: #0000cd;">__dict__</span></pre></div></div>

<p>Which prints:</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;">Hi Johnny Hammersticks, your <span style="color: #008000;">list</span>: <span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">2</span>, <span style="color: #ff4500;">3</span>, <span style="color: #ff4500;">4</span><span style="color: black;">&#93;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2008/10/22/iterating-over-a-custom-object-in-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FlixBot</title>
		<link>http://bigbadcode.com/2008/10/20/flixbot/</link>
		<comments>http://bigbadcode.com/2008/10/20/flixbot/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 05:59:18 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[netflix]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/?p=192</guid>
		<description><![CDATA[I&#8217;ve built a proof of concept in some hacked together python code to automatically add movies to my netflix queue when I send twitter messages to @flixbot.
For example this tweet:

Gets Blade into my queue. Awesome.
I started building this out into a full fledged service so other people can use it as well. Of course I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve built a proof of concept in some hacked together python code to automatically add movies to my netflix queue when I send twitter messages to @flixbot.</p>
<p>For example this tweet:</p>
<p><a href="http://bigbadcode.com/wp-content/uploads/2008/10/2008-10-20_2241.png"><img class="alignnone size-medium wp-image-194" title="2008-10-20_2241" src="http://bigbadcode.com/wp-content/uploads/2008/10/2008-10-20_2241-300x130.png" alt="" width="300" height="130" /></a></p>
<p>Gets Blade into my queue. Awesome.</p>
<p>I started building this out into a full fledged service so other people can use it as well. Of course I&#8217;m going to need a hosted site somewhere for people to sign up. I figured it might be a good time to play with my app engine account.</p>
<p>I got part of the way of there with app engine serving up pages, but then ran into problems with xml libraries I was using in my POC not existing in the AppEngine sandbox. <img src='http://bigbadcode.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Also I&#8217;m starting to run out of enthusiasm.</p>
<p>So that&#8217;s where I&#8217;m at. Goodnight.</p>
]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2008/10/20/flixbot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>_why the lucky stiff is awesome.</title>
		<link>http://bigbadcode.com/2008/05/07/_why-the-lucky-stiff-is-awesome/</link>
		<comments>http://bigbadcode.com/2008/05/07/_why-the-lucky-stiff-is-awesome/#comments</comments>
		<pubDate>Wed, 07 May 2008 19:25:48 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Design Spotlights]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/?p=147</guid>
		<description><![CDATA[Yet more proof of his awesomeness.
http://hackety.org/2008/05/05/sneakingRubyThroughGoogleAppEngine.html
Basically he&#8217;s shown a proof of converting Ruby bytecode into Python bytecode, enabling ruby to run in python only places, like Google app-engine. Quite cool.
Additionally he&#8217;s been creating hackety-hack which is an environment for anyone (children) to learn programming. _why&#8217;s built it out of ruby and gecko and his own [...]]]></description>
			<content:encoded><![CDATA[<p>Yet more proof of his awesomeness.</p>
<p><a href="http://hackety.org/2008/05/05/sneakingRubyThroughGoogleAppEngine.html" target="_blank">http://hackety.org/2008/05/05/sneakingRubyThroughGoogleAppEngine.html</a></p>
<p>Basically he&#8217;s shown a proof of converting Ruby bytecode into Python bytecode, enabling ruby to run in python only places, like Google app-engine. Quite cool.</p>
<p>Additionally he&#8217;s been creating <a href="http://hacketyhack.net/" target="_blank">hackety-hack</a> which is an environment for anyone (children) to learn programming. _why&#8217;s built it out of ruby and gecko and his own shoes framework, it looks great so far.</p>
<p>Check out the first bylaw of hackety-hack:</p>
<blockquote><p>Beginners should be greeted to Hackety Hack by a cartoon character. (For the sake of argument, let&#8217;s call this character: Hacky Mouse.)</p></blockquote>
<p>Check it out:</p>
<p><a href="http://hacketyhack.net/"><img class="aligncenter size-medium wp-image-148" title="hackety-hack" src="http://bigbadcode.com/wp-content/uploads/2008/05/picture-1-300x242.png" alt="hackety-hack" width="300" height="242" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2008/05/07/_why-the-lucky-stiff-is-awesome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Flexbuilder to edit and debug Flash Applications</title>
		<link>http://bigbadcode.com/2008/04/10/flexbuilder_for_flash/</link>
		<comments>http://bigbadcode.com/2008/04/10/flexbuilder_for_flash/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 05:26:38 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flexbuilder3]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/?p=139</guid>
		<description><![CDATA[The goal here is to use the excellent code editing and application debugging/profiling available in Flexbuilder and still have the rapid prototyping and layout ability that the Flash IDE gives to you.
To get started create a new &#8220;Actionscript Project&#8221; in Flexbuilder.
Now we will add some code to testDebug.as that traces out when the application is [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">The goal here is to use the excellent code editing and application debugging/profiling available in Flexbuilder and still have the rapid prototyping and layout ability that the Flash IDE gives to you.</p>
<p style="text-align: left;">To get started create a new &#8220;Actionscript Project&#8221; in Flexbuilder.<a href="http://bigbadcode.com/wp-content/uploads/2008/04/picture-3.png"><img class="alignnone size-medium wp-image-140" title="new project" src="http://bigbadcode.com/wp-content/uploads/2008/04/picture-3-300x285.png" alt="" width="300" height="285" /></a></p>
<p style="text-align: left;">Now we will add some code to testDebug.as that traces out when the application is run:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript actionscript" style="font-family:monospace;">package <span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> testDebug <span style="color: #0066CC;">extends</span> Sprite
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> testDebug<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;I am created&quot;</span><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 style="text-align: left;">With that code saved we will Debug this actionscript project and if everything is working correctly you should see something like this in your console window:</p>
<p style="text-align: left;"><img class="alignnone size-medium wp-image-142" title="picture-4" src="http://bigbadcode.com/wp-content/uploads/2008/04/picture-4-300x38.png" alt="" width="300" height="38" /></p>
<p style="text-align: left;">So far everything is working correctly in Flexbuilder, now lets get Flash into the action.</p>
<p style="text-align: left;">Open up flash and create a new Flash file, lets call it TestFlexBuilderIntegration.fla. Add some timeline animation or something so you know it&#8217;s coming from the Flash IDE, save this file into the root directory of your new Flex project.</p>
<p style="text-align: left;">Now set the document class of your Flash file to &#8216;testDebug.&#8217; The AS class that we wrote in flexbuilder will now be the document class for your flash file as well.</p>
<p style="text-align: left;">Here come the tricks, under Publish Settings enable &#8220;Permit debugging&#8221;</p>
<p style="text-align: left;"><a href="http://bigbadcode.com/wp-content/uploads/2008/04/picture-1.png"><img class="alignnone size-medium wp-image-143" title="permit_debugging" src="http://bigbadcode.com/wp-content/uploads/2008/04/picture-1-300x228.png" alt="" width="300" height="228" /></a></p>
<p>Next in the Formats tab of Publish Settings change the .swf file to be published to the flexbuilder bin-debug folder.</p>
<p><a href="http://bigbadcode.com/wp-content/uploads/2008/04/picture-5.png"><img class="alignnone size-medium wp-image-144" title="publish_where" src="http://bigbadcode.com/wp-content/uploads/2008/04/picture-5-300x124.png" alt="" width="300" height="124" /></a></p>
<p>The path will be something like</p>
<pre>"/Users/YourName/Workspace/testDebug/bin-debug"</pre>
<p>Now if you test the movie in Flash you should see your animation as well as the trace &#8220;I am created&#8221; in the flash IDE.</p>
<p>For the final steps we go back to Flexbuilder and under the html-template folder open index.template.html in a text editor. This is a template file that generates the index.html that is used to launch your app. We are going to update it so it points to the .swf generated by Flash IDE instead of Flexbuilder.</p>
<p>Replace all occurrences of ${swf} with the name of your Flash IDE generated swf file. In this case it would be TestFlexBuilderIntegration.</p>
<p>The moment of truth! In Flexbuilder Debug your project, it should launch the .swf in a browser for you and the animation you created should be playing, additionally the trace(&#8221;I am created&#8221;) line should show up in your console.</p>
<p>If Flexbuilder has trouble connecting to the debugger, right click in the swf in the browser and change the debugger connection to 127.0.0.1 and that should solve that issue.</p>
<p>Now you have the full power of Flexbuilder to code and debug and you still have the Flash IDE to layout movieclips and rapidly prototype things. Sweet.</p>
<p><strong>Notes:</strong></p>
<p>As you make changes to the code in Flexbuilder, you&#8217;ll need to go back to Flash and republish.</p>
<p>Profiling should probably work as well though I haven&#8217;t played with it yet.</p>
<p>You can set breakpoints in Flexbuilder without needing to republish.</p>
]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2008/04/10/flexbuilder_for_flash/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Duplicate music file finder code.</title>
		<link>http://bigbadcode.com/2008/01/21/duplicate-music-file-finder-code/</link>
		<comments>http://bigbadcode.com/2008/01/21/duplicate-music-file-finder-code/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 01:11:52 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/2008/01/21/duplicate-music-file-finder-code/</guid>
		<description><![CDATA[I&#8217;ve been consolidating my music collection and found that there were lots of duplicate files. 
Most of the dupes were named something like &#8220;Happy Birthday 1.mp3&#8243; and &#8220;Happy Birthday.mp3&#8243; would exist in the same directory. I&#8217;m not sure which program added these dupes, but removing 2500 or so of em by hand would not be [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been consolidating my music collection and found that there were lots of duplicate files. </p>
<p>Most of the dupes were named something like &#8220;Happy Birthday 1.mp3&#8243; and &#8220;Happy Birthday.mp3&#8243; would exist in the same directory. I&#8217;m not sure which program added these dupes, but removing 2500 or so of em by hand would not be fun. </p>
<p>Without further ado, here&#8217;s some python code that takes care of that problem for you. It only examines the filename, not the date or the bitrate or the actual file contents, etc. But you could of course extend it to do all those things. </p>
<p>Enjoy.</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#-------------------------------------------------------------------------------</span>
<span style="color: #808080; font-style: italic;"># Name:        cleanDuplicateMusicFiles.py</span>
<span style="color: #808080; font-style: italic;"># Purpose:     Loops over a directory structure looking for 'duplicate' music files</span>
<span style="color: #808080; font-style: italic;">#				and moving them to a safe directory for deletion.</span>
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;"># Author:      Joshua Bloom</span>
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;"># Created:     01/18/2008</span>
<span style="color: #808080; font-style: italic;">#-------------------------------------------------------------------------------</span>
<span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
dupList = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
rootDirectory = <span style="color: #483d8b;">&quot;/Users/joshbloom/Music/iTunes/iTunes Music&quot;</span>
sequesteredFilesDirectory = <span style="color: #483d8b;">&quot;/Users/joshbloom&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Starting search ...&quot;</span>
    checkDir<span style="color: black;">&#40;</span>rootDirectory<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Found %s dupes&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>dupList<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> checkDir<span style="color: black;">&#40;</span>path<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Checking path '%s' for duplicates&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">basename</span><span style="color: black;">&#40;</span>path<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> item <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#91;</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>path, x<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">listdir</span><span style="color: black;">&#40;</span>path<span style="color: black;">&#41;</span> <span style="color: black;">&#93;</span>:
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">isdir</span><span style="color: black;">&#40;</span>item<span style="color: black;">&#41;</span>:
            checkDir<span style="color: black;">&#40;</span>item<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            checkForDupe<span style="color: black;">&#40;</span>item<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> checkForDupe<span style="color: black;">&#40;</span>fName<span style="color: black;">&#41;</span>:
	<span style="color: #483d8b;">''</span><span style="color: #483d8b;">'Example: if we find '</span>Happy Birthday 1.<span style="color: black;">mp3</span><span style="color: #483d8b;">' and '</span>Happy Birthday.<span style="color: black;">mp3</span><span style="color: #483d8b;">' exists in the
	same directory we consider this a duplicate and send it for re-education. '</span><span style="color: #483d8b;">''</span>
    fileName = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">basename</span><span style="color: black;">&#40;</span>fName<span style="color: black;">&#41;</span>
    folderList = <span style="color: #dc143c;">os</span>.<span style="color: black;">listdir</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">dirname</span><span style="color: black;">&#40;</span>fName<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> fileName.<span style="color: black;">endswith</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;1.mp3&quot;</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">for</span> otherName <span style="color: #ff7700;font-weight:bold;">in</span> folderList:
            <span style="color: #ff7700;font-weight:bold;">if</span> otherName <span style="color: #66cc66;">!</span>= fileName: <span style="color: #808080; font-style: italic;">#Make sure we aren't comparing with the current file</span>
                <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">basename</span> <span style="color: black;">&#40;</span>otherName<span style="color: black;">&#41;</span>.<span style="color: black;">startswith</span><span style="color: black;">&#40;</span>fileName<span style="color: black;">&#91;</span>:-<span style="color: #ff4500;">6</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>:
                    <span style="color: #808080; font-style: italic;">#This is a duplicate</span>
                    dupList.<span style="color: black;">append</span><span style="color: black;">&#40;</span>fName<span style="color: black;">&#41;</span>
                    sequesterDup<span style="color: black;">&#40;</span>fName<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> sequesterDup<span style="color: black;">&#40;</span>fName<span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">''</span><span style="color: #483d8b;">' Move em to a new folder, if you were confident you could change
 		this function to delete the file. '</span><span style="color: #483d8b;">''</span>
    <span style="color: #ff7700;font-weight:bold;">try</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Moving file: %s&quot;</span> <span style="color: #66cc66;">%</span> fName
        <span style="color: #dc143c;">os</span>.<span style="color: black;">rename</span><span style="color: black;">&#40;</span>fName, <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>sequesteredFilesDirectory, <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">basename</span><span style="color: black;">&#40;</span>fName<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> <span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">Exception</span>, E:
        <span style="color: #ff7700;font-weight:bold;">print</span> E
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2008/01/21/duplicate-music-file-finder-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XRay Logging with AS3</title>
		<link>http://bigbadcode.com/2007/10/30/xray-logging-with-as3/</link>
		<comments>http://bigbadcode.com/2007/10/30/xray-logging-with-as3/#comments</comments>
		<pubDate>Tue, 30 Oct 2007 23:55:24 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[xray]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/2007/10/30/xray-logging-with-as3/</guid>
		<description><![CDATA[Using Xray you can utilize logging in your AS3 development in a nice clean manner. One of the great benefits here is that your logging/debugging process can be the same when developing locally and when you are running on your development and production servers.
To get started download the latest xray code from their SVN repository.
http://code.google.com/p/osflash-xray/source
Then [...]]]></description>
			<content:encoded><![CDATA[<p>Using <a href="http://osflash.org/xray">Xray</a> you can utilize logging in your AS3 development in a nice clean manner. One of the great benefits here is that your logging/debugging process can be the same when developing locally <strong>and</strong> when you are running on your development and production servers.</p>
<p>To get started download the latest xray code from their SVN repository.<br />
<a href="http://code.google.com/p/osflash-xray/source">http://code.google.com/p/osflash-xray/source</a></p>
<p>Then create a new AS3 flash document using the code below as the document class:<br />
Make sure that you add the &#8216;trunk&#8217; directory that you downloaded to your class path (so flash can find the xray files)</p>
<p>Once you are compiling correctly, launch the xray viewer in a browser from <a href="http://www.rockonflash.com/xray/flex/Xray.html">http://www.rockonflash.com/xray/flex/Xray.html</a>. You will get a notification about not finding a SWF to connect with, ignore this for now (full xray support is not yet therefor AS3 projects). Make sure that the Show Output checkbox along the bottom is checked.</p>
<p>Now if you click the red square in your swf player, you should see the following show up in the XRay viewer windows.</p>
<p>Congratulations you are now logging. Big thanks to <a href="http://rockonflash.com/blog/">John Grden </a> and everyone else contributing to Flash development methodologies.</p>
<p><a href="http://bigbadcode.com/wp-content/uploads/2007/10/picture-4.png" title="picture-4.png"><img src="http://bigbadcode.com/wp-content/uploads/2007/10/picture-4.thumbnail.png" alt="picture-4.png" /></a></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript actionscript" style="font-family:monospace;">package <span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">blitzagency</span>.<span style="color: #006600;">xray</span>.<span style="color: #006600;">logger</span>.<span style="color: #006600;">XrayLog</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #66cc66;">*</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #66cc66;">*</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> testLoggingAS <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">log</span>:XrayLog = <span style="color: #000000; font-weight: bold;">new</span> XrayLog<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> mc:<span style="color: #0066CC;">MovieClip</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> testLoggingAS<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">log</span>.<span style="color: #006600;">debug</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Application starting up&quot;</span><span style="color: #66cc66;">&#41;</span>;
			createClickableMovieClip<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #0066CC;">log</span>.<span style="color: #006600;">debug</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Application has completed startup&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> showTheClick<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">log</span>.<span style="color: #006600;">debug</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Square was clicked. Tracing out the Event&quot;</span>, <span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">e</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createClickableMovieClip<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			mc = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">MovieClip</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			mc.<span style="color: #0066CC;">name</span> = <span style="color: #ff0000;">&quot;ClickableMovieClip&quot;</span>
			mc.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xFF0000<span style="color: #66cc66;">&#41;</span>;
			mc.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span>0, 0, <span style="color: #cc66cc;">100</span>, <span style="color: #cc66cc;">80</span><span style="color: #66cc66;">&#41;</span>;
			mc.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			mc.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">80</span>;
			mc.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">60</span>;
			addChild<span style="color: #66cc66;">&#40;</span>mc<span style="color: #66cc66;">&#41;</span>;
			mc.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, showTheClick<span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2007/10/30/xray-logging-with-as3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
