<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><description>Former Brown CS student. Co-creator of touchtonetanks.com and mixest.com. See more projects at dtrejo.com</description><title>David Trejo's Thoughts</title><generator>Tumblr (3.0; @ddtrejo)</generator><link>http://blog.dtrejo.com/</link><item><title>My new blog is at http://dtrejo.com/blog</title><description>&lt;p&gt;Please read my new blog at &lt;a href="http://dtrejo.com/blog"&gt;http://dtrejo.com/blog&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/94259039055</link><guid>http://blog.dtrejo.com/post/94259039055</guid><pubDate>Sat, 09 Aug 2014 09:59:00 -0700</pubDate></item><item><title>Faster git workflow?</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/71a594589f6055261781d308ec891f69/tumblr_inline_mul4f2CqdO1rtbspo.png" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;Normally, &lt;code&gt;git status -s&lt;/code&gt; shows me the following image, and then I spend some time entering in the paths to edit or add the files I&amp;#8217;ve changed.
&lt;img src="http://media.tumblr.com/48b35db5830cb63d795e8464b40f2d8d/tumblr_inline_mul4pqkzww1rtbspo.png" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;But what if &lt;code&gt;git status -s&lt;/code&gt; showed me this?&lt;/p&gt;

&lt;pre&gt;
$ git status -s
g1  M lib/child_process.js
g2 M  lib/sys.js
g3 ?? newfile.md
&lt;/pre&gt;

&lt;p&gt;And then I could do this:&lt;/p&gt;

&lt;pre&gt;
$ vim g1
$ git add g3
...
&lt;/pre&gt;

&lt;p&gt;Does anyone know of a tool that allows this?&lt;/p&gt;

&lt;p&gt;If it doesn&amp;#8217;t exist, maybe I&amp;#8217;ll make it :)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GOOD NEWS:&lt;/strong&gt; &lt;a href="https://github.com/ndbroadbent/scm_breeze"&gt;scm breeze&lt;/a&gt; does all these things! Thanks for the tip &lt;a href="https://twitter.com/glebm"&gt;@glebm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cheers,&lt;/p&gt;

&lt;p&gt;D&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/63877982986</link><guid>http://blog.dtrejo.com/post/63877982986</guid><pubDate>Sat, 12 Oct 2013 19:04:00 -0700</pubDate><category>faster git workflow</category></item><item><title>My pull request workflow for wtfjs.com</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/8f386455e2661d608d97800d958c7b98/tumblr_inline_msokjlMNeK1qz4rgp.png" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s how I merge pull requests quickly, and make sure they work well on the site:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;open github, find a pull request&lt;/li&gt;
&lt;li&gt;then run this script&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;code&gt;sh
NUM=72
curl -s &lt;a href="https://github.com/brianleroux/wtfjs/pull/%24NUM.patch"&gt;https://github.com/brianleroux/wtfjs/pull/$NUM.patch&lt;/a&gt; &amp;gt; $NUM.patch
git am --signoff &amp;lt; $NUM.patch&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;then I edit the post if the person made a typo, and eventually publish.&lt;/li&gt;
&lt;li&gt;sometimes I &lt;code&gt;git rebase -i origin/master&lt;/code&gt; and then &lt;code&gt;fixup&lt;/code&gt; and &lt;code&gt;reword&lt;/code&gt; if the person made many small commits for a single post. I also use &lt;code&gt;git commit --amend&lt;/code&gt;, which I have aliased to &lt;code&gt;git amend&lt;/code&gt; and &lt;code&gt;git ammend&lt;/code&gt; in case I make a typo.&lt;/li&gt;
&lt;li&gt;While rewording or amending, I also add &amp;#8220;closes #39&amp;#8221; for each issue, to make sure that I merged the issues, and none are closed accidentally via the web UI.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;That&amp;#8217;s all!&lt;/p&gt;

&lt;p&gt;Cheers,&lt;/p&gt;

&lt;p&gt;D&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/60411237594</link><guid>http://blog.dtrejo.com/post/60411237594</guid><pubDate>Thu, 05 Sep 2013 18:38:38 -0700</pubDate><category>nodejs</category><category>git</category><category>wtfjs</category></item><item><title>Metrics and Operational Awareness at Voxer</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/5e15f99c2921e07db1b69ff8d687b5e4/tumblr_inline_msd6vmG1k41qz4rgp.png" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;note: written in august 2012 during my Voxer internship. &lt;em&gt;some links are broken as the &lt;code&gt;sky&lt;/code&gt; project has yet to be released.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Please read the article on Voxer&amp;#8217;s &lt;a href="http://blog.dtrejo.com/post/43757456124/node-single-point-of-failure"&gt;no single point of failure architecture&lt;/a&gt;, as it explains how process rings work, and how voxer&amp;#8217;s load balancing works.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://media.tumblr.com/30b6b931fc30601e71d5504ee159f2f7/tumblr_inline_msd6y47vk21qz4rgp.png" alt=""/&gt;&lt;/p&gt;

&lt;h2&gt;What are the salient implementation features of our metrics solution?&lt;/h2&gt;

&lt;p&gt;Client side (on your app servers, which emit data)&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;metrics are coalesced into 1440 byte udp packets to optimize network efficiency&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.dtrejo.com/node-single-point-of-failure"&gt;handy node.js bindings&lt;/a&gt; which allow you simply call &lt;code&gt;sky.counter("http_status|200")&lt;/code&gt; whenever a certain call suceeds or fails&lt;/li&gt;
&lt;li&gt;keys emitted with the form &lt;code&gt;http_status|200&lt;/code&gt; are rolled together with keys of the form &lt;code&gt;http_status|404&lt;/code&gt;, giving you both information on, say, 404s, 200 OKs, AND the high-level view of how many http requests you are doing per minute.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Server side (on the skyservers which aggregate metrics data)&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;skyservers form a ring, and clients load balance themselves so as not to overwhelm a single server&lt;/li&gt;
&lt;li&gt;intra-ring skyserver communication is also coalesced for efficiency.&lt;/li&gt;
&lt;li&gt;load balancing allows you to add more skyservers as the number of your appservers grows&lt;/li&gt;
&lt;li&gt;every minute, skyservers talk to a single redis server to roll-up their data&lt;/li&gt;
&lt;li&gt;the redis intermediary in front of riak allows for accurate counters, because redis performs atomic &lt;a href="http://redis.io/commands/incr"&gt;&lt;code&gt;INCR&lt;/code&gt;&lt;/a&gt; operations&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Persisting data&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;a rollup process continuously pulls keys out of redis and puts the latest time period of data into redis, simultaneously performing 5-minute rollups of the 1 minute data, if applicable.&lt;/li&gt;
&lt;li&gt;riak as our persistence medium allows us to keep historical data forever, as we can increase the size of our riak cluster by adding a machine.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Viewing metrics and adding new ones&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;the redis server keeps a list of keys that have recently been emitted, and exposes this list to our graphing UI, meaning that to begin recording a new metric, you need not do any configuration, simply start recording it on your app servers. The skygraphs UI will simply pick it up and start showing it to you.&lt;/li&gt;
&lt;li&gt;the skygraphs UI will also hit redis for the latest minute&amp;#8217;s data, giving you real-time access to what is going on right now in your infrastructure.&lt;/li&gt;
&lt;/ul&gt;&lt;h2&gt;Why didn&amp;#8217;t we just use etsy&amp;#8217;s statsd and whisper and carbon?&lt;/h2&gt;

