<?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; Technical</title>
	<atom:link href="http://bigbadcode.com/category/technical/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>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>How To: Install Heated Handgrips on Your Motorcycle</title>
		<link>http://bigbadcode.com/2009/01/05/how-to-install-heated-handgrips-on-your-motorcycle/</link>
		<comments>http://bigbadcode.com/2009/01/05/how-to-install-heated-handgrips-on-your-motorcycle/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 18:36:11 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Instructables howto motorcycle]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/2009/01/05/how-to-install-heated-handgrips-on-your-motorcycle/</guid>
		<description><![CDATA[
Hosted at instructables.com
Installing heated handgrips on a Suzuki Vstrom DL-1000
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.instructables.com/id/Install_Heated_Grips_on_Your_Motorcycle_or_ATV/"><img class="alignnone size-full wp-image-217" title="The Parts" src="http://bigbadcode.com/wp-content/uploads/2009/01/2009-01-05_1034.png" alt="The Parts" width="499" height="331" /></a></p>
<p><a href="http://www.instructables.com/id/Install_Heated_Grips_on_Your_Motorcycle_or_ATV/" target="_blank">Hosted at instructables.com</a></p>
<p>Installing heated handgrips on a Suzuki Vstrom DL-1000</p>
]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2009/01/05/how-to-install-heated-handgrips-on-your-motorcycle/feed/</wfw:commentRss>
		<slash:comments>1</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>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>Auto twitter SMS on/off</title>
		<link>http://bigbadcode.com/2007/07/20/auto-twitter-sms-onoff/</link>
		<comments>http://bigbadcode.com/2007/07/20/auto-twitter-sms-onoff/#comments</comments>
		<pubDate>Sat, 21 Jul 2007 05:13:51 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/2007/07/20/auto-twitter-sms-onoff/</guid>
		<description><![CDATA[So I&#8217;ve spent a little more time thinking about this and have decided this utility would be better as a server utility that sits out in the cloud and monitors for my computer activity. If it doesn&#8217;t see activity for some set period it notifies twitter to re-enable SMS messages.
This takes care of any issues [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve spent a little more time thinking about this and have decided this utility would be better as a server utility that sits out in the cloud and monitors for my computer activity. If it doesn&#8217;t see activity for some set period it notifies twitter to re-enable SMS messages.<br />
This takes care of any issues with me shutting down or closing my laptop/computer before my notifier can get its message out.</p>
<p>I&#8217;m thinking a python script, called by cron that checks for an indication that I&#8217;m active on my computer, if it doesn&#8217;t see the indication after some number of tries it turns SMS notifications on. That part seems pretty solid, what should I use on the laptop to signal my presence? If this was a Windows machine I&#8217;d be off and running but I&#8217;ve recently switched to a Mac and I don&#8217;t know the platform very well. Instant messenger sounds like something to tap into as it already has the concept of active/idle built into it, but I&#8217;m using Adium and it seems like Adium plug-ins are written in Objective-C which is totally foreign to me. </p>
<p>I think it&#8217;s time for some googling&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2007/07/20/auto-twitter-sms-onoff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto update Twitter notifications to phone</title>
		<link>http://bigbadcode.com/2007/07/19/auto-update-twitter-notifications-to-phone/</link>
		<comments>http://bigbadcode.com/2007/07/19/auto-update-twitter-notifications-to-phone/#comments</comments>
		<pubDate>Fri, 20 Jul 2007 04:58:39 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/2007/07/19/auto-update-twitter-notifications-to-phone/</guid>
		<description><![CDATA[I just started twittering and have found that getting alerts on my phone is great, just not when I&#8217;m also at the computer.
So being a good geek I thought I&#8217;d automate the process of turning mobile alerts on or off based on my laptop status.
So far I&#8217;ve scraped the HTTP headers and post variables so [...]]]></description>
			<content:encoded><![CDATA[<p>I just started twittering and have found that getting alerts on my phone is great, just not when I&#8217;m also at the computer.<br />
So being a good geek I thought I&#8217;d automate the process of turning mobile alerts on or off based on my laptop status.</p>
<p>So far I&#8217;ve scraped the HTTP headers and post variables so I know how to login and turn updates on or off. Next I need to package up a small utility to automatically decide when to send the commands.</p>
]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2007/07/19/auto-update-twitter-notifications-to-phone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert m4a to mp3</title>
		<link>http://bigbadcode.com/2007/06/06/convert-m4a-to-mp3/</link>
		<comments>http://bigbadcode.com/2007/06/06/convert-m4a-to-mp3/#comments</comments>
		<pubDate>Wed, 06 Jun 2007 14:15:41 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[m4a]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/2007/06/06/convert-m4a-to-mp3/</guid>
		<description><![CDATA[I&#8217;ve been moving a bunch of my brothers music out of iTunes for him so he can use it with portable players besides iPod. Unfortunately he encoded a lot of his cd&#8217;s in .m4a format. I found a decent utility for converting to mp3 (and other formats) http://www.bonkenc.org/
Unfortunately when you point Bonk at a directory [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been moving a bunch of my brothers music out of iTunes for him so he can use it with portable players besides iPod. Unfortunately he encoded a lot of his cd&#8217;s in .m4a format. I found a decent <a href="http://www.bonkenc.org/">utility for converting to mp3 (and other formats) http://www.bonkenc.org/</a></p>
<p>Unfortunately when you point Bonk at a directory full of m4a&#8217;s it crashes on certain files for some reason (encoding issues probably.) After the crash you need to setup all of your settings and add the files again, which is really time consuming and annoying.</p>
<p>To make this easier I whipped  up a short python script that calls Bonk for you on each file, if it runs into a bad file it will rename the file for you so you don&#8217;t try to process it again. </p>
<p>Here&#8217;s the python code:</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><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;">pprint</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">subprocess</span>
curDir = <span style="color: #dc143c;">os</span>.<span style="color: black;">getcwd</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #808080; font-style: italic;"># The current directory. This should contain your .m4a files</span>
pathToBonk = <span style="color: #483d8b;">&quot;C:<span style="color: #000099; font-weight: bold;">\\</span>Program Files<span style="color: #000099; font-weight: bold;">\\</span>BonkEnc<span style="color: #000099; font-weight: bold;">\\</span>becmd.exe&quot;</span> <span style="color: #808080; font-style: italic;">#Where the becmd.exe file lives</span>
problemFiles = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span> <span style="color: #808080; font-style: italic;">#A list of files that failed conversion</span>
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #ff7700;font-weight:bold;">for</span> item <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>curDir<span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">if</span> item.<span style="color: black;">upper</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">endswith</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.M4A'</span><span style="color: black;">&#41;</span>:
		fullPath = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>curDir,item<span style="color: black;">&#41;</span>
		<span style="color: #dc143c;">cmd</span> = <span style="color: #483d8b;">'&quot;%s&quot; -e LAME -d &quot;%s&quot; &quot;%s&quot;'</span> <span style="color: #808080; font-style: italic;">#The command to convert a single file</span>
		<span style="color: #dc143c;">cmd</span> = <span style="color: #dc143c;">cmd</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>pathToBonk, curDir, fullPath<span style="color: black;">&#41;</span>
		val = <span style="color: #dc143c;">subprocess</span>.<span style="color: black;">call</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">cmd</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> val == 0: <span style="color: #808080; font-style: italic;">#Successfull conversion, delete the original</span>
			<span style="color: #dc143c;">os</span>.<span style="color: black;">remove</span><span style="color: black;">&#40;</span>fullPath<span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">else</span>:
			problemFiles.<span style="color: black;">append</span><span style="color: black;">&#40;</span>fullPath<span style="color: black;">&#41;</span>
			<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Problem converting %s'</span> <span style="color: #66cc66;">%</span> item
			<span style="color: #dc143c;">os</span>.<span style="color: black;">rename</span><span style="color: black;">&#40;</span>fullPath, fullPath + <span style="color: #483d8b;">&quot;.BAD&quot;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'These files had problems converting and have been renamed with .BAD extensions:'</span>
<span style="color: #dc143c;">pprint</span>.<span style="color: #dc143c;">pprint</span><span style="color: black;">&#40;</span>problemFiles<span style="color: black;">&#41;</span></pre></div></div>

<p>NOTES: This will <strong>delete </strong>the .m4a file after converting it. If you want to keep your old files for some reason make sure to run this on a copy of your files. IE in a different directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2007/06/06/convert-m4a-to-mp3/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Primecondition.com</title>
		<link>http://bigbadcode.com/2007/02/26/primeconditioncom/</link>
		<comments>http://bigbadcode.com/2007/02/26/primeconditioncom/#comments</comments>
		<pubDate>Tue, 27 Feb 2007 01:00:53 +0000</pubDate>
		<dc:creator>jbloom</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://bigbadcode.com/2007/02/26/primeconditioncom/</guid>
		<description><![CDATA[
I saw Simon demo Primecondition.com at last months Refresh Phoenix meeting and I have to say that I was impressed.
The gist of it is you create your workouts. Input your exercises, sets, reps, times, etc and the app generates an audio track for you. The generated track has all the verbal cues that a personal [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.primecondition.com/"><img src="http://blog.primecondition.com/storage/smalllogo.gif" height="56" width="107" /></a></p>
<p>I saw Simon demo <a href="http://www.primecondition.com/">Primecondition.com</a> at last months Refresh Phoenix meeting and I have to say that I was impressed.</p>
<p>The gist of it is you create your workouts. Input your exercises, sets, reps, times, etc and the app generates an audio track for you. The generated track has all the verbal cues that a personal trainer would have for you at a much lower cost <img src='http://bigbadcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  You move the track onto your iPod or whatever device and hit the gym. It walks you through all the stuff that you have defined in your exercise while playing music to workout to.</p>
<p>This is a great application! The fact that its on the web just makes it easier to use and talk about and enables the sharing and community features that make apps so much more sticky.</p>
<p><a href="http://blog.primecondition.com">Check it out</a> if you need someone telling you what to do next at the gym.</p>
]]></content:encoded>
			<wfw:commentRss>http://bigbadcode.com/2007/02/26/primeconditioncom/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
