<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Daniel Saewitz]]></title>
  <link href="http://saewitz.com/rss.xml" rel="self"/>
  <link href="http://saewitz.com/"/>
  <updated>2013-12-20T01:29:42-05:00</updated>
  <id>http://saewitz.com/</id>
  <author>
    <name><![CDATA[Daniel Saewitz]]></name>
    
  </author>
  <icon>http://www.saewitz.com/favicon.png</icon>

  
  <entry>
    <title type="html"><![CDATA[Node.js Websocket Hosting Roundup]]></title>
    <link href="http://saewitz.com/node-dot-js-websocket-hosting-roundup"/>
    <updated>2013-01-07T15:44:00-05:00</updated>
    <id>http://saewitz.com/node-dot-js-websocket-hosting-roundup</id>
    <content type="html"><![CDATA[<p>Over the past few months, I have been building a <a href="http://derbyjs.com">DerbyJS</a> application. Derby is absolutely changing the game as far as frameworks go. I won&#8217;t delve into the benefits or features here, but it&#8217;s built on top of standard npm modules like Express, Browserify, and Socket.io. This allows for immense customizability and compatibility with existing node solutions rather than the walled garden that other frameworks impose.</p>

<p>My Derby app has been running stably for months, but I was nearing the end of my yearly Linode subscription and felt compelled to switch things up. Here&#8217;s what I discovered in my research.</p>

<h2>Roll Your Own</h2>

<p>I ran my app for quite some time on a small Linode. The benefits are obvious. You have total control over your setup. This means you can support websockets out of the gate. However, unless you&#8217;re a sysadmin wizard, you&#8217;re going to spend quite some time doing maintenance and initial setup. I finally found a solution that worked for me, but eventually decided to move towards greener pastures with a PaaS provider. There&#8217;s something nice about not worrying about infrastructure or deployment. I recommend everyone give being a sysadmin a try just to explore what it takes to run your own server. After about a year, I decided I didn&#8217;t want to maintain it myself any more. But the experience was worth it&#8217;s weight in gold.</p>

<h2>Nodejitsu</h2>

<p><a href="http://nodejitsu.com">Link</a></p>

<p>Brimming with hype off of hackathons and Hacker News, I was ecstatic to try out Nodejitsu. They promised websocket support out of the gate even when scaling horizontally with multiple <em>drones</em> (their cute name for extra processes). I tested it myself over many months before finally deciding to give it a production go. Although I really wanted to like nodejitsu, they made it very difficult. It would take 4-5 <code>jitsu deploy</code>s every time I wanted to update my app due to obscure <em>socket hangups</em>. While they are <strong>very</strong> responsive in IRC, they often told me that large apps can cause these errors. Meanwhile my app is only about 300KB. Their web-panel, while slick, was unresponsive at times. I had a tough time logging in just to take a screenshot for this post.</p>

<p style="text-align:center;"><a href="http://i.imgur.com/bGytD.png"><img src="http://i.imgur.com/jm46f.png" alt="Nodejitsu" /></a></p>

<p>While nodejitsu was one of the few to promise websocket support and have it actually work, their CPU seemed to be quite slow and therefore websocket&#8217;s speed suffered as a result. Unfortunately, I can&#8217;t recommend their service in its current iteration. There were just too many snags that I hit along the way.</p>

<p>Update: Since posting, Nodejitsu has made many improvements to their service. jitsu deploys actually work well and sites seem to hold up. But, my site has gone down twice with errors in the past few days. When entering IRC and asking why my site was down, the support blamed it on their router and said it would be reset in a few hours. Unfortunately, they could do nothing about it so here I was, sitting helpless while my sites were down for a few hours. That is <strong>unacceptable</strong>.</p>

<p>Yesterday, I was planning on launching a site on Nodejitsu and when I went to IRC for them to add an SSL certificate (something I&#8217;ve done before), they told me I couldn&#8217;t. When asked why, they said only business plans (another 40-50 bucks a month; something a student can&#8217;t afford) are allowed to use SSL. They never notified me of this change, just like they neglected to notify me for <strong>expected</strong> downtime.</p>

<h2>Heroku</h2>

<p><a href="http://heroku.com">Link</a></p>

<p>Heroku doesn&#8217;t support websockets. Heroku is expensive. But, Heroku has been battle tested and can hold up to the heat. I&#8217;ve had a decent amount of experience with Heroku before giving them a go in a production environment and I have to say that the experience has been nothing but positive. No consistently obscure errors. No frills. It hosts my app, and it does it well. I was worried that <code>xhr-polling</code> would be consistently slower than websockets, but that&#8217;s turned out to be false. In fact, <code>xhr-polling</code> on Heroku was faster than websockets on Nodejitsu. I can&#8217;t explain why, but by comparing the two side-by-side it was blatantly true. I have yet to test out multiple <em>dynos</em>, but according to <a href="http://habitrpg.com">Tyler Renelle</a>, his Derby app held up to about 1000 concurrent connections on a single Heroku dyno with <code>xhr-polling</code> enabled. This is more than acceptable to me for the time being.</p>

<p>Heroku is not perfect, but it&#8217;s a <strong>very</strong> good option for hosting a small node application that doesn&#8217;t need to handle thousands of concurrent users. Plus, you&#8217;re first dyno is always free. My app is currently running on Heroku and handling it swimmingly.</p>

<h2>AppFog</h2>

<p><a href="http://appfog.com">Link</a></p>

<p>Much to my surprise, I&#8217;ve had a very positive experience with Appfog. I went in quite skeptical, but my app was up and running in minutes. They give you something that no one else is able to offer. 2GB of memory for free. Plus, you&#8217;re able to spread that across up to 8 instances of your application&#8230; all for free! So, 8 instances running at 256 MB each right out of the gate! My Linode was only giving me 512 MB for one instance and it cost over $200 a year. I have yet to use this in a production environment, but through my own load-testing AppFog has held up better than almost every other provider. On top of which, they recently acquired <a href="http://nodester.com/">Nodester</a> thereby explicitly promising to have websocket support soon. Also, their web-panel works surprisingly well and I haven&#8217;t had any major issues with it.</p>

<p style="text-align:center;"><a href="http://i.imgur.com/CXjms.png"><img src="http://i.imgur.com/KJrXU.png" alt="AppFog" /></a></p>

<p>I&#8217;m really excited about AppFog and have been seriously considering moving my app there full-time. Once websocket support comes through the pipeline, I have a feeling this might be the place I end up. Watch out for them, they&#8217;re clearly not going away without a fight.</p>

<h2>Modulus</h2>

<p><a href="http://modulus.io">Link</a></p>

<p>To be honest, I never heard of this provider before yesterday. My favorite bassist plays a 5 string Modulus bass so the name certainly jumped out at me. I decided to give them a quick try – and I was pleased! My app was up and running within minutes sans issues. Their design is by far the worst out of all the providers, but they&#8217;re young. It seems they&#8217;re focused on providing useful analytics and as much data as possible which is something any sysadmin can appreciate. I can&#8217;t recommend them yet, but since it&#8217;s free [for now] it can&#8217;t hurt to take a look. Watch out for these guys. They&#8217;re up to something.</p>

<p style="text-align:center;"><a href="http://i.imgur.com/tkjzY.png"><img src="http://i.imgur.com/ZruRT.png" alt="Modulus" /></a></p>

<p>The node.js ecosystem is young and growing. There really isn&#8217;t a proper solution yet and, quite frankly, that sucks. But, the future is bright. I can&#8217;t wait to see what 2013 has for us in the land of node.</p>

<p>I would recommend using Heroku if you&#8217;re small or don&#8217;t have to support websockets. Keep your eyes on AppFog and Modulus. If you really want to scale a large websocket application, you&#8217;re probably looking at rolling your own solution using some sort of VPS/Dedicated provider. Good luck and Happy New Year!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Recently Read Articles On Facebook]]></title>
    <link href="http://saewitz.com/recently-read-articles-on-facebook"/>
    <updated>2012-03-12T16:48:00-04:00</updated>
    <id>http://saewitz.com/recently-read-articles-on-facebook</id>
    <content type="html"><![CDATA[<p>Facebook is great. It might not be for everyone, but to say that it has no positive purpose is just plain ignorant. Everyone who uses Facebook complains about changes constantly (see: newsfeed, messages, redesigns, etc) and within weeks they realize how genius these additions usually are. It is a company that is built on innovation, and it has been clear for a while that Facebook wants to become the next Google.</p>

<p>Mark Zuckerberg has made it obvious that he wants to intertwine Facebook with your life. The timeline is meant to be your life&#8217;s story. I personally am not as fond of the timeline as I believe not many people want to reminisce their awkward social past in high school, but I get the point. Also, I don&#8217;t think it&#8217;s aesthetically pleasing to read as your eyes have to dart back and forth across two columns. Over a few years, once we&#8217;ve amassed content day in and day out, we&#8217;ll be able to see the places we&#8217;ve been, the people we&#8217;ve met, and the things we&#8217;ve accomplished.</p>

<p>For the past few months, Facebook has ingrained itself into many notable blogs and applications (e.g. Spotify). When you read an article, it is automatically posted into your timeline.</p>

<p style="text-align:center;"><img src="http://saewitz.com/downloads/images/facebook-read.png" alt="Facebook" /></p>

<p>I for one, believe that nothing should ever be automatically posted to your timeline without direct consent. Just because I read an article does not mean that I endorse said article. Therefore, I never give access to these &#8220;social reader&#8221; applications for that very reason. Now, here&#8217;s the real problem. If I see an article that my friend has read that I&#8217;m interested in, I click on it. Instead of the article loading up like one would expect, it forces me to give that app access to my timeline and my personal information. There is no reason why I should have to give any application my information just to read an article that is open to the free web. It is very frustrating to click on a link, only to be harassed into giving up my privacy.</p>

<p>Sure, I can block the app from sharing with my friends, but I have no way of blocking it from getting access to my information. Here&#8217;s what Yahoo requires from me just to read a simple article.</p>

<h5>THIS APP WILL RECEIVE:</h5>

<ul>
<li>Your basic info</li>
<li>Your e-mail address (*****@***.edu)</li>
<li>Your birthday</li>
<li>Your likes</li>
<li>This app will share videos you watched, articles you read and other activity on Facebook.</li>
</ul>


<p>Why? Why!? Why do I have to give up all of my information just to read an article. Now instead of me reading your article and possibly generating you revenue, I get frustrated and never even reach the website. Please fix this.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[iTunes Account Hacked Twice in 24 Hours]]></title>
    <link href="http://saewitz.com/itunes-account-hacked-twice-in-24-hours"/>
    <updated>2012-02-27T01:48:00-05:00</updated>
    <id>http://saewitz.com/itunes-account-hacked-twice-in-24-hours</id>
    <content type="html"><![CDATA[<p>Last night, February 26th 2012, my iTunes account was hacked.  The password had been changed and the $81 or so sitting in the account was gone.  Luckily I was awake at 2 AM when it happened.  I never received an email saying my password had changed.  Quickly, I emailed Apple Support informing that I did not purchase the app 江湖行2, and that I couldn&#8217;t even remotely read what app that was (but I was genuinely excited to own the sequel).  The game bought appears to be the free &#8221;<a href="http://translate.google.com/translate?hl=en&amp;sl=zh-CN&amp;u=http://itunes.apple.com/cn/app/jiang-hu-xing2/id480073223%3Fmt%3D8&amp;ei=FChLT8LqIInz0gG9ho3yDQ&amp;sa=X&amp;oi=translate&amp;ct=result&amp;resnum=4&amp;ved=0CFgQ7gEwAw&amp;prev=/search%3Fq%3D%25E6%25B1%259F%25E6%25B9%2596%25E8%25A1%258C2%26hl%3Den%26safe%3Doff%26prmd%3Dimvnsa">Rivers and Lakes 2</a>&#8221;.  All costs were for in-app purchase totaling the amount in the account.  They did not spend any more, which I assume is because they did not have my credit card pin number.  I also changed my email password.</p>

<p>Apple quickly (to my delight) emailed me back and credited my account with the funds even though this was an &#8221;<em>exception to the iTunes Store Terms and Conditions, which state that all sales are final.</em>&#8221;  I changed my password and went to sleep satisfied.</p>

<p>All was well today, until about 15 minutes ago.  I received an email saying: $27.52 had been charged to my Apple account.  The thieves had gotten back in.  I attempted to login, but the password had been changed again.  I rushed to change the password, yet again.  After emailing Apple support saying I had been hacked again, I went off to Google to see if anyone else was getting repeatedly hacked.</p>

<p>Well, it appears people are getting hacked <a href="https://discussions.apple.com/thread/2665383?start=1215&amp;tstart=0">all the time</a>.  The only thing most users that were hacked had in common, was that they all had some sort of gift card in their account.  Many had only gift card money taken, but some seemed to have Paypal funds stolen and credit cards charged.  Either way, it seems these are happening directly on Apple&#8217;s server which means Apple itself is getting hacked and passwords are being altered.  All of the charges are for overseas in-app purchases which means these aren&#8217;t people snooping on my wifi (might I add that I&#8217;m on a highly secure University campus wifi).  Hopefully Apple will patch this hole quickly.  As for now, I&#8217;ve gone ahead and told Apple to freeze my account.  You might want to do the same.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Vinyl Record Length]]></title>
    <link href="http://saewitz.com/interesting-note-about-vinyl-record-length"/>
    <updated>2011-12-12T00:34:00-05:00</updated>
    <id>http://saewitz.com/interesting-note-about-vinyl-record-length</id>
    <content type="html"><![CDATA[<p>This conversation came up due to discussion on Twitter with <a href="https://twitter.com/phish83">@Phish83</a> about pressing the Phish record <em><a href="http://en.wikipedia.org/wiki/A_Live_One">A Live One</a></em> on vinyl. One particular track (<a href="http://phish.net/song/tweezer/history">Tweezer</a>) is 30 minutes long.  I thought you could only fit ~22 minutes on the single side of a record, but apparently they have been able to fit up to 45 minutes on each side. They essentially just made the width of each groove smaller, which degraded the sound. I doubt it could hold up Phish&#8217;s wall of music well, but who knows? It&#8217;d be interesting to hear.</p>

<p><a href="http://en.wikipedia.org/wiki/LP_record#Columbia">Wikipedia</a>:</p>

<blockquote><p>CBS Laboratories head research scientist Peter Goldmark led Columbia&#8217;s team to develop a phonograph record that would hold at least 20 minutes per side. Research began in 1941, was suspended during World War II, and then resumed in 1945&#8230;
When initially introduced, 12-inch LPs played for a maximum of 45 minutes, divided over two sides. However, in 1952, Columbia Records began to bring out extended-play LPs that played for as long as 52 minutes, or 26 minutes per side. These were used mainly for the original cast albums of some Broadway musicals&#8230;[These records] remained rare, however, because of mastering limitations, and most LPs continued to be issued with a 30- to 45-minute playing time throughout the lifetime of their production. However, some albums would eventually exceed even the 52-minute limitation, with <strong>single albums going to as long as ninety minutes</strong> in the case of Arthur Fiedler&#8217;s 1976 LP 90 Minutes with Arthur Fiedler and the Boston Pops, <strong>made by Radio Shack</strong>. However, such records had to be cut with much narrower spacing between the grooves, which allowed for a much smaller amount of dynamic range on the records, and meant that playing the record with a worn needle could damage the record. It also resulted in a much quieter sound.<sup>[1]</sup> Spoken word and comedy albums, not having a wide range of musical instrumentation to reproduce, can be cut with much narrower spacing between the grooves; for example, The Comic Strip, released by Springtime Records in 1981, has a side A lasting 38:04 and a side B lasting 31:08, for a total of 69:12.</p>

<p>In any case, the standard 45-minute playing time of the LP was a significant improvement over that of the previous dominant format, the 78 rpm single, which was generally limited to three to four minutes. At around 14 minutes per side for 10-inch and 23 minutes per side for 12-inch, LPs provided a measured time to enjoy a recording before having to flip discs.</p>

<p>Some record turntables, called record changers, could play a stack of records piled on a specially designed spindle and arm arrangement. Because of this, many multiple-record sets were released in what&#8217;s called <strong>&#8220;automatic sequence.&#8221;</strong></p>

<hr />

<p>[1] (Other notably long albums included the UK version of The Rolling Stones&#8217; Aftermath, with both sides exceeding 26 minutes in length; Genesis&#8217; Duke, with both sides exceeding 27 minutes; Bob Dylan&#8217;s 1976 album Desire, with side two being just shy of thirty minutes; Brian Eno&#8217;s 1975 album Discreet Music, whose A-side exceeded 30 minutes; Miles Davis&#8217; 1972 album Get Up with It, totalling 124:15 over four sides; Todd Rundgren&#8217;s 1975 album Initiation, totaling 67:32 over two sides, as well as his band Utopia&#8217;s 1974 self-titled debut, totaling 59:17 over two sides, and his 1973 album A Wizard, A True Star, whose second side nearly reaches thirty minutes; and La Monte Young&#8217;s Dream House 78&#8217; 17&#8221;, whose two sides were each just under 40 minutes (the running time of the album is indeed 78:17))</p></blockquote>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to modify Jekyll for use with external links]]></title>
    <link href="http://saewitz.com/how-to-modify-jekyll-for-use-with-external-links"/>
    <updated>2011-11-25T17:21:00-05:00</updated>
    <id>http://saewitz.com/how-to-modify-jekyll-for-use-with-external-links</id>
    <content type="html"><![CDATA[<p>Many bloggers like to post external links such as other blogs and comment on them for their readers to see.  One of the more well-known examples of this is John Gruber&#8217;s <a href="http://daringfireball.net/linked/">Linked List</a>.  Unfortunately, this feature is not built into Jekyll nor Octopress.  Read on to find out how you can build it in yourself.</p>

<p style="text-align:center;"><img src="http://saewitz.com/downloads/images/linked-post.png" alt="Linked Post" /><br />
<em>The blue link indicates an externally linked post</em></p>

<p>Jekyll uses <a href="https://github.com/mojombo/jekyll/wiki/YAML-Front-Matter">YAML Front Matter</a> as a way of storing variables on posts such as title, date, and more.  We are going to add our own custom variable: <em>link</em>.</p>

<p>Here&#8217;s an example of what a YAML Header looks like:</p>

<pre><code>---
layout: post
title: "Phish Video of the Week: 1997-11-22"
date: 2011-11-25 01:54
comments: true
categories: 
---
</code></pre>

<p>We&#8217;ll manually add our own variable in.  Let&#8217;s call it <code>link</code>.`</p>

<pre><code>---
layout: post
title: "Phish Video of the Week: 1997-11-22"
date: 2011-11-25 01:54
comments: true
categories: 
link: http://blog.phish.net/1322194271/video-of-the-week-1997-11-22
--- 
</code></pre>

<p>Now let&#8217;s head over to the templating system.  Open the <code>article.html</code> file in your <code>/source/_includes</code> folder.</p>

<p>Replace (inside of <code>{% if index %}</code>):</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='html'><span class='line'><span class="nt">&lt;h1</span> <span class="na">class=</span><span class="s">&quot;entry-title&quot;</span><span class="nt">&gt;&lt;a</span> <span class="na">href=</span><span class="s">&quot;{{ root_url }}{{ post.url }}&quot;</span><span class="nt">&gt;</span>{% if site.titlecase %}{{ post.title | titlecase }}{% else %}{{ post.title }}{% endif %}<span class="nt">&lt;/a&gt;&lt;/h1&gt;</span>
</span><span class='line'>{% else %}
</span><span class='line'><span class="nt">&lt;h1</span> <span class="na">class=</span><span class="s">&quot;entry-title&quot;</span><span class="nt">&gt;</span>{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}<span class="nt">&lt;/h1&gt;</span>
</span></code></pre></td></tr></table></div></figure>


<p>With:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
</pre></td><td class='code'><pre><code class='html'><span class='line'>{% if post.link %}
</span><span class='line'>      <span class="nt">&lt;h1</span> <span class="na">class=</span><span class="s">&quot;entry-title&quot;</span><span class="nt">&gt;&lt;a</span> <span class="na">href=</span><span class="s">&quot;{{ post.link }}&quot;</span> <span class="na">class=</span><span class="s">&quot;link&quot;</span><span class="nt">&gt;</span>{% if site.titlecase %}{{ post.title | titlecase }}{% else %}{{ post.title }}{% endif %}<span class="nt">&lt;/a&gt;&lt;/h1&gt;</span>
</span><span class='line'>  {% else %}
</span><span class='line'>      <span class="nt">&lt;h1</span> <span class="na">class=</span><span class="s">&quot;entry-title&quot;</span><span class="nt">&gt;&lt;a</span> <span class="na">href=</span><span class="s">&quot;{{ post.url }}&quot;</span><span class="nt">&gt;</span>{% if site.titlecase %}{{ post.title | titlecase }}{% else %}{{ post.title }}{% endif %}<span class="nt">&lt;/a&gt;&lt;/h1&gt;</span>
</span><span class='line'>  {% endif %}
</span><span class='line'>{% else %}
</span><span class='line'>{% if page.link %}
</span><span class='line'>  <span class="nt">&lt;h1</span> <span class="na">class=</span><span class="s">&quot;entry-title&quot;</span><span class="nt">&gt;&lt;a</span> <span class="na">href=</span><span class="s">&quot;{{ page.link }}&quot;</span> <span class="na">class=</span><span class="s">&quot;link&quot;</span><span class="nt">&gt;</span>{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}<span class="nt">&lt;/a&gt;&lt;/h1&gt;</span>
</span><span class='line'>{% else %}
</span><span class='line'>  <span class="nt">&lt;h1</span> <span class="na">class=</span><span class="s">&quot;entry-title&quot;</span><span class="nt">&gt;&lt;a</span> <span class="na">href=</span><span class="s">&quot;{{ page.url }}&quot;</span><span class="nt">&gt;</span>{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}<span class="nt">&lt;/a&gt;&lt;/h1&gt;</span>
</span><span class='line'>{% endif %}
</span></code></pre></td></tr></table></div></figure>


<p>Don&#8217;t worry, I&#8217;ll walk you through what were doing here.</p>

<p>We first check if we are on the index page.  This doesn&#8217;t matter all too much, but Jekyll&#8217;s objects are different for the index and the article pages.  On the index, we use the <code>post</code> variable, and on the article, we use the <code>page</code> variable. In order to access the link variable, we must use <code>post.link</code> or <code>page.link</code> respectively.</p>

<p>The first group of code will output this HTML:</p>

<pre><code>&lt;h1 class="entry-title"&gt;&lt;a href="http://saewitz.com/2011/11/25/phish-video-of-the-week-1997-11-22"&gt;Phish Video of the Week: 1997-11-22&lt;/a&gt;&lt;/h1&gt;
</code></pre>

<p>The second will output this:</p>

<pre><code>&lt;h1 class="entry-title"&gt;&lt;a href="http://blog.phish.net/1322194271/video-of-the-week-1997-11-22" class="link"&gt;Phish Video of the Week: 1997-11-22&lt;/a&gt;&lt;/h1&gt;
</code></pre>

<p>See the difference?  The first just throws out a normal link to the post, while the second gives us a link to an external post (with our post&#8217;s title) and adds the class <code>link</code>.</p>

<p>If you&#8217;d like to style that, just add the <code>article h1 a.link</code> to your CSS file. Feel free to use whatever stylings you like.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='css'><span class='line'><span class="nt">article</span> <span class="nt">header</span> <span class="nt">h1</span> <span class="nt">a</span><span class="nc">.link</span> <span class="p">{</span>
</span><span class='line'>  <span class="k">color</span><span class="o">:</span> <span class="m">#147ed9</span><span class="p">;</span>
</span><span class='line'>  <span class="k">border</span><span class="o">:</span> <span class="k">none</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>I suggest adding a permalink button to the date line, to allow people to link to your post.  If you&#8217;d like a tutorial on that, please let me know.</p>

<p>If you have any problems, post in the comments below.</p>

<p>That&#8217;s it, enjoy!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Octopress and Jekyll Tips and Tricks]]></title>
    <link href="http://saewitz.com/octopress-and-jekyll-tips-and-tricks"/>
    <updated>2011-11-21T20:02:00-05:00</updated>
    <id>http://saewitz.com/octopress-and-jekyll-tips-and-tricks</id>
    <content type="html"><![CDATA[<p>It&#8217;s been about <a href="http://saewitz.com/2011/11/20/welcome-to-my-musings">a day</a> with my Jekyll blog and I&#8217;m loving it.  Octopress adds a few enhancements on top of Jekyll that really make things easier.  One of those improvements is a script that automatically generates a new markdown file with the proper <a href="https://github.com/mojombo/jekyll/wiki/yaml-front-matter">YAML headers</a>.  In order to do this, you must be in the right directory and then run <code>rake new_post["Title"]</code>.  This is simple and all, but I want to be able to generate a blog post from any directory.</p>

<p>Here&#8217;s my solution:</p>

<p>1. Create a file named <code>new_post</code> somewhere outside of your blog&#8217;s directory<sup>1</sup> and paste the following in</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c">#! /bin/sh</span>
</span><span class='line'>
</span><span class='line'><span class="k">if</span> <span class="o">[</span> <span class="s2">&quot;$1&quot;</span> <span class="o">]</span>
</span><span class='line'><span class="k">then  </span>
</span><span class='line'><span class="k">  </span><span class="nb">cd</span> ~/Desktop/Blog <span class="c">#set this to your blog directory</span>
</span><span class='line'>  rake new_post<span class="o">[</span><span class="s2">&quot;$*&quot;</span><span class="o">]</span>
</span><span class='line'><span class="k">else  </span>
</span><span class='line'><span class="k">  </span><span class="nb">echo</span> <span class="s2">&quot;Please enter a post title: ./new_post TITLE&quot;</span>
</span><span class='line'><span class="k">fi</span>
</span></code></pre></td></tr></table></div></figure>


<p>2. Set the directory (on line 5) to match your blog&#8217;s directory</p>

<p>3. Open your <code>~/.bash_profile</code> and add the following line</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nb">export </span><span class="nv">PATH</span><span class="o">=</span><span class="s2">&quot;$PATH:~/Scripts&quot;</span> <span class="c">#set to your script&#39;s directory</span>
</span></code></pre></td></tr></table></div></figure>


<p>This will allow any script in your Scripts directory to be called from any directory.  If you don&#8217;t want to add that directory to the <code>$PATH</code> variable, just use: <code>alias newpost='~/path/to/newpost'</code> and remove the <code>export PATH</code> line.</p>

<p>4. To run, just type <code>source ~/.bash_profile</code> and then <code>newpost "Octopress and Jekyll Tips and Tricks"</code> (quotes optional)</p>

<p>I also automate the blog push to git<sup>2</sup> from any directory.</p>

<p>1. Create a file called <code>blog_push</code> and paste the following in</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c">#! /bin/sh</span>
</span><span class='line'>
</span><span class='line'><span class="k">if</span> <span class="o">[</span> -m <span class="s2">&quot;$1&quot;</span> <span class="o">]</span>
</span><span class='line'><span class="k">then</span>
</span><span class='line'><span class="k">  </span><span class="nb">cd</span> ~/Desktop/Blog <span class="c">#set to your blog directory</span>
</span><span class='line'>  rake generate
</span><span class='line'>  git add .
</span><span class='line'>  git commit -m <span class="s2">&quot;$*&quot;</span>
</span><span class='line'>  git push
</span><span class='line'><span class="k">else</span>
</span><span class='line'><span class="k">  </span><span class="nb">echo</span> <span class="s2">&quot;No commit message entered: ./blog_push COMMIT_MESSAGE&quot;</span>
</span><span class='line'><span class="k">fi</span>
</span></code></pre></td></tr></table></div></figure>


<ul>
<li><em>Note: You may have to modify the <code>git push</code> to suit your specific needs.  Use whatever push command you normally use</em></li>
</ul>


<p>2. Set the directory (on line 5) to match your blog&#8217;s directory</p>

<p>3. Open your <code>~/.bash_profile</code> and add the following line</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nb">export </span><span class="nv">PATH</span><span class="o">=</span><span class="s2">&quot;$PATH:~/Scripts&quot;</span> <span class="c">#set to your script&#39;s directory</span>
</span></code></pre></td></tr></table></div></figure>


<ul>
<li><em>Note: If you already set the <code>$PATH</code> to that directory, then you don&#8217;t need to do it again</em></li>
</ul>


<p>4. To run, just type <code>source ~/.bash_profile</code> and then <code>blogpush "New Post: Octopress and Jekyll Tips and Tricks"</code> (quotes optional)</p>

<hr />


<p>1. I use a scripts directory to store all of my bash scripts in my home directory.<br />
2. This won&#8217;t work with RSync. It is for Git based (Github, Heroku) blogs.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[French Press: Javascript Beautifier for Espresso.app]]></title>
    <link href="http://saewitz.com/french-press-javascript-beautifier-for-espresso-dot-app"/>
    <updated>2011-11-20T21:11:00-05:00</updated>
    <id>http://saewitz.com/french-press-javascript-beautifier-for-espresso-dot-app</id>
    <content type="html"><![CDATA[<p><a href="https://github.com/switz213/FrenchPress.sugar">https://github.com/switz213/FrenchPress.sugar</a></p>

<p>Today I whipped up something that I&#8217;ve wanted for a long time in <a href="http://macrabbit.com/espresso/">Espresso</a>.  Now that Espresso 2 has javascript actions this is a possibility!  Read below to find out more.</p>

<br/>


<h3>FrenchPress.sugar</h3>

<p>A javascript action that beautifies javascript files into formatted code:</p>

<ul>
<li><p>Uses the library from jsbeautifier.org</p></li>
<li><p>To run use Actions->Javascript menu or press <code>Control + Alt + Arrow Up</code></p></li>
<li><p>This will not fix syntactically incorrect documents</p></li>
<li><p>This is beta software, please backup your code in advance. You may <em>undo</em> the action by pressing <code>command+z</code> (or Edit->Undo)</p></li>
</ul>


<h3>Installation</h3>

<p><strong>Requires Espresso 2.0</strong></p>

<p>The easiest way to install FrenchPress.sugar currently is directly from GitHub:</p>

<pre><code>cd ~/Library/Application\ Support/Espresso/Sugars
git clone git://github.com/switz213/FrenchPress.sugar
</code></pre>

<p><a href="https://github.com/switz213/FrenchPress.sugar">https://github.com/switz213/FrenchPress.sugar</a></p>

<p>Relaunch Espresso, and a new Javascript submenu will be available in your Actions menu.</p>

<br/>


<h3>Development</h3>

<p>FrenchPress.sugar is written entirely in XML and JavaScript using Espresso&#8217;s <a href="http://wiki.macrabbit.com/index/JavaScriptActions/">JavaScript API</a>! Feel free to mess around with the code or fork it on github!</p>

<p>You may email me if you have any feedback, requests, or run across any problems.</p>

<p>hi@danielsaewitz.com</p>

<br/>


<h3>Changelog</h3>

<p><strong>1.0</strong>:</p>

<ul>
<li>Initial release</li>
<li>Beautify Javascript using menu or key-combo (<code>Control + Alt + Arrow Up</code>)</li>
<li>Will automatically match your Espresso tab settings (# of spaces, spaces or tabs)</li>
</ul>


<br/>


<h3>Thanks to:</h3>

<h4>Ian Beck</h4>

<p>This could not have been completed without the <a href="http://github.com/onecrayon/Handy.sugar">Handy.sugar</a> source code</p>

<h4>JS Beautifier</h4>

<p>Written by <a href="mailto:einar@jsbeautifier.org">Einar Lielmanis</a><br/>
<a href="http://jsbeautifier.org/">http://jsbeautifier.org/</a></p>

<p>Originally converted to javascript by <a href="mailto:vital76@gmail.com">Vital</a></p>

<p>&#8220;End braces on own line&#8221; added by <a href="mailto:chrisjshull@gmail.com">Chris J. Shull</a></p>

<br/>


<h3>MIT License</h3>

<p>Copyright (c) 2011 Daniel Saewitz</p>

<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &#8220;Software&#8221;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>

<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>

<p>THE SOFTWARE IS PROVIDED &#8220;AS IS&#8221;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Welcome to My Musings]]></title>
    <link href="http://saewitz.com/welcome-to-my-musings"/>
    <updated>2011-11-20T12:22:00-05:00</updated>
    <id>http://saewitz.com/welcome-to-my-musings</id>
    <content type="html"><![CDATA[<p>Welcome.</p>

<p><a href="http://www.youtube.com/watch?v=gMAbNFptzAA">Stay awhile and listen.</a></p>

<h2>$ whoami</h2>

<p><a href="http://saewitz.com/about"><code>Daniel Saewitz</code></a></p>

<p>This is a window into my mind.</p>

<p>I&#8217;ve been bouncing around the popular blogging solutions trying to find the right one.  I believe I have met my match.</p>

<p>Here&#8217;s what I was looking for:</p>

<ul>
<li>Simple</li>
<li>Lightweight</li>
<li>Fast</li>
<li>Customizable</li>
<li>Markdown support</li>
</ul>


<p>I started with Wordpress, etc. all the way down the blogosphere daisychain to Tumblr.  While all were <em>good</em>, none were <strong>great</strong>.  Each had some solid features, and each had some not so solid features.  They were all too bloated and slow.</p>

<h3>Static Site Generator</h3>

<p>I started looking in to what is known as a <em>Static Site Generator</em>.  This principal behind the SSG is that there is no dynamically loaded content.  Everything is static.  This means that when the user goes to any page, they are served an html file.  No slow, server-side php.  Nothing for the server to do. It just loads the content and goes away.</p>

<p>It&#8217;s a directory of <a href="http://daringfireball.net/projects/markdown">markdown</a> files.  The header of those files include some settings, such as date, title, layout, and more.  Once a command line function is called, the html files are generated from the markdown files.  The files are then pushed out on git to <a href="http://www.heroku.com">heroku</a>, which manages the website.<sup>1</sup></p>

<p>The site is currently running a taste of <a href="https://github.com/mojombo/jekyll">Jekyll</a> known as <a href="http://www.octopress.com/">Octopress</a>.</p>

<hr />


<p>1. It is also important to know that not all SSGs are blogging engines.</p>
]]></content>
  </entry>
  
</feed>
