Note: For PostgreSQL you should use advisory locks. For MySQL we still recommend the solution in this card.

makandra dev

There is no good equivalent for the Unix sudo command in Windows. Below are a few workarounds that are all...

To open a terminal quickly navigate to System → Preferences → Keyboard Shortcuts. There, click the "Run a terminal" row (It should...

Have a backup. Stop MySQL: sudo service mysql stop Move (or copy) your mysql directory. If you want /mnt/mysql to...

makandra dev

Using OpenSSL it's very easy to seriously encrypt files. Use the script below. Input / Output are self explanatory. Put...

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

When you use the send_file method to send a local file to the browser, you can save resources on...

A check if two date or time ranges A and B overlap needs to cover a lot of cases:

There are times when you need to send SQL to the database, like this: def self.some_count(field) field = connection.quote...

From time to time we're convinced that an error must be very close to the network card, OS IP...

It's that simple to allow one of your Linux users to run a single command as UID 0:

If you're on Ubuntu: sudo apt-get install ruby-dev On other platforms: Look for a package containing ruby...

When you are using Apache for development, it still accepts connections from everyone in the same network as you.

When you eagerly load an association list using the .include option, and at the same time have a .where on...

This card explains how to install RubyMine for the first time. If you want to upgrade an existing RubyMine installation...

Occasionally some complex query must be processed on the database because building thousands of Ruby objects is impracticable.

For clarity and traceability, your commit messages should include the ID and title of the Pivotal Tracker story you're...

You most likely never want to do this. But if you do: Model.update_all({:id => new_id}, {:id => old_id...

To install webmock 1.5.0: sudo gem install webmock --version "=1.5.0" or sudo gem install webmock -v "=1.5.0"

Use this scope: class Stick named_scope :shuffled, lambda { last_record = last { :conditions => [ 'id >= ?', rand(last_record.id) ] } if last_record }

skorks.com

Ctrl + R Search commands you entered previously. Press Ctrl + R again to search further back, Ctrl + Shift + R searches forward...

Use this MySQL command to show further info about a table: SHOW CREATE TABLE tags; This will output a table...

If a controller action responds to other formats than HTML (XML, PDF, Excel, JSON, ...), you can reach that code in...

After switching to Rails 3 you may get a LoadError with the following message when trying to use your application...