<?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>ReadyState4</title>
	<atom:link href="http://readystate4.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://readystate4.com</link>
	<description>JavaScript, Web Development, Ruby, and Technology.</description>
	<lastBuildDate>Fri, 18 May 2012 06:14:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Nginx and Apache rewrite to support HTML5 Pushstate</title>
		<link>http://readystate4.com/2012/05/17/nginx-and-apache-rewrite-to-support-html5-pushstate/</link>
		<comments>http://readystate4.com/2012/05/17/nginx-and-apache-rewrite-to-support-html5-pushstate/#comments</comments>
		<pubDate>Thu, 17 May 2012 19:06:04 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[backbone]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://readystate4.com/?p=495</guid>
		<description><![CDATA[HTML5 pushstate is awesome. It enables you to change the URL of your site dynamically without refreshing the page (goodbye hashes!). Libraries like Backbone have great support for this. Unfortunately if a user bookmarks or refresh a page on an app that&#8217;s using HTML5 pushstate, it makes a request to the server for that deep [...]]]></description>
			<content:encoded><![CDATA[<p>HTML5 pushstate is awesome. It enables you to change the URL of your site dynamically without refreshing the page (goodbye hashes!). Libraries like <a href="http://backbonejs.org/">Backbone</a> have great support for this. Unfortunately if a user bookmarks or refresh a page on an app that&#8217;s using HTML5 pushstate, it makes a request to the server for that deep linked content. Here are the rewrites for Nginx and Apache to internally redirect that call to the same html file. Browser thinks its a unique page but it&#8217;s the same.</p>
<h3>Apache</h3>
<p>In your vhost <directory>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>IfModule mod_rewrite.c<span style="color: #000000; font-weight: bold;">&gt;</span>
    RewriteEngine On
    RewriteBase <span style="color: #000000; font-weight: bold;">/</span>
    RewriteRule ^index\.html$ - <span style="color: #7a0874; font-weight: bold;">&#91;</span>L<span style="color: #7a0874; font-weight: bold;">&#93;</span>
    RewriteCond <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>REQUEST_FILENAME<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">!</span>-f
    RewriteCond <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>REQUEST_FILENAME<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">!</span>-d
    RewriteRule . <span style="color: #000000; font-weight: bold;">/</span>index.html <span style="color: #7a0874; font-weight: bold;">&#91;</span>L<span style="color: #7a0874; font-weight: bold;">&#93;</span>
 <span style="color: #000000; font-weight: bold;">&lt;/</span>IfModule<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<h3>Nginx</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    rewrite ^<span style="color: #7a0874; font-weight: bold;">&#40;</span>.+<span style="color: #7a0874; font-weight: bold;">&#41;</span>$ <span style="color: #000000; font-weight: bold;">/</span>index.html <span style="color: #c20cb9; font-weight: bold;">last</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2012/05/17/nginx-and-apache-rewrite-to-support-html5-pushstate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>405 Not Allowed on Facebook Canvas Page</title>
		<link>http://readystate4.com/2012/05/11/405-not-allowed-on-facebook-canvas-page/</link>
		<comments>http://readystate4.com/2012/05/11/405-not-allowed-on-facebook-canvas-page/#comments</comments>
		<pubDate>Fri, 11 May 2012 19:10:06 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[facebook]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://readystate4.com/?p=491</guid>
		<description><![CDATA[I enabled Facebook Canvas for a responsive web app we&#8217;re building an noticed despite meeting the SSL requirement and hitting the correct page, that Nginx was returning a 405 Not Allowed. Turns out Facebook makes a POST request to your HTML page and you need to allow this. Here&#8217;s the Nginx code: location / { [...]]]></description>
			<content:encoded><![CDATA[<p>I enabled Facebook Canvas for a responsive web app we&#8217;re building an noticed despite meeting the SSL requirement and hitting the correct page, that Nginx was returning a 405 Not Allowed. </p>
<p>Turns out Facebook makes a POST request to your HTML page and you need to allow this. Here&#8217;s the Nginx code:</p>
<pre>
location / {
    error_page 405 =200 $uri;
    root /var/www/html/yoursite.com;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2012/05/11/405-not-allowed-on-facebook-canvas-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrade Centos LAMP stack to PHP 5.4</title>
		<link>http://readystate4.com/2012/04/04/upgrade-centos-lamp-stack-to-php-5-4/</link>
		<comments>http://readystate4.com/2012/04/04/upgrade-centos-lamp-stack-to-php-5-4/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 01:16:59 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://readystate4.com/?p=477</guid>
		<description><![CDATA[The new PHP 5.4 is out, and it&#8217;s really awesome (for being PHP). Among it&#8217;s many new features is a new shortened array syntax similar to Ruby, Python, and JavaScript. I remember when I was into PHP a few years ago this was the biggest request from developers and PHP core-team was vehemently against it. [...]]]></description>
			<content:encoded><![CDATA[<p>The new PHP 5.4 is out, and it&#8217;s really awesome (for being PHP). Among it&#8217;s many new features is a new <a href="https://wiki.php.net/rfc/shortsyntaxforarrays">shortened array syntax</a> similar to Ruby, Python, and JavaScript. I remember when I was into PHP a few years ago this was the biggest request from developers and PHP core-team was vehemently <a href="https://bugs.php.net/bug.php?id=35957">against it</a>. It seems they have given in and now the code looks way nicer and fun to write:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'common'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'model'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$class_path</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">spl_autoload_register</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$class</span><span style="color: #009900;">&#41;</span> use <span style="color: #009900;">&#40;</span><span style="color: #000088;">$class_path</span><span style="color: #339933;">,</span> <span style="color: #000088;">$doc_root</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$class_path</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$doc_root</span>/classes/<span style="color: #006699; font-weight: bold;">$class_path</span>/<span style="color: #006699; font-weight: bold;">$class</span>.class.php&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$class_path</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$class_path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>To upgrade your Centos LAMP stack compile PHP 5.4 like so:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.php.net<span style="color: #000000; font-weight: bold;">/</span>get<span style="color: #000000; font-weight: bold;">/</span>php-5.4.0.tar.gz<span style="color: #000000; font-weight: bold;">/</span>from<span style="color: #000000; font-weight: bold;">/</span>a<span style="color: #000000; font-weight: bold;">/</span>mirror
<span style="color: #c20cb9; font-weight: bold;">tar</span> xzf php-5.4.0.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> php-5.4.0<span style="color: #000000; font-weight: bold;">*</span>
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-apxs2</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>apxs <span style="color: #660033;">--with-mysq</span> <span style="color: #660033;">--with-mcrypt</span> <span style="color: #660033;">--without-iconv</span> <span style="color: #666666; font-style: italic;"># --with-mcrypt=/opt/local for OS X</span>
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #7a0874; font-weight: bold;">test</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>Mcrypt param is optional if you don&#8217;t have it and need it.
<pre>sudo yum | apt-get | port install libmcrypt # libmcrypt-devel for centos</pre>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2012/04/04/upgrade-centos-lamp-stack-to-php-5-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing memcached on OS X 10.7.3 Lion with MAMP or native Apache2 support</title>
		<link>http://readystate4.com/2012/03/15/installing-memcached-on-os-x-10-7-3-lion-on-mamp/</link>
		<comments>http://readystate4.com/2012/03/15/installing-memcached-on-os-x-10-7-3-lion-on-mamp/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 00:51:22 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[memcached]]></category>

		<guid isPermaLink="false">http://readystate4.com/?p=471</guid>
		<description><![CDATA[The post I wrote four years ago on installing memcached on OS X Leopard is still popular today. Here are the updated steps for installing on OS X 10.7.3 Lion with extra steps on getting memcached working with MAMP or your native Apache2. # memcached requires libevent cd /tmp curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.17-stable.tar.gz tar -xvzf libevent-2.0.17-stable.tar.gz [...]]]></description>
			<content:encoded><![CDATA[<p>The post I wrote four years ago on <a href="http://readystate4.com/2008/08/19/installing-memcached-on-os-x-1054-leopard/">installing memcached on OS X Leopard</a> is still popular today. Here are the updated steps for installing on OS X 10.7.3 Lion with extra steps on getting memcached working with MAMP or your native Apache2.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># memcached requires libevent</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp
curl <span style="color: #660033;">-OL</span> https:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>downloads<span style="color: #000000; font-weight: bold;">/</span>libevent<span style="color: #000000; font-weight: bold;">/</span>libevent<span style="color: #000000; font-weight: bold;">/</span>libevent-2.0.17-stable.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvzf</span> libevent-2.0.17-stable.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> libevent-2.0.17-stable<span style="color: #000000; font-weight: bold;">*</span>
.<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Compile memcached utility</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp
curl <span style="color: #660033;">-O</span> http:<span style="color: #000000; font-weight: bold;">//</span>memcached.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>memcached-1.4.13.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvzf</span> memcached-1.4.13.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> memcached-1.4.13<span style="color: #000000; font-weight: bold;">*</span>
.<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">make</span> 
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Create .bash_profile alias to start memcached as needed</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">m</span>=<span style="color: #ff0000;">&quot;memcached -d -m 24 -p 11211&quot;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;"># Compile and copy memcached.so module</span>
<span style="color: #666666; font-style: italic;"># For the lazy, you can use my memcached.so file or continue: # curl -O http://readystate4.com/memcache.so</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp 
<span style="color: #666666; font-style: italic;"># download one and untar http://pecl.php.net/package/memcache</span>
phpize
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--enable-memcache</span>
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #666666; font-style: italic;"># If using MAMP</span>
<span style="color: #666666; font-style: italic;"># cp modules/memcache.so /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/</span>
<span style="color: #666666; font-style: italic;"># emacs /Applications/MAMP/bin/php/php5.3.6/conf/php.ini # add line: extension=memcache.so</span>
<span style="color: #666666; font-style: italic;"># If using Apache2</span>
<span style="color: #666666; font-style: italic;"># sudo emacs /etc/php.ini # add line: extension=memcache.so</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2012/03/15/installing-memcached-on-os-x-10-7-3-lion-on-mamp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>git hook to reject bad emails on the server.</title>
		<link>http://readystate4.com/2012/02/19/git-hook-to-reject-bad-emails-on-the-server/</link>
		<comments>http://readystate4.com/2012/02/19/git-hook-to-reject-bad-emails-on-the-server/#comments</comments>
		<pubDate>Sun, 19 Feb 2012 09:03:46 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[node]]></category>

		<guid isPermaLink="false">http://readystate4.com/?p=446</guid>
		<description><![CDATA[In my git workflow I use git-commit-notifier to email beautiful, color-coded, diff emails out to the dev group anytime there&#8217;s a commit. Problem is, if a new engineer didn&#8217;t set his git author email properly that email will get silently rejected from the email group. I finally got around to creating a git commit hook [...]]]></description>
			<content:encoded><![CDATA[<p>In my git workflow I use <a href="https://github.com/bitboxer/git-commit-notifier">git-commit-notifier</a> to email beautiful, color-coded, diff emails out to the dev group anytime there&#8217;s a commit. Problem is, if a new engineer didn&#8217;t set his git author email properly that email will get silently rejected from the email group.</p>
<p>I finally got around to creating a git commit hook to reject the commit from the start, and inform the developer to update his or her git author email.</p>
<p>To use, simply create a <code>pre-receive</code> file in your remote repos <code>hooks</code> folder and make it executable.<br />
I wrote this in Node so you&#8217;ll need to have Node installed on your server if it&#8217;s not there already:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">#<span style="color: #339933;">!</span> <span style="color: #339933;">/</span>bin<span style="color: #339933;">/</span>env node
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> fs <span style="color: #339933;">=</span> require<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'fs'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
arguments <span style="color: #339933;">=</span> fs.<span style="color: #660066;">readFileSync</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'/dev/stdin'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">' '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
exec <span style="color: #339933;">=</span> require<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'child_process'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">exec</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> email <span style="color: #339933;">=</span> <span style="color: #3366CC;">'yourcompany.com'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Accept if this is a delete branch action</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>stdout.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>email<span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// Return success</span>
    process.<span style="color: #660066;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
exec<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'git log -1 '</span> <span style="color: #339933;">+</span> arguments<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">' --format=%ae'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>err<span style="color: #339933;">,</span> stdout<span style="color: #339933;">,</span> stderr<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>stdout.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>email<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Author email must contain '</span> <span style="color: #339933;">+</span> email <span style="color: #339933;">+</span> <span style="color: #3366CC;">'! Your email is currently set to: '</span> <span style="color: #339933;">+</span> stdout<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Please update by running: git config --global user.email &quot;name@'</span> <span style="color: #339933;">+</span> email <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'And then: git commit --amend --reset-author'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            process.<span style="color: #660066;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        process.<span style="color: #660066;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2012/02/19/git-hook-to-reject-bad-emails-on-the-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setting up and using a git wrapper around SVN with git-svn</title>
		<link>http://readystate4.com/2012/01/27/setting-up-and-using-a-git-wrapper-around-svn-with-git-svn/</link>
		<comments>http://readystate4.com/2012/01/27/setting-up-and-using-a-git-wrapper-around-svn-with-git-svn/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 18:29:21 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://readystate4.com/?p=404</guid>
		<description><![CDATA[Note: I wrote this post a long time ago but never got around to posting it. A lot of these steps are applicable to porting an SVN repo to Git as well. Preface on why I love git Roughly four years ago I switched to git for version control and it&#8217;s changed my development life. [...]]]></description>
			<content:encoded><![CDATA[<p>Note: I wrote this post a long time ago but never got around to posting it. A lot of these steps are applicable to porting an SVN repo to Git as well.</p>
<h3>Preface on why I love git</h3>
<p>Roughly four years ago I switched to <a href="http://git-scm.com/">git</a> for version control and it&#8217;s changed my development life. While SVN is sufficient to &#8220;get the job done&#8221; in terms of keeping a history of your commits with a group of people, Git is truly the next evolutionary step up in every way. I could expound a whole article on the joy of git, but many others already have, and this articles not about that. But I will kindly throw in my 0.02 on why I personally love it:</p>
<ul>
<li>It&#8217;s fast. Git keeps your whole repo&#8217;s history local. So no need to ping your repo server for every command. You can even checkout your codebase from 3 weeks ago or a year ago in under a second.&#8221;</li>
<li>It works offline. That&#8217;s right, no internet. Sync up later.</li>
<li>It has useful modern tools. Like <a href="http://ariejan.net/2008/04/23/git-using-the-stash/">git stash</a> and <a href="http://readystate4.com/2010/12/05/the-wonders-of-git-bisect/">git bisect</a>. Both will save you a lot of time.</li>
<li>It&#8217;s your third hand. Let&#8217;s face it, besides svn being slow, it&#8217;s not friendly enough to do more than throw your past commits into an empty hole you will probably never see again. With <a href="http://jblevins.org/notes/git-colors">very little setup</a>, you have beautiful colored output in your logs and diffs with git. And &#8220;git log&#8221; actually pages by default (while keeping colors) instead of flooding your console with the entire repos history! Want to query something in your history log? What about all commits from your friend Bob in the past 2 weeks?
<pre class="bash">git log --date=relative --author=nizam --since="2 weeks ago"</pre>
<p>Bam. Done.
</li>
<li>Easy repo creation. You don&#8217;t have to be an admin to setup a git repo. Just cd into a folder and type &#8220;git init&#8221;. You just created a new repo. I do this all the time, for example in my folder of todo lists, I use it to track history of my todos. At work someone kept messing up the apache config file, all I had to do was &#8220;git init&#8221; in /etc/httpd/conf and now I can easily &#8220;git diff&#8221; new changes that were made and revert / adjust if needed.</li>
<li>Many ways to use it. Git is promoted as &#8220;decentralized&#8221; version control, but it can be an easy drop in replacement for any job SVN can do. Which leads me to&#8230;
<li>
</ul>
<p>With all those advantages, many larger companies haven&#8217;t jumped on the git bandwagon. I believe there&#8217;s two reasons this is the case.</p>
<ul>
<li>As programmers get more experienced, they generally become more pragmatic (which is generally a good thing.) They adopt a &#8220;if it ain&#8217;t broke, don&#8217;t fix it.&#8221; mentality. After all, SVN get&#8217;s the job done.</li>
<li>There is a bit of a learning curve with git. But there are a ton of good resources for learning it. I recommend getting your hands dirty with <a href="http://gitimmersion.com/">Git Immersion</a> if you&#8217;re new or would like to learn. I don&#8217;t recommend wrapping git around svn as I&#8217;m about to show you for a person who&#8217;s learning git.</li>
</ul>
<h3>Getting down to business.</h3>
<p>In order to use git with an svn repo, you&#8217;ll have to run some commands to import that svn repo, commit by commit into a git repo.</p>
<p>1. First, make sure you have a version of git installed with svn bindings. If you type &#8220;git svn&#8221; and it give you an error, I&#8217;d google one of the resources in reinstalling git with svn bindings.</p>
<p>2. We need to keep</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># In your existing svn repo, lets grab a list of authors</span>
<span style="color: #c20cb9; font-weight: bold;">svn</span> log <span style="color: #660033;">-q</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span> <span style="color: #ff0000;">'|'</span> <span style="color: #ff0000;">'/^r/ {sub(&quot;^ &quot;, &quot;&quot;, $2); sub(&quot; $&quot;, &quot;&quot;, $2); print $2&quot; = &quot;$2&quot; &lt;&quot;$2&quot;&gt;&quot;}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-u</span> <span style="color: #000000; font-weight: bold;">&gt;</span> authors.txt
<span style="color: #666666; font-style: italic;"># create a new folder</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ..; <span style="color: #c20cb9; font-weight: bold;">mkdir</span> NEWREPO.git;
git <span style="color: #c20cb9; font-weight: bold;">svn</span> clone <span style="color: #660033;">-A</span> ..<span style="color: #000000; font-weight: bold;">/</span>OLDREPO<span style="color: #000000; font-weight: bold;">/</span>authors.txt https:<span style="color: #000000; font-weight: bold;">//</span>svn<span style="color: #000000; font-weight: bold;">/</span>repo<span style="color: #000000; font-weight: bold;">/</span>trunk
git <span style="color: #c20cb9; font-weight: bold;">svn</span> fetch <span style="color: #666666; font-style: italic;"># this could take a long time as it checks the repo out one rev at a time.</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># update your working copy:</span>
git-svn rebase
&nbsp;
<span style="color: #666666; font-style: italic;"># commit your changes to svn server</span>
git-svn dcommit</pre></div></div>

<p>kudos to:</p>
<p>http://flavio.castelli.name/howto_use_git_with_svn</p>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2012/01/27/setting-up-and-using-a-git-wrapper-around-svn-with-git-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Great little bash snippet to summarize your daily git commits.</title>
		<link>http://readystate4.com/2012/01/09/great-little-bash-snippet-to-summarize-your-daily-git-commits/</link>
		<comments>http://readystate4.com/2012/01/09/great-little-bash-snippet-to-summarize-your-daily-git-commits/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 23:15:02 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://readystate4.com/?p=434</guid>
		<description><![CDATA[For general invoicing and hour tracking, I like to post the details of my git commits. Though, I had my own little version of this script, this one posted at stackoverflow was a lot better looking. Posted here for posterity: function gdaily &#123; NEXT=$&#40;date +%F&#41; echo &#34;CHANGELOG&#34; echo ---------------------- git log --no-merges --format=&#34;%cd&#34; --date=short &#124; [...]]]></description>
			<content:encoded><![CDATA[<p>For general invoicing and hour tracking, I like to post the details of my git commits. Though, I had my own little version of this script, this one posted at <a href="http://stackoverflow.com/questions/2976665/git-changelog-day-by-day/2979587#2979587">stackoverflow</a> was a lot better looking. Posted here for posterity:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> gdaily <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #007800;">NEXT</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>F<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;CHANGELOG&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">----------------------</span>
    git log <span style="color: #660033;">--no-merges</span> <span style="color: #660033;">--format</span>=<span style="color: #ff0000;">&quot;%cd&quot;</span> <span style="color: #660033;">--date</span>=short <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-u</span> <span style="color: #660033;">-r</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> DATE ; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">$DATE</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
        <span style="color: #007800;">GIT_PAGER</span>=<span style="color: #c20cb9; font-weight: bold;">cat</span> git log <span style="color: #660033;">--no-merges</span> <span style="color: #660033;">--format</span>=<span style="color: #ff0000;">&quot; * %s&quot;</span> <span style="color: #660033;">--since</span>=<span style="color: #007800;">$DATE</span> <span style="color: #660033;">--until</span>=<span style="color: #007800;">$NEXT</span>
        <span style="color: #007800;">NEXT</span>=<span style="color: #007800;">$DATE</span>
    <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p></p>
<p>Which looks like:</p>
<pre>[2012-01-07]
 * Refactor list portfolio page css and js.
 * namespace.data include to load fake api data until it is ready. Portfolio list working again.
 * CurrentUser model defaults and code cleanup.

[2012-01-06]
 * Upgrade portfolio call from GET and POST. To be discussed in tomorrow's standup.</pre>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2012/01/09/great-little-bash-snippet-to-summarize-your-daily-git-commits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Low powered web servers and resolving issues installing Ubuntu on an Android Galaxy S</title>
		<link>http://readystate4.com/2011/11/21/low-powered-web-servers-and-resolving-issues-installing-ubuntu-on-an-android-galaxy-s/</link>
		<comments>http://readystate4.com/2011/11/21/low-powered-web-servers-and-resolving-issues-installing-ubuntu-on-an-android-galaxy-s/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 08:18:38 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://readystate4.com/?p=425</guid>
		<description><![CDATA[I&#8217;ve been on a multi-month long side project trying to create a low powered web server for hosting an offline version of Wikipedia in the dessert (long story). I assembled my own machine from Newegg but even with solid-state it was running between 30-50 watts. My latest approach has been modifying a Linksys NSLU2, an [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been on a multi-month long side project trying to create a low powered web server for hosting an offline version of Wikipedia in the dessert (long story). I assembled my own machine from Newegg but even with solid-state it was running between 30-50 watts.</p>
<p>My latest approach has been modifying a <a href="http://en.wikipedia.org/wiki/NSLU2">Linksys NSLU2</a>, an old low-powered network storage device, and installing Debian on it (thanks to <a href="http://www.nslu2-linux.org/">great documentation</a> from the NSLU/Linux community). The end product is a web server that runs between 3-5.5 watts! And it&#8217;s able to support two usb drives. Not the fastest machine but certainly useable, especially at the cost of only $35 used for the device off Craigslist (compared also to the $225 or so I spent assembling the machine above.)</p>
<p>While I think it&#8217;s the approach I&#8217;m going to go with, I found a <a href="http://androlinux.com/android-ubuntu-development/how-to-install-ubuntu-on-android/">link</a> where someone installed Ubuntu on their Android device. This piqued my interest as it&#8217;s also a low wattage device (and the fact that I have a Galaxy S sitting around doing nothing.) I followed the steps, and though it worked well, the Ubuntu package manager has problems when you want to install any new packages or do an update. It just 404&#8242;s like so:</p>
<pre>Err http://ports.ubuntu.com karmic/main Packages
  404  Not Found</pre>
<p>After much research I ended up having to change <code>/etc/apt/sources.list</code> from:</p>
<pre>deb http://ports.ubuntu.com/ubuntu-ports karmic main universe</pre>
<p>to:
<pre>deb http://old-releases.ubuntu.com/ubuntu/ karmic main universe</pre>
<p>I tried to post this update to the blog above but it errored out, so I&#8217;m leaving the solution here instead should anyone else have the issue.</p>
<p>Additional note In the case of the NSLU2: if DHCP has assigned the Slug an ip address but your wireless router doesn&#8217;t find it, use nmap to ping for port 22 on your subnet:</p>
<pre>nmap -p 22 --open -sV 10.0.0.0/24</pre>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2011/11/21/low-powered-web-servers-and-resolving-issues-installing-ubuntu-on-an-android-galaxy-s/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Common Backbone errors and what they mean.</title>
		<link>http://readystate4.com/2011/10/22/common-backbone-errors-and-what-they-mean/</link>
		<comments>http://readystate4.com/2011/10/22/common-backbone-errors-and-what-they-mean/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 02:09:00 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[backbone]]></category>

		<guid isPermaLink="false">http://readystate4.com/?p=420</guid>
		<description><![CDATA[I&#8217;m a big fan of Backbone, the open-source JavaScript MVC framework. It&#8217;s lightweight, extendable, has an awesome event model that allows one to bind to changes from just about anything &#8211; it&#8217;s error messages, however, can be quite cryptic. Simply referencing a missing template file can lead to half an hour of wasted time tracking [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a big fan of <a href="http://documentcloud.github.com/backbone/">Backbone</a>, the open-source JavaScript MVC framework. It&#8217;s lightweight, extendable, has an awesome event model that allows one to bind to changes from just about anything &#8211; it&#8217;s error messages, however, can be quite cryptic. Simply referencing a missing template file can lead to half an hour of wasted time tracking down the issue. Without further ado here&#8217;s a quick list of the day-to-day errors I occasionally encounter and what the problem ended up being: </p>
<div id="outline-container-1" class="outline-3">
<h3 id="sec-1">TypeError: &#8216;undefined&#8217; is not a function (evaluating &#8216;func.apply(obj, args.concat(slice.call(arguments)))&#8217;)</h3>
<div class="outline-text-3" id="text-1">
<p>You probably created an event listener in view that binded to a function that doesn&#8217;t exist. </p>
</p></div>
</p></div>
<div id="outline-container-2" class="outline-3">
<h3 id="sec-2">invalid &#8216;in&#8217; operand attrs</h3>
<div class="outline-text-3" id="text-2">
<p>You probably passed a string instead of an object to a Model.set. This frequently happens to me during an ajax callback using jQuery &#8211; for some reason Webkit browser return and object while Firefox returns a string. </p>
</div></div>
<div id="outline-container-3" class="outline-3">
<h3 id="sec-3">Uncaught TypeError: Cannot call method &#8216;replace&#8217; of null (underscore.js:768)</h3>
<div class="outline-text-3" id="text-3">
<p>    You&#8217;re calling an underscore template put not passing in the data it uses in the template.     You&#8217;re referencing an underscore template that doesn&#8217;t exist.     You could have created a new template but forgot to change it&#8217;s id. </p>
</div></div>
<div id="outline-container-4" class="outline-3">
<h3 id="sec-4">TypeError: &#8216;undefined&#8217; is not an object (evaluating &#8216;func.bind&#8217;)</h3>
<div class="outline-text-3" id="text-4">
<p>You probably set a _bind or _bindAll in your view initiailize code and that method doesn&#8217;t exist in this view. Double check for a typo. </p>
</p></div>
</p></div>
<div id="outline-container-5" class="outline-3">
<h3 id="sec-5">TypeError: &#8216;null&#8217; is not an object (evaluating &#8216;func.bind&#8217;)</h3>
<div class="outline-text-3" id="text-5">
<p>In your view you could be binding an event to a callback that got overwritten during initialization. Commen when your model is called &#8220;contact&#8221; and your model is called the same and gets passed in. </p>
</div></div>
<div id="outline-container-6" class="outline-3">
<h3 id="sec-6">TypeError: &#8216;undefined&#8217; is not a function (evaluating &#8216;this._configure(options || {})&#8217;) backbone.js #881</h3>
<div class="outline-text-3" id="text-6">
<p>    Something went wrong in the routing. You may have not instantiated a new view. </p>
</div></div>
<div id="outline-container-7" class="outline-3">
<h3 id="sec-7">Uncaught TypeError: Cannot call method &#8216;extend&#8217; of undefined (yourfile.js)</h3>
<div class="outline-text-3" id="text-7">
<p>    Your probably extending an object that extended a backbone object, but the reference to the object is wrong or missing. </p>
</p></div>
</p></div>
<div id="outline-container-8" class="outline-3">
<h3 id="sec-8">Uncaught SyntaxError: Unexpected identifier (underscore.js:782)</h3>
<div class="outline-text-3" id="text-8">
<p>    Your template logic might have an error in it. Check that you closed open parens and such. </p>
</div></div>
<p>If you&#8217;ve experienced a Backbone error that&#8217;s not on the list, feel free to post it in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2011/10/22/common-backbone-errors-and-what-they-mean/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Response Times: The 3 Important Limits</title>
		<link>http://readystate4.com/2011/10/22/laws-of-load-time/</link>
		<comments>http://readystate4.com/2011/10/22/laws-of-load-time/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 01:55:00 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[General Web Dev]]></category>

		<guid isPermaLink="false">http://readystate4.com/?p=411</guid>
		<description><![CDATA[Regardless of new technology and devices the basic advice regarding (perceived) response time has been the same for forty years in counting. I find that I&#8217;m always having to google around to find this link when the subject pops up so I&#8217;ll post the basics here, and link to the rest if you&#8217;re interested in [...]]]></description>
			<content:encoded><![CDATA[<p> Regardless of new technology and devices the basic advice regarding (perceived) response time has been the same for forty years in counting. I find that I&#8217;m always having to google around to find this link when the subject pops up so I&#8217;ll post the basics here, and link to the rest if you&#8217;re interested in reading more. </p>
<ul>
<li><strong>0.1 second</strong> is about the limit for having the user feel that the system is reacting instantaneously, meaning that no special feedback is necessary except to display the result. </li>
<li><strong>1.0 second</strong> is about the limit for the user&#8217;s flow of thought to stay uninterrupted, even though the user will notice the delay. Normally, no special feedback is necessary during delays of more than 0.1 but less than 1.0 second, but the user does lose the feeling of operating directly on the data. </li>
<li><strong>10 seconds</strong> is about the limit for keeping the user&#8217;s attention focused on the dialogue. For longer delays, users will want to perform other tasks while waiting for the computer to finish, so they should be given feedback indicating when the computer expects to be done. Feedback during the delay is especially important if the response time is likely to be highly variable, since users will then not know what to expect.  </li>
</ul>
<p> From the book  <a href="http://www.amazon.com/gp/product/0125184069/ref=as_li_ss_tl?ie=UTF8&#038;tag=readystate4-20&#038;linkCode=as2&#038;camp=217145&#038;creative=399369&#038;creativeASIN=0125184069">Usability Engineering (1993)</a>. More info <a href="http://www.useit.com/papers/responsetime.html">here</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2011/10/22/laws-of-load-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