&lt;p&gt;Etsy wrote a library called &lt;a href="https://github.com/etsy/statsd"&gt;statsd&lt;/a&gt;, which works with &lt;a href="https://github.com/etsy/statsd"&gt;whisper&lt;/a&gt; (the backend) to record metrics data. There are a couple reasons we chose not to use these technologies.&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;rings of servers recieving metrics is the only way we can handle the volume of data being recorded by our app servers&lt;/li&gt;
&lt;li&gt;riak allows us to store historical data forever (just add another machine)&lt;/li&gt;
&lt;li&gt;we think our &lt;a href="http://skygraphs"&gt;graphing UI&lt;/a&gt; is pretty snazzy, especially since it has &lt;a href="https://github.com/sentientwaffle/llquantize"&gt;heat maps&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Forthcoming: If you&amp;#8217;d like to read about &lt;a href="http://skygraphs"&gt;skygraphs&lt;/a&gt;, our awesome graphing UI, please check out &lt;a href="http://skygraphs"&gt;this article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;br/&gt;&lt;a href="http://dtrejo.com"&gt;David Trejo&lt;/a&gt;&lt;br/&gt;&lt;a href="https://twitter.com/ddtrejo"&gt;@ddtrejo&lt;/a&gt; &amp;amp; &lt;a href="https://github.com/DTrejo"&gt;DTrejo on github&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757455220</link><guid>http://blog.dtrejo.com/post/43757455220</guid><pubDate>Fri, 18 Jan 2013 22:11:00 -0800</pubDate><category>JustMigrate</category><category>nodejs</category><category>voxer</category></item><item><title>Node Single Point of Failure</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/5e15f99c2921e07db1b69ff8d687b5e4/tumblr_inline_msd6ti6AdJ1qz4rgp.png" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;note: written in august 2012 during my Voxer internship&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Voxer believes that any single point of failure is bad. Very bad (this is why we use riak). To achieve this, we&amp;#8217;ve written a couple libraries to allow node processes to communicate across machines and in concert. The first is &lt;a href="https://github.com/dannycoates/poolee"&gt;poolee&lt;/a&gt; by &lt;a href="https://github.com/dannycoates"&gt;Danny Coates&lt;/a&gt; which does http load balancing on the client, and the second is &lt;a href="https://npmjs.org/package/ring"&gt;ring&lt;/a&gt;*, which organizes processes that compose a service into a cooperating whole (each process owns part of the keyspace, and thus part of the work).&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s how this looks:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://media.tumblr.com/2f26f8c4fbd353178d6bfe8d4d015b7d/tumblr_inline_msd6u7nXok1qz4rgp.png" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;Requests emanate from clients via &lt;a href="https://github.com/dannycoates/poolee"&gt;poolee&lt;/a&gt;, which has a list of all API servers. Poolee chooses a random API server to speak with, and will stop talking to the API server if it becomes unresponsive. Health checks on unresponsive servers are performed with using exponential backoff (e.g. 1 second, 8 seconds, 16 seconds, etc), so as not to flood the network.&lt;/p&gt;

&lt;p&gt;The ring of API servers kicks in! Each client request has a distinguishing characteristic (e.g. geographic region), which dictates a specific API server as the &amp;#8220;home&amp;#8221; or &amp;#8220;owner&amp;#8221; of that data, and it is tasked with responding to that request. You may have noticed that poolee chooses a &lt;em&gt;random&lt;/em&gt; node, but it turns our that this random node knows it is not the owner of the request, and can forward it to the true &amp;#8220;home&amp;#8221; node of that request.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ring&lt;/code&gt; is consistent, which means that when an API server goes down, the other servers will fill in for the downed server without changing the homes of data stored on any nodes other than one neighboring node. The efficiency of home re-shuffling is what makes the ring consistent. If this doesn&amp;#8217;t make sense, it is because it&amp;#8217;s difficult to explain, wikipedia does a better job of explaining &lt;a href="https://en.wikipedia.org/wiki/Consistent_hashing"&gt;consistent hash rings&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Failure&lt;/h2&gt;

&lt;p&gt;Poolee and ring work together and allow us to do rolling restarts without service interruption, restart single machines when SSL has memory leaks, and remove machines from our clusters.&lt;/p&gt;

