<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Slawcup</title>
 <link href="http://slawcup.com/atom.xml" rel="self"/>
 <link href="http://slawcup.com/"/>
 <updated>2009-02-26T00:09:55-05:00</updated>
 <id>http://slawcup.com/</id>
 <author>
   <name>David Billingham</name>
   <email>billingham@gmail.com</email>
 </author>

 
 <entry>
   <title>Interesting projects, languages &amp; ideas</title>
   <link href="http://slawcup.com//interests"/>
   <updated>2009-02-19T00:00:00-05:00</updated>
   <id>http://slawcup.com/interesting-projects-languages-ideas</id>
   <content type="html">&lt;p&gt;I will try to keep this list up to date.  It should really be a glimpse of what I am interested in right now.&lt;/p&gt;
&lt;h3&gt;Projects&lt;/h3&gt;
&lt;ol&gt;
	&lt;li&gt;&lt;strong&gt;&lt;a href="http://couchdb.apache.org/"&gt;CouchDB&lt;/a&gt;&lt;/strong&gt; » Document database&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://processing.org/"&gt;Processing&lt;/a&gt; » Super cool visualizations&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://cappuccino.org/"&gt;Cappuccino&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.capify.org/"&gt;Capistrano&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://github.com/mojombo/jekyll/tree/master"&gt;Jekyll&lt;/a&gt; » The simple publisher script that this blog uses&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.nltk.org/"&gt;&lt;span class="caps"&gt;NLTK&lt;/span&gt;&lt;/a&gt; » Natural Language Toolkit (python linguistic modules)&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Languages&lt;/h3&gt;
&lt;ol&gt;
	&lt;li&gt;Objective-C and Cocoa
	&lt;ul&gt;
		&lt;li&gt;&lt;a href="http://developer.apple.com/iphone/"&gt;iPhone Development&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://developer.apple.com/cocoa/"&gt;Cocoa&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;&lt;/li&gt;
	&lt;li&gt;Ruby
	&lt;ul&gt;
		&lt;li&gt;&lt;a href="http://rubyonrails.com"&gt;Rails&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://merbivore.com/"&gt;Merb&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.macruby.org/"&gt;MacRuby&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://shoooes.net/"&gt;&lt;span class="caps"&gt;SHOES&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Ideas&lt;/h3&gt;
&lt;ol&gt;
	&lt;li&gt;&lt;strong&gt;&lt;a href="http://labs.google.com/papers/mapreduce.html"&gt;map/reduce&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://aws.amazon.com/ec2"&gt;EC2&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;</content>
 </entry>
 
 <entry>
   <title>CouchDB, I am beginning to relax</title>
   <link href="http://slawcup.com//2009/02/09/couchdb-relax.html"/>
   <updated>2009-02-09T00:00:00-05:00</updated>
   <id>http://slawcup.com/2009/02/09/couchdb-relax</id>
   <content type="html">&lt;p&gt;I had briefly played with a &lt;a href="http://couchdb.apache.org/"&gt;CouchDB&lt;/a&gt; install a few years ago, but never gave it a serious digging.  My next personal project to really learn the ins and outs of CouchDB and figure out how to make it work for me.  I had never tried to install couchDB before, so I figured I would take a run at it on my Mac Book.  The following is what I learned and how I made it work:&lt;/p&gt;
&lt;h3&gt;The Easy Way&lt;/h3&gt;
&lt;p&gt;You will need to install &lt;a href="http://www.macports.org"&gt;MacPorts&lt;/a&gt; for this.  The &lt;a href="http://www.macports.org/install.php"&gt;installation&lt;/a&gt; should be fairly straight forward the provided &lt;strong&gt;.dmg&lt;/strong&gt; is the simplest way to get it up and running quickly.  Once MacPorts is installed, the rest is cake&amp;#8212; just 2 lines to and you have a running couchdb instance.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;sudo port install couchdb +server
sudo -i -u couchdb couchdb
&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Go ahead and check the running instance at &lt;a href="http://127.0.0.1:5984/_utils/index.html"&gt;http://127.0.0.1:5984/_utils/index.html&lt;/a&gt;&lt;br /&gt;
You should be able to see an access log being dumped to the terminal.  This is actually how I prefer to run it while coding so that I can see the live access log.&lt;/p&gt;
&lt;p&gt;You could also launch it as a service by running the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;sudo launchctl load -w &lt;span class="se"&gt;\&lt;/span&gt;
         /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist
