Posted: February 4th, 2010 | Author: Joakim Andersson | Filed under: apple, ruby | No Comments »
The latest MacRuby with HotCocoa is amazing! Finally a way to write OS X applications without having to learn Objective-C.
require 'rubygems'
require 'hotcocoa'
include HotCocoa
application do |app|
win = window :size => [100,50]
b = button :title => 'Hello'
b.on_action { puts 'World!' }
win << b
end
Posted: March 20th, 2008 | Author: Joakim Andersson | Filed under: ruby | No Comments »
Daemons provides an easy way to wrap existing ruby scripts (for example a self-written server) to be run as a daemon and to be controlled by simple start/stop/restart commands.
Posted: January 15th, 2008 | Author: Joakim Andersson | Filed under: ruby | No Comments »
Starling is a light-weight persistent queue server that speaks the MemCache protocol. It was built to drive Twitter’s backend, and is in production across Twitter’s cluster.
Starling: Twitter’s Persistent Queue Released
I want to play with that!
Posted: July 30th, 2007 | Author: Joakim Andersson | Filed under: java, ruby | No Comments »
Jamis Buck reminds me why I dislike Java in his Net::SSH revisited post.
It’s not that Java is bad. It’s quite a nice language with a good solid foundation of available classes and libraries. No, the problem is all the frameworks and design patterns you need to use to be able to work at the same level as what come as default in a language in Ruby.
Dependency injection is a good example. I remember then it was the latest hype in Java-land a few years back. In Java it helps you write modular code without tight coupling between the components. And that’s a good thing, right?
However, in Ruby this is a non-issue. You can accomplish the same in Ruby without using a framework and extra libraries.
This is what I dislike with Java. It holds me back! With Ruby I feel I have an incredibly amount of power available at my finger tips. I can concentrate on the fun thing; solving the problem at hand. No need to fuss around with frameworks, support libraries and what not, just to have the ground to build upon.
So to summarize. Ruby makes you happy. Ruby makes you smile. Ruby gives you all you need.
Posted: June 13th, 2007 | Author: Joakim Andersson | Filed under: ruby | No Comments »
If you get weird errors then your normal (i.e. using the ruby implementation in c) ruby program tries to access a DRb resource shared from a DRb server running on jruby try to upgrade to the latest jruby release.
I got very mysterious errors with jruby 0.9.8 but the errors went away after I upgraded to the 1.0 release.
Oh, and furthermore don’t test your DRb stuff with a method named ‘test’. It will work with normal ruby but with jruby you’ll get a ‘trying to access private method’ error. It seems like jruby defines a private test method on objects for some reason and you end up with a conflict.
Posted: June 13th, 2007 | Author: Joakim Andersson | Filed under: rails, ruby | No Comments »
If you are wondering how to get your Rails application to play together with the rest of the kids in the SOA playground this SOA and Rails article by Russ Miles over at the SOA Ranch will give you a nice introduction.
Posted: May 9th, 2007 | Author: Joakim Andersson | Filed under: java, ruby | No Comments »
Apparently ThoughtWorks are going to run their new product Mingle on JRuby. That’s cool stuff!
Posted: May 1st, 2007 | Author: Joakim Andersson | Filed under: java, ruby | No Comments »
I’ve played with JRuby a bit lately and it’s quite marvelous. I wanted to use a library that was only available in Java but the rest of the code I had written was in ruby, jruby then magically solved my problem and saved me a bunch of time. Super!
Posted: January 18th, 2007 | Author: Joakim Andersson | Filed under: ruby | 3 Comments »
Maybe I didn’t get how it works but I can’t get the Net::HTTP.post_form method in the ruby library to post to a URL like this, http://foo.bar/foo.php?q=search, i.e. a URL with GET query parameters.
The post_form method takes an URI instance (which you get with something like u = URI.parse(“http://foo.bar/foo.php?q=search”)) and then the code works like this:
def HTTP.post_form(url, params)
req = Post.new(url.path)
req.form_data = params
req.basic_auth url.user, url.password if url.user
new(url.host, url.port).start {|http|
http.request(req)
}
end
You see the use of url.path there then creating the Post object? That won’t include the ?q=search part of the url.
I’m not sure if this is the way it’s designed to work but I haven’t been able to figure out a way to mark any parameter I send in to the post_form method in params as a GET parameter. If that was possible this would work fine but for now I’ve settled on the below piece of code:
def my_post_form(url, params)
req = Net::HTTP::Post.new(url.request_uri)
req.form_data = params
req.basic_auth url.user, url.password if url.user
Net::HTTP::new(url.host, url.port).start {|http|
http.request(req)
}
end
which will do for me until you all tell me how stupid I am and give me a better solution :)
Posted: October 19th, 2006 | Author: Joakim Andersson | Filed under: java, ruby | 1 Comment »
Is Ruby Raven – Java Build with Rake and Gems the way to go to get away from the horrible time wasting programming in XML that using Ant means? At least it might be for those that already know Ruby and have used Rake and Ruby Gems.