Basic Instruments.app Demo
February 20, 2008 § Leave a comment
[This is a follow-up to my Rails 2.0 demo]
- In Finder, Double-click to launch /Developer/Applications/Instruments.app
- Select “UI Recorder” for new document
- In toolbar, Select Launch Executable -> Safari.app
- Quit Safari if currently running
- In that instrument, Click “i” for info subwindow
- Configure UI Recorder to NOT Record Mouse Move, Drag
- Open Library from Toolbar
- Select Activity Monitor instrument (e.g., type “act” in Search field)
- In Instrument, select [i] and choose:
- Sample Rate: 2
- Net Bytes In Per Second
- Disk Bytes Read Per Second
- Disk Bytes Written Per Second
- % User Load
- Zoom 4x (move split screen)
- Click “Record”
Assuming you have already started the app from the last post:
- Type http://localhost:3000/articles into address bar
- Click on “New article”
- Enter title and contents
- Click “Create”
- Click “Back”
- Select “Destroy” for that record
- Quit Safari # ends recording
Finally, zoom into Track to fill window, to show individual actions.
If you’re brave, click “Drive [& Record]” to show that it recorded properly. I haven’t gotten that to work consistently yet, though…
Rails 2.0 on Leopard
February 15, 2008 § 3 Comments
I wanted to try out some of the new Ruby on Rails 2.0 features in Leopard, so I may as well blog my notes here for future reference.
1. Update Gems
Use this if you haven’t ugpraded your system to Rails 2.0 yet.
sudo gem update --system # Update "gems" itself sudo gem install rails # not just update, since there's new components sudo gem uninstall actionwebservice # Get rid of SOAP; REST rules! sudo gem update # update everything else, to help Rails 2.0 compatibility yes | sudo gem cleanup # Remove old versions yes | sudo gem cleanup # Twice, because of dependencies gem list actionmailer (2.0.2) actionpack (2.0.2) activerecord (2.0.2) activeresource (2.0.2) activesupport (2.0.2)... mongrel (1.1.3)... rails (2.0.2) rake (0.8.1)... sqlite3-ruby (1.2.1) ...
2. Create Project
Create the Rails project, and make sure it and Mongrel work properly.
cd ~/Developer # where I keep all my Rails projects rails miniblog # Create new Rails hierarchy cd !$ open http://0.0.0.0:3000 && script/server # start server and launch Safari => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails application starting on http://0.0.0.0:3000
3. Create Scaffold
Use [Command-T] to create a new Tab in Terminal, so the server can keep displaying output in original Tab.
cd ~/Developer/miniblog script/generate scaffold article title:string content:text open http://0.0.0.0:3000/articles # Will return error, since no tables
4. Add to Xcode Organizer
- Launch Xcode
- Click on Window -> Organizer (Ctrl-Command-O)
- Drag ~/Developer/miniblog into Organizer window
- Select “miniblog”
- Under ‘Action’, choose “rake db:migrate”