Basic Instruments.app Demo

February 20, 2008 § Leave a comment

[This is a follow-up to my Rails 2.0 demo]

  1. In Finder, Double-click to launch /Developer/Applications/Instruments.app
  2. Select “UI Recorder” for new document
  3. In toolbar, Select Launch Executable -> Safari.app
    • Quit Safari if currently running
  4. In that instrument, Click “i” for info subwindow
    • Configure UI Recorder to NOT Record Mouse Move, Drag
  5. Open Library from Toolbar
  6. Select Activity Monitor instrument (e.g., type “act” in Search field)
  7. 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)
  8. Save
  9. Click “Record”

Assuming you have already started the app from the last post:

  1. Type http://localhost:3000/articles into address bar
  2. Click on “New article”
  3. Enter title and contents
  4. Click “Create”
  5. Click “Back”
  6. Select “Destroy” for that record
  7. 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”
  • open http://0.0.0.0:3000/articles

Where Am I?

You are currently browsing entries tagged with rubyonrails at iHack, therefore iBlog.