Emphloyer and Employer-PDO update

Emphloyer-PDO has been updated, starting with v0.4.1 you can now specify the tablenames to use for the backends allowing you to create multiple setups within the same database. This update is backwards compatible, if you don’t specify tablenames for the backends the previously hardcoded names are assumed as defaults.

Emphloyer itself also has a minor update fixing a PHP warning.

Enjoy 🙂


Introducing TestPilot

In the distant past I worked for a company where our team had built its own in house testing tool in which allowed our software testers to write their own automated acceptance testing scripts in Ruby (using a custom DSL) which in turn would drive Selenium. I really liked this little tool because it was a standalone piece of software that allowed just about anyone to test our application on their own workstation without the need for access to the application’s source code. Unfortunately it was in certain ways rather specific to our product, and its source code was never released as open source.

Several times in the past years have I tasked myself to rebuild this experience into a generic open source tool (because of its use and because I thought it would make for an entertaining side project). Unfortunately I just never got around to making it happen… until now. While its still in it’s infancy I am very proud to present TestPilot. Continue reading

Decentralizing your cronjobs with Emphloyer

I have released another update of Emphloyer and Emphloyer-PDO, in this version I have done more work on the recently added scheduler that allows you to schedule jobs periodically like you would commands in the cron. One of the benefits of using Emphloyer in this manner is that any of the available worker machines will enqueue jobs according to the schedule, so if any of your machines running Emphloyer stops functioning others that are still up and running will continue to follow the schedule.

As with previous releases this is all pretty new functionality so it is not unlikely that you may find issues when putting it to work, if you experience any then please do report them on GitHub. Also there’s plenty of room for improvement (for example: right now you will have to write your own frontend to schedule jobs).

I hope that Emphloyer will be of use to other developers out there using PHP. Happy coding! 🙂

Emphloyer and Employer-PDO update

Last November I first released Emphloyer, a PHP library for asynchronous job processing with pluggable backends. Today I pushed out a small update to Emphloyer itself and the PDO backend to enable you to exert more control over what type of jobs are executed concurrently. In the new release you can specify a type for each of your jobs and then specify sets of employees that work on specific types or exclude specific types in your configuration files. Take a look at the the README for more information.

If you want to see an example of Emphloyer in action you can take a look at the emphloyer-example.

If you’re already using Emphloyer than please note that this update is not backwards compatible with the 0.1.x releases and that at the very least you will have to modify your configuration files (replacing the $numberOfEmployees setting with the $employees array).

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 https://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 🙂