<?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>Clockwise &#187; Coding</title>
	<atom:link href="http://clockwi.se/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://clockwi.se</link>
	<description>by Caleb Jaffa</description>
	<lastBuildDate>Mon, 21 Jun 2010 10:38:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Coda Twilight Syntax Highlighting for PHP</title>
		<link>http://clockwi.se/2008/09/04/coda-twilight-syntax-highlighting-for-php/</link>
		<comments>http://clockwi.se/2008/09/04/coda-twilight-syntax-highlighting-for-php/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 21:12:38 +0000</pubDate>
		<dc:creator>Caleb</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[coda]]></category>
		<category><![CDATA[textmate]]></category>
		<category><![CDATA[twilight]]></category>

		<guid isPermaLink="false">http://clockwi.se/?p=25</guid>
		<description><![CDATA[I am a fan of using one editor and knowing it well to do everything. I switched to Mac OS X back in the days of Jaguar, and BBEdit was the de-facto standard text editor. My friend who I worked with and was the guiding light was a lifelong Mac user and he felt right at home [...]]]></description>
			<content:encoded><![CDATA[<p>I am a fan of using one editor and knowing it well to do everything. I switched to Mac OS X back in the days of Jaguar, and BBEdit was the de-facto standard text editor. My friend who I worked with and was the guiding light was a lifelong Mac user and he felt right at home there. I however found BBEdit lacking for my tastes.</p>
<p>From the first glimpses of TextMate shown to the world in <a href="http://www.loudthinking.com/">David Heinemeier Hansson&#8217;s </a> first screencasts of Ruby on Rails I was intrigued, and soon to be in love. (I managed to snag license #20 for TextMate.) My favorite color scheme by far is the one called Twilight. Easy on my eyes and still useful for helping work in code.</p>
<p>Along came <a href="http://panic.com">Panic&#8217;s</a> offering of <a href="http://www.panic.com/coda/">Coda</a>. I surprised myself by purchasing it. Even though the <a href="http://www.codingmonkeys.de/subethaedit/">SubEthaEdit</a> editor is not my favorite, it&#8217;s the core to Coda&#8217;s text editor, I found the integration of SFTP to be an attractive offering, even more so when the file listing gave access to a much improved engine over Panic&#8217;s own <a href="http://www.panic.com/transmit/">Transmit.</a> </p>
<p>On a recent project I&#8217;ve been spending more time in Coda as it&#8217;s not feasible to develop locally and then push my changes up to the server. I finally broke down after google searches netted me nothing and took the time to change my PHP-HTML syntax highlighting to match Twilight as best I could quickly. I&#8217;m sharing my labors with the world cause it might be useful to someone out there. Download the theme file below, go into Coda&#8217;s preferences, select the PHP-HTML language and click on import to use this theme.</p>
<p><strong>Update:</strong></p>
<p>I&#8217;ve made a few minor changes to the declaration and prologue colors (I had left them alone before so they didn&#8217;t fit the theme). Also here is a screenshot of how it looks, I use inverted colors and checked that this style can be imported into SubEthaEdit as well as Coda.</p>
<p><a href="http://clockwi.se/wp-content/uploads/2008/09/php-html-twilightseestyle1.zip">php-html-twilightseestyle1.zip</a></p>
<p> </p>
<div id="attachment_34" class="wp-caption alignnone" style="width: 280px"><a href="http://clockwi.se/wp-content/uploads/2008/09/twilight-screenshot.png"><img class="size-medium wp-image-34" title="twilight-screenshot" src="http://clockwi.se/wp-content/uploads/2008/09/twilight-screenshot-270x300.png" alt="Screenshot of Twilight theme/style for Coda/SubEthaEdit" width="270" height="300" /></a><p class="wp-caption-text">Screenshot of Twilight theme/style for Coda/SubEthaEdit</p></div>
]]></content:encoded>
			<wfw:commentRss>http://clockwi.se/2008/09/04/coda-twilight-syntax-highlighting-for-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Transparent GIF</title>
		<link>http://clockwi.se/2008/08/09/transparent-gif/</link>
		<comments>http://clockwi.se/2008/08/09/transparent-gif/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 22:15:40 +0000</pubDate>
		<dc:creator>Caleb</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[hacks]]></category>

		<guid isPermaLink="false">http://clockwi.se/?p=18</guid>
		<description><![CDATA[My old friend the transparent GIF has come back in town. I was putting together some updates for Gough Homes home page. While it wasn&#8217;t the most extensive search, I settled on using 24 ways to impress your friends&#8217; transparent PNGs in IE6 solution. Part of this solution was the introduction of a transparent GIF. [...]]]></description>
			<content:encoded><![CDATA[<p>My old friend the transparent GIF has come back in town. I was putting together some updates for <a href="http://goughhomesutah.com">Gough Homes</a> home page. While it wasn&#8217;t the most extensive search, I settled on using 24 ways to impress your friends&#8217; <a href="http://24ways.org/2007/supersleight-transparent-png-in-ie6">transparent PNGs in IE6</a> solution. Part of this solution was the introduction of a transparent GIF. Not ideal, but a worthwhile sacrifice for ease of development.</p>
<p>With that piece of the puzzle in figured out, I decided to switch over to the other major piece. It was a slideshow, which was to use JavaScript and not Flash. It needed to link to a popup showing home plans. Attempts to work within the system to add the onclick event led nowhere. So the simple solution of placing an invisible layer with the proper link above was used. It worked great and simplified things, though obviously not the most ideal solution. That is the chore of the web developer to balance between the ideal and the practical solution that gets the job done efficiently.</p>
<p>The final piece I added to the home page was a location map that had small hover layers when you placed the cursor over a community. The hover popups worked best as PNGs, and hence the search for a good way to use PNGs as transparently as possible to work in all browsers. This is where it got fun as IE7 will not do anchor tag hover if there is no text, even if it is a block level element. Transparent GIF was employed to give IE7 something to hover over and make the layers work.</p>
<p>So it isn&#8217;t the ideal solution, but then not all browsers are ideal. It was interesting to brush the dust off of something that used to be abused in the 90&#8242;s from the toolkit. However at the end of the day it&#8217;s all about, hopefully, providing all users of a website the best experience efficiently.</p>
<p>You can see the magic on the <a href="http://goughhomesutah.com">Gough Homes</a> home page, the two additions are the locations and plans.</p>
]]></content:encoded>
			<wfw:commentRss>http://clockwi.se/2008/08/09/transparent-gif/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mephisto 0.8 to WordPress 2.5.1 Ruby Script</title>
		<link>http://clockwi.se/2008/07/06/mephisto-08-to-wordpress-251-ruby-script/</link>
		<comments>http://clockwi.se/2008/07/06/mephisto-08-to-wordpress-251-ruby-script/#comments</comments>
		<pubDate>Sun, 06 Jul 2008 21:50:06 +0000</pubDate>
		<dc:creator>Caleb</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://clockwi.se/?p=16</guid>
		<description><![CDATA[Not long ago I converted from Mephisto to WordPress for my wife&#8217;s blog and a blog I keep for my family. At the time I couldn&#8217;t find any scripts to automate the process. I did find someone had written a controller to put into the Mephisto code to convert, but it was the controller only [...]]]></description>
			<content:encoded><![CDATA[<p>Not long ago I converted from Mephisto to WordPress for my wife&#8217;s blog and a blog I keep for my family. At the time I couldn&#8217;t find any scripts to automate the process. I did find someone had written a controller to put into the Mephisto code to convert, but it was the controller only and didn&#8217;t include the models. I wanted something simpler to run anyway. I&#8217;ve put the rough code up on <a href="http://pastie.org/228661">Pastie</a>.</p>
<p>Some notes about how to use it. First off you&#8217;ll need to run it on a computer that can access your Mephisto MySQL server and your target WordPress. You&#8217;ll need a default WordPress database to point at, I suggest clearing out the &#8220;Hello World&#8221; type stuff first. It does Mysql.quote on some fields, but not all, these were the fields that caused problems not being quoted for the two test blogs. It uses REPLACE INTO so in case a problem arises you can fix the script to handle the exception and re-run without worrying about duplicate data.</p>
]]></content:encoded>
			<wfw:commentRss>http://clockwi.se/2008/07/06/mephisto-08-to-wordpress-251-ruby-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Heroku Gem and Git</title>
		<link>http://clockwi.se/2008/05/26/the-heroku-gem-and-git/</link>
		<comments>http://clockwi.se/2008/05/26/the-heroku-gem-and-git/#comments</comments>
		<pubDate>Mon, 26 May 2008 20:28:49 +0000</pubDate>
		<dc:creator>Caleb</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http://10.0.1.199/?p=12</guid>
		<description><![CDATA[I signed up for the Heroku beta and got in months ago. It was fun to kick the tires, but I never did more than that. The web interface to edit your application is indeed a technical feat, I’d much rather develop with the tools I know and love. Heroku sort of got pushed off in the [...]]]></description>
			<content:encoded><![CDATA[<p>I signed up for the <a href="http://heroku.com/">Heroku</a> beta and got in months ago. It was fun to kick the tires, but I never did more than that. The web interface to edit your application is indeed a technical feat, I’d much rather develop with the tools I know and love. Heroku sort of got pushed off in the back of my mind. Today I came across an article talking about <a href="http://technicalpickles.com/posts/playing-with-heroku">playing with heroku</a> by Josh Nichols at his blog <a href="http://technicalpickles.com/">Technical Pickles</a>.</p>
<p>Digging around proved that I never did subscribe to the <a href="http://blog.heroku.com/">Heroku blog</a> and that it was time to give it another spin. I’ll refer you to the above article for a good overview of the new features. The skinny is that there is a Heroku gem that allows you to interact with your account. Then you can use it to create a local git repository of an application. After editing locally, committing and pushing your changes Heroku will update your application, run any migrations and restart the mongrel process. This certainly make Heroku more appealing to investigate further. The best part is that with git and rails you aren’t necessarily tied to them, should their eventual pricing plans not suit your tastes.</p>
]]></content:encoded>
			<wfw:commentRss>http://clockwi.se/2008/05/26/the-heroku-gem-and-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading PHPBB from version 2 to 3</title>
		<link>http://clockwi.se/2008/04/14/upgrading-phpbb-from-version-2-to-3/</link>
		<comments>http://clockwi.se/2008/04/14/upgrading-phpbb-from-version-2-to-3/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 11:46:52 +0000</pubDate>
		<dc:creator>Caleb</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpbb]]></category>

		<guid isPermaLink="false">http://10.0.1.199/?p=9</guid>
		<description><![CDATA[Recently I took over hosting duties for a phpbb forum for a group of friends, and friends of friends. It’s not a large forum, but it isn’t small either. The database with search index was about half a gig. Thankfully the conversion process can be run alongside the existing forum. Granted you should disable the old forum [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I took over hosting duties for a <a href="http://phpbb.com/">phpbb</a> forum for a group of friends, and friends of friends. It’s not a large forum, but it isn’t small either. The database with search index was about half a gig.</p>
<p>Thankfully the conversion process can be run alongside the existing forum. Granted you should disable the old forum when you are upgrading, but to test the process out it is handy to not have to take the board down. Unfortunately for me the conversion process that comes with <span class="caps">PHPBB 3</span>.0.1 was consistently failing. Turning on all the php error reporting resulted in nothing as to why the script was failing. After some searching I read some people having problems with 3.0.1’s conversion had success upgrading to 3.0.0. The process wasn’t flawless, needing to be babysat for the occasional 500 error that thankfully can be overcome with a simple reload of the script. After a couple of hours it could at least complete the process.</p>
<p>I did try immediately upgrading to 3.0.1, but the update package didn’t like something and ended up leaving the board in an unusable state. Attempts to manually update things couldn’t save it. So the process was started over again and left at version 3.0.0 for the time being.</p>
<p>This information might be useful to someone else having problems upgrading a version 2 phpbb forum to a version 3. Good luck, dealing with their update process is a painful reminder of how much nicer it is to migrate a Rails app to a newer version.</p>
]]></content:encoded>
			<wfw:commentRss>http://clockwi.se/2008/04/14/upgrading-phpbb-from-version-2-to-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design the Interface First</title>
		<link>http://clockwi.se/2008/01/29/design-the-interface-first/</link>
		<comments>http://clockwi.se/2008/01/29/design-the-interface-first/#comments</comments>
		<pubDate>Tue, 29 Jan 2008 09:11:51 +0000</pubDate>
		<dc:creator>Caleb</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Clockwise]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http://10.0.1.199/?p=7</guid>
		<description><![CDATA[I’ve spent many years developing websites. The most successful projects have always had a good foundation design done before the coding started. 37 Signals talks about this in their book Getting Real in chapter 9 Interface First. The interface gives you something concrete to think about and to work towards. Recently I had a small project come my way, that [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve spent many years developing websites. The most successful projects have always had a good foundation design done before the coding started. <a href="http://www.37signals.com/">37 Signals</a> talks about this in their book <a href="http://gettingreal.37signals.com/index.php">Getting Real</a> in chapter 9 <a href="http://gettingreal.37signals.com/ch09_Interface_First.php">Interface First</a>. The interface gives you something concrete to think about and to work towards.</p>
<p>Recently I had a small project come my way, that was basically a simple feed reader. I started by sketching out my interface. The target was simplicity and not a lot of development time. Unfortunately I neglected one vital part of the application in the interface design phase, the requirement that the user be able to sort the feeds.</p>
<p>I dove into the code, setting up the Ruby on Rails project. I found a gem that would simplify reading in all the different feed types and letting me treat them the same. I got the interface in and about 90% of the project coded within an hour and a half. Then my poor interface planning skills hit trying to implement the sort. There were certainly easier and more elegant ways to tackle the problem, but not in the interface I had designed.</p>
<p>The decision became to bolt on the sorting requirement or to rethink my interface. I was already hovering around the expected amount of effort put in. I spent some time toying with some different interface ideas, but nothing came that solved the problem without requiring significant work and making the application more than it was intended to be. So I bent the framework to my purposes and called it version 0.1.</p>
<p>I temporarily had it running on this server. As a coding exercise I might do more with this project and expand it out with a better interface. The interface is definitely the thing that needs to be overhauled and the next would be reworking the tests that are mostly untouched from their generated state.</p>
]]></content:encoded>
			<wfw:commentRss>http://clockwi.se/2008/01/29/design-the-interface-first/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Importing Data to MySQL with Ruby</title>
		<link>http://clockwi.se/2007/12/18/importing-data-to-mysql-with-ruby/</link>
		<comments>http://clockwi.se/2007/12/18/importing-data-to-mysql-with-ruby/#comments</comments>
		<pubDate>Tue, 18 Dec 2007 19:05:17 +0000</pubDate>
		<dc:creator>Caleb</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://10.0.1.199/?p=6</guid>
		<description><![CDATA[When I first started coding with Ruby regularly my code was not always The Ruby Way. One task I’ve come back to time and time again is importing data from a text file into a database. Though I can’t recall the specific code used, I believe my first attempt loaded the whole file into memory before [...]]]></description>
			<content:encoded><![CDATA[<p>When I first started coding with Ruby regularly my code was not always <em>The Ruby Way</em>. One task I’ve come back to time and time again is importing data from a text file into a database. Though I can’t recall the specific code used, I believe my first attempt loaded the whole file into memory before running the <span class="caps">INSERT</span>statements. This was needlessly expensive on the machine doing the processing and slow. I had started the process before leaving work and on my commute home puzzled out the better way to do it. The new version that read a line in, inserted the data in the database and then went on to the next line forgetting about the previous took much less time to execute and worked wonderfully.</p>
<p>Later I took over primary development of a large set of Ruby scripts that more or less managed importing and exporting data from MySQL using flat files. This system communicated with corporate headquarters and individual stores about everything, customers, orders, products, special pricing agreements, etc. Processing time varied on file size, but most files took a couple of minutes to process even on new hardware and the largest set of files, a potentially daily input of data, could take up to an hour to get through. Now there was some processing with this data to populate some fields and sometimes joins were necessary to set things up right.</p>
<p>However the client was looking to be able to take this process from a handful of sites to potentially hundreds. The system’s architecture was changed so we could throw more hardware to scale. I also looked for optimizations that could be made. It made sense to do things they way they were, Ruby read in a line of data, performed any calculations or string concatenations and then inserted the data in the database. There was something faster though. MySQL’s <span class="caps">LOAD DATA INFILE</span> was brought in to do all the heavy lifting of getting data from the flat files into the database. Then a<span class="caps">SQL</span> query could be run to calculate any fields that needed to be calculated. This cut processing time overall for the most common file from minutes to seconds. It was a good reminder of how usually if your database server can do it, it’ll probably do it faster than whatever language you’re working with.</p>
]]></content:encoded>
			<wfw:commentRss>http://clockwi.se/2007/12/18/importing-data-to-mysql-with-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
