spicycode
Hiding /Opt From Finder.App In OSX
Simple way via the command line:
sudo SetFile -a V /opt killall Finder
Want to get FireFox 3 on OSX working well?
Step 1: Get FireFox 3
Step 2: Install the Proto theme (it’s the soon to be default osx theme)
Step 3: Install the latest Firebug that is compatible with Firefox 3
Anyone Get SuperRedCloth To Build On Leopard?
Two machines here get segfaults from gcc (yes, after port installing ragel). Help?Enable The New Web Inspector On Leopard
Just run the following in your terminal
defaults write com.apple.Safari WebKitDeveloperExtras -bool trueThen right click on anything and click Inspect Element to bring it up
A Serialized Mystery
Author: Nick Ang Ehren and I recently had to spec out a discussion filter to return only items selected by the user. While testing all things were golden. However, when we tried to step through the implementation in the browser we would have issues. After some investigation in script/console we finally found the culprit. The breakdown of our model The model we are filtering contains a serialized column of integers to aid with the filtering. This is a low-tech version of a full-blown association. The purpose was to insulate us from yet more expensive sub queries as the full page load can be quite intensive. (I jest not when I say we have a model named “Item” in this project.)class Item serialize :used_by_filter_ids end
Calling Scotland Yard
Our investigation had us discover that the serialized column was returning an array of integers as Strings, versus actual Numerics which our callers expected. A simple tweak to the implementation to call to_i prior to handing the results back and all is good.
class Item serialize :used_by_filter_ids def used_by_filter_ids read_attribute(:used_by_filter_ids).each(&:to_i) end endThis discovery and subsequent fix explained why we were getting the errors through the browser but none during the specifications. The browser passes params around as strings, and the tests submit actual integers. A lesson to learn Always verify you are not relying on conversion magic at some level when serializing, or testing in general. If it needs to be an integer, use an integer. If rails will pass an integer as a string in params, you should do the same in your tests and specifications. I estimate the time we spent in proportion to the code of size n was about O(n), but the constant hidden by the big-o notation was rather large.
Make it fast please
I love OSX. It’s my favorite OS this side of BeOS. However I still get frustrated some times when things move more slowly that I would like. That’s why I was very happy to find this tip at macosxhints From MacOSX Hints If you are willing to sacrifice the visual feedback, disabling animation can provide a snappier experience. To disable animation in the Finder, open your favorite Terminal Software and enter this command:
defaults write com.apple.finder DisableAllAnimations -bool true
killall Finder
I definitely don’t have a slower system, but I still like being able to disable the zooming windows here and there. When I want a folder open, just open the folder please. If you decided it wasn’t for you, just reissue the command and restart finder again.
defaults write com.apple.finder DisableAllAnimations -bool false
killall Finder
RSpec 1.0 Released!
RailsConf was quite fun this and I finally got a chance to meet David Chelimsky and Aslak Hellesøy on Saturday. Ken and I sat down with them and coded a patch or two for RSpec 1.0. We got the “not implemented” spec feature added during this time. It worked like this:
describe YourClass do
it "should do something awesome later"
end
By not giving the example (‘it’) a block you get a Not Implemented spec notice in all the various outputs. This will be yellow in the console output when color is on, and the same in the html output. Having not implemented specs will not break your build, and they do not count as errors or failures. All in all a very fun time.
Jim Weirich Joins EdgeCase
I haven’t had a lot of time to blog recently but I had to get the word out on a few things at my company, EdgeCase.A wonderful addition:
Jim Weirich of rake, rubygems, flexmock, and many other ruby projects is joining EdgeCase. I couldn’t be more ecstatic. Jim will bring a great depth of experience to our team and allow us to really tackle the larger projects with ease.
A new site
The EdgeCase Website has relaunched with a new design and more useful information on our portfolio, services, and who we are. It’s nice to get this up and going prior to RailsConf.
Enterprise Ruby Conference: erubycon
erubycon is coming up sooner than you might think. Pat Eyler has recently announced a contest we are putting on to get free tickets to erubycon.