&lt;p&gt;Thus, Voxer achieves a no single point of failure architecture using the power of &lt;a href="http://nodejs.org"&gt;node.js&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;*Forthcoming: docs and more information on &lt;a href="https://npmjs.org/package/ring"&gt;ring&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;br/&gt;&lt;a href="http://dtrejo.com"&gt;David Trejo&lt;/a&gt;&lt;br/&gt;&lt;a href="https://twitter.com/ddtrejo"&gt;@ddtrejo&lt;/a&gt; &amp;amp; &lt;a href="https://github.com/DTrejo"&gt;DTrejo on github&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757456124</link><guid>http://blog.dtrejo.com/post/43757456124</guid><pubDate>Fri, 18 Jan 2013 21:03:00 -0800</pubDate><category>JustMigrate</category><category>nodejs</category><category>voxer</category></item><item><title>Salary Negotiation Resources (CS focused)</title><description>&lt;p&gt;&lt;strong&gt;This is a dump of my personal notes; expect nothing!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;br/&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;General&lt;/p&gt;
&lt;p&gt;    - &lt;a href="http://www.offer-letters.com/"&gt;http://www.offer-letters.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;    - &lt;a href="http://www.jamesaltucher.com/2011/11/how-to-negotiate-in-three-easy-lessons/"&gt;http://www.jamesaltucher.com/2011/11/how-to-negotiate-in-three-easy-lessons/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;    - &lt;a href="http://www.iwillteachyoutoberich.com/blog/negotiate-like-an-indian-i-taught-my-friend-how-to-negotiate-an-8000-salary-increase/"&gt;http://www.iwillteachyoutoberich.com/blog/negotiate-like-an-indian-i-taught-m&amp;#8230;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;    - &lt;a href="http://mindyourdecisions.com/blog/2009/08/04/how-to-negotiate-a-pay-raise-with-game-theory/"&gt;http://mindyourdecisions.com/blog/2009/08/04/how-to-negotiate-a-pay-raise-wit&amp;#8230;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;    - why you should talk about salary with co-workers and friends: &lt;a href="http://news.ycombinator.com/item?id=4767273"&gt;http://news.ycombinator.com/item?id=4767273&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;    - summary/review of secrets of power negotiating book: &lt;a href="http://www.korokithakis.net/posts/secrets-power-negotiating/"&gt;http://www.korokithakis.net/posts/secrets-power-negotiating/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Startup-specific&lt;/p&gt;
&lt;p&gt;    - &lt;a href="http://accountalent.com/?p=380"&gt;http://accountalent.com/?p=380&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;    - How I negotiated my startup compensation &lt;/p&gt;
&lt;p&gt;      &lt;a href="http://blog.keen.io/post/29904565692/how-i-negotiated-my-startup-compensation"&gt;http://blog.keen.io/post/29904565692/how-i-negotiated-my-startup-compensation&lt;/a&gt; [article crit:http://news.ycombinator.com/item?id=4413569]&lt;/p&gt;
&lt;p&gt;    - Should you join that start-up? Running the numbers.   &lt;/p&gt;
&lt;p&gt;       &lt;a href="http://auscillate.com/post/238"&gt;http://auscillate.com/post/238&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;    - [great comments] &lt;a href="http://news.ycombinator.com/item?id=2928339"&gt;http://news.ycombinator.com/item?id=2928339&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Books&lt;/p&gt;
&lt;p&gt;    - ask for it on amazon; be sure to do excercises with whichever friend of yours is best at negotiating&lt;/p&gt;
&lt;p&gt;    - summary/review of secrets of power negotiating book: &lt;a href="http://www.korokithakis.net/posts/secrets-power-negotiating/"&gt;http://www.korokithakis.net/posts/secrets-power-negotiating/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scientific&lt;/p&gt;
&lt;p&gt;    &lt;a href="http://link.springer.com/chapter/10.1007%2F978-3-642-00142-0_66"&gt;http://link.springer.com/chapter/10.1007%2F978-3-642-00142-0_66&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;    &lt;a href="http://link.springer.com/article/10.1007%2Fs11211-008-0084-x"&gt;http://link.springer.com/article/10.1007%2Fs11211-008-0084-x&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;    &lt;a href="http://psycnet.apa.org/index.cfm?fa=search.displayRecord&amp;amp;UID=2001-17820-002"&gt;http://psycnet.apa.org/index.cfm?fa=search.displayRecord&amp;amp;UID=2001-17820-002&lt;/a&gt;&lt;/p&gt;

&lt;div&gt;
&lt;p&gt;unread&lt;/p&gt;
&lt;p&gt;    &lt;a href="http://news.ycombinator.com/item?id=2309317"&gt;http://news.ycombinator.com/item?id=2309317&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;    &lt;a href="http://news.ycombinator.com/item?id=2438980"&gt;http://news.ycombinator.com/item?id=2438980&lt;/a&gt;&lt;/p&gt;

&lt;/div&gt;</description><link>http://blog.dtrejo.com/post/43757457055</link><guid>http://blog.dtrejo.com/post/43757457055</guid><pubDate>Sun, 06 Jan 2013 13:25:00 -0800</pubDate><category>JustMigrate</category></item><item><title>Mounting a remote file system over ssh on Mac OSX Lion...</title><description>&lt;img src="http://40.media.tumblr.com/1b35bdc931e91135f450ea7fc847bbde/tumblr_minbaw2AOi1rbdazno1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;h2&gt;Mounting a remote file system over ssh on Mac OSX Lion 10.7.4&lt;/h2&gt;
&lt;p&gt;You hate having to ftp and/or git push. You like being able to using finder and your local editor configurations.&lt;/p&gt;
&lt;p&gt;Here’s how to mount a remote filesystem over ssh:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;download &lt;a href="http://osxfuse.github.com/"&gt;http://osxfuse.github.com/&lt;/a&gt; and &lt;a href="http://macfusionapp.org"&gt;http://macfusionapp.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;at this point, if you try to use macfusion, you will see &lt;a href="http://mriddle.com/2012/04/21/os-x-lion-macfusion-macfuse-and-libfuse-0-dylib-error"&gt;this error&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;download &lt;a href="http://www.tuxera.com/mac/macfuse-core-10.5-2.1.9.dmg"&gt;http://www.tuxera.com/mac/macfuse-core-10.5-2.1.9.dmg&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;open up macfusion, and it should work!&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;These instructions were put together from the &lt;a href="http://pig.made-it.com/sshfs.html#29009"&gt;sshfs website&lt;/a&gt; as well as a &lt;a href="http://mriddle.com/2012/04/21/os-x-lion-macfusion-macfuse-and-libfuse-0-dylib-error"&gt;blog post which tells you how to fix macfuse errors&lt;/a&gt;. There is more discussion on this over at &lt;a href="http://www.matthewratzloff.com/blog/2012/03/12/macfusion-on-os-x-lion/"&gt;http://www.matthewratzloff.com/blog/2012/03/12/macfusion-on-os-x-lion/&lt;/a&gt;.&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757461368</link><guid>http://blog.dtrejo.com/post/43757461368</guid><pubDate>Mon, 30 Jul 2012 11:17:00 -0700</pubDate><category>JustMigrate</category></item><item><title>

My Github Pull Request Workflow



Let’s say I’m...</title><description>&lt;img src="http://40.media.tumblr.com/86f9399b7c7f2b2ff0abe779b8e001d1/tumblr_minbb0576d1rbdazno1_r1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a href="http://null"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;My Github Pull Request Workflow&lt;/h2&gt;



&lt;p&gt;Let’s say I’m taking pull requests for &lt;a href="https://github.com/mranney/node_redis"&gt;node_redis&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here’s how I go about it.&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;export NUM=214 # for convenience
curl -s &lt;a href="https://github.com/mranney/node_redis/pull/%24NUM.patch"&gt;https://github.com/mranney/node_redis/pull/$NUM.patch&lt;/a&gt; &gt; $NUM.patch

# see what changed, and make sure it applies cleanly
git apply --stat $NUM.patch
git apply --check $NUM.patch

