So, I removed rvm and installed rbenv. All in all straight forward. Until I started it to use with an older project, that is requiring REE. Set a .ruby-version and checked the ruby. All good. Sweet. Bundle and off I should go. Nope… Besides some special dependencies (e.g. Nokogiri lately requiring ruby > 1.9.2), which I solved by installing it separately, bundle did keep complaining about not being able to install Nokogiri. Why trying to install again? It’s there, I installed it myself!

But no, a “gem list” just gave me a short list of gems, way shorter than what already had been installed by bundler. I kept checking for other Gem paths, other weird dependencies or rvm leftovers. Nothing. Until I did the following:

Bundle was configured not to share the gems and therefore never picked up the ones installed. Weird behavior, but deleting the .bundle in my project folder did the trick. See some infos on Stackoverflow

It’s been a while since I’ve updated my app on heroku. In between the mongoid version updated and configuration file (mongoid.yml) did change. That for me was the most obvious change, but then as well, there were a couple of things under the hood, that only showed up once I tried to deploy on heroku. The above error appeared and left me clueless for a moment, until I figured out, I had to define the ruby version 1.9.3 in my Gemfile:

The Bootstrap Framework is an awesome base for my applications, Styling is good and easy. It also brings some nice components into the play, one of them the Typeahead. You simply register it with your input and it will return matching values. Unfortunately it does so only for Strings, but I needed a solution to return object and work of them to also populate other fields in the same form. This did not work out of the box, but luckily I found a nice gist that did add these capabilities. Go, have a look and enjoy the possibilities.

To add the patched version, add it to a suitable location to be loaded, in my Rails 3.2 project I placed it under vendor/assets/javascripts/twitter/bootstrap and added it to my application.js:

//= require twitter/bootstrap/bootstrap-typeahead

You are now able to use objects as return values and specify the property that should be used as display value in the list. The onselect callback allows for further manipulations, I for example set the value to the food name, update a select box with the retrieved list of serving_sizes and set an hidden field to the internal id (recipe.js.coffee):

In a recent case I needed to combine many date values out of a bunch of XForms documents. The forms had changed over time in a way that there was no date input at the beginning, so date values could be typed in freely. That ended up in values like “07.07.2012″, “7.7.2012″, “07. 07.2012″, “07.07.12″ and so on. Then there were also erroneously typed spaces. Later on, the input was marked as date type and standard input selectors were used, dates from that moment on were saved as “2012-07-07T12:00:00″ (UTC Time Format as specified in ISO 8601).

So, what I needed was a way to get the date formatted in a standard way as “dd.MM.yyyy” (first of the examples above) or the original value back for further error handling. I did not want to include any further libraries as the project is distributed via web and I want to keep the dependencies as little as possible. So I came up with a method to parse the dates from a combination of SimpleDateFormat, that involve the different possibilities:

So, here I am, migrating an application from Tapestry to Rails. First issue I ran into is how to authenticate existing users. The Spring Security setup I used wasn’t to advanced, but still I had to figure out all of the defaults and how to implement them in Ruby.

But first things first, I needed a hash to test against. I setup an user using a simple password (“password”). The resulting hash is “94fd377436677640be814ac7b2d98b219f1f96d4″, encoded by the password and a salt. Ok, for the password, what’s missing is the digest to use and the salt.

To figure out the used encoder, I injected it and output it simply via:

The same I did with the saltSource to figure out which Salt is used all over the system (I did not set up a custom salt, nor user-based salt, shame on me):

System.out.println(saltSource.getSalt(user));
// DEADBEEF

I ended up with the information, that the Encoder used is the SHAPasswordEncoder and a system wide salt of “DEADBEEF”. Looking at the source, the line of interest can be found in BasePasswordEncoder#mergePasswordAndSalt(String password, Object salt, boolean strict):

To be able to use Devise with our old passwords, the solution is to override the “valid_password?” method, as suggested in this Wiki entry.
The above code used, it is now possible to authenticate existing users with Devise and still use all the nifty new features coming with it.

This compiles the slider example to the out folder. To run, you call your Google Chrome Browser with the newly created html file. Make sure Chrome is not currently running as this will create a conflict accessing the profile

So, today it finally became available for the public. And since it sounds really promising, I thought it might be good to get it going right away. Oh, btw, in my opinion the possibility to switch from a quick-and-dirty approach with dynamically typed variables at the beginning for prototyping to statically typed variables as the project evolves sounds just right. No need to decide upfront whether to go for the big-overhead-framework or the simplest possible approach as this simply develops as needed by adding libraries or adding domain specific features. Sounds great, let’s see if they can get some grip soon. For those interested in finding out more, read the introduction to Dart.

On their pages they do also explain how to get Dart up and running, I will follow those instructions and will summarize the steps necessary:

Install XCode >= 3.2 (I assume you have this already, if not, install it from your MacOS X installation DVD)

at the end of the sync I get a message that DumpRenderTree could not be downloaded and I need to execute another command. So I do:

third_party/gsutil/20110627/gsutil config

This tool prompts for a lot of setup and configuration, such as setting up your Google Account for use with Dart. I won’t repeat all the steps here as they may not be applicable to you. But you will need a Google Account and the Cloud Storage activated.

This did not go through completely and it seems DumpRenderTree has not been installed properly. I got to check this out, but hope you’ve been more successful so far. I will be back. Nevertheless I can run the other tests separately:

Deploying applications is not my favorite task. I don’t do it often and every time I’m not really sure what the bloody command was. So, here I go, taking down notes on what I need to do to get my application up and running from scratch.

First off, I decided to use a Turnkey Linux Tomcat on Apache appliance as it contains all I need and provides some nifty and easy to use tools. Not to forget, it’s the minimal configuration and configured to check for updates automatically to keep security risks to a minimum. But the main point for Turnkey Linux is the ability to deploy their appliances onto Amazons Web Services. Sweet, that will allow me to familiarize with just one installation and simply follow these steps on an EC2 instance. It even gives me the ability to backup and restore from local to cloud instances.

The specific steps involved to get it working locally:

Download from http://www.turnkeylinux.org/tomcat-apache. In my case it came as version 11.1

Unzip and run using VMWare Player or Workstation (or use one of the other formats)

Follow the initial steps to set passwords for the different accounts used

Call up the manager at https://[SERVERIP]/manager

Deploy a WAR file (created for example by using “mvn package”) using the “WAR file to deploy” Form. A new application will be created from that WAR and deployed automatically

The one and only tricky part was the mapping configuration. Since Apache is running in front of Tomcat, it will answer all incoming requests. To have it forward these requests to your application, the Apache-Tomcat-Connector has to know about that. Edit the configuration as follows:On your console (of the VM): nano /etc/tomcat6/mod_jk.confAdd the following to lines to the configuration:

I really like that sight when calling up the Apple Store to buy a MacBook Pro as it says

We are busy updating the store for you and will be back shortly.

Why is that so great, another Fanboy waiting to get his toy? Nope, not in my case, but still were looking at getting at least one Mac to be able to build iOS software. Unlike other products you have to have MacOS to be able to to do so. Second point my beloved Dell XPS M1330 is now getting a little to slow for all my work, so instead of investing money into upgrading it I decided to get a new one. Boys and their toys. Was about time…

So, soon I’ll be able to compare current Mac and OS X to my previous experiences with Windows (from NT till 7), Ubuntu, Debian and earlier versions of OS X. Maybe it’s interesting enough to post here about experiences from a relative neutral point of view.

Anyway, I’m looking forward to having a new toy at hands soon. By the looks of it, just a couple of minutes away.