Categories
computer

Debugging JavaScript With Safari

I usually use FireBug and other FireFox-based tools for troubleshooting JavaScript issues, but never found a solid way to approach it in Safari, my primary browser. It turns out that the nightly builds of WebKit (Safari’s core) also come with a great utility called Drosera.app, which allows you to attach to a running WebKit process and get funky with a JavaScript console.

w00t l00ps! drosera.png

Categories
computer

Writing Good Error Messages

I received this little note from my Mac today.

mac_low_battery_warning.png

This made me feel all warm and fuzzy inside despite the interruption of my work because it satisfies my general criteria for displaying error messages to users.

  1. A graphical severity indicator is given so I know whether or not to care.
  2. It provides a succinct, human-readable desciption of the issue. (No “ERROR CODE: 23DD8” crap which is meaningless to the user.)
  3. An immediate, resolvable course of action is given to the user. Providing this makes the user feel empowered and accomplished for acting. Neglecting this makes the user concerned and irritated.
  4. A description of future symptoms is given for when/if the user does not take the suggested course of action. This gives the user reason to do what you’re asking.
  5. It shut up about the issue when I clicked OK and let the failure happen like it told me it would. When I noticed my mouse wasn’t responding I immediately remembered why.

The dialog is in stark contrast to this nifty gem constantly pooping out of my Solaris kernel..08-21-07_1354.jpg

“Pin widgit 27 is EAPD capable.”

WTF??? What the heck is a “pin widgit” and why do I care if it’s “EAPD capable”? Is this even a bad thing? Do I need to do something here? What happens if I ignore this, which I most definitely will since I have clue what it’s talking about? Why does it tell me this every time I start the machine?

Criteria failure on all counts. Bad computer!

Categories
computer

Ruby Troubleshooting: Hpricot On OS X Leopard

If you upgraded to Leopard, you may be getting this nasty error when trying to install Hpricot, which is required by other popular gems such as mechanize..

preston$ sudo gem install mechanize
Password: ********

Bulk updating Gem source index for: http://gems.rubyforge.org
Install required dependency hpricot? [Yn]
Select which gem to install for your platform (i686-darwin8.10.3)
1. hpricot 0.6 (mswin32)
2. hpricot 0.6 (jruby)
3. hpricot 0.6 (ruby)
4. hpricot 0.5 (ruby)
5. hpricot 0.5 (mswin32)
6. Skip this gem
7. Cancel installation
> 3
Building native extensions. This could take a while…
ERROR: While executing gem … (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby extconf.rb install mechanize
checking for main() in -lc… no
creating Makefile

make
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.3 -I. -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -c hpricot_scan.c
cc -dynamic -bundle -undefined suppress -flat_namespace -L/opt/local/lib -L”/opt/local/lib” -o hpricot_scan.bundle hpricot_scan.o -lruby -lpthread -ldl -lobjc
/usr/bin/ld: /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libpthread.dylib unknown flags (type) of section 6 (__TEXT,__dof_plockstat) in load command 0
/usr/bin/ld: /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libdl.dylib unknown flags (type) of section 6 (__TEXT,__dof_plockstat) in load command 0
/usr/bin/ld: /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libobjc.dylib load command 9 unknown cmd field
/usr/bin/ld: /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libSystem.dylib unknown flags (type) of section 6 (__TEXT,__dof_plockstat) in load command 0
/usr/bin/ld: /usr/lib/libSystem.B.dylib unknown flags (type) of section 6 (__TEXT,__dof_plockstat) in load command 0
collect2: ld returned 1 exit status
make: *** [hpricot_scan.bundle] Error 1

Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/hpricot-0.6 for inspection.
Results logged to /opt/local/lib/ruby/gems/1.8/gems/hpricot-0.6/ext/hpricot_scan/gem_make.out

The issue is that Xcode 3 must be upgraded as well; Hpricot’s native components cannot be built with the older Tiger development tools on Leopard. After installing Xcode 3 from either your Leopard DVD or Apple Developer Connection, run the install again…

preston$ sudo gem install mechanize

Install required dependency hpricot? [Yn] Y
Select which gem to install for your platform (i686-darwin8.10.3)
1. hpricot 0.6 (mswin32)
2. hpricot 0.6 (jruby)
3. hpricot 0.6 (ruby)
4. hpricot 0.5 (ruby)
5. hpricot 0.5 (mswin32)
6. Skip this gem
7. Cancel installation
> 3
Building native extensions. This could take a while…
Successfully installed mechanize-0.6.11
Successfully installed hpricot-0.6
Installing ri documentation for mechanize-0.6.11…
Installing ri documentation for hpricot-0.6…
Installing RDoc documentation for mechanize-0.6.11…
Installing RDoc documentation for hpricot-0.6…

Success!

Categories
computer

OS X Ruby Troubleshooting: "command not found: dot"

If you’re trying to run rdoc but are getting errors like..

Generating HTML…
Diagrams: ./opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27: command not found: dot -Tismap dot/f_0.dot
./opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27: command not found: dot -Tismap dot/f_1.dot

..the package you need to install is called graphviz. You can install it using Darwin Ports on OS X like so..

sudo port install graphviz

Categories
computer

Parallels Desktop Coherence Mode Rocks: OS X/Windows XP Screenshot

I tried Parallels Desktop‘s Coherence mode today, and was so blown away I had to blog about it immediately.

parallels-coherence-mode-small.png

The above image has not been doctored. It’s my normal OS X desktop with Windows XP running in coherence mode. When activated, the window around the XP virtualization session vanishes, the XP taskbar integrates into your OS X desktop, and XP application windows are free to float around. With Parallels Tools installed each XP application has a dock item which can be Command-Tabbed to. If you look closely you can see I’m running IE 6 next to Safari, both natively, without the visual distraction of the virtualization window. This is a huge usability landmark. Thank you Parallels!

Try it yourself by selecting the View -> Coherence menu option when running Parallels Desktop.

(Question: Does VMWare currently have a feature like this?)