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

  <title><![CDATA[119 Labs LLC]]></title>
  <link href="http://119labs.com/atom.xml" rel="self"/>
  <link href="http://119labs.com/"/>
  <updated>2013-01-21T16:05:08-05:00</updated>
  <id>http://119labs.com/</id>
  <author>
    <name><![CDATA[Dan Thiffault]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Tmux quick connect]]></title>
    <link href="http://119labs.com/blog/2013/01/15/tmux-quick-connect/"/>
    <updated>2013-01-15T14:39:00-05:00</updated>
    <id>http://119labs.com/blog/2013/01/15/tmux-quick-connect</id>
    <content type="html"><![CDATA[<p>I saw <a href="https://github.com/croaky/dotfiles/commit/df3dd5129bfa941ac0bdf2885da92f822042ee5b">this</a> the other day which definitely seemed useful. I also find myself jumping in and out of tmux.  I updated the script so it will also create the named session whenever it isn&#8217;t already available. Hope you find it useful too.</p>

<p> <div><script src='https://gist.github.com/4541064.js?file=tad.sh'></script>
<noscript><pre><code>#!/bin/sh</p>

<h1>tmux attach directory</h1>

<h1>inspired by https://github.com/croaky/dotfiles/commit/df3dd5129bfa941ac0bdf2885da92f822042ee5b</h1>

<p>SESSION=$(basename $PWD)</p>

<h1>credit from http://stackoverflow.com/questions/3432536/create-session-if-none-exists</h1>

<p>function hassession {
  tmux has-session -t $SESSION 2&gt;/dev/null
}</p>

<p>if hassession
then
  tmux attach -t $SESSION
else
  tmux new-session -s $SESSION
fi</code></pre></noscript></div></p>

<p>Just put the file on your path and run <code>./tad.sh</code> to jump into a tmux session named by your current directory&#8217;s name.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[VPS Latency from Mumbai]]></title>
    <link href="http://119labs.com/blog/2012/10/11/vps-latency-from-mumbai/"/>
    <updated>2012-10-11T00:00:00-04:00</updated>
    <id>http://119labs.com/blog/2012/10/11/vps-latency-from-mumbai</id>
    <content type="html"><![CDATA[I just did some very rough &amp; quick testing of latency using VPS providers from Bombay.  Latency I checked with ping average 15 responses.  Throughput I downloaded a 100mb file and took average download speed rounded down in 25 mb increments (because it felt very volatile). Here are the quick results:

&nbsp;
<table>
<tbody>
<tr>
<th>Provider</th>
<th>Region</th>
<th>Latency</th>
<th>Throughput</th>
</tr>
<tr>
<td>Linode</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>Tokyo</td>
<td>147ms</td>
<td>200 kB/s</td>
</tr>
<tr>
<td></td>
<td>London</td>
<td>155ms</td>
<td>200 kB/s</td>
</tr>
<tr>
<td>EC2</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>Singapore</td>
<td>76ms</td>
<td>300 kB/s</td>
</tr>
<tr>
<td></td>
<td>Tokyo</td>
<td>141ms</td>
<td>200 kB/s</td>
</tr>
<tr>
<td></td>
<td>EU-Ireland</td>
<td>174ms</td>
<td>175 kB/s</td>
</tr>
</tbody>
</table>
&nbsp;

No big surprises, but I couldn&#8217;t find another source anywhere else.  Obviously not a rigorous test methodology, but at least it gives some general feedback.
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Rails, Vagrant, & Chef]]></title>
    <link href="http://119labs.com/blog/2012/03/21/rails-vagrant-chef/"/>
    <updated>2012-03-21T00:00:00-04:00</updated>
    <id>http://119labs.com/blog/2012/03/21/rails-vagrant-chef</id>
    <content type="html"><![CDATA[<p> More and more sites are using a variety of architectures, and corresponding backend services, that are putting a lot of pressure on local development setup. Fortunately there&#8217;s a lot of work going on in the devops space to help this out.  I basically wanted to be able to created a local dev environment, develop, and then push up live and know that my environment would be the same without futzing about.

I started going down the path of using <a title="Vangrant" href="http://vagrantup.com/">Vagrant</a> for a dev environment and configuring with <a title="Chef from Opscode" href="http://www.opscode.com/">Chef</a>.  I was really hoping it would all just work, unfortunately I wasn&#8217;t so lucky.  Before we get to that though, lets develop a simple test app that we can test out deploying:
</p> 
&nbsp;

<script type="text/javascript" src="https://gist.github.com/2134403.js?file=rails_app.sh"></script>
<p> 
I&#8217;m not going to add any functionality to this app right now, but it will show as the basis for our deployments.
</p> 
&nbsp;
<h2>Chef</h2>
<p> 
Chef is where I ran into the most trouble. Opscode has extensive documentation, but it is definitely geared towards their hosted environment. While their hosted environment seems great, its more well suited to a team trying to automate their infrastructure not a lone developer trying to get things going off the ground. I decided to go with Chef Solo. Fortunately I also found the great gem <a title="Librarian for Chef" href="https://github.com/applicationsonline/librarian">librarian</a>. Librarian is bundler for your chef recipes and it works as advertised. To get librarian setup in your project run the following:
</p>
<script src="https://gist.github.com/2134403.js?file=librarian_chef_install.sh"></script>
<h2>Vagrant</h2>
<p>
To get started, Ryan Bates has an <a title="Vagrant" href="http://railscasts.com/episodes/292-virtual-machines-with-vagrant">excellent screencast on Vagrant</a>. I&#8217;m going to present a short version, but if you&#8217;re interested in a little more detail I highly suggest you check it out.  Vagrant uses virtual box for virtualization.  In order to get going first go visit <a title="Virtual Box" href="https://www.virtualbox.org/">virtual box</a>and download the latest version. As of this writing I have version 4.1.10 installed. Next from a cmd line:
</p> 
<script src="https://gist.github.com/2134403.js?file=vagrant_install.sh"></script>
<p> 
This takes care of all the background work required to have vagrant up and running.
</p> 
<h2>Pulling it together</h2>
<p>So we have a rails project with chef dependancies managed by librarian & vagrant. Now we want to be able to actually deploy a minimal rails stack to a virtual box. First thing linux (our deploy target) does not come with a javascript environment so make sure uncomment &#8220;gem &#8216;therubyracer&#8217;&#8221; in your Gemfile. Also, since we&#8217;re using unicorn uncomment &#8220;gem &#8216;unicorn&#8217;&#8221; while you&#8217;re there.</p>
<p>Now lets setup our chef dependancies. These are managed through the Cheffile.  Edit your Cheffile so it looks like this:
</p>
<script src="https://gist.github.com/2134403.js?file=Cheffile"></script>
<p>Now just run <b>librarian-chef install</b> to download those deps to your cookbook directory</p>

<p>
You might notice the last dependency, rails-lastmile.  I created this cookbook to pull together the other cookbooks: unicorn, ngnix, etc.  Over time I plan on added a lot more to this.  It will also be the way I keep a consistent deployment structure between Vagrant, EC2, and others. More on this in a future post.
</p>

<p>
Next lets configure Vagrant to use our dependencies. Open up Vagrantfile in your favorite editor and put in the following:
</p>
<script src="https://gist.github.com/2134403.js?file=Vagrantfile"></script>
<p>
That should be all you need to do to get ready to deploy. Just run <b>vagrant up</b> and watch the magic happen. The rails application is being hosted in the virtual environment using your code base.  Click <a href="http://33.33.33.10">here</a> to see it.  Since the code base is actually on your system, as you edit files you&#8217;ll be able to see the changes live in the hosted environment.  The only exception being dependancies.  If you need to rely on a new dependency run <b>vagrant reload</b> to have the vagrant restart and pull in new bundled dependancies. Next up I&#8217;ll be looking at both adding some more infrastructure (like MongoDb) and deploying to EC2.
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[TouchStream Multitouch Utilities Update]]></title>
    <link href="http://119labs.com/blog/2012/03/05/touchstream-multitouch-utilities-update/"/>
    <updated>2012-03-05T00:00:00-05:00</updated>
    <id>http://119labs.com/blog/2012/03/05/touchstream-multitouch-utilities-update</id>
    <content type="html"><![CDATA[I&#8217;ve gotten a lot of great feedback from everyone on my previous post. Unfortunately the utilities aren&#8217;t currently working properly. First on the path to tracking down the issue was to fix up the source repository. The source repository on source forge has been abandoned for years. I&#8217;ve applied my patches to the code base and uploaded them on <a title="Jusb on Github" href="https://github.com/DanThiffault/jusb">github</a> (forks welcome).

If you checkout the source from github you should be able to type make and have a fresh copy of the class files &amp; libs. After some digging around I&#8217;ve been able to reproduce the issues by running the following command:

<code>LD_LIBRARY_PATH=. java $THREADS -classpath jusb.jar usb.view.Foo</code>

This (attempts) to run the jusb test app, usb viewer.  Currently it fails for me with a control read error. I&#8217;m pretty sure that the issue is that between versions of OSX the OS APIs have changed.  I&#8217;m currently digging in to <a href="https://github.com/DanThiffault/jusb/blob/master/native/macosx.c" title="Native OSX Jusb code">that particular code</a> and I welcome any feedback.  
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Fingerworks Multitouch utility & Lion]]></title>
    <link href="http://119labs.com/blog/2011/07/24/fingerworks-multitouch-utility-lion/"/>
    <updated>2011-07-24T00:00:00-04:00</updated>
    <id>http://119labs.com/blog/2011/07/24/fingerworks-multitouch-utility-lion</id>
    <content type="html"><![CDATA[Along with OSX 10.7 Lion Apple dropped support for PowerPC applications. My one last holdout was the multitouch utilities I use to change settings on my fingerworks touch stream lp. The mtu (multitouch utility) is actually a java app with a native wrapper. So first step was to run the java app directly. After a little poking in the config files I came up with the following script:

&nbsp;
<script src="https://gist.github.com/1096642.js?file=mtu_run.sh"></script>

&nbsp;

Save the script to your /Applications/Fingerworks directory and remember to chmod it. Now I could run the app, but it still couldn&#8217;t see my touch stream.  The issue was the <a title="jUSB" href="http://jusb.sourceforge.net/">jusb</a> that came with the finger works installation. Jusb is an open source library that hasn&#8217;t been updated in years.  <a title="Difficulty installing utilities on MacIntel OSX" href="http://fingerfans.dreamhosters.com/viewtopic.php?t=337">This thread</a> put me in the right direction. In order to upgrade jusb first you need to check out the source. Run the following from terminal:

&nbsp;

<script src="https://gist.github.com/1096642.js?file=build_source.sh"></script>

After that you should be able to run the utilities again

&nbsp;

&nbsp;

&nbsp;

&nbsp;
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Page title helper in Rails 3]]></title>
    <link href="http://119labs.com/blog/2011/05/06/page-title-helper-in-rails-3/"/>
    <updated>2011-05-06T00:00:00-04:00</updated>
    <id>http://119labs.com/blog/2011/05/06/page-title-helper-in-rails-3</id>
    <content type="html"><![CDATA[I was looking to DRY up my page titles but was having some trouble with Rails 3 view contexts. Here&#8217;s what I finally ended on:

&nbsp;
<script src="https://gist.github.com/1263449.js?file=application_helper.rb"></script>

Just place this method in your application_helper.rb. This automatically looks for an entry in your translation store based on the path of the view template which you call the helper from. So if you you have a template under user_sessions/new.html.erb like this:

&nbsp;

<script src="https://gist.github.com/958547.js?file=new.html.erb"></script>

And an entry in en.yml like this:

&nbsp;
<script src="https://gist.github.com/958549.js?file=en.yml"></script>

It will automatically generate an H1 containing your translated text.
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Rails custom formats with bookmarklets]]></title>
    <link href="http://119labs.com/blog/2011/02/28/rails-custom-formats-with-bookmarklets/"/>
    <updated>2011-02-28T00:00:00-05:00</updated>
    <id>http://119labs.com/blog/2011/02/28/rails-custom-formats-with-bookmarklets</id>
    <content type="html"><![CDATA[I&#8217;m working on an app that makes heavy use of bookmarklets. There are some really great resources already for creating your one bookmarklets. For more information look <a href="http://www.smashingmagazine.com/2010/05/23/make-your-own-bookmarklets-with-jquery/">here</a>, <a href="http://benalman.com/projects/run-jquery-code-bookmarklet/">here</a>, or just search the web.

One of the issues I&#8217;ve had to deal with is that many of my bookmarklet screens are using standard parts of my site just in a slightly different format.  Rather than duplicating controller logic or adding if statements everywhere I decided to add bookmarklets as a declared format.

The First step was to setup my custom format.  For me it was really just an alias for js (html might work better for you in your app). So I started by creating an initializer to setup the type alias:

&nbsp;
<script src="https://gist.github.com/847004.js?file=respond_to_bookmarklet.rb"></script>

Make sure to restart rails server in order to see this change. Now if we visit a regular page and add the format like this http://localhost:3000/user_sessions/new.bookmarklet You should see a template missing error.  Add the file user_sessions/new.bookmarklet.erb and you should see your custom response. Now at this point you can create different template files accommodating for your different view size, layout, etc. Still in order to drive this change you need to hard code the format in to the views which are posting/linking to your custom views. In order to DRY that up I added a before filter to automatically infer the format based upon referrer.

&nbsp;
<script src="https://gist.github.com/847143.js?file=application_controller.rb"></script>
&nbsp;

Here I use the bookmarklet_url, which is my base path as the test whether I should be formatting for embedding in the bookmarklet or not.

From here any action that I call from my bookmarklet I just add a.bookmarklet.erb to my views folder. Along with this I make heavy use of partials and have very little duplication between my views.
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Resolving cucumber gem incompatibilities]]></title>
    <link href="http://119labs.com/blog/2011/02/16/resolving-cucumber-gem-incompatibilities/"/>
    <updated>2011-02-16T00:00:00-05:00</updated>
    <id>http://119labs.com/blog/2011/02/16/resolving-cucumber-gem-incompatibilities</id>
    <content type="html"><![CDATA[I was trying to run cucumber with profiles under rails when I got the following error:

&#8220;You have already activated builder 3.0.0, but your Gemfile requires builder 2.1.2. Consider using bundle exec. &#8221;

Looking into it this seems to be a common problem not just limited to builder.  Option #1 according to <a href="http://stackoverflow.com/questions/4484378/rails-3-cucumber-problem-already-activated-builder-3-0-0-but-your-gemfile-r">stack overflow</a> is:

bundle exec cucumber

That works fine, but I was looking for something more concise.  Fortunately bundler comes with an option to help out. If you add the binstubs option to your install command it will create a directory bin in your rails root that contains all executables from gems that are installed. So after running:

bundle install &#8212;-path .bundle/ &#8212;-binstubs

I can run

bin/cucumber &#8212;-profile wip

from my rails root. Not bad, but I force of habit I kept just typing cucumber (which on my system is under /usr/bin) and I was back to square one. So the final step I edited the /usr/bin/cucumber file so that it detected the &lt;rails_root&gt;/bin/cucumber and ran it if it existed. Here&#8217;s the new /usr/bin/cucumber:

&nbsp;

And that&#8217;s it. Now cucumber runs using the bundle environment if it exists, otherwise it falls back to default behavior.
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Better image dimensions with paperclip]]></title>
    <link href="http://119labs.com/blog/2011/02/15/better-image-dimensions-with-paperclip/"/>
    <updated>2011-02-15T00:00:00-05:00</updated>
    <id>http://119labs.com/blog/2011/02/15/better-image-dimensions-with-paperclip</id>
    <content type="html"><![CDATA[A while ago I had the need to add image dimensions (height &amp; width) to my paperclip attachments. After a lot of research I came across this:

<script type="text/javascript" src="https://gist.github.com/343678.js">// &lt;![CDATA[

// ]]&gt;</script>
https://gist.github.com/343678

It did the job OK, but had a few problems:
<ul>
	<li>I hated adding the my_style attribute</li>
	<li>Dimension calculation was flaky and often produced ghost failures</li>
</ul>
So instead I rewrote the caching part to listen for paperclip processing events and use introspection to determine attachments and styles. I also took a suggestion (thanks Win) and moved it into an initializer.  Here&#8217;s the updated file:

<script type="text/javascript" src="https://gist.github.com/827827.js">// &lt;![CDATA[

// ]]&gt;</script>
https://gist.github.com/827827

In order to get this working you need to add a couple lines to the model that currently has the Paperclip::Attachment

<script type="text/javascript" src="https://gist.github.com/827533.js">// &lt;![CDATA[

// ]]&gt;</script>
https://gist.github.com/827533

Seems to work much more reliably now. Also, notice the lack of my style attributes. One more note, if you&#8217;re adding dimensions to your model where they weren&#8217;t before, make sure to add a &lt;attachment_name&gt;_dimensions column to your model (should be type :text on sql)
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Hello world with Compojure & Leiningen]]></title>
    <link href="http://119labs.com/blog/2010/07/12/hello-world-with-compojure-leiningen/"/>
    <updated>2010-07-12T00:00:00-04:00</updated>
    <id>http://119labs.com/blog/2010/07/12/hello-world-with-compojure-leiningen</id>
    <content type="html"><![CDATA[Compojure is a web framework for clojure. It is built on top of ring and provides a good starting point for web based clojure apps. It is not a direct replacement for a stateful web app framework like rails or spring webflow. Instead it allows you to quickly connect clojure code to the web and is ideal for building backend systems which can communicate over http.

It took me a bit of working around since compojure 0.4.0 came out to get it to work with a simple hello world project. Thanks to the <a title="Building a clojure web application" href="http://data-sorcery.org/2009/11/29/incanter-webapp/ ">incanter</a> folks for getting me most of the way there.  First off if you&#8217;re working (or just playing) with clojure then <a href="http://github.com/technomancy/leiningen">leiningen</a> is really a must.  It using a combination of maven &amp; ant to manage dependancies and build your projects. First you can get started by installing lein using the instructions on their website.

<a href="http://github.com/technomancy/leiningen">Installing lein</a>

Next from the command line make a new project:

<code>lein new helloworld</code>

Cd into your new project directory and take a look around. The main files we&#8217;ll be dealing with are project.clj and the src directory.  Open up the project.clj file. It should look something like this:
<pre lang="Lisp">(defproject helloworld "1.0.0-SNAPSHOT"
  :description "FIXME: write"
  :dependencies [
      [org.clojure/clojure "1.1.0"]
      [org.clojure/clojure-contrib "1.1.0"]
])</pre>
If you&#8217;ve worked with Maven before this should look pretty familiar . First thing we need to do is add a couple of dependancies. Edit the file so it looks like the following:
<pre lang="Lisp">(defproject helloworld "1.0.0-SNAPSHOT"
:description "FIXME: write"
:dependencies [[org.clojure/clojure "1.1.0"]
[org.clojure/clojure-contrib "1.1.0"]
[compojure "0.4.0"]
[ring/ring "0.2.3"]])</pre>
<div>First we&#8217;ve added a dependency on compojure version 0.4.0 second we&#8217;ve included a dependency on all the jars in the ring project. By default compojure includes a dependency on ring for the essentials, but it leaves out the adapters (including the jetty adapter) which we&#8217;ll need to complete a live demo.</div>
<div>Next we need to create a clojure file that describes our web application. Under the src directory create a file called simple_web_app.clj. Put the following code in that file:</div>
<pre lang="Lisp">(ns simple_web_app
(:gen-class)
(:use compojure.core, ring.adapter.jetty)
(:require [compojure.route :as route]))

(defroutes webservice
(GET "/" [] "&lt;h1&gt;Hello World&lt;/h1&gt;")
(route/not-found "&lt;h1&gt;Page not found&lt;/h1&gt;"))
(defn -main [&amp; args]
(run-jetty webservice {:port 8080})
)</pre>
<div>Lets take one block at a time:</div>
<pre lang="Lisp">(ns simple_web_app
(:gen-class)
(:use compojure.core, ring.adapter.jetty)
(:require [compojure.route :as route]))</pre>
<div>This block sets the namespace to be simple_web_app, includes some required classes, and tells the compiler to create a java class file for this set of functions. Next</div>
<pre lang="Lisp">(defroutes webservice
(GET "/" [] "&lt;h1&gt;Hello World&lt;/h1&gt;")
(route/not-found "&lt;h1&gt;Page not found&lt;/h1&gt;"))</pre>
<div>This block defines a set of routes called webservice. We have two routes here. The homepage should return &#8220;Hello World&#8221; while all other pages should return &#8220;Page not found&#8221;. Last section</div>
<pre lang="Lisp">(defn -main [&amp; args]
(run-jetty webservice {:port 8080})
)</pre>
<div>This creates a main method for the generated class. As part of the main method it starts a jetty instance and passes in our defined routes as the application to run.</div>
<div>One last step. Now that we have a clojure file which contains our webapp, we need to tell lein to package the jar so this class is run. This is by done by adding the following to the project.clj:</div>
<pre lang="Lisp">:main simple_web_app</pre>
<div>Making the final project.clj look like this;</div>
<pre lang="Lisp">(defproject helloworld "1.0.0-SNAPSHOT"
:description "FIXME: write"
:dependencies [[org.clojure/clojure "1.1.0"]
[org.clojure/clojure-contrib "1.1.0"]
[compojure "0.4.0"]
[ring/ring "0.2.3"]]
:main simple_web_app)</pre>
<div>Now out at the command prompt run</div>
<div>lein deps</div>
<div>lein compile</div>
<div>lein  uberjar</div>
<div>java -jar helloworld-standalone.jar</div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Reasonable JRuby Env with IDEA]]></title>
    <link href="http://119labs.com/blog/2010/03/16/reasonable-jruby-env-with-idea/"/>
    <updated>2010-03-16T00:00:00-04:00</updated>
    <id>http://119labs.com/blog/2010/03/16/reasonable-jruby-env-with-idea</id>
    <content type="html"><![CDATA[I&#8217;m all for using TextMate (or hopefully soon Ultraedit for osx) for straight rails dev. I&#8217;m starting on a project that uses both clojure and rails so I wanted something that would play nicer for cross-language development. My favorite IDE from the Java side of things is by far IntelliJ IDEA. They have a relatively new version out with ruby support so I thought I&#8217;d give it a go setting up a jruby based rails project. It ended up being a little more complicated than just download and install so here you go:

First head over to the <a href="http://www.jetbrains.com/idea/index.html">jetbrain&#8217;s website</a> and download a demo copy of IDEA 9. Make sure to get the ultimate edition since ruby dev is disabled in their community edition. After that snag the most recent version of <a href="http://jruby.org/download">jruby</a> which as of this writing was 1.4.0. In order to follow along exactly you&#8217;ll want the straight bin version, but with a little modification to paths any version should do.

I keep all of my (non-maven) java libraries in /Library/JavaDev just swap that out for whatever directory you use.

Place the downloaded jruby-bin in /Library/JavaDev/
<p lang="bash">cd /Library/JavaDev/
curl http://jruby.kenai.com/downloads/1.4.0/jruby-bin-1.4.0.tar.gz &gt; jruby-bin-1.4.0.tar.gz
tar xzvf jruby-bin-1.4.0.tar.gz</p>
make sure your user has permissions to execute files in the bin directory. As a matter of good house keeping, I also like to setup a symlink
<p lang="bash">ln -s jruby-1.4.0 jruby</p>
next lets see where ruby is currently running from type
<p lang="bash">which gem</p>
It most likely is running under /usr/bin/gem. We want to change that temporarily so we can update the gem system. Lets change our path and update the gem system
<p lang="bash">export JRUBY_HOME=/Library/JavaDev/jruby
export PATH=$JRUBY_HOME/bin:$PATH
which gem</p>
the last command should now read /Library/JavaDev/jruby/bin/gem. If at any point you now close your terminal window you&#8217;ll need to run the last three commands again to make sure you&#8217;re working with the right gem base. Time to update the gems on your system:

gem install rails
gem update system
gem install activerecord-jdbcsqlite3-adapter
gem install jdbc-sqlite3
gem install activerecord-jdbcmysql-adapter

You will probably see a message &#8220;JRuby limited openssl loaded. gem install jruby-openssl for full support.&#8221; As long as this is just a development station don&#8217;t worry about it.

Now on to IDEA. Open the dmg and copy IDEA to your application folder. Run the app and create a new Ruby project. Once you get to the point that you need a project SDK click configure and add. The file IDEA is looking for is $JRUBY_HOME/bin/jruby. It will detect the lib folders from there.

Last step make sure you&#8217;re using the appropriate sql adapter in your database.yml file. For sqlite your dev should look something like:
<p lang="ruby">development:
adapter: jdbcsqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000</p>
Notice the adapter is jdbcsqlite3 rather than the standard sqlite3

That&#8217;s it. If you want to use a db other than sqllite, you&#8217;ll need to install the appropriate gem. IDEA will warn you &amp; let you fix it if you forget to do this so no big deal. For reference:
<ul>
	<li>OSX 10.6.2</li>
	<li>Jruby 1.4.0</li>
	<li>Rails 2.3.5</li>
	<li>Idea Ultimate 9.0.1</li>
</ul>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[pbpaste & pbcopy]]></title>
    <link href="http://119labs.com/blog/2010/02/26/pbpaste-pbcopy/"/>
    <updated>2010-02-26T00:00:00-05:00</updated>
    <id>http://119labs.com/blog/2010/02/26/pbpaste-pbcopy</id>
    <content type="html"><![CDATA[I love pbpaste and pbcopy. They are utilities on osx that allow you to write to and read from the copy buffer. They really have unlimited use in productivity scripts for transforming information. My most frequent use though is when I want to open a new tab in Terminal and stay in the same directory. In order to do this in Terminal I:
<ol>
	<li>type &#8220;pwd | pbcopy&#8221;</li>
	<li>Apple-T</li>
	<li>cd &lt;paste&gt;</li>
</ol>
This is even snazzier with a touchstream.

I used to run in to the problem all the time where some one would send me a unc style path and I needed to open it up on my mac. To get around this I wrote the following script:
<pre lang="bash">### unc2smb.sh ###
#!/bin/sh

pbpaste|sed -e "s,[\\][\\],smb://," -e  "s,[\\],/,g" -e "s,\(.*\)/\([^/]*\),\1/,"|pbcopy</pre>
Now just copy your unc style (&#92;server\folder) path and run unc2smb.sh. Now when you use a standard paste, you&#8217;ll instead paste the osx friendly smb style (smb://). One last step, I added unc2smb.sh to quciksilver. Now when I get a unc style path in an email I:
<ol>
	<li>Select &amp; copy the path</li>
	<li>run unc2smb.sh from the quicksilver command menu (or you could bind it to a key)</li>
	<li>Connect to server</li>
	<li>&lt;Paste&gt;</li>
</ol>
Still not a great process, but better than I had before. Anyways combining pbpaste, pbcopy, &amp; sed can really give you a huge amount of control
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Installing auth openid on trac with Dreamhost]]></title>
    <link href="http://119labs.com/blog/2010/01/22/installing-auth-openid-on-trac-with-dreamhost/"/>
    <updated>2010-01-22T00:00:00-05:00</updated>
    <id>http://119labs.com/blog/2010/01/22/installing-auth-openid-on-trac-with-dreamhost</id>
    <content type="html"><![CDATA[It turns out installing plugins, and particularly the openid plugin, on a shared dreamhost environment is arduous at best. �After a bit of work and research I managed to get it to work so here you go:
<h3>I. Perform a one-click install of trac from the web panel</h3>
if you don&#8217;t know how to do this you shouldn&#8217;t even try to proceed.
<h3>II. Setup a virtual python environment</h3>
Having a shared account with no sudo access you need to setup a local python environment to do all of the building. I found a reference <a title="Setting up a virtual python environment" href="http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python">here</a> on how to do that. Here are the steps
<blockquote>cd ~

wget�<a href="http://peak.telecommunity.com/dist/virtual-python.py">virtual-python.py</a>

python virtual-python.py

wget http://peak.telecommunity.com/dist/ez_setup.py

bin/python ez_setup.py

export PYTHONPATH=~/lib/python2.4/:~/lib/python2.4/site-packages/</blockquote>
<h3>III. Build the plugin</h3>
<blockquote>mkdir install_dir

cd install_dir

&nbsp;
<pre id="clone-url-https" style="font: normal normal normal 11px/normal 'Bitstream Vera Sans Mono', Monaco, 'Courier New', Courier, monospace; margin-top: 3px !important; margin-right: 0px !important; margin-bottom: 3px !important; margin-left: 0px !important; padding: 0px !important;"><span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; white-space: normal; font-size: 13px; line-height: 19px;">hg clone http://bitbucket.org/Dalius/authopenid-plugin/</span></pre>
cd authopenid-plugin

python setup.py install &#8211;prefix=$HOME

cp ~/lib/python2.4/site-packages/*.egg &lt;your_trac&gt;/plugins</blockquote>
For more info see <a title="Building authopenid-plugin" href="http://bitbucket.org/Dalius/authopenid-plugin/wiki/Home">this</a> article.
<h3>IV. Configure openid</h3>
<blockquote>edit &lt;your_trac&gt;/conf/trac.ini</blockquote>
add the following lines:

&nbsp;
<blockquote>
<pre style="font: normal normal normal 11px/normal 'Bitstream Vera Sans Mono', Monaco, 'Courier New', Courier, monospace; line-height: 1.4em !important; font-family: monospace !important; white-space: pre !important;"><span class="k" style="font-weight: bold;">[components]</span>
<a name="cl-2"></a><span class="na" style="color: #008080;">trac.web.auth.*</span> <span class="o" style="font-weight: bold;">=</span> <span class="s" style="color: #bb8844;">disabled</span>
<a name="cl-3"></a><span class="na" style="color: #008080;">authopenid.*</span> <span class="o" style="font-weight: bold;">=</span> <span class="s" style="color: #bb8844;">enabled</span></pre>
</blockquote>
see the above article for more config options.
<h3>V. Install Element Tree</h3>
As of this writing,<a title="ElementTree python" href="http://effbot.org/zone/element-index.htm#installation"> element tree</a> was not installed in the dream host system python cache. �In order to get around this do the following:
<blockquote>cd ~/install_dir

wget�http://effbot.org/media/downloads/elementtree-1.2.6-20050316.tar.gz

tar xzvf�elementtree-1.2.6-20050316.tar.gz

cd�elementtree-1.2.6-20050316

setup.py install</blockquote>
In order to get our trac instance to pick up this library, we need to package it as an egg

edit its setup.py

change
<blockquote>from distutils.core import setup, Extension</blockquote>
to:
<blockquote>from setuptools import setup, Extension</blockquote>
then run
<blockquote>python setup.py bdist_egg

cp dist/*.egg &lt;your_trac&gt;/plugins</blockquote>
you now have all of the files installed you need to run openid on trac
<h3>VI. Creating the plugin schema</h3>
If you go to you project home page and you see the message:
<pre>TracError: The Trac Environment needs to be upgraded.</pre>
Then like me you need to initialize the SQL tables used by the python-openid plugin. If that is the case then do the following:
<blockquote>cd &lt;your_trac&gt;/db

sqlite3 trac.db

CREATE TABLE oid_nonces(server_url VARCHAR);

&lt;hit enter&gt;

CREATE TABLE oid_associations(server_url VARCHAR(2047),handle VARCHAR(255),secret BLOB(128),issued INTEGER,lifetime INTEGER,assoc_type VARCHAR(64),PRIMARY KEY (server_url, handle));

&lt;hit enter&gt;

.exit</blockquote>
See the�<a title="SQLiteStore source" href="http://openidenabled.com/files/python-openid/docs/1.2.0/openid.store.sqlstore.SQLiteStore-class.html">source code</a> for more info. Now we need to &#8220;upgrade&#8221; the schema
<blockquote>cd ~/install-dir

wget http://openidenabled.com/files/python-openid/packages/python-openid-2.2.4.tar.gz

tar xzvf python-openid-2.2.4.tar.gz
<div id="_mcePaste">cd �python-openid-2.2.4</div>
cd �contrib

./upgrade-store-1.1-to-2.0 &#8211;sqlite=&lt;your_trac&gt;/db/trac.db</blockquote>
on the above line you <strong>must</strong> use the <strong>absolute path</strong> to your trac instance. No using ~ as a home dir shortcut.

This should run successfully.If the output of that command is �&#8221;no such table oid&#8230;&#8221; Then something was messed up with using sqllite. Go back in and use the command .tables and make sure the two tables are there. If not, re-run the create table commands and look for error messages.

DONE! You should now be able to log in to your trac instance.
<h3>VII. Setting OpenId permissions in trac</h3>
Setup your account with permissions.ant more? log in and check trac.log

edit &lt;your_trac&gt;/conf/trac.ini

change the logging section so it looks like this:
<blockquote>[logging]

log_file = trac.log

log_level = DEBUG

log_type = file</blockquote>
save and exit. Now:
<blockquote>tail -n 200 -F &lt;your_trac&gt;/log/trac.log</blockquote>
Next log in to your trac instance (using a web browser) using a openid account.

You&#8217;ll see something like�Retrieving session for ID u&#8217;http://xxxxxxxxxxxxxxxxxxxxxxxxx&#8217;

Everything between the single quotes is your account name. Now we can use trac-admin to give our openid account some permissions:
<blockquote>trac-admin &lt;trac_instance&gt;

permission add &lt;account_name&gt; &lt;PERMISSION&gt;</blockquote>
where permission is something �like TRAC_ADMIN. �Use the command permission list to see currently assigned permissions
<h3>VIII. Cleanup</h3>
One thing I dislike about the one click install is it messes up the logo area. �Here&#8217;s a simple fix

edit &lt;your_trac&gt;/.htaccess

after the line

RewriteCond $1 !^htdocs(.*).png$

add the line

RewriteCond $1 !^chrome(.*).png$

save and the logo should now show up.

Good luck. let me know if you run into other stumbling blocks and I&#8217;ll update the instructions.
]]></content>
  </entry>
  
</feed>
