Add a prefix to form field IDs

Rails form fields can clash when the same form is rendered multiple times; a prefix keeps field IDs unique without changing submitted names.

Exchange messages between Javascript and Flash

Flash movies can exchange data with JavaScript in the same page, with ExternalInterface as the preferred bridge and fscommand or SetVariable() as legacy options.

Insert an ndash and other special characters using the Compose key on Linux

Typing en-dashes, em-dashes, and other symbols is awkward without a compose key. A configured compose key enables cross-application input of special characters on Linux.

Configuring User Agents with Capybara + Selenium Webdriver

A while ago we were working on an application that had an entire version specially created for mobiles, such as the iPhone. This specific application was entirely tested with Capybara, Steak and Selenium Webdriver. Although the test suite wasn’t the fastest one in the world, the web application was very well tested, and to guarantee that we would also be testing the mobile version, we would have to simulate an iPhone user agent accessing the application.

But wait, you might be thinking that we are not able to change browser headers while ...

Paperclip: Image resize options

Paperclip supports ImageMagick resize flags for scaling, cropping, and fitting images to specific dimensions without distorting them.

Escaping of quotation marks in Cucumber steps and step definitions

Quoted text in Cucumber steps can break matching because escaped quotation marks are not handled reliably. Regex steps, capture groups, or Spreewald multiline strings avoid the issue.

sudo command for Windows

Windows lacks a direct sudo equivalent; elevation usually relies on running a shell as Administrator, runas, or third-party tools with limitations.

Ubuntu: Open a new terminal window with a keyboard shortcut

Open a terminal window faster by assigning a custom keyboard shortcut to Ubuntu’s terminal launcher; avoiding clashes with existing app shortcuts prevents conflicts.

Maximum representable value for a Ruby Time object

32-bit Ruby Time values stop at 2038-01-19 03:14:07 UTC; later timestamps raise ArgumentError. DateTime can store later dates but differs from Time and is slower.

How to change MySQL's data directory

Relocating MySQL storage can free space or move databases to another disk, but configuration and AppArmor access must match the new path.

HTML5 and Web Video: Questions for the Industry from the Community

What are Google’s plans for turning WebM into a genuinely open standard, one that is based on consensus like the rest of W3C’s HTML5 effort? Would Google fully support such an effort? Even the WebM project’s domain is controlled by Google. Google chose to release WebM under the Creative Commons license which would theoretically allow a standards body to use the specification as a basis for a truly open standard. Would Google agree to adopt the specification and changes that would emerge from an open process in a timely and robust manner? Wha...

Encrypt files using OpenSSL

Protect files with AES-256 encryption via openssl enc, using a long passphrase file and secure deletion to limit recovery of the original data.

Securely remove files on Linux

rm leaves file data recoverable; shred overwrites files before deletion, while wipe handles directories. Flash storage still needs disk encryption for reliable erasure.

Upgrade from Rails 2.3.10 to Rails 2.3.11

A Rails 2.3.10 to 2.3.11 upgrade can reduce maintenance risk and keep an older application on a supported patch level.

Dump your database with dumple

dumple creates a database dump from a project directory on local machines or application servers, including deployment-time use.

Validate an XML document against an XSD schema with Ruby and Nokogiri

XML files can fail schema checks silently in Ruby; Nokogiri validates documents against XSD and returns syntax errors for reporting.

Continously run command under bash

Sometimes you want to run a command forever, e.g. to compile a haml to html file on the console. Use this:

$ while(true) do haml index.haml index.html; sleep 1.5; done

Cucumber fails without giving error message

Cucumber can fail with little or no visible error output; a backtrace, verbose formatter, or debug mode can expose the underlying cause.

Linux: rename or change extension of multiple files

Bulk file renaming on Linux is error-prone with shell wildcards; Perl rename can change extensions or strip filename prefixes in one command.

Deploy and migrate with a single Capistrano command

Run database migrations during deployment with cap deploy:migrations to restart an application after schema changes, but task hooks can make the sequence unsafe.

Show the description of a Capistrano task

In order to bring up a textual description of a Capistrano task you can say

cap -e taskname

... where taskname is the name of the task you're not sure about.

Auto-hide player controls in the default Flash video player component

Hiding the default Flash video player's controls keeps the skin from staying visible during playback. Set skinAutoHide to true in the component inspector.

Test that a select field contains an option with Cucumber

Cucumber steps can verify that a form select contains or excludes a specific option, without checking the currently selected value.

Fix errors when rendering PDF output

If you run specs or your application and get an error like:
ActionController::MissingFile in 'ProductsController#show, should render PDF'
Cannot read file /some/file.pdf

You may be missing the HTMLDOC binary on your system. Install it like this on Debian/Ubuntu:
sudo apt-get install htmldoc