Goal: Find out how fast this code runs.
Solution: Write a performance test using Rails’ built-in script/generate performance_test
Steps:
- script/generate performance_test homepage
- edit test/performance/homepage_test.rb
- Oh wait, I don’t have a test database set up
- ssh dev
- pg_dump -Fc devdb > db.dump
- exit
- scp dev:~/db.dump .
- Wait for 700Mb compressed dump file to download over wi-fi connection
- pg_restore -d testdb db.dump
- errors: could not access $libdir/pg_trgm, $libdir/uuid-ossp, $libdir/fuzzystrmatch, tons of no relation errors
- Search Google: what is all this stuff?
- uuid-ossp depends on http://www.ossp.org/pkg/lib/uuid/
- Download, untar, configure, make, make install
- Oops, forgot to build with postgres support
- GOTO 13 and return
- That didn’t work; GOTO 11 and return
- Oh, compiling uuid-ossp on Mac has problems: http://cvs.ossp.org/tktview?tn=81
- Try running one user’s suggestion of renaming uuid_t
rgrep -l uuid_t | grep -v ChangeLog | xargs perl -i -pe 's/uuid_t/ossp_uuid_t/g'
- rgrep: command not found
- GOTO 11 and return
- sudo port install rgrep (nope)
- Is rgrep source available? (nope)
- Ah, rgrep is part of the jed text editor
- sudo port install jed (installs slang and jed)
- GOTO 19, 20, (swear once), 21
- What was my goal again?
- locate rgrep (nope)
- locate jed (nope)
- How do you update the locate db again? GOTO 11 and return
- sudo /usr/libexec/locate.updatedb (receive warning, “the Lord will kill you for running as root”)
- Why am I doing this?
- I know, I’ll write a funny post on how great it is to be a programmer and how 90% of your time is debugging your system or your code (because no one’s ever written about that before)
- Let’s go over the steps again, start from the beginning
- rake test:benchmark (database structure loads with errors, but the test runs; what?!)
- “rake aborted: undefined method
`use_transactional_fixtures=' for Test::Unit::TestCase:Class"
- edit test_helper.rb: replace
Test::Unit::TestCase with ActiveSupport::TestCase
- rake test:benchmark (it works: “wall_time: 5 ms”)
- GOTO 32 and return
- Why are memory, objects, gc_runs, and gc_time all zero?
- GOTO 11 and return
- Oh, I need to patch Ruby with a GC patch
- cd /usr/local/src/ruby-1.8.6-p369
- curl http://rubyforge.org/tracker/download.php/1814/7062/17676/3291/ruby186gc.patch | patch -p0
- “8 out of 28 hunks FAILED”
- Does it compile? ./configure; make (error)
- Oh well
- GOTO 27 and return
I’m curious. Because newspaper is a medium. The reason newspapers have layouts that look like crammed, painful columns on the page is because it costs money to print them and they usually have more content than space available. Necessarily, the layout is based on the need to fit as much content as possible in a small space.
But web sites don’t have this constraint. Yet, newspaper web sites still look like their printed relatives.
Wouldn’t it be better to layout the web site around the content instead the content around the web site?
If you’re thinking of buying an Apple Airport Extreme wireless router and an external hard drive in the hopes that you’ll be able to use the external drive with the advertised AirDisk feature under Apple’s Leopard OS, think again.
It doesn’t work.*
Don’t even attempt to think about using the advertised Time Machine automated, whoop-de-doo backup feature with said external hard drive over the Airport connection. That’s not even a feature of Leopard anymore. Even though it once was.
Bait and switch? Maybe not. It’s pretty close, though.
Here’s the funny thing. I bought both of these products, the router and the hard drive, at the Apple store. They were sitting right next to each other on the shelf.
“Gee,” I thought. “That makes so much sense! Airport has an AirDisk feature and a USB connection. This here 500 Gb Western Digital MyBook has a USB connection. I could hook these up and transfer files over WiFi! Not only that, but Leopard has Time Machine, an automated backup system that connects seamlessly to your external hard drive. Woohoo, I rock!”
Three months later, I am unable to hold a sustained connection to the AirDisk for more than an hour, even when it’s in use, such as when I’m transferring large files.
And if I let it idle for several minutes, forget it, it’s gone. It might as well not even be plugged in.
There are many posts online about this problem, some even on Apple’s support forums. Apple has yet to acknowledge the problem, even though people have been reporting the problem for over six months.
Not to mention, in what feels like a slap in the face, Apple recently announced their new Time Capsule product which is, unbelievably, an Airport Extreme wireless router combined with an internal 500 Gb hard drive. Guess what! You can transfer files over WiFi! You can use Time Machine as an automated backup system over the Airport connection!
I don’t know whether to laugh or cry. I do know that I’m pissed.
Apple, you’ve won today’s What The Phở? Award.
* Here’s my definition of “It doesn’t work.”
You bought a brand new Mercedes two months ago from the local, authorized Mercedes dealer. Every time you drive it—let me say that again—every time you drive it, the car comes to a dead stop in the middle of the road at unforeseeable intervals. The car’s still running. It just stops moving, frozen on the road. You’re about to pick up your kids. Stop. You’re getting on the freeway. Stop. You’re ten miles from home after a long day at work. Stop.
The only way to get moving again is to turn off the engine, turn on the engine, wait a few minutes, all the while tapping the accelerator every now and then because you don’t know if it’s going to move or not until you try. There’s no indicator for this.
So is this a working, reliable car, the type of car you thought you were getting when you picked it up brand new from the dealer?
What would be an appropriate response from the dealer? What would you say if I told you it was a known problem before you bought the car? Shouldn’t there have been some kind of warning on the car?
Okay, my definition is getting a little Extreme now. I know, moan, moan, moan, I have such a hard life.
[Perfect. Just as I'm writing this, the left arrow key on my 1-year-old, post-warranty Macbook is crapping out.]
Actually, the hovercar is the hovercar I’m waiting for.
From seeing the guided tour and reading the reviews so far, including John Gruber’s and Jason Kottke’s, I’m excited by the changes the iPhone brings to the market, but I’m not excited by the iPhone.
Continue reading …
Xanadu Star Theater, Cleveland, Ohio – Int.
Derek: No it’s not an exit. Not an exit.
David: We don’t want an exit.
Derek: No, that’s true.
David: Try this way.
Derek: I hope so. This way.
David: Wait, this looks familiar, though…it really does.
After stumbling around in the dark for the last several years I’ve decided to learn the fascinating Science of Computers from MIT’s OpenCourseWare. Up first, 6.001.
David: I don’t know, it’s in Indiana or something.