Hostname middleware for rails apps on multiple servers

If you run a rails application on multiple servers behind a load balancer, almost every time you make a request you have a response from a different host. If you want to know which host has sent back the response, you can use a middleware that adds the hostname in the page title of each request.

»
Author's profile picture Andrea Franz

Testing rails generators with Cucumber

In the last days I switched a lot of old projects to use Cucumber, then I started writing test for Web App Theme. Here I haven’t models or controllers to test, because it’s just a generator, but I found enjoyable the use of plain text features to describe the ThemeGenerator behavior:

»
Author's profile picture Andrea Franz

2 minutes admin layout with rails and the web-app-theme generator

Many people found out a rails generator inside my web-app-theme project and asked me how to use it. Here an example, starting from scratch with a new rails app that manages music Albums.

»
Author's profile picture Andrea Franz

Creating PDF with images using flex and AlivePDF

Today I’m working on an AIR application, and I need to create a PDF starting from a list of images. This PDF needs to have one image for each page. I used AlivePDF, a very useful ActionScript3 library for PDF generation, and I created a simple class that takes an array of image paths and creates the PDF I need.

»
Author's profile picture Andrea Franz

Cocos2d: how to make a label to fit the Iphone screen width

In the iPhone game I’m working on I need to display a different label every time I start a new game level. Each one of these labels has a random string taken from an array of words, and each one of these strings has different size. So every time I create a new label I set the maximum font size and then I decrement it until the string size measures less than the iPhone screen. I do that using the sizeWithFont method of the NSString class:

»
Author's profile picture Andrea Franz