<?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>bluebones.net &#187; Uncategorized</title>
	<atom:link href="http://bluebones.net/categories/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://bluebones.net</link>
	<description>Adventures in Computer Programming</description>
	<lastBuildDate>Mon, 30 Jan 2012 12:08:49 +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>History (Again)</title>
		<link>http://bluebones.net/2012/01/history-again/</link>
		<comments>http://bluebones.net/2012/01/history-again/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 12:07:08 +0000</pubDate>
		<dc:creator>bakert</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bluebones.net/?p=924</guid>
		<description><![CDATA[[bakert@fenchurch ~]$ history &#124; awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' &#124; sort -rn &#124; head 24899 git 9575 vi 7366 cd 3929 ls 2517 php 2162 mate 2125 rsync 2022 cat 1950 ssh 1938 make Compare to four years ago. New: git, php, mate, rsync, cat, make. Climbers: ls. Same: cd, ssh. Fallers: [...]]]></description>
			<content:encoded><![CDATA[<pre class="viewsource">
[bakert@fenchurch ~]$ history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
24899 git
9575 vi
7366 cd
3929 ls
2517 php
2162 mate
2125 rsync
2022 cat
1950 ssh
1938 make
</pre>
<p>Compare to <a href="http://bluebones.net/2008/04/history-meme/">four years ago</a>.  New: git, php, mate, rsync, cat, make.  Climbers: ls.  Same: cd, ssh.  Fallers: vi.  Old: u, ruby, svn, td, mysql, gd.</p>
]]></content:encoded>
			<wfw:commentRss>http://bluebones.net/2012/01/history-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Newlines at the end of files</title>
		<link>http://bluebones.net/2011/12/newlines-at-the-end-of-files/</link>
		<comments>http://bluebones.net/2011/12/newlines-at-the-end-of-files/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 11:47:23 +0000</pubDate>
		<dc:creator>bakert</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bluebones.net/?p=916</guid>
		<description><![CDATA[For If you cat a file without a trailing newline your prompt may appear at the end of the output instead of flush left. Some C++ compilers complain when there is no trailing newline. Each line in the file ends in a newline. wc -l reports an incorrect result if it is missing More reasons [...]]]></description>
			<content:encoded><![CDATA[<h2>For</h2>
<ul>
<li>If you cat a file without a trailing newline your prompt may appear at the end of the output instead of flush left.</li>
<li><a href="http://stackoverflow.com/questions/72271/no-newline-at-end-of-file-compiler-warning">Some C++ compilers complain when there is no trailing newline</a>.</li>
<li>Each line in the file ends in a newline.</li>
<li><code>wc -l</code> reports an incorrect result if it is missing</li>
<li><a href="http://stackoverflow.com/questions/729692/why-should-files-end-with-a-newline">More reasons</a></li>
</ul>
<h2>Against</h2>
<ul>
<li>git considers a trailing newline a whitespace error.</li>
<li>Trailing whitespace is easily lost when, for example, exchanging patches via email.</li>
<li>A newline after a closing &#8220;?&gt;&#8221; in PHP can cause problems with <code>header()</code> (although closing tags are no longer required in PHP).</li>
<li>It uses one more byte.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://bluebones.net/2011/12/newlines-at-the-end-of-files/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>You Know You Are Trying to Do Too Much in a Bash One-Liner When &#8230;</title>
		<link>http://bluebones.net/2011/08/you-know-you-are-trying-to-do-too-much-in-a-bash-one-liner-when/</link>
		<comments>http://bluebones.net/2011/08/you-know-you-are-trying-to-do-too-much-in-a-bash-one-liner-when/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 02:45:25 +0000</pubDate>
		<dc:creator>bakert</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bluebones.net/?p=911</guid>
		<description><![CDATA[find ~/bazel/src/main/webapp/lib -type f &#124; grep -v "lib/deps/" &#124; grep -v "lib/ext/" &#124; grep -v "XG_MessageCatalog_" &#124; xargs -I{} -L1 sh -c "echo {}; phpcs -d memory_limit=1024M -p -n -s --standard=/Users/bakert/Desktop/BazelCodingStandard {}" Edit: Better: #!/bin/env ruby BAZEL_HOME = '/Users/bakert/bazel' STANDARD_PATH = '/Users/bakert/Desktop/BazelCodingStandard' VERBOSE = false def main exclude_patterns = [ /XG_MessageCatalog_/, /\/lib\/deps\//, /\/lib\/ext\// ] files [...]]]></description>
			<content:encoded><![CDATA[<p><code>find ~/bazel/src/main/webapp/lib -type f | grep -v "lib/deps/" | grep -v "lib/ext/" | grep -v "XG_MessageCatalog_" | xargs -I{} -L1 sh -c "echo {}; phpcs -d memory_limit=1024M -p -n -s --standard=/Users/bakert/Desktop/BazelCodingStandard {}"</code></p>
<p><em>Edit:</em> Better:</p>
<pre class="viewsource">
#!/bin/env ruby

BAZEL_HOME = '/Users/bakert/bazel'
STANDARD_PATH = '/Users/bakert/Desktop/BazelCodingStandard'
VERBOSE = false

def main
  exclude_patterns = [ /XG_MessageCatalog_/, /\/lib\/deps\//, /\/lib\/ext\// ]
  files = Dir.glob("#{BAZEL_HOME}/src/main/webapp/**/*").reject do |f|
    exclude_patterns.any? { |p| f.match(p) } \
      || ! File.file?(f) \
      || File.extname(f) != '.php'
  end
  files.each do |f|
    puts f if VERBOSE
    print %x[phpcs -d memory_limit=1024M -n -s --standard=#{STANDARD_PATH} #{f}]
  end
end

main
</pre>
]]></content:encoded>
			<wfw:commentRss>http://bluebones.net/2011/08/you-know-you-are-trying-to-do-too-much-in-a-bash-one-liner-when/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Pleasing Way to Represent Ascending and Descending sort in querystring</title>
		<link>http://bluebones.net/2011/07/a-pleasing-way-to-represent-ascending-and-descending-sort-in-querystring/</link>
		<comments>http://bluebones.net/2011/07/a-pleasing-way-to-represent-ascending-and-descending-sort-in-querystring/#comments</comments>
		<pubDate>Sat, 23 Jul 2011 20:37:43 +0000</pubDate>
		<dc:creator>bakert</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bluebones.net/?p=903</guid>
		<description><![CDATA[I&#8217;ve often used sort=name_a and sort=name_d for this but I noticed that ReviewBoard uses sort=name and sort=-name. I like it.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve often used <code>sort=name_a</code> and <code>sort=name_d</code> for this but I noticed that ReviewBoard uses <code>sort=name</code> and <code>sort=-name</code>.</p>
<p>I like it.</p>
]]></content:encoded>
			<wfw:commentRss>http://bluebones.net/2011/07/a-pleasing-way-to-represent-ascending-and-descending-sort-in-querystring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transparent Overlays in iMovie &#8217;09</title>
		<link>http://bluebones.net/2011/07/transparent-overlays-in-imovie-09/</link>
		<comments>http://bluebones.net/2011/07/transparent-overlays-in-imovie-09/#comments</comments>
		<pubDate>Sat, 23 Jul 2011 15:57:54 +0000</pubDate>
		<dc:creator>bakert</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bluebones.net/?p=904</guid>
		<description><![CDATA[Assuming you have a PNG with transparency, and an iMovie project then, in iMovie: iMovie, Preferences Check &#8220;Show Advanced Tools&#8221; File, Project Properties, Timing Set Initial Photo Placement to &#8220;Crop&#8221; Drag the PNG with transparency to the point you want the overlay to appear in the timeline From the resulting pop-up menu choose &#8220;Overlay&#8221; (for [...]]]></description>
			<content:encoded><![CDATA[<p>Assuming you have a PNG with transparency, and an iMovie project then, in iMovie:</p>
<ol>
<li>iMovie, Preferences</li>
<li>Check &#8220;Show Advanced Tools&#8221;</li>
<li>File, Project Properties, Timing</li>
<li>Set Initial Photo Placement to &#8220;Crop&#8221;</li>
<li>Drag the PNG with transparency to the point you want the overlay to appear in the timeline</li>
<li>From the resulting pop-up menu choose &#8220;Overlay&#8221; (for full screen) or &#8220;Picture in Picture&#8221; (for part-of-screen)</li>
<li>Adjust the size and duration of your overlay</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://bluebones.net/2011/07/transparent-overlays-in-imovie-09/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>node.js on ubuntu (on linode)</title>
		<link>http://bluebones.net/2011/06/node-js-on-ubuntu-on-linode/</link>
		<comments>http://bluebones.net/2011/06/node-js-on-ubuntu-on-linode/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 23:53:16 +0000</pubDate>
		<dc:creator>bakert</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bluebones.net/?p=897</guid>
		<description><![CDATA[I got my simple movies node.js app running through Apache using mod_proxy $ a2enmod proxy_http $ a2enmod proxy Configured under sites-available like so: $ cat /etc/apache2/sites-available/movies &#60;VirtualHost *:80&#62; ServerName actualfqdnofhost.bluebones.net ServerAlias movies.bluebones.net ProxyPass / http://127.0.0.1:3000/ &#60;Proxy *&#62; Allow from all &#60;/Proxy&#62; &#60;/VirtualHost&#62; (This assumes that your app listens on port 3000 when running.) Then to [...]]]></description>
			<content:encoded><![CDATA[<p>I got my simple movies node.js app running through Apache using mod_proxy</p>
<pre>
$ a2enmod proxy_http
$ a2enmod proxy
</pre>
<p>Configured under sites-available like so:</p>
<pre>
$ cat /etc/apache2/sites-available/movies
&lt;VirtualHost *:80&gt;
    ServerName actualfqdnofhost.bluebones.net
    ServerAlias movies.bluebones.net
    ProxyPass / http://127.0.0.1:3000/
    &lt;Proxy *&gt;
	Allow from all
    &lt;/Proxy&gt;
&lt;/VirtualHost&gt;
</pre>
<p>(This assumes that your app listens on port 3000 when running.)</p>
<p>Then to ensure it gets restarted when the machine does I created the following file as /etc/init/movies.conf</p>
<pre>
$ cat /etc/init/movies.conf
description "movies.bluebones.net on node.js"
author "bakert"

start on startup
stop on shutdown

script
  export MOVIES_ROOT=/srv/movies
  export EXPRESS_ROOT=$MOVIES_ROOT/src/express
  cd $EXPRESS_ROOT &#038;&#038; exec sudo -u www-data NODE_PATH=$NODE_PATH:/opt/local/node/lib/node_modules/ EXPRESS_ENV=production /opt/local/node/bin/node $EXPRESS_ROOT/app.js 2&gt;&#038;1 &gt;&gt;$MOVIES_ROOT/logs/node.log
end script
</pre>
<p>Which also lets me stop and start my app with:</p>
<pre>
$ start movies
$ stop movies
</pre>
]]></content:encoded>
			<wfw:commentRss>http://bluebones.net/2011/06/node-js-on-ubuntu-on-linode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Set up an SPF Record to (theoretically) reduce the risk of your web app&#8217;s email being marked as spam</title>
		<link>http://bluebones.net/2011/06/set-up-an-spf-record-to-theoretically-reduce-the-risk-of-your-web-apps-email-being-marked-as-spam/</link>
		<comments>http://bluebones.net/2011/06/set-up-an-spf-record-to-theoretically-reduce-the-risk-of-your-web-apps-email-being-marked-as-spam/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 19:45:18 +0000</pubDate>
		<dc:creator>bakert</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bluebones.net/?p=895</guid>
		<description><![CDATA[I&#8217;m setting up email sending from my domain instead of faking gmail.com because of mail delivery issues. To make this work without just going automatically to everyone&#8217;s spam folder I have set up an SPF record. I found the documentation on the web a bit dense trying to work this out so here&#8217;s a short [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m setting up email sending from my domain instead of faking gmail.com because of mail delivery issues.  To make this work without just going automatically to everyone&#8217;s spam folder I have set up an SPF record.  I found the documentation on the web a bit dense trying to work this out so here&#8217;s a short look at what I did.</p>
<p>&#8220;Show Original&#8221; in gmail used to say:</p>
<pre>
Received-SPF: neutral (google.com: 74.54.101.112 is neither permitted nor denied by domain of bakert+fantasyfootball@gmail.com) client-ip=74.54.101.112;
Authentication-Results: mx.google.com; spf=neutral (google.com: 74.54.101.112 is neither permitted nor denied by domain of bakert+fantasyfootball@gmail.com) smtp.mail=bakert+fantasyfootball@gmail.com
</pre>
<p>Now it says:</p>
<pre>
Received-SPF: pass (google.com: domain of admin+2@ff.bluebones.net designates 178.79.178.155 as permitted sender) client-ip=178.79.178.155;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of admin+2@ff.bluebones.net designates 178.79.178.155 as permitted sender) smtp.mail=admin+2@ff.bluebones.net
</pre>
<p>This means Gmail is less likely to mark email sent by my web app as spam, thanks to the SPF record I have set up.</p>
<p>An SPF record is implemented as a DNS TXT (as opposed to A, CNAME, etc.) record with no &#8220;name&#8221; and a value something like this:</p>
<pre>
v=spf1 a mx include:_spf.google.com ~all
</pre>
<p>Let&#8217;s break that down &#8230;</p>
<p><strong>v=spf1</strong> &#8211; this indicates that the record is an SPF v1 record.</p>
<p><strong>A</strong> &#8211; this indicates that any IP address in an A record for this network is allowed to send email for this domain.</p>
<p><strong>MX</strong> &#8211; this indicates that any IP address in an MX record for this network is allowed to send email for this domain.</p>
<p><strong>include:_spf.google.com</strong> &#8211; this indicates that _spf.google.com is allowed to send email for this domain.</p>
<p><strong>~all</strong> &#8211; this indicates that _spf.google.com is allowed to send email for this domain.</p>
<p>All parts of the record except v=spf1 are optional and can take a prefix of -, + or ~.  If there is no prefix + is assumed.  + means allowed, &#8211; means not allowed and ~ means might be allowed.  <strong>all</strong> is the catch-all for anything not explicitly called out by the rule.</p>
<p>You might be interested in <a href="http://www.openspf.org/SPF_Record_Syntax">a more detailed guide to SPF record syntax</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bluebones.net/2011/06/set-up-an-spf-record-to-theoretically-reduce-the-risk-of-your-web-apps-email-being-marked-as-spam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup NS Records for Subdomain</title>
		<link>http://bluebones.net/2011/06/setup-ns-records-for-subdomain/</link>
		<comments>http://bluebones.net/2011/06/setup-ns-records-for-subdomain/#comments</comments>
		<pubDate>Sat, 18 Jun 2011 05:25:12 +0000</pubDate>
		<dc:creator>bakert</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bluebones.net/?p=892</guid>
		<description><![CDATA[If you want to serve DNS for a subdomain while keeping most of the DNS records to do with its domain with another DNS provider you need NS records. On the nameserver for example.com: somesubdomain NS ns1.otherprovider.net somesubdomain NS ns2.otherprovider.net somesubdomain NS ns3.otherprovider.net somesubdomain NS ns4.otherprovider.net On the otherprovider.net nameserver for somesubdomain.example.com you just need [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to serve DNS for a subdomain while keeping most of the DNS records to do with its domain with another DNS provider you need NS records.</p>
<p>On the nameserver for <strong>example.com</strong>:</p>
<pre>
somesubdomain			NS	ns1.otherprovider.net
somesubdomain			NS	ns2.otherprovider.net
somesubdomain			NS	ns3.otherprovider.net
somesubdomain			NS	ns4.otherprovider.net
</pre>
<p>On the otherprovider.net nameserver for <strong>somesubdomain.example.com</strong> you just need a &#8220;normal&#8221; A record (+CNAME/MX/whatever):</p>
<pre>
somesubdomain			A	178.79.178.155
</pre>
<p>I have this setup working with everydns.net providing most of my DNS but linode providing DNS for the sites I have moved off my old providers and on to linode.</p>
<p>The previously wonderful everydns that served me well for many years (for nothing!) has been bought up and is going paid in less than 90 days so I&#8217;m taking this opportunity to move things around.</p>
]]></content:encoded>
			<wfw:commentRss>http://bluebones.net/2011/06/setup-ns-records-for-subdomain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Develop node.js without restarting</title>
		<link>http://bluebones.net/2011/06/develop-node-js-without-restarting/</link>
		<comments>http://bluebones.net/2011/06/develop-node-js-without-restarting/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 05:44:35 +0000</pubDate>
		<dc:creator>bakert</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bluebones.net/?p=889</guid>
		<description><![CDATA[Run your server with nodemon instead of node. It will scan for filesystem changes and restart node automatically when a change is made. $ sudo npm install nodemon $ nodemon app.js]]></description>
			<content:encoded><![CDATA[<p>Run your server with nodemon instead of node.  It will scan for filesystem changes and restart node automatically when a change is made.</p>
<pre class="code">
$ sudo npm install nodemon
$ nodemon app.js
</pre>
]]></content:encoded>
			<wfw:commentRss>http://bluebones.net/2011/06/develop-node-js-without-restarting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Partials in Jade</title>
		<link>http://bluebones.net/2011/06/partials-in-jade/</link>
		<comments>http://bluebones.net/2011/06/partials-in-jade/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 05:17:15 +0000</pubDate>
		<dc:creator>bakert</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bluebones.net/?p=886</guid>
		<description><![CDATA[I couldn&#8217;t find good docs on partials in the Jade template engine which is used by default by the Express framework for node.js. Here&#8217;s an example: movies.jade in the views directory: div(id='movies') - each movie in movies !=partial('movie', movie) where movie.jade is also in the views directory.]]></description>
			<content:encoded><![CDATA[<p>I couldn&#8217;t find good docs on partials in the <a href="http://jade-lang.com/">Jade template engine</a> which is used by default by the <a href="http://expressjs.com/">Express framework</a> for <a href="http://nodejs.org/">node.js</a>.  Here&#8217;s an example:</p>
<p><code>movies.jade</code> in the <code>views</code> directory:</p>
<pre class="code">
div(id='movies')
  - each movie in movies
    !=partial('movie', movie)
</pre>
<p>where <code>movie.jade</code> is also in the <code>views</code> directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://bluebones.net/2011/06/partials-in-jade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

