Archive for the ‘Apple’ Category
I finally finished migrating everything over from my old desktop to my new iMac. (I’m still amazed that a consumer-level Mac is more than twice as fast as my old high-end desktop… such is the pace of hardware, of course.)
At any rate, when I started working on one of my Rails projects, I was surprised to see that performance was really poor– much slower that on the old box. Then I realized that my Ruby and Rails installations probably got migrated by Migration Assistant.
Sure enough, ruby -v in Terminal revealed Ruby 1.8.6 for PowerPC/Darwin. This means that Ruby is running in PPC emulation, which explains the performance I was seeing.
Since Leopard ships with Ruby, this means that I now have two versions: in /usr/bin/ruby there’s the version that came with the OS, which is
ruby 1.8.6 (2007-06-07 patchlevel 36) [universal-darwin9.0]
In /usr/local/bin/ruby there’s:
ruby 1.8.6 (2007-03-13 patchlevel 0) [powerpc-darwin8.10.0].
This is obviously a problem…
Some Google time later, I came across this post on Punctuated Productivity; that set me in the right direction for uninstalling the old version and getting the new one up to snuff. His approach was to completely wipe /usr/local/bin and /opt/, which I found a little scary. Here’s a slightly more surgical approach.
- Remove the following from /usr/local/bin (sudo, of course):
gem*
update_rubygems
rails
rake
mongrel-rails
cap
capify
gpgen
index_gem_repository.rb
libpng-config
- Unfortunately, I had just installed and configured ImageMagick on the old box, which is a long and tricky process that I’ll have to do all over again. But since it was the only thing that I had installed on that day, so I was able to
open ./ to open /usr/local/bin in the Finder, sort by date, and select/delete all of the ImageMagick and RMagick files in a couple of clicks:
Magick-config
Wand-config
animate
compare
composite
conjure
convert
display
freetype-config
identify
import
libpng12-config
libwmf-config
libwmf-fontmap
mogrify
montage
pkg-config
stream
wmf2eps
wmf2fig
wmf2gd
wmf2svg
wmf2x
libpng-config
- My last uninstall step was to delete /opt after all, because only MacPorts (which I used to install ImageMagick) had put anything in there.
Now hash -r followed by which ruby correctly reveals /usr/bin/ruby, and ruby -v reports ruby 1.8.6 (2007-06-07 patchlevel 36) [universal-darwin9.0]
Now to reinstall Rails:
sudo gem install rails --include-dependencies
Next I have to reinstall ImageMagick and RMagick, which will hopefully be less painful this time around now that I know about MacPorts…
They did the right thing!
Tonight when I got home from work, I found this in my e-mail box:

Apparently, Apple used to provide video of WWDC sessions, but last year, they opted instead for streaming broadcasts of the sessions via “ADC TV”. With no mention of session videos at this year’s WWDC, everyone pretty much assumed the worst; for many, this was right up there with the quality of the food as a sign that the good old days days of the WWDC were long gone. So nay-sayers, say nay no more. Or something.
As of 12:45 this morning, there are 108 sessions available for viewing, with more sections labelled “Coming Soon”. Each session seems to contain an eBook of slides and a video of the presentation itself. (I’m not talking about what sessions are or are not there, because of the often-stressed NDA.)
Hopefully now that Apple has done the right thing and released all of this content, the dev community can take a deep breath and get back to coding the next wave of great apps for Leopard. Mine is already in progress…
I’m a 13-year veteran of web development (currently doing WebO) but a complete newcomer to Cocoa. Since WWDC I’ve been tackling learning Objective-C. I learn best by doing, so I thought up a little app that I could write while learning the language.
I was sitting on the porch having a cigarette, staring at my notebook and trying to figure out my object model. I was really afraid of making the wrong choice with the “isa” hierarchy and ending up with a really kludgy model. “Isa” doesn’t express relationships the way I want to with my application’s entities.
If this were a web app, I would have separate database tables for each entity, and lookup tables mapping the relationships. In the web app these tables would of course be represented as objects, and their relationships would be handled by the object graph.
But this isn’t going to be a web app, so how am I going to create that object graph with all of its relationships?
The term “Core Data” popped into my head, but I didn’t know anything about it other than the fact that it was featured in several sessions on the WWDC schedule.
A single Google search later, and I found an incredible tutorial by Scott Stevenson at Cocoa Dev Central called “Build a Core Data App“. The graphic in the header showed an entity diagram… and I knew that this was what I was looking for.
The tutorial walked me through creating a sample blogging app that has Topic, Post, and Author entities, each with attributes and relationships. The data modelling is done in XCode– which I didn’t even know was possible– and then the data model is available to Interface Builder to bind to the view.
At a couple of milestones in the tutorial Scott recommends building and running the application to see how things are coming. The first time I did this, I entered a few lines of random text and played with the interface before quitting and resuming the tutorial. The second time I compiled and ran the app… the data from the first run was still there. This freaked me out. Sure enough, there was an XML file in ~/Library/Application Support/BlogDemo/ with my junk data in it.
Core Data is going to make a huge difference in the way I approach Cocoa in general and my app in particular. I’m particularly grateful to Scott Stevenson for his clear writing and illustration.
Okay, so my post-WWDC, desktop-application-envy got the better of me. Since I learn best with a project in my head, my laptop at hand, and a book at my side, I’m now working my way through a series of Cocoa and Objective-C books.
I just finished the first in my stack, Learning Objective-C on the Macintosh, by Mark Dalrymple and Scott Knaster, available from SpiderWorks.
I’m a long-time O’Reilly fan, but despite being burned on occasion by poor editing and worse writing, I’m not as averse to buying outside of their catalog as I used to be. And it’s paid off this time: I’m really glad that I chose this particular book to start with.
I love the fact that the authors focus on the language, not the environment. Interface Builder isn’t covered until the very last chapter of the book, and there’s rarely even a mention of XCode itself throughout. The sample code that you start writing at the beginning of the book gets refined as new concepts are introduced, and there’s nary a user interface in sight.
The chapters are short and clear and tend to focus on single concepts, with a sample-code-to-copy ratio that makes reading easy and skimming easier. The chapter on memory management and the autorelease pool alone (reinforced in subsequent chapters) made the book worth the money.
Learning Objective-C on the Macintosh also features an appendix highlighting differences between Objective-C and other languages, intended to make things easier to understand for those who are learning Objective-C after having mastered another language like C, C++, or Java first.
Attentive readers may ask: what is the Cocoa project that’s in my head? Really attentive readers will know that I’m not gonna tell yet. Attentive readers who know me personally may doubt that any such project will ever see the light of day, but they’re not being nice. (Psychic readers: no spoilers, please.)

