state_machine: Test whether an object can take a transition

Check whether an object can perform a state transition before calling it. can_transition_ab? only verifies that a matching transition exists; validations may still block it.

Login forms: Disable browser prompt to remember the password

Browsers may prompt to save passwords on login forms; setting autocomplete="off" on the form suppresses that prompt.

Large forms are slow on the iPad

Very large forms can become unresponsive on iPad, with touch controls taking seconds to react. Showing only a limited set of inputs at once avoids the slowdown.

Be careful with "memoize"

ActiveSupport::Memoizable can return wrong results when a memoized method is called with arguments, because true may trigger recomputation instead of being passed through.

jQuery 1.7 Released

jQuery 1.7 introduces on and off for event handling, deprecates bind, delegate, and live, and improves delegated event performance.

Ruby: Downloading files from the Internet

Downloading a remote file in Ruby can be done with open-uri; HTTP Basic Authentication credentials work when the source is protected.

Multi-line Ruby block in Haml

Haml can render multi-line Ruby code with the :ruby filter when puts sends generated output into the template response.

"Show me the page" fails to open a browser window

Show me the page can fail to launch a browser window when launchy is outdated; upgrading to a newer version resolves the error.

Rails 3.1 error message: Could not find a JavaScript runtime

Fresh Rails 3.1 apps can fail on boot when ExecJS cannot locate a JavaScript runtime, and adding a runtime gem to the Gemfile removes the error.

Web font embedding requires new CSS for IE9

Internet Explorer 9 needs updated @font-face syntax for embedded web fonts; older Font Squirrel CSS can fail until the EOT source includes the ?#iefix workaround.

How the Clearance gem remembers and clears sessions

Persistent sign-in via remember_token keeps users logged in across browser restarts, while logout invalidates every matching session immediately by rotating the token.

Change the MySQL default character set on Amazon Relational Database Service (RDS)

MySQL character set defaults on Amazon RDS can require a custom parameter group and instance reboot to take effect.

Improve web font rendering in Windows by autohinting fonts

Windows web fonts often render poorly because embedded hinting is weak; replacing it with autohinted font files improves readability across browsers.

Connect to a VirtualBox guest machine over the network

A VirtualBox guest can be reachable on its own LAN IP by switching the adapter to bridged networking, enabling HTTP, SSH, and other direct connections.

Make Type 1 fonts (.pfb/.pfm) appear in OpenOffice on Ubuntu Linux

Type 1 fonts may not appear in OpenOffice on Ubuntu because missing metric files prevent recognition. t1lib-bin and .afm generation make them available.

Give table columns equal width using CSS

table-layout: fixed makes a table divide its width evenly across columns, avoiding uneven sizing when equal column widths are needed.

Cucumber.yml was found, but could not be parsed.

cucumber fails because cucumber.yml cannot be parsed; removing rerun.txt in the Rails directory often fixes the invalid rerun state.

/proc/cpuinfo on Solaris

Solaris does not provide /proc/cpuinfo; psrinfo -v is the standard way to inspect processor status and speed.

Stub methods on any instance of a class in Rspec 1 and Rspec 2

Stub a method on every instance of a class to control behavior in tests, using stub_any_instance, any_instance.stub, or allow_any_instance_of.

Solve screen error "Cannot open your terminal '/dev/pts/0' - please check"

screen can fail with “Cannot open your terminal '/dev/pts/0'” after switching users in the same session; owning the shell correctly or reconnecting as the target user avoids it.

Show the character set and the collation of your MySQL tables

MySQL table collation and default character set are available through SHOW TABLE STATUS and SHOW CREATE TABLE; individual columns can still use different encodings.

Show and change MySQL default character set

MySQL character-set mismatches cause garbled text and inconsistent comparisons; SHOW VARIABLES LIKE 'char%' and my.cnf settings reveal and change the server defaults.

Creating a patch in git and how to apply patches

Shareable Git changes can be turned into patch files and reapplied in another working tree or repository. git apply stages changes as edits; git am recreates commits with messages.

Stub a request's IP address in a Cucumber scenario

Force a fixed client IP in Cucumber scenarios when request-dependent code needs predictable behavior.