Earlier posts on my blog show that I like to run my development environments on virtual machines rather than directly on my own OS. In the past I did this using VirtualBox, nowadays I prefer using Vagrant (my previous blog post probably gave that away already) which makes managing development VMs a lot easier. If you’re not already using Vagrant I highly recommend you give it a try. There’s an excellent introduction on Railscasts if you like screencasts, otherwise the Vagrant website should most certainly help you get started. I like to do most of my work on shell sessions, and to do this effectively I have the need to customize all of my Vagrant boxes to have my own settings. In this article I’ll show you how you can easily setup Vagrant to customize your Vagrant boxes to your heart’s content.
Capybara is an easy way to perform integration testing through a browser for your web applications. Capybara has various drivers including one which works with Selenium Webdriver that allows you to run your tests against a number of different browsers including Internet Explorer, Firefox and Chrome. When you develop directly on your own machine then all is good and running your tests through Capybara with Selenium will fire up a browser window to run your tests. I like to develop web applications using Vagrant boxes with Ubuntu server on them and there the same approach won’t work directly, in this article I’ll show what you can do to automate testing using Capybara with Selenium on such an environment.
Mongoid is an excellent ORM for using MongoDB. Its very easy to use as a replacement for ActiveRecord in Rails as it uses ActiveModel inside and offers a lot of the same functionality as ActiveRecord.
MongoDB encourages you to embed documents for contains type of relations rather than creating relations between different collections. If you want to know more about embedding versus linking I encourage you to read the MongoDB documentation on schema design.
When you use Mongoid and add uniqueness validations on an embedded document you’ll soon discover that these validations only apply to the scope of the parent document (as described in the validations documentation). In many cases that’s exactly what you want, however there may be scenarios where you want a field in an embedded document to be unique across the entire collection. In this article I’ll show you how that can be done.
- The website itself is now just static HTML, and because of this my server no longer needs to run PHP and MySQL and thus greatly decreasing the footprint of this blog.
- All of the blog entries and pages can be written in text files, edited with my favorite editor, and kept in version control make the whole lot much more portable.
Since I get so many spam comments and so few actual comments I’ve decided to turn off comments on this weblog. If I post something here and you want to reply to it then please go ahead and send a public tweet to my Twitter account: @mkrmr.
Ruby 1.9 doesn’t come with SOAP support out of the box, in this article I’ll show you a very basic example SOAP service over HTTP that I’ve written in Ruby 1.9 that supports a subset of the SOAP 1.1 standard (enough to make it compliant for what it does) that you can use to get started if you want or need to write a SOAP service in Ruby get started. Additionally I’ll briefly show you how you can poke around it with soapUI and how you can consume (use) it with PHP, Java (using Apache CXF), .NET and of course Ruby (using Savon).
Ubuntu 11.10 uses lightdm as its display manager, configuring how the login screen behaves and what it looks like can be done with the files in /etc/lightdm. To change the background image for the login screen simply edit /etc/lightdm/unity-greeter.conf (as super user, so be sure to use sudo or gksudo to fire up your editor)
Foreman is a utility written in Ruby that makes it easy to launch multiple processes with a single command and watch the output (which is color coded per process) on a single screen. If your application has multiple processes to start then Foreman might be a good solution for you (take a look at the Railscast on Foreman for a good introduction if you’re not familiar with it).
Inside Foreman makes use of Process#fork to launch its processes and unfortunately that isn’t supported by JRuby. If you’re using RVM to manage your Ruby installations you can use its wrapper functionality to create a wrapper for Foreman to run it using MRI (or another Ruby implementation that supports Process#fork). Here’s how you do it: