I found that this was actually not a very good idea nor did it make my system faster. This will disable your computer's ability to use virtual memory.

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist

To turn it back on

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist

However, note the command-line tool "purge" (just one word) to free the inactive memory on your system.

Ruby's most commonly used method is probably each, an iterator that can act on an Array, Hash, Range, or any other array-like object. (It can also act on non-array like objects such as IO, in which case .each will iterate over each line).

There are four iterators built on top of each, called the Enumerable iterators. You can use them on any enumerable objects.

Method What it does

Basic cheat sheet for me to help remember the new syntax of Rails 3. Check out the rubyonrails.org guide and also Rails 3 Upgrade Handbook

I got this error whenever I ran sudo apachectl restart starting after a recent upgrade to 10.6.5:

/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument

After this reading this post1, I changed /usr/sbin/apachectl line 64 from this:

ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"

to this:

ULIMIT_MAX_FILES=""

References
1. deversus.com

When using App Loader, geting this error when trying to upload my zip file (happens right after you click "Send"):

"The CodeResources file must be a symbolic link to _CodeSignature/CodeResources"

Do this while at the root of your project:

ln -s _CodeSignature/CodeResources CodeResources

Apture – (Tristan Acher) "We give readers power to search and explore information without leaving the page." Financial Times is their customer. It is embedded software that displays an in-page window popped up when a user selects text on the page. Used by newspapers (NY Times, Reuters, Financial Times, the Nation) to keep users on the page while providing a richer sense of what it is. Publishers will need to add only 1 line of code to integrate.

Last week that Apple said that the new iTunes 10 logo has dropped the CD. This logo change received much bally-hooed flack in the media, with designers even spawning replacement suggestions, such as this one.

Then, the popular spoof Steve Jobs tweeter @CEOSteveJobs sent this: "We're also taking the booth out of the Photo Booth icon because, frankly, no one uses those anymore either."

In the "bugs that drive me crazy" category are two that I've recently discovered when I upgraded to the new iPhone 4. Both look like examples of programmers writing software from the comfort of their cushy high-speed internet connections and not testing in the real world. Both involve disappearing data – unbelievably frustrating.

Here's a common pattern and good rails thing to know about: read_attribute(:symbol)

Basically what it does is read the attribute from the object's database field, even if you have over-ridden the name of that attribute with a virtual attribute of the same name.

When using Paperclip to save an attached image, how do I get & store the dimensions of the image? Best way is to create two fields to store the width & height and then just populate those fields when the image loads. (Other solutions, like reading it dynamically each, incur a lot of unnecessary disk activity.) Be sure to checkout some basic tutorials on Paperclip if you are unfamiliar with it generally. (see references below 1 2 3)

Step by step instructions.

1. create a new file at lib/paperclip_processors/thumbnail_with_dimensions.rb

2. Paste the contents of this gist into the newly created file:
http://gist.github.com/343678