&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As of today,Feb 8th 2009, this method installs version 0.81 of couchdb, but I wanted a more up to date dev version so I decided to uninstall the &lt;a href="http://couchdb.darwinports.com/"&gt;ports version&lt;/a&gt; and build it from source.  Firstly, I uninstalled the ports version in order to avoid problems.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;sudo port uninstall couchdb
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;The Not So Easy Way&lt;/h3&gt;
&lt;h4&gt;Get Couch DB&lt;/h4&gt;
&lt;p&gt;The first step is to download a fresh copy of couchdb from svn&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;svn co http://svn.apache.org/repos/asf/couchdb/trunk couchdb
&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once you get the source (&lt;code&gt;cd couchdb&lt;/code&gt;), I would recommend popping open the &lt;span class="caps"&gt;README&lt;/span&gt;, it is hugely helpful and it is a great starting point for the installation.&lt;/p&gt;
&lt;h4&gt;Install Dependancies&lt;/h4&gt;
&lt;p&gt;You need &lt;a href="http://www.macports.org"&gt;MacPorts&lt;/a&gt; again.&lt;/p&gt;
&lt;p&gt;I have seen it recommended a few places that &lt;strong&gt;erlang&lt;/strong&gt; is left at the end of this list since it is usually the one that has an issue on mac osx. I have followed that advice but didn&amp;#8217;t receive any errors when installing erlang.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;port install automake autoconf libtool &lt;span class="se"&gt;\&lt;/span&gt;
         help2man icu spidermonkey curl erlang
&lt;/pre&gt;&lt;/div&gt;&lt;h4&gt;Big Bang&lt;/h4&gt;
&lt;p&gt;Ok, here is where it all happens. In the couchdb directory run the following command, it will bootstrap, configure, make and, you guessed it, install couchdb.&lt;br /&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;./bootstrap &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ./configure &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; make &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; sudo make install
&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;The commands could each be done separately, and if you are an advanced user, that may be advisable.  If you want to change come config values try &lt;code&gt;./configure --help&lt;/code&gt; to get a list of options.&lt;/p&gt;
&lt;h4&gt;Setting up User&lt;/h4&gt;
&lt;p&gt;http://www.macosxhints.com/article.php?story=20071025175202466&lt;/p&gt;
&lt;p&gt;Now, this is where it got a little hairy for me. &lt;code&gt;dscl&lt;/code&gt; is new to me and so I had to do some research to figure out how to get the couch user setup correctly.&lt;/p&gt;
&lt;p&gt;If I just ran &lt;code&gt;sudo -i -u couchdb couchdb&lt;/code&gt; right now, I received an error about the shell.  That happens because the shell and home attributes of the couchdb user are not setup correctly.&lt;/p&gt;
&lt;p&gt;If you run the command &lt;code&gt;dscl . -read /Users/couchdb&lt;/code&gt; and you get a &lt;strong&gt;eDSRecordNotFound&lt;/strong&gt; error then you first need to create a user either by using the &lt;em&gt;System Preferences&lt;/em&gt; &amp;gt; &lt;em&gt;Accounts&lt;/em&gt; route or using &lt;strong&gt;dscl&lt;/strong&gt; (&lt;a href="http://osxdaily.com/2007/10/29/how-to-add-a-user-from-the-os-x-command-line-works-with-leopard/"&gt;more details on creating a user using dscl&lt;/a&gt;) which I won&amp;#8217;t go into more detail about here.&lt;/p&gt;
&lt;p&gt;When you look at the details of the couchdb user they should look something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;AppleMetaNodeLocation: /Local/Default
GeneratedUID: C90A5B9A-52DE-4DCA-A819-849B80398B52
NFSHomeDirectory: /usr/local/var/lib/couchdb
Password: *
PrimaryGroupID: 500
RealName: couchdb
RecordName: couchdb
RecordType: dsRecTypeStandard:Users
UniqueID: 500
UserShell: /bin/bash
&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The two very important parts are that there is a &lt;em&gt;UserShell&lt;/em&gt; set to a shell and that it is &lt;strong&gt;not&lt;/strong&gt; set to &lt;em&gt;/dev/null&lt;/em&gt; and that the &lt;em&gt;NFSHomeDirectory&lt;/em&gt; is set to &lt;em&gt;/usr/local/var/lib/couchdb&lt;/em&gt;.  I found the easiest way to change these was to actually log in to the dscl console using the following commands:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;sudo dscl localhost
&lt;span class="nb"&gt;cd&lt;/span&gt; /Local/Default/Users
&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once you are in the dscl console and in the Users dir, you can run &lt;code&gt;cat couchdb&lt;/code&gt; which will print the current settings for user &lt;strong&gt;couchdb&lt;/strong&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;change couchdb dsAttrTypeNative:home &lt;span class="se"&gt;\&lt;/span&gt;
         /dev/null /usr/local/var/lib/couchdb
