<?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>Cuppster.com</title>
	<atom:link href="http://cuppster.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://cuppster.com</link>
	<description>Kicking the Internet Can Since Mosaic 2.0</description>
	<lastBuildDate>Thu, 26 Apr 2012 17:44:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Simple String Generator in Python</title>
		<link>http://cuppster.com/2012/04/26/simple-string-generator-in-python/</link>
		<comments>http://cuppster.com/2012/04/26/simple-string-generator-in-python/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 17:44:38 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[generators]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://cuppster.com/?p=1681</guid>
		<description><![CDATA[Here&#8217;s some handy code for generating combinations of strings in Python. Provide a string with substitution variables and a list of iterables, and poof! import itertools def string_patterns(pattern, *args): '''generator for string patterns''' for data in itertools.product(*args): s = pattern.format(*data) &#8230; <a href="http://cuppster.com/2012/04/26/simple-string-generator-in-python/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s some handy code for generating combinations of strings in Python. Provide a string with substitution variables and a list of iterables, and poof!</p>
<pre><code>import itertools

def string_patterns(pattern, *args):
  '''generator for string patterns'''

  for data in itertools.product(*args):
    s = pattern.format(*data)
    yield s

# generate some urls!
for url in string_patterns('http://example.com/{0}/{1}', ['page'], range(1,5)):
  print url
</code></pre>
<p><span id="more-1681"></span></p>
<p>Output</p>
<pre><code>http://example.com/page/1

http://example.com/page/2

http://example.com/page/3

http://example.com/page/4

</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://cuppster.com/2012/04/26/simple-string-generator-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CORS Middleware for Node.js and Express</title>
		<link>http://cuppster.com/2012/04/10/cors-middleware-for-node-js-and-express/</link>
		<comments>http://cuppster.com/2012/04/10/cors-middleware-for-node-js-and-express/#comments</comments>
		<pubDate>Tue, 10 Apr 2012 18:19:38 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Gist]]></category>
		<category><![CDATA[cors]]></category>
		<category><![CDATA[gist]]></category>
		<category><![CDATA[middleware]]></category>
		<category><![CDATA[node.js]]></category>

		<guid isPermaLink="false">http://cuppster.com/?p=1672</guid>
		<description><![CDATA[Here&#8217;s a little gist of Express middleware that will add support for CORS pre-flight handling to your website or API service. Many examples found on interwebs don&#8217;t return immediately after detecting the pre-flight request, and end up issuing duplicate database &#8230; <a href="http://cuppster.com/2012/04/10/cors-middleware-for-node-js-and-express/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little gist of <a href="http://expressjs.com/">Express</a> middleware that will add support for <a href="http://www.w3.org/TR/cors/">CORS</a> pre-flight handling to your website or API service. Many examples found on interwebs don&#8217;t return immediately after detecting the pre-flight request, and end up issuing duplicate database queries, etc&#8230;</p>
<p><span id="more-1672"></span></p>
<p><script src="https://gist.github.com/2344435.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://cuppster.com/2012/04/10/cors-middleware-for-node-js-and-express/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Input Box That Isn&#8217;t</title>
		<link>http://cuppster.com/2012/03/22/the-input-box-that-isnt/</link>
		<comments>http://cuppster.com/2012/03/22/the-input-box-that-isnt/#comments</comments>
		<pubDate>Thu, 22 Mar 2012 15:52:14 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[ui]]></category>
		<category><![CDATA[ux]]></category>

		<guid isPermaLink="false">http://cuppster.com/?p=1662</guid>
		<description><![CDATA[Just an Android rant. I really don&#8217;t like the Google Search widget on my Android desktop. Looks like a button, but isn&#8217;t. Why?? Also, apps that show multiple &#8212; sometimes 3 at a time &#8212; progress spinners. Ugh&#8230;]]></description>
			<content:encoded><![CDATA[<p>Just an Android rant. I really don&#8217;t like the Google Search widget on my Android desktop. Looks like a button, but isn&#8217;t. Why?? Also, apps that show multiple &#8212; sometimes 3 at a time &#8212; progress spinners. Ugh&#8230;</p>
<p><a href="http://cuppster.com/wp-content/uploads/2012/03/screenshot-1332370229789.png"><img src="http://cuppster.com/wp-content/uploads/2012/03/screenshot-1332370229789-180x300.png" alt="" title="screenshot-1332370229789" width="180" height="300" class="aligncenter size-medium wp-image-1663" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://cuppster.com/2012/03/22/the-input-box-that-isnt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New To Linode? Starting Out Right&#8230;</title>
		<link>http://cuppster.com/2012/03/18/new-to-linode-starting-out-right/</link>
		<comments>http://cuppster.com/2012/03/18/new-to-linode-starting-out-right/#comments</comments>
		<pubDate>Sun, 18 Mar 2012 00:07:10 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[linode]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://cuppster.com/?p=1593</guid>
		<description><![CDATA[Big thanks to the great reps of Linode for turning me on to their hosting at PyCon last week. Since I&#8217;m starting with a fresh Ubuntu server, I wanted to do it right, so I spent some time learning how &#8230; <a href="http://cuppster.com/2012/03/18/new-to-linode-starting-out-right/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Big thanks to the great reps of <a href="http://www.linode.com/?r=a656ac027a46c13beb02ab72be8ba47a17be056c">Linode</a> for turning me on to their <a href="http://www.linode.com/?r=a656ac027a46c13beb02ab72be8ba47a17be056c">hosting</a> at <a href="https://us.pycon.org">PyCon</a> last week. Since I&#8217;m starting with a fresh Ubuntu server, I wanted to do it right, so I spent some time learning how to properly do public/private keys for logins and to disable remote <em>root</em> logins&#8230;</p>
<p><span id="more-1593"></span></p>
<h2>Your First Log-In</h2>
<p>The first time ssh&#8217;ing to your new instance a warning will appear letting you know that you haven&#8217;t seen this hostname and/or IP before and asks you if you <em>really</em> want to connect (i.e. do you trust this server):</p>
<pre><code>The authenticity of host 'xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx)' can't be established.
ECDSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'xxx.xxx.xxx.xxx' (ECDSA) to the list of known hosts.
root@xxx.xxx.xxx.xxx's password:
Welcome to Ubuntu 11.10 (GNU/Linux 3.0.18-linode43 i686)

 * Documentation:  https://help.ubuntu.com/

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

root@lixxx-xxx:~#
</code></pre>
<p>If you answer in the affirmative and supply the correct password, your new server&#8217;s <em>public key</em> will be stored under two possible entries in your local <code>~/.ssh/known_hosts</code> file: one for the IP address and the other for the hostname (if used). FYI: you can delete an entry by using:</p>
<pre><code>$ ssh-keygen -R xxx.xxx.xxx.xxx
</code></pre>
<h2>Create a new user</h2>
<p>In later steps we&#8217;re going to <em>disallow</em> remote logins by the <em>root</em> user, so this step is <strong>CRITICAL!</strong></p>
<pre><code>$ sudo adduser NEWUSERNAME

... lots of easy steps here ...
</code></pre>
<p>Add you&#8217;ll probably want to add this new user to the <code>sudoers</code> list so they can do things like install system-wide packages and perform upgrades. Edit (as root) the file <code>/etc/sudoers</code> and add your new username to the list under <code>User privilege specification</code>:</p>
<pre><code># User privilege specification
root,NEWUSERNAME      ALL=(ALL:ALL) ALL
</code></pre>
<h2>Go Password-Less!</h2>
<p>Create a private/public key pair on the <strong>client</strong> machine. The default type is &#8216;rsa&#8217;, but let&#8217;s use the <code>-t</code> option for demonstration purposes. Also, to stop a default email address from getting into the comment, we&#8217;ll be specific and use a good email (doesn&#8217;t have to be an email, could be a location like &#8220;mylaptop&#8221;, etc&#8230;):</p>
<pre><code>$ ssh-keygen -t rsa -b 4096 -C name@example.com

... answer the questions
</code></pre>
<p>When asked to enter the filename, you can accept the default or go with a custom name. I&#8217;ll use &#8220;MYKEY_rsa&#8221; for this workflow. Also, I&#8217;ve NOT used a passphrase. You may add a passphrase for added security&#8230;</p>
<h2>Transfer your public key to the remote machine</h2>
<p>The remote machine needs your public key to decrypt the data you send it that&#8217;s encrypted with your private key. Below are steps to do this both manually and then quickly with the <code>ssh-copy-id</code> program.</p>
<h3>Manually</h3>
<p>Create the <code>~/.ssh</code> directory on the <strong>server</strong> and protect it:</p>
<pre><code>$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
</code></pre>
<p>Transfer your public key from the <strong>client</strong> to remote machine:</p>
<pre><code>$ cat ~/.ssh/MYKEY_rsa.pub | ssh NEWUSERNAME@xxx.xxx.xxx.xxx 'cat &gt;&gt; ~/.ssh/authorized_keys'

root@xxx.xxx.xxx.xxx's password: XXXXXX
</code></pre>
<h3>Using <code>ssh-copy-id</code></h3>
<p>This method is a lot more bullet-proof.</p>
<pre><code>$ ssh-copy-id -i ~/.ssh/MYKEY_rsa NEWUSERNAME@xxx.xxx.xxx.xxx
root@xxx.xxx.xxx.xxx's password: XXXXXX
Now try logging into the machine, with "ssh 'root@xxx.xxx.xxx.xxx'", and check in:

  ~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.
</code></pre>
<h2>Make yourself known to <code>ssh-agent</code></h2>
<p>You&#8217;ve given your public identity to the remote server and you&#8217;ve added it to your <code>known_hosts</code>. Now, if you attempt an <code>ssh</code> connection, you&#8217;ll see this error if you&#8217;ve used a non-default name for your keys:</p>
<pre><code>Agent admitted failure to sign using the key.
</code></pre>
<p>This is because <code>ssh</code> didn&#8217;t know which identity you to use. To remedy this, let the <code>ssh</code> agent know about your new identity so it can provide the correct credentials behind the scenes when needed.</p>
<pre><code>$ ssh-add ~/.ssh/MYKEY_rsa
</code></pre>
<p>FYI: to delete all your identities, use this command:</p>
<pre><code>$ ssh-add -D
</code></pre>
<p>Ubuntu will prompt you for the password, if the private key has one (I didn&#8217;t supply one in this workflow).</p>
<h2>Disallow Keyboard-based And Remote Root Logins:</h2>
<p>Now that authentication can happen using public/private keys, we can now safely disable standard keyboard password authentication on the server. On the <strong>server</strong> machine, open the file <code>/etc/ssh/sshd_config</code> and make the following changes:</p>
<pre><code>PasswordAuthentication no
ChallengeResponseAuthentication no
</code></pre>
<p><strong>ONLY</strong> if you&#8217;ve created a new user and given them <code>sudo</code> permissions should you modify this line:</p>
<pre><code>PermitRootLogin no
</code></pre>
<p>Reload your <code>sshd</code> config file (using Ubuntu&#8217;s upstart):</p>
<pre><code>$ service ssh reload
</code></pre>
<p>Now (just to test things) back on the <strong>client</strong>, tell our agent to forget our key, and attempt a regular <code>ssh</code> connection. You should get a &#8216;Permission denied&#8217; error:</p>
<pre><code>$ ssh NEWUSERNAME@xxx.xxx.xxx.xxx
Agent admitted failure to sign using the key.
Permission denied (publickey).
</code></pre>
<p>Add the key back to the agent, and all should be good!</p>
<pre><code>$ ssh-add MYKEY_rsa
Identity added: MYKEY_rsa (MYKEY_rsa)

$ ssh NEWUSERNAME@xxx.xxx.xxx.xxx
</code></pre>
<h2>Try Something!</h2>
<p>Now to test your new user and their sudo permissions, try installing a cool database!</p>
<pre><code>$ sudo apt-get install redis-server
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://cuppster.com/2012/03/18/new-to-linode-starting-out-right/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UTF-8 Round Trip for Perl, MySQL and node.js</title>
		<link>http://cuppster.com/2012/02/28/utf-8-round-trip-for-perl-mysql-and-node-js/</link>
		<comments>http://cuppster.com/2012/02/28/utf-8-round-trip-for-perl-mysql-and-node-js/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 05:57:23 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[encodings]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://cuppster.com/?p=1571</guid>
		<description><![CDATA[Doing things the un*x way means keeping a supply of &#8220;go-to&#8221; tools for the various tasks that spring up during development. For me, that&#8217;s a lot of bash, python and Perl on the dev machine and recently node.js on the server. While &#8230; <a href="http://cuppster.com/2012/02/28/utf-8-round-trip-for-perl-mysql-and-node-js/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Doing things the un*x way means keeping a supply of &#8220;go-to&#8221; tools for the various tasks that spring up during development. For me, that&#8217;s a lot of bash, python and Perl on the dev machine and recently <a href="http://nodejs.org/">node.js</a> on the server.</p>
<p>While <del>scraping</del> acquiring multi-lingual (Unicode) data for a project, I had to make sure I kept the correct utf-8 encoding all along the processing pipeline. One screw-up and it&#8217;s garbage out. Here are some tips:</p>
<p><span id="more-1571"></span></p>
<p><strong>Acquire Content in Perl</strong></p>
<p>Use the Perl modules <a href="http://search.cpan.org/~ingy/pQuery-0.07/lib/pQuery.pm">pQuery</a> and <a href="http://search.cpan.org/~melo/Redis-1.926/lib/Redis.pm">Redis</a> to fetch and store the content. Everything will work in utf-8, no worries.</p>
<p><strong>Normalize the Data as CSV</strong></p>
<p>Use the Perl modules <a href="http://search.cpan.org/~rmbarker/Text-CSV-Unicode-0.115/lib/Text/CSV/Unicode.pm">Text::CSV::Unicode</a>, your CSV file will be encoded in utf-8.</p>
<p><strong>Read CSV into MySQL Database</strong></p>
<p>Using Text::CSV::Unicode again, insert the data into a MySQL database. But <strong>here&#8217;s the kicker</strong>, use:</p>
<pre>$dbh-&gt;{'mysql_enable_utf8'} = 1;
$dbh-&gt;do(qq{SET NAMES 'utf8';});</pre>
<p>&#8230; if you don&#8217;t, your utf-8 strings will be re-encoded into the local character set. Not good.</p>
<p>Also create a file at <em>~/.my.cnf</em> with this content:</p>
<pre>[mysql]
default-character-set=utf8</pre>
<p><strong>Serving Up The Data</strong></p>
<p>I&#8217;m using <a href="http://expressjs.com/">Express</a> with a <a href="http://nodejs.org/">node.js</a> server. I found that the documented default behaviour of responding with utf-8 wasn&#8217;t working, so I needed to set it manually:</p>
<pre>res.charset = 'utf-8';
res.send(output);</pre>
<p>There you go&#8230; I hope this helps somebody! It gave me quite a headache for a day&#8230; =D</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://cuppster.com/2012/02/28/utf-8-round-trip-for-perl-mysql-and-node-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using git And rsync To Remote Install Code</title>
		<link>http://cuppster.com/2011/11/15/using-git-and-rsync-to-remote-install-code/</link>
		<comments>http://cuppster.com/2011/11/15/using-git-and-rsync-to-remote-install-code/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 22:02:48 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[rsync]]></category>

		<guid isPermaLink="false">http://cuppster.com/?p=1561</guid>
		<description><![CDATA[It can be annoying to maintain a git repository on your web server and use commit hooks to install new code. Here&#8217;s a way to still use git, but instead use rsync to push those updates to the server. Your project may &#8230; <a href="http://cuppster.com/2011/11/15/using-git-and-rsync-to-remote-install-code/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It can be annoying to maintain a <code>git</code> repository on your web server and use <a href="http://cuppster.com/2011/01/30/using-git-to-remotely-install-website-updates/">commit hooks to install new code</a>. Here&#8217;s a way to still use <code>git</code>, but instead use <code>rsync</code> to push those updates to the server.</p>
<p><span id="more-1561"></span></p>
<p>Your project may look like the one below, a node server with support files:</p>
<pre class="brush:plain">my_project
├── .git
├── admin
├── assets
└── server
    ├── resources
    ├── server.js
    ├── static
    ├── views</pre>
<h2>Create a &#8216;<em>staging</em>&#8216; folder outside your project folder.</h2>
<pre class="brush:shell">$ mkdir my_project_staging</pre>
<h2>In your favorite editor, create a new bash script to do the work for us.</h2>
<pre class="brush:shell"># set staging folder
STAGEDIR=/home/rockstar/my_project_staging

# set your website host
HOST=example.com

# set the destination folder at your host
HOSTDIR=/home/user/my_project/server/

echo "staging locally, then syncing with server..."
GIT_WORK_TREE=${STAGEDIR}

echo "git working tree is now $GIT_WORK_TREE"
export GIT_WORK_TREE

echo "checking out to staging folder..."
git checkout -f master -- server

#echo "installing updates..."
#rsync -r -a -v -u -e "ssh -l ubuntu" --delete ${STAGEDIR}/server/ ${HOST}:${HOSTDIR}</pre>
<h2>Run this script in your <code>git</code> repository.</h2>
<p>The <code>checkout</code> will ONLY check out the <code>/server</code> folder to your staging folder.</p>
<h2>Your staging folder should look like this:</h2>
<pre class="brush:plain">my_project_staging
└── server
    ├── resources
    ├── server.js
    ├── static
    ├── views</pre>
<h2>Run <code>rsync</code> to install the updates to your server</h2>
<p>Uncomment the last two lines on the bash script if your staging folder looks correct and then execute the script again. Customize the <code>rsync</code> options to work with your host.</p>
<h2>Wrap Up</h2>
<p>The big problem with this method is that the timestamps are all NEW in your staging folder so rsyns send everything up to the server every time. I&#8217;m looking into a solution, probably using one of these methods mentioned <a href="http://stackoverflow.com/questions/1964470/whats-the-equivalent-of-use-commit-times-for-git">here</a>.</p>
<p><em><strong>Good Luck!</strong></em></p>
]]></content:encoded>
			<wfw:commentRss>http://cuppster.com/2011/11/15/using-git-and-rsync-to-remote-install-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Date is Off!</title>
		<link>http://cuppster.com/2011/10/12/the-date-is-off/</link>
		<comments>http://cuppster.com/2011/10/12/the-date-is-off/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 02:45:15 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Node.js]]></category>
		<category><![CDATA[dates]]></category>
		<category><![CDATA[express]]></category>
		<category><![CDATA[nodejs]]></category>

		<guid isPermaLink="false">http://cuppster.com/?p=1541</guid>
		<description><![CDATA[Here&#8217;s a tip for those of you using express as your node.js web framework. If you need a date library for pretty-printing in various date formats, do NOT use the Datejs library. It adds something toxic to the stock Date &#8230; <a href="http://cuppster.com/2011/10/12/the-date-is-off/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a tip for those of you using <a href="http://expressjs.com/">express</a> as your <a href="http://nodejs.org/">node.js</a> web framework. If you need a date library for pretty-printing in various date formats, do <strong>NOT</strong> use the <a href="http://www.datejs.com/">Datejs</a> library. It adds something toxic to the stock Date object that <a href="http://wiki.unknowableroom.org/Confund">confunds</a> express&#8217;s session cookie expiration date. You&#8217;ll never be able to keep anything in your session between requests.</p>
<p>Use <a href="https://github.com/timrwood/underscore.date">underscore.date</a> instead&#8230; it avoids the Date object altogether.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://cuppster.com/2011/10/12/the-date-is-off/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing node.js Packages From github</title>
		<link>http://cuppster.com/2011/09/10/installing-node-js-packages-from-github/</link>
		<comments>http://cuppster.com/2011/09/10/installing-node-js-packages-from-github/#comments</comments>
		<pubDate>Sat, 10 Sep 2011 06:40:30 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[couchdb]]></category>
		<category><![CDATA[cradle]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[npm]]></category>

		<guid isPermaLink="false">http://cuppster.com/?p=1506</guid>
		<description><![CDATA[I had a situation the other day, where the cradle couchdb client from the npm repository was throwing an error like the one below: require.paths is removed in latest node After tracking down the issue, I needed a way to &#8230; <a href="http://cuppster.com/2011/09/10/installing-node-js-packages-from-github/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I had a situation the other day, where the <a href="https://github.com/cloudhead/cradle">cradle couchdb client</a> from the <a href="http://npm.mape.me/">npm repository</a> was throwing an error like the one below:</p>
<p><code>require.paths is removed in latest node</code></p>
<p>After tracking down <a href="https://github.com/cloudhead/cradle/commit/60ebc76c692ea2e4fecfb7180a71c5ba5ded6d3b">the issue</a>, I needed a way to install the latest cradle code from github. This is how you do it, installing into the <code>node_modules</code> folder:<br />
<code><br />
$ git clone git@github.com:&lt;username&gt;/cradle<br />
$ npm remove cradle<br />
$ npm install ./cradle<br />
</code></p>
<p>First you clone the cradle repository. This creates the <code>/cradle</code> folder. Second, you remove existing cradle package using <code>npm</code>. Lastly, you use <code>npm</code> again to install from a folder. Easy as pie!</p>
]]></content:encoded>
			<wfw:commentRss>http://cuppster.com/2011/09/10/installing-node-js-packages-from-github/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Back On WordPress</title>
		<link>http://cuppster.com/2011/09/09/back-on-wordpress/</link>
		<comments>http://cuppster.com/2011/09/09/back-on-wordpress/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 17:19:46 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cuppster.com/?p=1502</guid>
		<description><![CDATA[It&#8217;s good to be back!! Despite how much fun it was developing my own blogging/publishing framework with Node.js, I never actually got around to publishing much Although I did learn a thing or two about the holy trinity&#8230; node.js &#8211; &#8230; <a href="http://cuppster.com/2011/09/09/back-on-wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s good to be back!! Despite how much fun it was developing my own <a href="https://github.com/cuppster/node-publish">blogging/publishing framework with Node.js</a>, I never actually got around to publishing much <img src='http://cuppster.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Although I did learn a thing or two about the holy trinity&#8230; node.js &#8211; Amazon EC2 &#8211; git.</p>
<p>I&#8217;d like to say I&#8217;m back in business, but you know how it goes: full-time job, multiple side-projects, team call-ins, mouths to feed, etc&#8230; at least it&#8217;s now easier to publish something when the mood strikes!</p>
]]></content:encoded>
			<wfw:commentRss>http://cuppster.com/2011/09/09/back-on-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Supervisor with Upstart</title>
		<link>http://cuppster.com/2011/05/18/using-supervisor-with-upstart/</link>
		<comments>http://cuppster.com/2011/05/18/using-supervisor-with-upstart/#comments</comments>
		<pubDate>Wed, 18 May 2011 04:19:47 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.cuppster.com/?p=1496</guid>
		<description><![CDATA[In the previous post where we managed our node.js server with supervisor, we used a classic init script to have supervisor start on reboot. In this receipe, we&#8217;ll instead use upstart, a replacement for init bundled with Ubuntu distributions. stop &#8230; <a href="http://cuppster.com/2011/05/18/using-supervisor-with-upstart/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In the previous post where we <a href="/2011/05/12/diy-node-js-server-on-amazon-ec2">managed our node.js server with supervisor</a>, we used a classic init script to have supervisor start on reboot. In this receipe, we&#8217;ll instead use <strong>upstart</strong>, a replacement for <em>init</em> bundled with Ubuntu distributions.</p>
<h3>stop and remove the old supervisord script</h3>
<p>Previously, we created this file in our home directory, so you might still have that first copy in case you want to go back doing it the old-fashioned way <img src='http://cuppster.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre><code>$ sudo /etc/init.d/supervisord stop
$ sudo rm /etc/init.d/supervisord
</code></pre>
<h3>create an upstart script</h3>
<p>Create a new file <strong>/etc/init/supervisor.conf</strong>. Its content should look like this:</p>
<pre><code>description     "supervisor"

start on runlevel [2345]
stop on runlevel [!2345]

respawn

exec /usr/local/bin/supervisord --nodaemon --configuration /etc/supervisord.conf
</code></pre>
<p>Note that we&#8217;re using the same <strong>supervisord</strong> configuration file we used before. No changes there&#8230;</p>
<h3>here&#8217;s the gotcha!</h3>
<p>This <em>upstart</em> script is modified from one found at <a href="http://lincolnloop.com/blog/2010/jun/24/automatically-running-supervisord-startup/">lincoln loop</a>. The problem with using &#8216;supervisor<strong>d</strong>.conf&#8217; as the <em>upstart</em> script filename is that the command <strong>supervisorctl</strong> picks that up and attempt to use it as a <em>supervisor</em> configuration file, which it is NOT. By changing the <em>upstart</em> script and service description to simply <strong>supervisor</strong> sans &#8216;d&#8217;, we can use <strong>supervisorctl</strong> normally.</p>
<h3>using supervisord with upstart</h3>
<p>We can now start and stop <strong>supervisord</strong> with the following commands</p>
<pre><code>$ sudo stop supervisor
$ sudo start supervisor
</code></pre>
<p>To check the status of <em>supervisor</em></p>
<pre><code>$ initctl list
$ initctl status supervisor
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://cuppster.com/2011/05/18/using-supervisor-with-upstart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

