Archive for July, 2007

XMPP4R and setting a VCard in Ruby on Rails

Friday, July 13th, 2007

Setting a VCard using the XMPP4r library wasn’t as straightforward as I thought it would be. Below is the code to do it:

#connect and authenticate to the server
@client = Client::new(@jid)
@client.connect
@client.auth(@pwd)
#get the vcard of the connected jid and fill it with new values
vcard = Jabber::Vcard::Helper.new(@client).get()
@vcard = Vcard::IqVcard.new
@vcard["FN"] = “test”
@vcard["NICKNAME"] = “test”
@vcard["BDAY"] = “15-07-1954″
@vcard["ADR/CTRY"] = “Belgium” #this [...]

Faceted search in Solr with Ruby on Rails

Friday, July 13th, 2007

Solr is a powerful, easy to use search framework build on top of Lucene. It currently powers the search of my RailsHostingInfo.com page. And it makes the nice faceting (grouping of data) possible. Recently I got the question how to do it with acts_as_solr. Well the truth is, I don’t know. I haven’t used acts_as_solr. [...]

Haml and Rails rendering speed

Friday, July 13th, 2007

I was shocked when I read that the new 1.7 release of Haml now comes with speed. Haml 1.7 is now only 1.8 times slower than ERB. And I thought ERB was one of the slowest things in Rails. Check out http://www.kuwata-lab.com/erubis/ for different rendering speeds and notice that ERB is the slowest of them [...]

Rails 1.2 doesn’t support composite primary keys

Friday, July 13th, 2007

Rails 1.2 doesn’t support composite primary keys out of the box!! Well, that certainly proves there is too much hype around Rails. I love it and it is really easy to build web applications in it. But no composite primary keys support, ouch. Luckily there are many plugins/extensions, so check out http://compositekeys.rubyforge.org/, if you need [...]

How to get Ruby OpenSSL to work on CentOS

Friday, July 13th, 2007

I recently needed the Ruby OpenSSL library to do some decoding and encoding. I had tested everything on Windows and there it worked without a glitch. But after moving my code to Linux CentOS it stopped working. I got the error: LoadError: no such file to load — openssl
After much searching I found the solution. [...]