<?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>Seán Hayes &#187; Web Design &amp; Development</title>
	<atom:link href="http://seanhayes.name/category/web-dev/feed/" rel="self" type="application/rss+xml" />
	<link>http://seanhayes.name</link>
	<description>Web Developer in Rochester, NY (Django, JavaScript, LAMP)</description>
	<lastBuildDate>Fri, 06 Jan 2012 00:45:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Awesome Web App, Codecademy, Teaches You to Program</title>
		<link>http://seanhayes.name/2011/09/28/awesome-web-app-codecademy-teaches-program/</link>
		<comments>http://seanhayes.name/2011/09/28/awesome-web-app-codecademy-teaches-program/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 04:17:07 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[learn]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=276</guid>
		<description><![CDATA[I just found out about this cool web app called Codecademy that teaches programming to complete novices. As soon as you visit the site you can start learning to program without having to create an account, and as of now &#8230; <a href="http://seanhayes.name/2011/09/28/awesome-web-app-codecademy-teaches-program/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just found out about this cool web app called <a href="http://www.codecademy.com/">Codecademy</a> that teaches programming to complete novices. As soon as you visit the site you can start learning to program without having to create an account, and as of now it looks like it&#8217;s completely free. If you or anyone you know is interested in learning to program I recommend trying it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2011/09/28/awesome-web-app-codecademy-teaches-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Web Intents Javascript Events Not Firing</title>
		<link>http://seanhayes.name/2011/08/31/twitter-web-intents-javascript/</link>
		<comments>http://seanhayes.name/2011/08/31/twitter-web-intents-javascript/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 20:33:35 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[web intents]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=265</guid>
		<description><![CDATA[If you&#8217;re trying out Twitter&#8217;s Web Intents Javascript Events and it&#8217;s not working, be aware that they only work if your HTML page is loaded from an HTTP server. If you open your page locally off your hard drive it &#8230; <a href="http://seanhayes.name/2011/08/31/twitter-web-intents-javascript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re trying out Twitter&#8217;s <a href="https://dev.twitter.com/docs/intents/events">Web Intents Javascript Events</a> and it&#8217;s not working, be aware that they only work if your HTML page is loaded from an HTTP server. If you open your page locally off your hard drive it won&#8217;t work, though you can fire up an Apache instance on your localhost and it&#8217;ll work from there.</p>
<p>Source: <a href="https://dev.twitter.com/comment/reply/304/491">https://dev.twitter.com/comment/reply/304/491</a></p>
<p>Update: It looks like this can also happen with the Facebook JavaScript API: <a href="http://forum.developers.facebook.net/viewtopic.php?pid=362167#p362167">http://forum.developers.facebook.net/viewtopic.php?pid=362167#p362167</a>. I guess <a href="http://vimeo.com/forums/topic:28340">it&#8217;s because they use iFrames</a>, and using them locally can cause security problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2011/08/31/twitter-web-intents-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saved Web Pages from Firefox Have Scripts Removed</title>
		<link>http://seanhayes.name/2011/08/26/saved-web-pages-firefox-scripts/</link>
		<comments>http://seanhayes.name/2011/08/26/saved-web-pages-firefox-scripts/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 21:39:53 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[maf]]></category>
		<category><![CDATA[missing]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=262</guid>
		<description><![CDATA[So, I was just in the middle of a programming test for a job application where I had to download an HTML page, edit the JavaScript to perform a desired task, and email it back. I downloaded the page, but &#8230; <a href="http://seanhayes.name/2011/08/26/saved-web-pages-firefox-scripts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So, I was just in the middle of a programming test for a job application where I had to download an HTML page, edit the JavaScript to perform a desired task, and email it back. I downloaded the page, but the JavaScript had been replaced by the text, &#8220;Script removed by snapshot save&#8221;. Luckily the removed JS was only one line and I was able to figure out what it was.</p>
<p>Afterwards, I went searching for the cause and found <a href="http://forums.informaction.com/viewtopic.php?f=10&#038;t=5641#p25574" title="InformAction Forums &bull; View topic - Script removed by snapshot save">this forum post</a>, which explains that the problem is caused by the Mozilla Archive Format extension, which has a setting that even affects pages not saved as .maff. To fix the problem, go into the MAF extension settings and change &#8220;When saving complete web page contents:&#8221; from &#8220;Take a faithful snapshot of the page&#8221; to one of the other options.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2011/08/26/saved-web-pages-firefox-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cookies Not Saved In Internet Explorer for Facebook iframe Apps</title>
		<link>http://seanhayes.name/2011/07/08/cookies-saved-internet-explorer/</link>
		<comments>http://seanhayes.name/2011/07/08/cookies-saved-internet-explorer/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 01:02:16 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[p3p]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=238</guid>
		<description><![CDATA[I&#8217;m making a Facebook game using Django and was having a problem with Internet Explorer. The Problem: After login the page would render correctly as if the user was logged in, but when navigating to another page it was as &#8230; <a href="http://seanhayes.name/2011/07/08/cookies-saved-internet-explorer/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m making a Facebook game using Django and was having a problem with Internet Explorer.</p>
<p>The Problem: After login the page would render correctly as if the user was logged in, but when navigating to another page it was as if the user wasn&#8217;t logged in. Upon investigation I could see that the cookies weren&#8217;t being saved.</p>
<p>The Solution: A quick Gogole search brought me to this blog post: <a href="http://adamyoung.net/IE-Blocking-iFrame-Cookies">IE Blocking iFrame Cookies</a>. It&#8217;s an easy to fix P3P issue, and the author describes how to add the necessary header for various languages/frameworks.</p>
<p>Rather than add the header to each Django view or write custom Django middleware, I just added the header to my Apache configuration. The following goes in your VirtualHost Directive:</p>
<p>Header add P3P &#8216;CP=&#8221;IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT&#8221;&#8216;</p>
<p>In order to work you have to enable mod_headers (run &#8220;sudo a2enmod headers&#8221;).</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2011/07/08/cookies-saved-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Meta Languages and Compilers</title>
		<link>http://seanhayes.name/2011/03/14/css-meta-languages-compilers/</link>
		<comments>http://seanhayes.name/2011/03/14/css-meta-languages-compilers/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 20:22:38 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[inheritance]]></category>
		<category><![CDATA[language]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=228</guid>
		<description><![CDATA[So, I&#8217;ve finally decided to add a CSS framework into my workflow, namely Blueprint. I&#8217;m not very skilled when it comes to graphic design (though I&#8217;m trying to learn) and the CSS frameworks out there give you some nice looking &#8230; <a href="http://seanhayes.name/2011/03/14/css-meta-languages-compilers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve finally decided to add a CSS framework into my workflow, namely <a href="http://www.blueprintcss.org/">Blueprint</a>. I&#8217;m not very skilled when it comes to graphic design (though I&#8217;m trying to learn) and the CSS frameworks out there give you some nice looking web pages. The only problem is they require you to add extra classes to each HTML element you want to use them with. The whole point of CSS is you can modify it without changing your markup. If I could set an id for  each element (#content, #footer) and have each id style definition simply inherit the CSS framework classes I want to use my problem would  be solved, but that can only be done using a CSS meta language and compiler.</p>
<p>I was looking at <a href="https://github.com/dziegler/django-css">django-css</a>, a project which would integrate CSS compilation into my Django projects, and it mentioned 4 popular languages:  <a href="http://ncannasse.fr/projects/hss" target="_blank">HSS</a>, <a href="http://sass-lang.com/" target="_blank">Sass</a>, <a href="http://sandbox.pocoo.org/clevercss/" target="_blank">CleverCSS</a>, and <a href="http://lesscss.org/" target="_blank">LESS</a>.</p>
<p>Here&#8217;s a spreadsheet comparing the features:</p>
<p><iframe width='500' height='300' frameborder='0' src='https://spreadsheets.google.com/pub?hl=en&#038;hl=en&#038;key=0AhZ3SH4irFLEdDlpekFWQ2dKdmFETjFVY2FObERYN0E&#038;output=html&#038;widget=true'></iframe></p>
<p><strong>Popularity</strong><br />
I think SASS is by far the most popular. I&#8217;m secretly rooting for it, since it&#8217;s probably in higher demand and would  therefore be a more valuable skill to have, though it would be awkward  introducing Ruby dependencies in a Python project.</p>
<p><strong>Inheritance</strong><br />
The main reason I want to use a CSS meta language is for the inheritance. When looking at the documentation for CleverCSS I couldn&#8217;t see any inheritance implementation, which is a shame because it&#8217;s the only one implemented in Python and would&#8217;ve been easier to integrate into my Django project.</p>
<p>HASS example:</p>
<pre><code>var nomargin = { margin : 0px; padding : 0px; }

pre {
    $nomargin;
    color : #FF0000;

}</code></pre>
<p>The inherited styles can&#8217;t be a normal CSS class, so this can&#8217;t be used to inherit classes from a CSS framework.</p>
<p>SASS Mixin example:</p>
<pre><code>@mixin table-base {
  th {
    text-align: center;

    font-weight: bold;
  }
  td, th {padding: 2px}
}

@mixin left($dist) {
  float: left;
  margin-left: $dist;
}

#data {
  @include left(10px);
  @include table-base;
}
</code></pre>
<p>The inherited definition needs to be declared as a mixin, and I&#8217;d rather not modify any CSS frameworks. There is a project called <a href="http://compass-style.org/" target="_blank">Compass</a> that provides CSS frameworks rewritten in SASS, but I&#8217;d rather not add yet another dependency into my project, especially a Ruby one (nothing against Ruby, it&#8217;s just undesirable within the context of a Python  project).</p>
<p>SASS Inheritance example:</p>
<pre><code>.error {
  border: 1px #f00;
  background: #fdd;
}
.error.intrusion {
  font-size: 1.3em;
  font-weight: bold;
}

.badError {
  @extend .error;

  border-width: 3px;
}
</code></pre>
<p>Just what I want, but it generates more code than needed:</p>
<pre><code>/* CSS */

.error, .badError {
  border: 1px #f00;
  background: #fdd;
}

.error.intrusion,

.badError.intrusion {
  font-size: 1.3em;
  font-weight: bold;
}

.badError {
  border-width: 3px;
}
</code></pre>
<p>LESS example:</p>
<pre><code>.bordered {
  border-top: dotted 1px black;

  border-bottom: solid 2px black;
}

#menu a {
  color: #111;

  .bordered;
}
.post a {
  color: red;
  .bordered;
}
</code>
</pre>
<p>Generates:</p>
<pre><code>#menu a {
  color: #111;
  border-top: dotted 1px black;

  border-bottom: solid 2px black;
}
.post a {
  color: red;
  border-top: dotted 1px black;

  border-bottom: solid 2px black;
}
</code></pre>
<p>Exactly what I need. The documentation says, &#8220;Any CSS <em>class</em>, <em>id</em> or <em>element</em> ruleset can be mixed-in that way.&#8221; And since it&#8217;s written in JavaScript, you can load your LESS files and compile them on the client side, which should make designing and debugging a lot easier. LESS best suits my needs, so it&#8217;s the one I&#8217;ll be going with.</p>
<p>Update: It turns out LESS doesn&#8217;t eliminate the inherited classes, they&#8217;re still present in the output. Even so, I still think it best suits my needs.</p>
<p>Update 2: It looks like django-css isn&#8217;t being maintained, so you should probably use <a href="https://github.com/jezdez/django_compressor">django_compressor</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2011/03/14/css-meta-languages-compilers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advice from my Experience with OAuth</title>
		<link>http://seanhayes.name/2010/07/02/advice-experience-oauth/</link>
		<comments>http://seanhayes.name/2010/07/02/advice-experience-oauth/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 01:57:44 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[advice]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[Darkroom]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[picasa]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=191</guid>
		<description><![CDATA[I recently finished coding the OAuth authentication method for accessing Picasa photos from within Darkroom. Since it was written client side using JavaScript I was trying to be as minimalist as possible, so I wrote my own minimal implementation rather &#8230; <a href="http://seanhayes.name/2010/07/02/advice-experience-oauth/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently finished coding the <a href="http://oauth.net/">OAuth</a> authentication method for accessing <a href="http://picasaweb.google.com/">Picasa</a> photos from within <a href="http://mugtug.com/darkroom/">Darkroom</a>. Since it was written client side using JavaScript I was trying to be as minimalist as possible, so I wrote my own minimal implementation rather than using a library. I&#8217;m sure most developers using OAuth use a library, which is probably why it&#8217;s hard to find advice on writing your own implementation, so I thought I&#8217;d share some tips, FAQ style.</p>
<p><strong>Use the right documentation.</strong><br />
There&#8217;s a lot of outdated docs out there. I frequently find myself at <a href="http://oauth.net/core/1.0a/">OAuth Core 1.0 Revision A</a>, and it&#8217;s such a pretty page and easy on the eyes, but way at the top where you&#8217;re likely to miss it is a notice saying it&#8217;s obsolete. The notice says to use <a href="http://tools.ietf.org/html/rfc5849">RFC 5849: The OAuth 1.0 Protocol</a> and, although hideous, it&#8217;s up to date and more complete.</p>
<p><strong>How&#8217;s the signature algorithm written?</strong><br />
Here&#8217;s some pseudo-code:<br />
<script type="text/javascript" src="http://gist.github.com/462169.js?file=signRequest.pseudo_code"></script></p>
<p>If you&#8217;re writing in JavaScript as well I recommend <a href="http://code.google.com/p/crypto-js/">Crypto-JS</a>.</p>
<p><strong>What&#8217;s the format for the timestamp?</strong><br />
It&#8217;s just a UNIX timestamp (in seconds).</p>
<p><strong>How do I generate a nonce value?</strong><br />
The OAuth spec just says it&#8217;s a random string. I think the Google documentation says something about using a string representation of a 64 bit integer. I had no idea what they were talking about, but somewhere I read you just need to md5 hash a random integer, and it worked for me.</p>
<p><strong>If developing for a Google service, use their OAuth playground.</strong><br />
Their <a href="http://googlecodesamples.com/oauth_playground/">OAuth Playground</a> is a great way to see the process you have to go through and what the requests look like. If trying to authenticate with another provider see if they also have an API test app.</p>
<p><strong>Don&#8217;t expect detailed errors.</strong><br />
You&#8217;ll be lucky if the response tells you &#8220;signature invalid&#8221;, but you won&#8217;t be told what&#8217;s wrong with it. My strategy was to compare my signatures and parameters to those used by the Google Playground; taking values from there that you know are valid and using them to test your code is a good way to debug.</p>
<p><strong>The scope parameter has to EXACTLY match the URLs used in your API calls</strong><br />
In the Google OAuth Playground, selecting &#8220;Picasa Web&#8221; will input &#8220;https://picasaweb.google.com/data/&#8221; for the scope. Note the use of https:// for the protocol. If you make API calls using that URL, it will fail since none of the Picasa services are served over https. If you try to make calls using regular http you will get an OAuth error saying invalid scope. In order for it all to work, you have to use &#8220;http://picasaweb.google.com/data/&#8221; for the scope.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2010/07/02/advice-experience-oauth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up SSL on Apache</title>
		<link>http://seanhayes.name/2010/07/02/setting-ssl-apache/</link>
		<comments>http://seanhayes.name/2010/07/02/setting-ssl-apache/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 18:21:25 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=187</guid>
		<description><![CDATA[While locally testing Darkroom over HTTPS, Firefox gave me the following error: &#8220;Error code: ssl_error_rx_record_too_long&#8221;. Turns out I&#8217;d never configured the Apache instance on my laptop to use SSL. Once you&#8217;ve got the right information it&#8217;s really quick to fix. &#8230; <a href="http://seanhayes.name/2010/07/02/setting-ssl-apache/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>While locally testing Darkroom over HTTPS, Firefox gave me the following error: &#8220;Error code: ssl_error_rx_record_too_long&#8221;. Turns out I&#8217;d never configured the Apache instance on my laptop to use SSL.</p>
<p>Once you&#8217;ve got the right information it&#8217;s really quick to fix. Here&#8217;s 2 links that I found helpful:</p>
<p><a style="font-weight: bold;" href="http://slacksite.com/apache/certificate.php">Generating an SSL Certificate with Apache+mod_ssl</a><br />
Has the commands you need for generating a self signed certificate.</p>
<p>If while generating the certificate you get the error &#8220;unable to write &#8216;random state&#8217;&#8221;, you&#8217;ll need to chown the .rnd file (sudo chown user:group ~/.rnd) and try again.<br />
I put all the generated files in /etc/apache2/ssl/.</p>
<p><a style="font-weight: bold;" href="http://lookit.typepad.com/lookit/2010/04/how-to-get-apache-to-do-both-http-and-https-on-one-ip-address.html">How to get Apache to do both HTTP and HTTPS on one IP address?</a><br />
Shows the basic Apache configuration needed for HTTPS. To get HTTPS working, I just copied my existing virtual host definition, modified it to use the port 443, and added the SSLEngine, SSLCertificateFile, and SSLCertificateKeyFile directives.</p>
<p>Here&#8217;s a copy of my file:<br />
<script src="http://gist.github.com/461702.js?file=website"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2010/07/02/setting-ssl-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MugTug Darkroom, Online/Offline Photo Editing</title>
		<link>http://seanhayes.name/2010/05/20/darkroom-online-offline-photo-editing/</link>
		<comments>http://seanhayes.name/2010/05/20/darkroom-online-offline-photo-editing/#comments</comments>
		<pubDate>Thu, 20 May 2010 17:07:28 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[About]]></category>
		<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[application cache]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[Darkroom]]></category>
		<category><![CDATA[Google I/O]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[image editing]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[local storage]]></category>
		<category><![CDATA[MugTug]]></category>
		<category><![CDATA[online]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=153</guid>
		<description><![CDATA[For those of you who don&#8217;t know, a few weeks ago I joined a project called Darkroom from MugTug.com. It&#8217;s an image processing application using cutting edge HTML 5 features such as the &#60;canvas&#62; element, localStorage, and application cache, and &#8230; <a href="http://seanhayes.name/2010/05/20/darkroom-online-offline-photo-editing/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For those of you who don&#8217;t know, a few weeks ago I joined a project called <a href="http://mugtug.com/darkroom/">Darkroom</a> from <a href="http://mugtug.com/">MugTug.com</a>. It&#8217;s an image processing application using cutting edge HTML 5 features such as <a href="https://developer.mozilla.org/en/HTML/Canvas">the &lt;canvas&gt; element</a>, <a href="https://developer.mozilla.org/en/DOM/Storage">localStorage</a>, and <a href="https://developer.mozilla.org/en/offline_resources_in_firefox">application cache</a>, and all the editing (and most of the GUI) is done client side using JavaScript, so it works even without an Internet connection.</p>
<p>Yesterday it was demoed during the <a href="http://code.google.com/events/io/2010/">Google I/O 2010</a> Keynote Speech:<br />
<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/4MrEtsplano&#038;hl=en_US&#038;fs=1&#038;color1=0x3a3a3a&#038;color2=0x999999&#038;hd=1&#038;start=110&#038;end=300"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/4MrEtsplano&#038;hl=en_US&#038;fs=1&#038;color1=0x3a3a3a&#038;color2=0x999999&#038;hd=1&#038;start=110&#038;end=300"" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></p>
<p>There&#8217;s currently a <a href="http://mugtug.com/darkroom/">development version</a> live, feel free to visit the site and try it out!</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2010/05/20/darkroom-online-offline-photo-editing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a Test Database in Django</title>
		<link>http://seanhayes.name/2010/01/09/test-database-django/</link>
		<comments>http://seanhayes.name/2010/01/09/test-database-django/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 14:27:07 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[sqlite]]></category>
		<category><![CDATA[test database]]></category>
		<category><![CDATA[unit test]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=132</guid>
		<description><![CDATA[At Govnex we&#8217;re using MySQL on our development machines. It has several advantages, but one of the drawbacks is unittests run slower when not using Sqlite (big ups to MockSoul for posting his benchmarks). The reason for this is when &#8230; <a href="http://seanhayes.name/2010/01/09/test-database-django/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>At Govnex we&#8217;re using MySQL on our development machines. It has several advantages, but one of the drawbacks is <a title="#8138 (Switch django tests to use transactions)" href="http://code.djangoproject.com/ticket/8138#comment:34">unittests run slower when not using Sqlite</a> (big ups to MockSoul for posting his benchmarks). The reason for this is when running unittests in Django with a Sqlite database, the database is run in memory (RAM) instead of being written to the disk.</p>
<p>Django only allows you to specify one database, and although a new database is created for unittests, <a href="http://docs.djangoproject.com/en/dev/topics/testing/#the-test-database">it still uses most of the same settings</a> (auto prepending &#8220;test_&#8221; to the database name), which means a Django install using MySQL also uses MySQL for unittests.</p>
<p>To get around this problem, I created a file in my project root called test_settings.py containing the following lines:<br />
<script type="text/javascript" src="http://gist.github.com/269919.js?file=test_settings.py"></script></p>
<p>I then opened my settings.py, imported sys, and inserted the following lines at the end of the file:<br />
<script type="text/javascript" src="http://gist.github.com/269919.js?file=settings.py"></script></p>
<p>If one of the command line arguments is &#8220;test&#8221;, that means a unittest is being run, in which case Django will attempt to import test_settings.py, which will override the database settings and use Sqlite instead. <a title="Cross Database Incompatibility Using Django South" href="http://seanhayes.name/2010/01/09/cross-database-incompatibility/">Migrations won&#8217;t be an issue</a>, since Django South uses the old syncdb command for generating databases for unittests.</p>
<p>Hope this helps you save some time testing.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2010/01/09/test-database-django/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Whitespace Management: Use Tabs, Spaces Considered Harmful</title>
		<link>http://seanhayes.name/2009/10/09/spaces-considered-harmful/</link>
		<comments>http://seanhayes.name/2009/10/09/spaces-considered-harmful/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 05:33:09 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[considered harmful]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[spaces]]></category>
		<category><![CDATA[tabs]]></category>
		<category><![CDATA[whitespace]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=93</guid>
		<description><![CDATA[At one of my previous jobs I worked on dozens of websites that had been created by other people. I prefer to use tabs instead of spaces when indenting code, and I can get a little OCD sometimes, so every &#8230; <a href="http://seanhayes.name/2009/10/09/spaces-considered-harmful/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>At one of my previous jobs I worked on dozens of websites that had been created by other people. I prefer to use tabs instead of spaces when indenting code, and I can get a little <acronym title="Obsessive Compulsive Disorder">OCD</acronym> sometimes, so every time I edited a file I would do a search and replace to change every 4 spaces to a tab character. I didn&#8217;t like the idea of having some files use spaces while others used tabs, so when I wrote a bash script for recursively searching and replacing inside text files throughout an entire directory structure, I added some code that would clean up the white space as well. The actions it performed were:</p>
<ul>
<li>Converting from Windows (&#8220;\r\n&#8221;) or Mac (&#8220;\r&#8221; on older versions) end of line encodings to Unix style encodings (just &#8220;\n&#8221;)</li>
<li>Removing trailing whitespace from the end of lines</li>
<li>Condensing multiple blank lines to single blank lines</li>
<li>And most importantly, converting every 4 spaces to a tab character</li>
</ul>
<p>I had anticipated that this would save some disk space, but I was surprised by how much; after running the bash script, the total size of each website would decrease by 10-50% (that&#8217;s not a typo, fifty), and that&#8217;s including binary files such as images and PDFs which were unchanged. Think about the impact that has. Every individual whitespace character takes up 1 byte, bytes which have to be stored on disk, loaded into memory, transferred over a network, loaded into the client&#8217;s memory, and iterated past when it gets processed by the browser. Whitespace management saves:</p>
<ul>
<li>Disk Space</li>
<li>RAM</li>
<li>Processing Power</li>
<li>Bandwidth</li>
</ul>
<p>which in turn helps save:</p>
<ul>
<li>Money</li>
<li>Electricity</li>
<li>the Environment</li>
</ul>
<p>It also helps you provide a better user experience. When browsing the Internet, I&#8217;d much rather download a 5KB HTML file than a 10KB one, since it&#8217;ll download faster and render faster.<br />
(On a side note, generally these are all also benefits of writing standards compliant, semantic XHTML with external CSS and JS.)</p>
<p>Another reason I prefer tabs to spaces is, when browsing code it&#8217;s easier to tell if the proper levels of indentation are being used. If there&#8217;s one space missing or one additional space it can sometimes be hard to tell, but if a tab character is missing it&#8217;s very obvious. Also, most text editors allow you to specify how wide a tab character should be displayed, so if one developer likes 8 space indentation width, another likes 4 spaces, and another likes 2 spaces, they can all use the same code containing tabs and configure their respective editors to display the tab character at their preferred width. If you were to use 4 space characters for each indentation level, the developers who like 8 and 2 spaces are forced to use it as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2009/10/09/spaces-considered-harmful/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

