Tl;dr: Heroku's non-intelligent routing takes about 25% capacity of your dynos

I'm a big fan of Heroku. For everything from really small projects to medium sized projects it has helped me focus on the development of the applications rather than how I deploy it. Recently however, Heroku took some flak after RapGenius, previously a Heroku success story, noted that it did have scaling issues on the platform

Specifically, the routing was not as smart as was advertised: routers do indeed route to 'idle' dynos, but the list of busy dynos is only based on the requests passed through that specific router, without taking other routers into account. Heroku, due to its size, has so many routers that the result is practically random assignment of work to the nodes. What does this mean in practice? To...

Read more (0 comments)

I run Ubuntu in Virtualbox on my retina macbook pro and found that it would not detect the full resolution by default. Just to spread the news on how it works:

1) Fire up the terminal and create a new resolution:

$ cvt 1680 1050 60
-> "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync

2) Copy the result into xrandr --newmode to create it

$ xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053  1059 1089 -hsync +vsync

3) Add the resolution so you can select it from the displays GUI

$ xrandr --addmode VBOX0 1680x1050_60.00
Read more (0 comments)

At Dienstenplanner.com (Dutch) - my company that schedules emergency duties for dentists - we wanted to get a better overview of how dentists are currently scheduling their evening and weekend duties. We knew that most of our current clients used to schedule these by hand, but were more interested in dentists that were not (yet) amongst our client base.

While we were thinking of ways to connect with possible clients, one thing popped up that I think is worth sharing: online surveys. Not your every-day survey with a loads of questions for thousands of respondents, but a well marked-up survey with at most 10 multiple choice questions, personally sent to a small group of potential clients. (e.g. see the survey we're releasing to our clients)

If you think about it, the survey fulfills much more than just an information gathering role, it also:

  • Creates awareness of our product
  • Makes down-sides of...
Read more (0 comments)

With the release of Ubuntu 12.04 LTS the time has come - albeit late - for an updated guide on rolling your own Rails production server with a long term supported Ubuntu. This is an updated guide based on an earlier version for Ubuntu 11.10. Most steps are the same, but I've gone through the guide in a fresh virtual machine to make sure everything still works as expected.

The setup

I'm assuming that you already have installed Ubuntu Server with a non-root user (with sudo rights) and that SSH is setup (e.g. [like this][6].) Use sudo, do not use root, because this is a requirement for rvm. You should setup your hosts file for your...

Read more (0 comments)
Dennis

Heroku!

Dennis | 9 months ago | Heroku

I moved this weblog to Heroku yesterday and it's been a great experience so far. In this post I'd like to describe how I moved the information in the mysql database from my VPS to the postgresql database at Heroku using taps.

After moving your application to heroku the usual way, all that is left is to move the database. Since the old database was mysql and heroku uses postgresql, data could not be imported directly. One way to do this is using taps, a gem that uses sinatra to make your database available for importing over the web. There are some caveats though, because the heroku implementation (server-side) uses ruby 1.9.2 and trying to send you database with 1.9.3 will not work.

On my VPS I checked out a fresh copy of my app and coupled the account to the right heroku app.

rvm use 1.9.2@temp --create
git...
Read more (0 comments)

BCrypt is a way to hash passwords with a given work-factor. I'm not going into the details here, but it comes down to 2 main properties

  1. BCrypt is difficult to implement on GPU's, which limits the speed in which a dedicated attacker can create hashes. (Unlike SHA or MD5 hashes, which were optimized for speed)
  2. BCrypt allows you to specify a work factor so that your hashing difficulty can grow with time.

One problem I found when running my tests in RSpec is that BCrypt is so good at its job that it has quite some impact on my tests. Every user that gets created takes out some time to generate a bcrypt hash and in the end this slows down each test by a few 100ms.

The solution is to reduce the work-factor, of course. However, implementing this in my user-model doesn't seem right, why would I adapt my code for tests? It only creates another entry for bugs or security...

Read more (0 comments)

This is a PDF cheatsheet for capybara. For quick lookups I wanted a one page cheat sheet -- or quick reference -- for capybara. Although there a number of those online, I couldn't find a PDF version the way I wanted. Of interest were:

From that I build this PDF version that you might like. Feel free to use it in any way you desire, if you want the raw file (It's in Pages), send me a comment or contact me on GitHub.

Read more (0 comments)

I was working on a new project and usually I use the twitter_bootstrap_form_for gem to get good looking forms with Bootstrap and Rails. However, this time I was working with the new Bootstrap 2.0 -- which is great! -- and twitter_bootstrap_for_form currently lacks support for Bootstrap 2.0. So, I set off to find another solution, I've long wanted to do more with the formtastic gem, so combining this with bootstrap was actually kind of a good thing.

As it turned out, there is a formtastic-bootstrap gem that can do most of the heavy lifting for you. Unfortunately, it does not play nice with bootstrap 2.0, or with formtastic 2.1+ for that matter. I had to use a fork of the formtastic-bootstrap gem and force the version of formtastic to 2.1 (vs 2.2, which is the latest release). Just to make things...

Read more (1 comments)

As a programming language, I love almost all aspects of Ruby. When watching people program in other languages, or during attempts at learning different languages (Erlang, the other day), I appreciate its syntax more and more. The combination with Rails is really great because, most of the time, it works as you'd expect.

And here comes the unexpected downside

Unfortunately, sometimes things go haywire, and it can be quite difficult to see where this is from, and how to fix it. Case in point, the views from this very blog --- the one you are reading right now --- sometimes render slowly. For example, I have a partial that renders that header above a post. On the homepage, this partial gets called about 10 times. 9 out of these 10 times, it will render in 2 or 3 milliseconds. However, one of them would randomly run up to 300ms. Thats 100 times performance loss! Very rarely, this happens twice, which pushes the total view rendering time into...

Read more (2 comments)
Dennis

Sign-in using GitHub

Dennis | about 1 year ago | Rails Omniauth

I want a painless way for visitors of my website to post comments, without going through the hassle of registering for an account. OmniAuth is a gem that allows us to do just that. In this tutorial I'll show how to enable users to sign-in/up using github and OAuth.

The setup

We're going to configure omniauth to use github for a users credentials. We do however create a user for the authenticated user, which will contain the information we obtain from GitHub. For one, this makes sure that our app doesn't crash and burn when GitHub is offline.

We're going to assume that you already have an authentication scheme working. With a sign_in(user) method that performs all the work related to sessions, etc. because I just want to show the implementation of omniauth itself.

OmniAuth has several strategies. You can install these separately in your Gemfile. Here we'll use the omniauth-github gem. Look at the [OmniAuth...

Read more (0 comments)