# add the commits to master
git am --signoff &lt; $NUM.patch

# if I need to make some changes, I do the following and put "e" next
# to the commits that need changes
git rebase -i origin/master&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Yes, rebase can be scary. I recommend reading about &lt;a href="http://gitfu.wordpress.com/2008/04/06/git-reflog-no-commits-left-behind"&gt;how to undo &lt;strong&gt;anything&lt;/strong&gt; using git’s reflog&lt;/a&gt;, even a botched rebase or merge.&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757465623</link><guid>http://blog.dtrejo.com/post/43757465623</guid><pubDate>Fri, 06 Jul 2012 12:01:00 -0700</pubDate><category>JustMigrate</category><category>git</category><category>howto</category></item><item><title>How To: All Your Sites Hosted Free on Nodejitsu</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/1fffed7163d589637d4b28e8b48c99c0/tumblr_inline_msd6l9chEk1qz4rgp.png" alt=""/&gt;&lt;img src="http://media.tumblr.com/dff122b889d67ff7d4cab37c59d7bffb/tumblr_inline_msd6k1dpFL1qz4rgp.png" alt=""/&gt;&lt;img src="http://media.tumblr.com/baf10535fbd214052b7276500f823166/tumblr_inline_msd6k70yNR1qz4rgp.png" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;Just moved all my sites to Nodejitsu so I wouldn’t have to pay for hosting (~$120/year). Other benefits: no need to sys-admin, redundancy, simplicity.&lt;/p&gt;

&lt;p&gt;Here’s my setup:&lt;/p&gt;

&lt;ol&gt;&lt;li&gt;Sign up for &lt;a href="http://jit.su/"&gt;Nodejitsu&lt;/a&gt; (free) with &lt;a href="http://GimmeSomeBeta.jit.su/"&gt;GimmeSomeBeta.jit.su&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://nodejs.org/#download"&gt;Make a node app&lt;/a&gt;, possibly a simple static site using &lt;a href="https://github.com/mikeal/tako"&gt;tako&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Sign up for &lt;a href="http://cloudflare.com/"&gt;Cloudflare&lt;/a&gt; (free), and make sure to turn off all security (you don’t need it).&lt;/li&gt;
&lt;li&gt;Follow &lt;a href="http://dns.jit.su/"&gt;nodejitsu’s DNS guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Deploy your app (&lt;code&gt;jitsu deploy&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Visit it at your domain name!&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;Cheers and happy hosting! &lt;br/&gt; David&lt;/p&gt;

&lt;p&gt;Pro tip: if you’d like to host different nodejitsu apps on different subdomains, make a *.yourdomain.com A record in Cloudflare. When you deploy an app you want served on a subdomain, just add the appropriate &lt;code&gt;"domains": [ "thing.yourdomain.com" ]&lt;/code&gt; property to your &lt;code&gt;package.json&lt;/code&gt;.&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757466949</link><guid>http://blog.dtrejo.com/post/43757466949</guid><pubDate>Thu, 26 Apr 2012 14:50:00 -0700</pubDate><category>JustMigrate</category><category>cloudflare</category><category>howto</category><category>nodejitsu</category><category>nodejs</category></item><item><title>Want a Nodejitsu Beta invite?</title><description>&lt;p&gt;Those of you who&amp;#8217;ve been waiting, wait no longer — get a &lt;a href="http://gimmesomebeta.jit.su"&gt;nodejitsu beta invite&lt;/a&gt; at &lt;a href="http://gimmesomebeta.jit.su"&gt;gimmesomebeta.jit.su&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;
&lt;p&gt;D&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757467882</link><guid>http://blog.dtrejo.com/post/43757467882</guid><pubDate>Fri, 09 Mar 2012 09:59:00 -0800</pubDate><category>JustMigrate</category><category>beta invite</category><category>nodejitsu</category><category>nodejs</category></item><item><title>Convert all line endings to LF</title><description>&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt; So that you can &lt;a href="http://www.mikealrogers.com/posts/nodemodules-in-git.html"&gt;check your node_modules folder into git&lt;/a&gt;, whether or not there are mixed line endings in files.&lt;/p&gt;

&lt;p&gt;Use &lt;a href="http://www.linuxcommand.org/man_pages/dos2unix1.html"&gt;dos2unix&lt;/a&gt;, which you can get using &lt;a href="http://www.macports.org/"&gt;macports&lt;/a&gt;:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;sudo port install dos2unix&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;And then use it:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;dos2unix filetoconvert.js&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Or if there are many offending files:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;cd path/to/bad/files/
find . | xargs dos2unix&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;And then &lt;code&gt;git add&lt;/code&gt; whatever you like and you’ll be good to go!&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757468806</link><guid>http://blog.dtrejo.com/post/43757468806</guid><pubDate>Mon, 02 Jan 2012 14:48:00 -0800</pubDate><category>JustMigrate</category><category>crlf</category><category>git</category><category>lf</category><category>line endings</category><category>node modules</category><category>nodejs</category></item><item><title>How to detect that node.js is running on Windows</title><description>&lt;p&gt;Do something like this:&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;if (process.platform === 'win32') {
  console.log('This is windows');
} else {
  console.log('%s is not windows, I hope!', process.platform);
}&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Needed this to update &lt;a href="https://github.com/dtrejo/run.js"&gt;run.js&lt;/a&gt; to work on Windows. Still not done making it work, but sometime soon it will happen.&lt;/p&gt;
&lt;p&gt;The main reason I need to do this is because &lt;a href="http://nodejs.org/docs/latest/api/all.html#fs.watchFile"&gt;fs.watchFile&lt;/a&gt; works on Mac/Linux, but only &lt;a href="http://nodejs.org/docs/latest/api/all.html#fs.watch"&gt;fs.watch&lt;/a&gt; works on windows. Once I have it working correctly I&amp;#8217;ll post an update with code.&lt;/p&gt;
&lt;p&gt;Cheers!&lt;br/&gt; David&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757469701</link><guid>http://blog.dtrejo.com/post/43757469701</guid><pubDate>Fri, 23 Dec 2011 22:38:00 -0800</pubDate><category>JustMigrate</category></item><item><title>Scraping Made Easy with jQuery and SelectorGadget
A few days ago...</title><description>&lt;img src="http://33.media.tumblr.com/333eedbbd314f02840874ebeaa8b0d1f/tumblr_minbb6E2TK1rbdazno1_250.gif"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;h2&gt;Scraping Made Easy with jQuery and SelectorGadget&lt;/h2&gt;
&lt;p&gt;A few days ago I was doing a TON of scraping, and as you know, without the right tools, scraping can be a REAL pain. Out of my pain comes your pleasure — here’s a list of scraping tools and resources which will make your life MUCH easier the next time you need some information from a crufty old website. If you’re short on time, skip to the end and read the &lt;code&gt;tl;dr&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Scraping with jQuery and Node.js&lt;/h2&gt;
&lt;p&gt;Scraping with jQuery is a real pleasure. Here’s some &lt;a href="https://gist.github.com/790580"&gt;example code&lt;/a&gt; to get you started, it gets the top three articles with their point values from Hacker News. The key part:&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;var window = jsdom(agent.body).createWindow()
    , $ = require('jquery').create(window);
  
  // scrape!
  var titles = $('.title a')
    , points = $('.subtext span');
    
  var printme = $.map(points, function(el, i) {
      if (i &lt; 3) {
        return $(el).text() + '\t' + $(titles[i]).text();
      }
    });
  
  console.log(printme.join('\n'));&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;To get the example working, make sure you’ve installed &lt;a href="http://joyeur.com/2010/12/10/installing-node-and-npm/"&gt;node.js and npm&lt;/a&gt;). You may find &lt;a href="https://github.com/dtrejo/run.js"&gt;run.js&lt;/a&gt; very helpful for auto-rerunning your scraper whenever you make a change.&lt;/p&gt;
