Moving my blog

After years of self-hosting my blog I’ve decided to give wordpress.com a go. For the time being I am using the free version of wordpress.com and thus my blog is hosted at http://mkrmr.wordpress.com, if I am happy with this form of hosting for my blog I’ll likely upgrade to premium in the future and will get this blog a custom domain once again.

Introducing Emphloyer

There comes a time in the life of any web application that asynchronous job processing becomes a requirement (you don’t want to keep your web processes hanging on long running tasks slowing down your users after all). In the years that I worked a lot with Ruby (and Rails) I worked with and on a variety of frameworks that cater for this need such as delayed_job and resque, and at a time I even built one of myself as a side project: Employer.

Nowadays I work mostly with PHP and I wanted something similary flexible to Employer so I decided to redo it in PHP… and thus Emphloyer was born!

I hope that Emphloyer (and perhaps Employer as well) will be of use to other developers out there, if you’re interested go take a look on GitHub. I only just finished Emphloyer so it is not unlikely that you may find issues when putting it to work, if you experience any then please report them on GitHub. Happy coding!

Add your own customization to Vagrant boxes

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. Continue reading

Capybara and Selenium with Vagrant

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. Continue reading

Globally unique values on embedded Mongoid documents

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. Continue reading

Writing a SOAP web service in Rails

Yesterday I posted an article on this blog on writing a SOAP web service in Ruby, the example service I offered was built using Sinatra. I have now implemented the same example EchoService in Rails for anyone that is interested in such an example: https://github.com/mkremer/echo_service_rails.

You can follow along with the client examples from Yesterday’s article against the Rails implementation instead of (or in addition to) the Sinatra implementation. You can start the Rails project on port 9292 to use the clients unmodified like so: “rails s -p 9292”.

Have fun :)

Writing a SOAP web service in Ruby

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). Continue reading

Useful *nix tools: ack-grep

ack (on Ubuntu named ack-grep, so if you’re using Ubuntu then replace ack in the example commands in this article with ack-grep) is a friendlier alternative to grep for most uses. One of the features I really like is that ack distinguishes files by type and that you can tell ack to explicitly look at certain file types, or to exclude certain file types from your searches. File types that ack it doesn’t know about are not searched, you can get a list of all the types that ack knows by typing ack- grep –help-types. Continue reading

Using dnsmasq to run your own TLD

So you’re developing networked applications on your own computer and now you want to test using different host names or URLs that route to localhost (because obviously that’s where your running everything). Surely you could go on and edit your hosts file every time you need a new host name, but that becomes tedious and annoying quickly. This article will describe how to use Dnsmasq on Ubuntu 11.04 to setup a (top level) domain for which all host names will route to localhost (your mileage will vary on other distros). Continue reading

Useful *nix tools: sed

If you work on *nix systems (UNIX, Linux, Mac OS X, BSD, etc.) and you want to extract information from text files such as log files of different kinds and/or lengthy output from other command line tools you’ll want to learn about sed. Sed stands for stream editor, it is an incredibly powerful non-interactive text editor/processor/filter that takes input via a *nix pipe and transforms it based on command line parameters and then outputs the result. Continue reading

Follow

Get every new post delivered to your Inbox.

Join 155 other followers