change couchdb dsAttrTypeNative:shell &lt;span class="se"&gt;\&lt;/span&gt;
         /dev/null /bin/bash
&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now that the user is set up, you just need to change the ownership of the &lt;strong&gt;couchdb&lt;/strong&gt; files.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;sudo chown -R couchdb:couchdb /usr/local/var/lib/couchdb
sudo chown -R couchdb:couchdb /usr/local/var/log/couchdb
&lt;/pre&gt;&lt;/div&gt;&lt;h4&gt;Running CouchDB&lt;/h4&gt;
&lt;p&gt;Now that CouchDB is installed and the &lt;em&gt;couchdb&lt;/em&gt; user is created, it is time to run your brand new shiny CouchDB Database.&lt;/p&gt;
&lt;p&gt;To run it from the terminal with the access logs being printed just run the &lt;strong&gt;couchdb&lt;/strong&gt; command.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;sudo -i -u couchdb couchdb
&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you would like to run it as a service, use the &lt;strong&gt;launchctl&lt;/strong&gt; command.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;sudo launchctl load &lt;span class="se"&gt;\&lt;/span&gt;
         /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist
&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Credit&lt;/h3&gt;
&lt;p&gt;Here are some of the sites/pages I used as reference for this.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://svn.apache.org/repos/asf/couchdb/trunk/README"&gt;&lt;span class="caps"&gt;README&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://blog.deadinkvinyl.com/2008/07/12/couchdb-on-macosx-leopard/"&gt;deadinkvinyl.com&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://wiki.apache.org/couchdb/Installing_on_OSX"&gt;CouchDB Wiki&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://couchdb.darwinports.com/"&gt;Darwin Ports&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.patmaddox.com/blog/2007/9/3/building-and-installing-couchdb-on-os-x"&gt;patmaddox.com&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.thoughtstoblog.com/articles/2007/9/18/building-couchdb-on-os-x"&gt;thoughtstoblog.com&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Go&lt;/h3&gt;
&lt;p&gt;Ok, now that CouchDB is installed, go and do cool stuff. Here are some links.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://wiki.apache.org/couchdb/"&gt;CouchDB Wiki&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.infoq.com/presentations/katz-couchdb-and-me"&gt;CouchDB and Me&lt;/a&gt; &amp;lt; talk by Damien Katz&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://vimeo.com/1992869"&gt;CouchDB Tech Talk by Chris Anderson&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://jan.prima.de/~jan/plok/archives/108-Programming-CouchDB-with-Javascript.html"&gt;Programming CouchDB with Javascript&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.cmlenz.net/archives/2007/10/couchdb-joins"&gt;CouchDB &amp;quot;Joins&amp;quot;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://github.com/rnewson/couchdb-lucene/tree/master"&gt;couchdb-lucene&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content>
 </entry>
 
 <entry>
   <title>Git gets me good</title>
   <link href="http://slawcup.com//2008/12/29/git-gets-me-good.html"/>
   <updated>2008-12-29T00:00:00-05:00</updated>
   <id>http://slawcup.com/2008/12/29/git-gets-me-good</id>
   <content type="html">&lt;p&gt;Ok I am now fully on board with the Git crew.  I now understand how Git works into my natural work flow.  I finally rounded the corner of thinking of it as a one for one replacement of another &lt;span class="caps"&gt;SCM&lt;/span&gt;. I believe it may be clearer to start using Git without previous experience with Subversion or &lt;span class="caps"&gt;CVS&lt;/span&gt;. So I would recommend going in to learning Git without thinking to much about other Version Control Software.&lt;/p&gt;