&lt;h2&gt;Test your code live against the page with jqueryify&lt;/h2&gt;
&lt;p&gt;Now that you can run any jQuery code you’d like, you can start testing your code against the page. I like to use firebug or Google Chrome’s built in console. Not all pages have jQuery included, and sometimes the version of jQuery will be old, so it’s best to overwrite it with your own version using the &lt;a href="http://www.learningjquery.com/2006/12/jquerify-bookmarklet"&gt;jqueryify bookmarklet&lt;/a&gt; (it’s also a good idea to change the version of jQuery used by the bookmarklet to match the one used by jsdom to avoid any strange bugs).&lt;/p&gt;
&lt;h2&gt;Find the shortest selector with Selector Gadget&lt;/h2&gt;
&lt;p&gt;Next up is finding the correct selectors for the information you want to extract. &lt;a href="http://www.selectorgadget.com/"&gt;Selector Gadget&lt;/a&gt; makes it very easy to find the least complicated selector that still does the job. Of course you can always choose selectors by hand if you don’t fancy selector gadget, but it is super helpful for crufty nasty sites.&lt;/p&gt;
&lt;h2&gt;Scrape dynamic pages that use javascript to populate information (arg!)&lt;/h2&gt;
&lt;p&gt;At this point you can easily find selectors and test on the page live, but there is danger ahead if you encounter a site that uses javascript or AJAX to populate the information. Your tests will work just fine, but when you load the page programmatically, the page’s javascript won’t be run. There’s a few ways to get around this:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Use a regex to extract the values from the javascript written to script tags in the page.&lt;/li&gt;
&lt;li&gt;Pretend to be the page and Make requests to the AJAX urls to get the information you need&lt;/li&gt;
&lt;li&gt;URL hack. There may still be a URL hack you haven’t tried which will give you the information you need. (in this case, &lt;a href="https://github.com/mikeal/node-utils/tree/master/request"&gt;request&lt;/a&gt; is your friend.)&lt;/li&gt;
&lt;li&gt;Run the page’s javascript programmatically, then scrape the information after it’s been slotted into the page. (See &lt;a href="https://github.com/tmpvar/jsdom/"&gt;jsdom’s documentation&lt;/a&gt;.).&lt;/li&gt;
&lt;/ol&gt;&lt;h2&gt;Regex: tools to make your life easier&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://txt2re.com"&gt;txt2re.com&lt;/a&gt; is a regex &lt;em&gt;generator.&lt;/em&gt; That’s right, &lt;em&gt;generator&lt;/em&gt;, not tester. This means you enter in a string, click the parts you’d like to match, and then copy and paste the regex into your code. For me, this is pure bliss.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://regexpal.com"&gt;regexpal.com&lt;/a&gt; helps you quickly test your regular expressions against test data. Protip: only type the regex, omit the &lt;code&gt;/&lt;/code&gt; at the front and end which you’d normally use in your javascript.&lt;/p&gt;
&lt;h2&gt;tl;dr&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Use jQuery and node.js for your scraping. &lt;a href="https://gist.github.com/790580"&gt;Example code&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Test on the live page with the &lt;a href="http://www.learningjquery.com/2006/12/jquerify-bookmarklet"&gt;jqueryify bookmarklet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Find the best selectors with &lt;a href="http://www.selectorgadget.com/"&gt;Selector Gadget&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;For pages with inline script tags containing information, use &lt;a href="http://txt2re.com"&gt;txt2re.com&lt;/a&gt; to &lt;em&gt;generate&lt;/em&gt; regular expressions, and &lt;a href="http://regexpal.com/"&gt;regexpal.com&lt;/a&gt; to test them.&lt;/li&gt;
&lt;li&gt;And finally, don’t forget that URL hacking is your friend!&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Thanks for reading — if you have any feedback, please leave a comment below!&lt;/p&gt;
&lt;p&gt;PS If things are going wrong, here’s the list of common gotchas:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;use the same version of jQuery to test as the one you use in your scraper&lt;/li&gt;
&lt;li&gt;make sure the information you need is not loaded by javascript on the page&lt;/li&gt;
&lt;/ul&gt;</description><link>http://blog.dtrejo.com/post/43757473805</link><guid>http://blog.dtrejo.com/post/43757473805</guid><pubDate>Fri, 21 Jan 2011 19:35:00 -0800</pubDate><category>JustMigrate</category><category>jquery</category><category>nodejs</category></item><item><title>Touch Tone Tanks featured on TechCrunch TV!</title><description>&lt;div class="p_embed p_image_embed"&gt;
&lt;img alt="Techcrunch_logo" src="http://getfile0.posterous.com/getfile/files.posterous.com/temp-2010-12-07/kDzllrmxmBaxECfhiunfogxlejDrgzycmeHpDiarBogGqbkbudvovApGiDmj/techcrunch_logo.png.scaled500.png"/&gt;&lt;/div&gt;
Our app, Touch Tone Tanks, was featured at 6:45 on &lt;a href="http://techcrunch.com/2010/12/07/cloudstock-salesforce-hackers-tctv/"&gt;TechCrunch TV&lt;/a&gt;.
&lt;p&gt;See the &lt;a href="http://techcrunch.com/2010/12/07/cloudstock-salesforce-hackers-tctv/"&gt;video of Touch Tone Tanks&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Check out 6:45 of the above video :)&lt;/p&gt;
&lt;p&gt;- David Trejo&lt;/p&gt;
&lt;p&gt;PS yeah that was pretty repetitive.&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757474723</link><guid>http://blog.dtrejo.com/post/43757474723</guid><pubDate>Tue, 07 Dec 2010 15:47:00 -0800</pubDate><category>JustMigrate</category></item><item><title>Always be Coding</title><description>&lt;p style="margin-bottom: 1.5em;"&gt;It is very difficult to always be coding. Here is a list that helps me make progress even when I’m presented with a hairy complicated technical problem. This list also helps soldier on even if I’m not feeling particularly motivated, or in the mood.&lt;/p&gt;
&lt;h2&gt;Mind Tricks&lt;/h2&gt;
&lt;p&gt;I’ve ordered this list from hardest to easiest in an attempt to trick my brain into doing at least one of these things:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Finish the whole project in one day. &lt;span class="caps"&gt;BAM&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;Pick an isolated sub-problem and solve that&lt;/li&gt;
&lt;li&gt;Take a 10 minute break and go outside, then come back and look at the problem again&lt;/li&gt;
&lt;li&gt;Write pseudocode&lt;/li&gt;
&lt;li&gt;Write really horrible and ugly and wrong pseudocode, with tons of TODOs and FIXMEs.&lt;/li&gt;
&lt;li&gt;Find a friend who is doing work, and make them guilt you into working with them [New! A highly effective tip suggested by &lt;a href="http://eactiv.com/"&gt;Charles Yeh&lt;/a&gt;]&lt;/li&gt;
&lt;li&gt;write tests and example cases to help focus your implementation [New! Big hat tip to &lt;a href="http://twitter.com/#!/jeremyhoffman"&gt;Jeremy Hoffman&lt;/a&gt;]&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;On a somewhat different axis:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Take a pen and paper and sit outside, far away from any screens, and just draw out the problem and how it flows&lt;/li&gt;
&lt;/ul&gt;&lt;blockquote&gt;I actually love drafting with a pen and paper, as you described. Somehow it&amp;#8217;s easier for me to draw out bullet points, boxes, lines, and bits of pseudocode than it is for me to conceive of it on a screen. A trick I&amp;#8217;ve been doing lately, especially when I have to learn a new system or API with many components, is to put each key function or object on a Post-it note. I stick the Post-Its on my desk, or on a single sheet in my notebook if I want to carry my diagram with me (or draw lines between post-its instead of on them). When I need to change my diagram, I don&amp;#8217;t have to erase anything, I can just move or replace the applicable Post-Its. High-tech! &lt;span style=""&gt; &lt;/span&gt;—&lt;em&gt; &lt;a href="http://twitter.com/#!/jeremyhoffman"&gt;Jeremy Hoffman&lt;/a&gt;&lt;/em&gt;&lt;/blockquote&gt;
&lt;ul&gt;&lt;li&gt;Write pseudocode with a pen and paper&lt;/li&gt;
&lt;li&gt;Take nap, but &lt;span class="caps"&gt;ONLY&lt;/span&gt; after you’ve done one of the above things for at least 5 minutes!&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;If you have any mind tricks, please share!&lt;/p&gt;
&lt;p&gt;– David&lt;/p&gt;
&lt;p&gt;PS Make sure to use &lt;a href="http://calendaraboutnothing.com/"&gt;calendaraboutnothing.com&lt;/a&gt; to really keep yourself honest (suggested by jettiene of #node.js — thanks!).&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757475691</link><guid>http://blog.dtrejo.com/post/43757475691</guid><pubDate>Mon, 22 Nov 2010 15:42:00 -0800</pubDate><category>JustMigrate</category></item><item><title>Watch me demo my phone-controlled game! 7pm tonight! (#nytm...</title><description>&lt;img src="http://36.media.tumblr.com/658aa5bc92a53c78f198703cafe2a8b5/tumblr_minbbbRgwN1rbdazno1_400.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;h2&gt;Watch me demo my phone-controlled game! 7pm tonight! (#nytm #node.js #twilio #socket.io)&lt;/h2&gt;&lt;p&gt;&lt;a href="http://livestream.com/nytechmeetup"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: You can now see a &lt;a href="http://twilly.no.de/#lsplayer"&gt;video demo of touch tone tanks!&lt;/a&gt; (It turns out we didn’t crash and burn)&lt;/p&gt;
&lt;p&gt;Good afternoon!&lt;/p&gt;
&lt;p&gt;Later today &lt;a href="http://paulkernfeld.com/" style="color: inherit; text-decoration: none;"&gt;Paul&lt;/a&gt;, Justin, and myself will be demoing our &lt;a href="http://twilly.no.de/" style="color: inherit;"&gt;phone-controlled tanks game&lt;/a&gt;* in front of 900 people at New York Tech Meetup! (I hope we don’t crash and burn)&lt;/p&gt;
&lt;p&gt;You can watch us live at &lt;a href="http://livestream.com/nytechmeetup/"&gt;livestream.com/nytechmeetup&lt;/a&gt; at 7pm tonight.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;David&lt;/p&gt;

&lt;p&gt;* In case you’re curious about how this works:&lt;/p&gt;
&lt;p&gt;First you set up a projector or other large screen, then you bust out your phones, call our phone number, and press the buttons on your keypad to shoot or move around. The tones are sent to the game over all kinds of crazy internet infrastructure (Twilio, node.js, and socket.io if you’re curious. We’ve even open-sourced the communication bits of it so you can build your own phone controlled game or web application. See &lt;a href="http://dtrejo.no.de/"&gt;nodaphone&lt;/a&gt; for documentation and source.)&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757479532</link><guid>http://blog.dtrejo.com/post/43757479532</guid><pubDate>Tue, 02 Nov 2010 11:34:00 -0700</pubDate><category>JustMigrate</category><category>nodejs</category></item><item><title>Node.js for Server Newbs
This is the story of how a webserver...</title><description>&lt;img src="http://36.media.tumblr.com/16a56e165f59878dbfa49eaa55527446/tumblr_minbbe6VtA1rbdazno1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;h2&gt;Node.js for Server Newbs&lt;/h2&gt;
&lt;p&gt;This is the story of how a webserver noob and thrifty college student got access to a server on which to run node.js.&lt;/p&gt;
&lt;p&gt;This guide is for those who have used node.js locally, but want to run it on a server and show their projects to the world.&lt;/p&gt;
&lt;p&gt;This assumes (almost) no familiarity with how hosting works, but does assume some familiarity with node.js and building from source. This guide will help you install node.js on an Ubuntu 10.4, 64-bit machine.&lt;/p&gt;
&lt;p&gt;Here we go:&lt;/p&gt;
&lt;p&gt;Sign up for web hosting at &lt;a href="http://webbynode.com/"&gt;webbynode&lt;/a&gt;. Why did I choose webbynode? It offers hosting for $10/month with root access. Only prgrmr competes&lt;span style="font-family: sans-serif; border-collapse: collapse; line-height: 19px;"&gt;†&lt;/span&gt;, but they have $4/month worth of support, which is scary for those new to hosting, namely myself. I also shied away from webfaction ($9.50/month), because while they do allow you to install node.js in your home directory, there are all kinds of configuration headaches (I think). In any case, these instructions are specific to webbynode with the Ubuntu setup. &lt;strong&gt;Update&lt;/strong&gt;: to get 99 cents off with webbynode, use &lt;code&gt;davidt&lt;/code&gt; at checkout.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Under deploy, click the bare linux image, then choose ubuntu 10.4, 64-bit. This may take a a minute or so. When it is active, continue on.&lt;/p&gt;
&lt;p&gt;On your dashboard you should see the IP of your webby, it looks like this: x.x.x.x&lt;/p&gt;
&lt;p&gt;Open up a console* on your local machine, and run these at the command line:&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;localmachine$ ssh root@x.x.x.x&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;(Enter your password to log into your webby server)&lt;/p&gt;
&lt;p&gt;This is key, as it allows you to do everything else:&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;webby# apt-get update
webby# apt-get install git-core g++ make curl libssl-dev&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;(python is already installed)&lt;/p&gt;

&lt;p&gt;Now to download the node files and build them (make sure to use the latest version from &lt;a href="http://nodejs.org/#build"&gt;http://nodejs.org/#build&lt;/a&gt;):&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;webby# curl -O &lt;a href="http://nodejs.org/dist/node-v0.2.0.tar.gz"&gt;http://nodejs.org/dist/node-v0.2.0.tar.gz&lt;/a&gt;
webby# tar xvzf node-v0.2.0.tar.gz
webby# cd node-v0.2.0
webby# ./configure
webby# make
webby# make install
webby# node --version
&gt;0.2.0&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;You’re ready to write some JS and serve people up!&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;
&lt;p&gt;-David&lt;/p&gt;

&lt;p&gt;PS In order to start serving your site from yourdomain.com, you’ll need to follow webbynode’s instructions for changing the dns setting with whoever you bought your domain from. Here’s their guide: &lt;a href="http://guides.webbynode.com/articles/webbymanager/dns-setup.html"&gt;http://guides.webbynode.com/articles/webbymanager/dns-setup.html&lt;/a&gt; Don’t forget to migrate your blog and other things!&lt;/p&gt;
&lt;p&gt;Bonus:&lt;/p&gt;
&lt;p&gt;Set up security on your machine with &lt;a href="http://guides.webbynode.com/articles/security/ubuntu810-ufw.html"&gt;http://guides.webbynode.com/articles/security/ubuntu810-ufw.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Use Tim’s guide to restart your node process when it crashes [just pay attention to the &lt;code&gt;upstart&lt;/code&gt; parts, if you want to keep moving parts to a minimum]&lt;/p&gt;
&lt;p&gt;&lt;a href="http://howtonode.org/deploying-node-with-spark"&gt;http://howtonode.org/deploying-node-with-spark&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="font-family: sans-serif; border-collapse: collapse; line-height: 19px;"&gt;† that I know of — let me know if you find other good options!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;* If you are using a pc you may need to install something like putty so that you can use &lt;code&gt;ssh&lt;/code&gt;.&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757484070</link><guid>http://blog.dtrejo.com/post/43757484070</guid><pubDate>Fri, 03 Sep 2010 13:26:00 -0700</pubDate><category>JustMigrate</category><category>howto</category><category>nodejs</category></item><item><title>$1100 clock made with jQuery

The QlockTwo, made in Germany, is...</title><description>&lt;img src="http://36.media.tumblr.com/0fa1d2adaa9a8d87641cd8f36d50766f/tumblr_minbbjiJx51rbdazno1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;h2&gt;$1100 clock made with jQuery&lt;/h2&gt;

&lt;div&gt;The QlockTwo, made in Germany, is a beautiful device.&lt;/div&gt;



&lt;div&gt;I set out to steal some of that beauty and made a version of the &lt;a href="http://dtrejo.com/qlock/qlock.html" target="_blank"&gt;QlockTwo using jQuery&lt;/a&gt;. You can see it live &lt;a href="http://dtrejo.com/qlock/qlock.html" target="_blank"&gt;right here&lt;/a&gt;.&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div&gt;&lt;/div&gt;



&lt;div&gt;Building this clock was a ton of fun. It took me a couple of days, and I learned about the relativity of time (ooh sophisticated).&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div&gt;Here are some fancy psychological things that go on when you use the clock:&lt;/div&gt;



&lt;div&gt;The first half of the hour creeps along — you don’t notice the dots as much as the words, so most of the time it’s later than what you see in words. The only way to stay accurate is to pay lots of attention to the dots, which requires more thought and means it takes you longer to read the clock.&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div&gt;The second half of the hour races. The words are always either in synced with or ahead of the real-time. This means it that you’ll finish meetings earlier, and be more punctual because you’ll give yourself extra time to get places. Just make sure you always schedule your appointments on the hour.&lt;/div&gt;



&lt;div&gt;&lt;span style="font-size: large;"&gt;Technical Details&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div&gt;I select the words to be highlighted in a really jenky way. It is very dependent on the structure of the table (yeah I tried to use divs, but I don’t have the skill to keep all the words aligned horizontally and vertically and keep everything square too). Here’s roughly how the code works:&lt;/div&gt;



&lt;div&gt;
&lt;ul&gt;&lt;li style="margin-left: 15px;"&gt;Javascript asks for the time &lt;/li&gt;
&lt;li style="margin-left: 15px;"&gt;Time is transformed into words by a for loop which used to be a GIGANTIC composite switch and if else statement. It was a mess.&lt;/li&gt;
&lt;li style="margin-left: 15px;"&gt;The text in all the table cells is put together into one long string. There is a one-to-one relationship between the table cells and the letters in the string. This means that if I match the word “OCLOCK” in the string, and the O in OCLOCK is the 50th character in the string, then I know I can just light up the 50th table cell and it will contain the “O.” That wasn’t the most clear way of saying things. Here’s how it goes: I want to highlight OCLOCK, the code finds the position of OCLOCK in the string, then highlights the table cells in that position. &lt;/li&gt;
&lt;li style="margin-left: 15px;"&gt;Every 400 milliseconds the clock’s face is refreshed. It is important to me that the clock change times in a smooth manner, and it is important that the clock light up in a visible way when you load the page. To achieve a smooth fadein, there is a css transition of .12 seconds. This makes things smooth when the clock changes times. The 400 millisecond fadein leaves the page time to load when you first fire it up, so you get to experience the initial glow when the clock lights up. &lt;/li&gt;
&lt;li style="margin-left: 15px;"&gt;Now you might be thinking, if the CLOCK REFRESHES EVERY 400 MILLISECONDS THEN WHY ISN’T IT FLASHING LIKE CRAAAAAZYYY?? That’s how it was initially, and it was ugly as sin (if you consider sin ugly). Here’s the solution: compare the previously lighted letters with the new ones that need to be lighted, unlight the ones not present in the new list, and then light up the new ones. This turns out to be a bit complicated and it turns out Venn diagrams made with water colors are a key tool of the modern-day programmer. &lt;/li&gt;
&lt;li style="margin-left: 15px;"&gt;What other cool stuff does the clock have in it? I stole a glow from &lt;a href="http://midtonedesign.com" target="_blank"&gt;midtonedesign.com&lt;/a&gt;, which adds the halo behind the clock (cheers Jonotan). I also chose a font from the google font directory that mimics the QlockTwo’s font quite well. And of course I threw in some text-shadows to make things glow. Mandatory.&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div&gt;&lt;span style="font-size: large;"&gt;Conclusion&lt;/span&gt;&lt;/div&gt;



&lt;div&gt;&lt;span style="font-size: large;"&gt; &lt;/span&gt;jQuery is tons of fun to work with, and the &lt;a href="http://webchat.freenode.net/?channels=jquery" target="_blank"&gt;#jquery channel&lt;/a&gt; is full of helpful people. I emailed QlockTwo and apparently &lt;a href="http://dtrejo.com/qlock/qlock.html"&gt;my version&lt;/a&gt; is a “Nice Application with JQuery and CSS!”&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div&gt;The time distorting aspects of the clock are quite fun, so make sure to put one up in your office so you can wrap up boring meetings more quickly.&lt;/div&gt;



&lt;div&gt;Cheers,&lt;/div&gt;

&lt;div&gt;David&lt;/div&gt;

&lt;p&gt; &lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757490255</link><guid>http://blog.dtrejo.com/post/43757490255</guid><pubDate>Sun, 15 Aug 2010 20:57:00 -0700</pubDate><category>JustMigrate</category><category>css</category><category>html</category><category>jquery</category></item><item><title>Hotkeys for Hacker NewsI was bored so I made gmail-style hotkeys...</title><description>&lt;img src="http://36.media.tumblr.com/c8cf243a1c93fb2f859dc7f0a3903861/tumblr_minbbr6BBh1rbdazno1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;h2&gt;Hotkeys for Hacker News&lt;/h2&gt;&lt;div&gt;I was bored so I made gmail-style &lt;a href="https://chrome.google.com/extensions/detail/nkeegljkkibjiiaehmjfncdbkbbgdojb"&gt;hotkeys for Hacker News&lt;/a&gt;. You can install the chrome extension &lt;a href="https://chrome.google.com/extensions/detail/nkeegljkkibjiiaehmjfncdbkbbgdojb"&gt;here&lt;/a&gt;.&lt;/div&gt;

&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;I thought I’d add support for Vim and Emacs style hotkeys, but then I didn’t.&lt;/div&gt;

&lt;div&gt;Hope you like the chrome extension. If you are concerned about privacy, it *only* runs on &lt;a href="http://news.ycombinator.com/*" target="_blank"&gt;http://news.ycombinator.com/*&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;Have a great day,&lt;/div&gt;
&lt;div&gt;David&lt;/div&gt;
&lt;div&gt;(&lt;a href="http://news.ycombinator.com/user?id=DTrejo"&gt;DTrejo&lt;/a&gt; on HN)&lt;/div&gt;

&lt;div&gt;PS Here’s the source if you fancy seeing it: &lt;a href="http://github.com/DTrejo/HN-Hotkeys"&gt;http://github.com/DTrejo/HN-Hotkeys&lt;/a&gt; Most of the action goes on in hnkeys.js&lt;/div&gt;</description><link>http://blog.dtrejo.com/post/43757503607</link><guid>http://blog.dtrejo.com/post/43757503607</guid><pubDate>Sat, 14 Aug 2010 16:43:00 -0700</pubDate><category>JustMigrate</category></item><item><title>How to Stay Up-to-date with Node.js</title><description>&lt;div class="p_embed p_image_embed"&gt;
&lt;img alt="Node" src="http://getfile7.posterous.com/getfile/files.posterous.com/temp-2010-08-02/fkDBFxEDghoeIeAaxnIEnrtCnhdszFabpmAhxzlGGngGznFAEHdgxcylzbsC/node.js_logo.png.scaled500.png"/&gt;&lt;/div&gt;


&lt;p&gt;Node.js is changing every day and new releases are very frequent. Here is how I stay up to date with the latest release version of Node.js. &lt;/p&gt;

&lt;p&gt;This guide assumes you already have node.js installed and you are familiar with the command line.&lt;/p&gt;

&lt;p&gt;1. Install &lt;a href="http://github.com/isaacs/npm"&gt;npm&lt;/a&gt; (&lt;a href="http://github.com/isaacs/npm"&gt;full npm install guide&lt;/a&gt;)&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;curl &lt;a href="http://npmjs.org/install.sh"&gt;http://npmjs.org/install.sh&lt;/a&gt; | sh&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Or update it if you&amp;#8217;ve already installed it&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;npm install npm&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;2. Install &lt;a href="http://github.com/isaacs/nave"&gt;nave&lt;/a&gt; with npm&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;npm install nave&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;3. Use nave to run the version of your choice in a subshell&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;nave use 0.1.102
# or even better:
nave usemain stable&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;4. All done!  Repeat from step 3 whenever a new version of node is released. By the way, npm is great, you can even use it to update itself :)&lt;/p&gt;



&lt;p&gt;What tools do you use to stay up to date? If there is a better way, please let me know!&lt;/p&gt;</description><link>http://blog.dtrejo.com/post/43757504611</link><guid>http://blog.dtrejo.com/post/43757504611</guid><pubDate>Mon, 02 Aug 2010 10:45:00 -0700</pubDate><category>JustMigrate</category><category>nave</category><category>nodejs</category><category>npm</category></item></channel></rss>
