How to Update Phusion Passenger When Installed via RubyGems

Pair of feet sticking out of a car window
Photo by Erik Odiin on Unsplash

Phusion Passenger (a.k.a. mod_rails) is a module for the Apache HTTP Server which can (among other things) be used to deploy Rails apps.

As with any piece of software, from time to time security vulnerabilities will be discovered and Passenger will need to be updated.

Although the project’s homepage offers some excellent documentation on how to do this, the steps they describe didn’t work for me and resulted in my app crashing.

Inspecting the Apache error logs informed me that a segmentation fault had occurred and that I may have encountered a bug in the Ruby interpreter. This was accompanied by a 5,000 line stack trace.

Oh dear!

More …

How to Set Up an Apache Virtual Host on Linux Mint

Running Apache on my local machine helps me speed up my web development work. It means that I can use root-relative urls, server-side programming languages (such as PHP) and interface with a database — all without having to upload anything via FTP.

The only problem comes when you are working on multiple projects at the same time. If you create different directories for different projects within your web root (which defaults to /var/www/html), then the root-relative urls will break, as will any server-side includes you are using.

This is where virtual hosts come in. They allow you to create a separate domain for each of your projects, such as http://project1/ and http://project2/.

More …

How to Install rbenv on Linux Mint 17.1

Last year I wrote about installing rbenv on Linux Mint 16. Back then the installation process as described on the project’s Github page didn’t work for me and, after much frustration, I ended up installing an older version of rbenv from the repositories.

Recently, I had to reinstall my operating system (upgrading to Mint 17.1) and decided to give the rbenv installation process another try. I’m happy to say that it worked entirely as expected and within a matter of minutes I had two Ruby versions installed on my system and could switch between them at will.

More …

Ajax Beginner's Tutorial

Ajax stands for Asynchronous JavaScript and XML and is used for allowing the client side of an application to communicate with the server side of an application.

This might be necessary in order to update the contents of a drop down menu, or to check the availability of a user name, all without reloading the whole page.

Using Ajax isn’t very hard and in this tutorial I’ll show you how to get up and running.

More …

Ignore "Invalid Byte Sequence in UTF-8" Error in Ruby

I wrote a simple Ruby script to parse text files and manipulate their content.

This is useful, for example, if you want to replace all occurrences of the phrase “Dr Jones” with “Prof. Jones” across a set of HTML files.

This was working great on Windows, but when I ran it under Linux, I started getting a “invalid byte sequence in UTF-8” error. This is how I solved it.

More …

How to Validate That Two Time Ranges Don't Overlap in JavaScript

I was working on a form for a timekeeping app, where a user is able to enter their time worked, as well as breaks taken.

There is no limit on the amount of breaks that may be taken, but one of the validation requirements is that no two breaks may overlap.

Here’s how I implemented this validation check.

More …

How to Create a Custom Filter Selector with jQuery

A little jQuery trick I learned recently, was how to create a reusable, custom filter to target specific elements based on their characteristics.

I was kind of surprised that I hadn’t heard of this before, so thought I’d jot it down here, in case it is of use to anyone else.

More …

Resurrecting a Rails 2.x App

This morning I had to give a client an estimate for some work they wanted doing on a Rails 2.1.2 app.

The work itself wasn’t overly complicated, but getting a system up and running using Ruby 1.8 and Rails 2.1 proved to be somewhat of a challenge.

Here’s how I did it.

More …