&lt;p&gt;A few simple things helped me immensely in learning to use Git everyday.&lt;/p&gt;
&lt;h5&gt;Git branch name in your command prompt&lt;/h5&gt;
&lt;p&gt;Since multiple branches are managed in the same directory on your local machine, a common question you ask is what branch am I working on.  similar to what directory am I in.  This bit of information is very valuable, so why not put it right in your command prompt.  I can&amp;#8217;t imagine working with Git and not having this.  It puts all the important information in front of you so you know exactly what you are working with.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="k"&gt;function &lt;/span&gt;parse_git_branch &lt;span class="o"&gt;{&lt;/span&gt;
  git branch --no-color 2&amp;gt; /dev/null &lt;span class="se"&gt;\&lt;/span&gt;
  | sed -e &lt;span class="s1"&gt;&amp;#39;/^[^*]/d&amp;#39;&lt;/span&gt; -e &lt;span class="s1"&gt;&amp;#39;s/* \(.*\)/(\1)/&amp;#39;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="nv"&gt;PS1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;\h \w\$(parse_git_branch) \n[\u] &amp;gt; &amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;!--script src="http://gist.github.com/40308.js"&gt;&lt;/script --&gt;&lt;/p&gt;
&lt;h5&gt;Auto-complete for Git&lt;/h5&gt;
&lt;p&gt;Working without autocomplete is like working blind or maybe just without glasses.  This script makes the &lt;span class="caps"&gt;TAB&lt;/span&gt; button work for you and for Git. Add &lt;a href="http://github.com/slawcup/dotfiles/tree/master/.git-completion.bash"&gt;.git-completion.bash&lt;/a&gt; to your .??rc file and you will be set to go.&lt;/p&gt;
&lt;h5&gt;gitk OR &lt;a href="http://github.com/pieter/gitx/tree/master"&gt;GitX&lt;/a&gt; (for Mac &lt;span class="caps"&gt;OSX&lt;/span&gt;)&lt;/h5&gt;
&lt;p&gt;At some point you will get to a branch/merge/rebase situation that you just can figure out.  Pop open one of these beauties and the visual keys are usually enough to help you understand &lt;span class="caps"&gt;WTF&lt;/span&gt; is going on and how to fix it.  I can&amp;#8217;t count the number of times that these beauties have saved me from going cross eyed.&lt;/p&gt;
&lt;p&gt;I am working on releasing my &lt;a href="http://github.com/slawcup/dotfiles/tree/master"&gt;dotfiles&lt;/a&gt; so checkout the project to see some more things I tried.&lt;/p&gt;</content>
 </entry>
 
 
</feed>