Troubles with JRuby and SoyLatte on OS X Snow Leopard

I was trying to install JRuby on a new install of OS X Snow Leopard today, but got this error when trying to run stuff like “jruby -S gem”:

Trace/BPT trap

I’m using SoyLatte for Java development on my machine, and was able to fix the JRuby error by switching back to the Java 1.6 with which Snow Leopard ships.

So what’s the quick fix — so we don’t have to debug JRuby/SoyLatte — in order to do Java development with SoyLatte, but use JRuby with OSX’s Java 1.6? Add this to the top of your “bin/jruby” file (wherever it lives):

export JAVA_HOME=/Library/Java/Home

やすい!

vijo doesn’t overheat my cpu! (yet)

Here’s what I came up with during the Hack Day portion of the incredible Open Video Conference 2009 this weekend. It’s a VJ’ing tool written purely in HTML5 and JS.

Bear with me if it’s glitchy! It’s just a prototype.

go to vijo


Deprecating ‘www’ from Rails Requests with Metal

In ‘app/metal/deprecate_w_w_w.rb’:

# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)

class DeprecateWWW
  def self.call(env)
    if env['HTTP_HOST'].slice!(/^www\./)
      location = "#{env['rack.url_scheme']}://#{env['HTTP_HOST']}#{env['REQUEST_URI']}"
      RAILS_DEFAULT_LOGGER.info "DeprecateWWW: Redirecting to #{location}"
      [302, {'Location' => location}, []]
    else
     # A 400 status (Not Found) passes the call on to the next piece in the stack,
     # which can be another metal piece, or your rails application.
     [404, {"Content-Type" => "text/html"}, ["Not Found!"]]
   end
  end
end

For example, ‘http://www.solid1pxred.com/foobar’ would be redirected to ‘http://solid1pxred.com/foobar’

Radial Gradiant in Safari / Webkit (CSS3)

Many of the docs on gradient support in WebKit right now only include examples for “linear” style gradients, while just mentioning the syntax for “radial” styles:

-webkit-gradient(type, inner_center, inner_radius, outer_center, outer_radius, / stop...)

So here’s an example of how to do a “radial” background gradient:

background: -webkit-gradient(radial, left top, 30, left top, 100, color-stop(0.7, #7C95AC), from(#FFF), to(#304B67));

And here it is!

Keep it shortenTweet

Behold… shortenTweet! It’s a wee microapp for Twitter that tries to shorten your tweets using UTF-8, ASCII and some shorthand. It’s a combination of Sinatra + jQuery, and after doing this I’m all aboard this microapp train (esp. with how easy it is to deploy Rack-based apps on Passenger).

And — par for the course — after I “launched” it, I discovered 2 or 3 or services that already did “tweet shortening” (although I don’t think any of them actually employ UTF-8).

Rails 2.3 : Uninitialized constant CGI::Session

Upgraded to Rails 2.3 today… very nice, but I ran into this

uninitialized constant CGI::Session

To solve, look for anywhere you reference the builtin session stores for rails (ie CookieStore), and change “CGI::Session” to “ActionController::Session”. (ie “CGI::Session::CookieStore” to “ActionController::Session::CookieStore”)

Convention over Configuration’ing my Blog.

I’m pretty close to ditching my 3-year-old Typo/Joyent shared hosting blog setup soon. I might just replace it with this Tumblelog.

(apologies to anyone who was following my old blog feed)

Accent theme by Handsome Code


view archive



Ask me anything