I had the good fortune to be sent off to Apple’s WWDC event for work this month. It was an incredible experience, and the only reason that I haven’t blogged about it up to now is the fact that I’m exhausted from bouncing between three different timezones in as many weeks.

I travelled with someone from my team so that we could split up between relevant sessions that were scheduled at the same time. We covered off on every WebObjects and Java session, and also signed up to spend time with Apple engineers to address performance tuning, debugging, and user experience for some of our existing web apps. I was struck by the fact that there was no session that we attended that felt like a waste of time– we learned something new and immediately useful in every case.
We also went to the WebKit Open Source party and, of course, the big party at the Apple campus. I ran into an old colleague, Jon Monroe from Actual Technologies (purveyor of fine ODBC drivers for OS X) and enjoyed the opportunity to catch up with him over Venetian tapas, beer, and diner food. (I last saw Jon on our MacWorld adventure two years ago.)
There are a lot of specifics that I can’t discuss because of the NDA with Apple, but trust me that, the lukewarm keynote presentation notwithstanding, there are a lot of cool new under-the-hood technologies rolling out with the next generation of OS X. Smart developers will be turning out some pretty amazing applications for Leopard.
Although we will be able to tap into some of these designed-for-the-desktop technologies in WebO, through some very cool tips that we picked up through conversations with Apple engineers, I’m feeling somewhat jealous of desktop application developers at the moment.
LazyWeb call to action: someone needs to invent a term for the creation of a blog entry as an act of goodwill and permanent record, following on an arduous and unfruitful Google crusade to find the answer to a tricky and obscure technical problem. (See why that needs a buzzword?)
The background:
My house radiates WiFi like nobody’s business, we’re all laptopish, and I’m fairly paranoid. I hated the idea of checking mail over an unsecured connection, even with the (questionable) protection that a secured WiFi network brings. My hosting provider offered a self-signed SSL certificate option, so I started using that about a year ago.
The problem:
Every time I launch Mail, I get a dialog box for each of half a dozen accounts stating “Unable to verify SSL server pop.idolhands.com”. That’s really, really annoying.
The sarcasm:
Thanks, Apple, for naming your mail client “Mail”. That makes a Google search really, really easy.
The solution:
-
Click on “Show Certificate” in the “Unable to verify SSL server…” dialog box. A new pane will appear containing more information about the certificate.

-
Option-click-drag the certificate icon in the certificate pane to the desktop. You’ll end up with a file named whatever.server.com.pem
-
Double-click the .pem file. It will open in Keychain Manager, and a dialog box will open asking you if you want to add the certificate to a keychain.
-
Important: select “X509Anchors”, not your account keychain, from the Keychain drop-down.

-
Click OK. You will be prompted for an admin password.
Note to Apple: while accepting self-signed certificates without a warning would be a Stupid Thing, and arbitrarily allowing users to permanently trust these certificates would be a Bad Thing, reading a stern warning and providing an admin password authorization should be the Only Thing that one has to do in order to trust a self-signed certificate. This obscure, non-inuitive 5-step approach stinks of security through obscurity.
|
No Comments »