Snow Leopard’s file system changes

Mac OS X 10.6 “Snow Leopard” brought a slew of under the hood changes. There are two distinct but related changes that Apple made that most users will probably never notice and many developers probably never will either. But if you happen to be someone who works with the file system, these changes may affect you. These changes are:

1. KB vs. KiB. That is, is a kilobyte 1000 bytes or 1024 bytes.

2. file-system-level compression of files

Since I recently went around with these, I felt it’d be worthwhile to share what I discovered, since there isn’t much information out there on the topic. The only thing I found that remotely discussed the matter was this page of Ars Technica’s Snow Leopard review.
Continue reading

But what if you need more when installing?

As a developer of Mac OS X software, how to deliver that software is an issue of constant battle.

Long long ago, everything was shipped as either an installer or just in a StuffIt archive. Typically applications came in installers and the only thing in StuffIt archives would be non-applications (documents, pictures, other data).

Mac OS X tries to change this by simplifying things using drag-installs. It’s actually a very simple process of download, drag the application icon to the Applications folder, and off you go. But, even something as simple as that can prove too confusing for the lay person, or at least it allows for a host of problems. Installers still exist as well, and there are many other modes of delivery and installation out there.

Various bloggers have been discussing the issue. It starts with FireFox distribution issues, where they ultimately conclude that you should just ship an installer and piggy back off other mechanisms (e.g. automounting of .dmg’s). John Gruber counters that we should just use .zip files, and makes rather compelling arguments for that approach. Chris Clark also agrees with using zip archives. Andy Kim takes it a bit further and actually starts to touch on what I’m going to hit at.

All of these solutions are nice, but they all seem to target one thing:

Very simple applications.

If all your application is is itself, then I guess that’s fine. But what if your application has more than just the application itself? What if it needs to install drivers or other kernel extensions? What if it had launch agents or daemons? How about other plugins that need to be installed? Maybe something that requires a restart of the machine? What if you need to run scripts to deal with housekeeping (e.g. to help upgrading past users to the new version of the software)? All of these simplistic approaches just do not cut it.

Some would argue this should be a part of the application itself. That is, self-healing applications. I see merit in that approach and it could be a solution that solves this and the initial download-and-install problem. But it is not a panacea.

The ultimate problem is there is no one-size-fits-all solution, which seems to be what people are proposing… or at least, they’re not considering the wider scope that some developers may need in the install process. Apple seems to have the tools in place, but isn’t quite there. What ought to come would be:

  • A new installer format. It could be an archive holding all the parts to be deployed, but it should allow for logic to be applied during the install (e.g. use of shell scripts, etc.).
  • This format is understood by the OS, so when applications such as Safari download them, they can start the install process. Of course, we have to be mindful that some people could use this for nefarious purposes, so being fully automatic is not ideal… asking the user would be helpful. Using code signing and other forms of trusted computing may help here.
  • The notion of installing then isn’t just some file format, but is also considered an end-to-end process, from either downloading the software or inserting the removable media that has the software on it, to getting the software installed, configured, registered, and cleaned up after (optionally removing older versions of the software and its support files, removing any archives, trying to leave the machine in a cleaner state than before it started). Get the users going the whole way through. It should “just work”; Gruber’s mention of how the iPhone works is apt.
  • To publish a set of tools AND guidelines on installer creation. Apple goes through a lot of trouble to establish human interface guidelines on how applications should work. Apple can and should do the same with installers so that the experience of getting software to users can be as simple and pain free as possible, but also as consistent as possible.

The big problem we have today is too many approaches to installing software. Everyone has different needs and different thoughts on how best to approach it. I’ve had debates at my office about how we should deliver our software, and it’s difficult to achieve consensus because all approaches have strengths and weaknesses. This only serves to hurt the user because there isn’t one way that “just works” for them to get to know and be comfortable with. Every install process is different and unique, and for the non-geeky types, just frustrating and confusing.

I hate to say it but the movement to improve this will ultimately have to come from Apple. It’s their platform, it’s their user experience that they wish to control and dictate. Ultimately Apple must be the one to improve this.

Can we 3rd party developers do something about it? Sure. We could work to tackle the problem, publish our own guidelines, create tools to help out. But I’m not sure how far it would get. Efforts like Growl, Sparkle, solve some great problems and didn’t come from Apple and have gained a tremendous amount of traction in the developer world. Still, some venture to do it themselves. Code solutions are good, but guidelines are better so if you have to do it yourself, at least some guiding principles can be followed with the hope of still making things good for the user.

Where to start?

Bulletproof Carbon

Check this. Carbon nanotubes being used to make bulletproof material.

Nanocomp Technologies, is the first in the world to make sheets of carbon nanotubes — microscopic tubes stronger than steel but lighter than plastic. The Pentagon has financed much of the Concord, N.H., firm’s work; stakes include the $500 million U.S. market for body and vehicle armor, which is currently dominated by DuPont’s Kevlar.

In April, [Nanocomp’s owner, David] Lashmore had a mechanical multicaliber gun shoot bullets at different versions of his sheet, each less than a fifth of an inch thick, at a speed of 1,400 feet per second. Four sheets were breached, but three showed no damage. Lashmore and his 35 employees were ecstatic.

[…]

Army tests show the material works as well as Kevlar. The military also hopes to replace copper wiring in planes and satellites with highly conductive nanotubes, saving millions of dollars in fuel costs.

It’s interesting. Lashmore was able to grow nanotubes large enough to make into yarn and sheets, and from there they can do whatever. Gotta wait to see where this is going to go.

Mac OS X x86 debugging

It’s been ages since I’ve had to do anything dealing with assembly language. And while I may not have to do much programming in it, it’s still a useful thing to know when it comes to debugging.

Today I’ve been trapped in debugging hell. We’ve got some code that works fine on Mac OS X versions prior to Snow Leopard (10.6) but seems to hang under 10.6. The code flat out executes differently. I watch how our code is invoked and things just don’t happen in the same order across the OS versions. Apple must have done some major under-the-hood changes to NSBrowser and NSTreeController. And since we’re using Cocoa Bindings, it’s a bitch to debug. Everything that’s happening is happening because of Key-Value Observing (KVO). I get somewhere into the bowels of NSBrowserBinder and it appears to be looping… looping… and never exiting the loop for some reason.

Now that we’re in the new x86-based world order of Macs, I went looking for some tips to help me work with debugging the x86 assembly so I could see what the OS was doing. I found a few useful resources.

Greg Parker at the Hamster Emporium has a great article about crashing in objc_msgSend and how to decipher the crash. I wasn’t crashing, but still there are some nice gdb commands and interpretation of the registers.

Then over at the Google Mac Blog, a 2 part article on spelunking. Part 1 and Part 2. These aren’t debugging articles (more like trying to hack around and discover how undocumented functions work), but they still explain a bit about how the x86 ABI works, AT&T syntax, and how Mac all mesh together. Note that Avi Drissman previously published the same article in his own personal blog, but edited it a bit for republishing in the Google blog.

Clark Cox provides a handy table on how to inspect Objective-C parameters in gdb.

And you thought the only thing I knew how to blog about was guns. 😉

How to manage geeks

An article from Computerworld on how to manage geeks.

Speaking as a geek, I can say that article is sound. Old school management practices will not work. Once you understand the geek, you’ll see that typically the best thing to do is let them do their job… get out of their way, shield them from crap, do things to enable them to get their work done.

And then we shall… and it shall be productive and glorious. 🙂

Search term grab bag

Let’s delve into the search terms and see what people are searching for now that wind them up here at my blog.

apple os x “snow leopard” gcc version

Technically, 4.2. However, there’s new stuff coming from Apple in terms of complier technology. Check out LLVM and Clang. This Ars Technica article on Snow Leopard has a good discussion of the compiler situation. Heck, the whole article is a good read regarding the real nuts and bolts of Snow Leopard.

contrast sights vs 3 dot sights

I believe contrast is good. Good shooting technique has you focusing on the front sight. Thus, things to help your eyes pick up the front sight are good. Furthermore eliminating things that can distract your eyes are also good. Thus, increasing the contrast between your front sight and the rear sight, between your front sight and your surroundings, IMHO these things are good.

That’s one reason I don’t like 3-dot sights. When you’re trying to quickly get a sight picture, now you have 3 dots to choose from, which is the front sight? If you’re moving fast it doesn’t take much to have the gun pointed slightly askew and actually having the front sight appear to the right or left. Or maybe the front sight doesn’t appear at all and you mentally ask yourself “is that the front sight?” You don’t need to waste time trying to determine “is that the front sight.” It should be definitive.

My current setup is using a set of Dawson Precision sights. The rear is just flat black, but very crisp, sharp, and no-glare. The front is a simple post, but has a red fiber optic insert to help draw my eye. The fiber isn’t used for aiming, just to make the front sight stand out so your eyes come to it. Otherwise, the sights act like any other notch-and-post type sights in terms of aiming.

a 9mm round is equal to what caliber

A 9mm Parabellum bullet is about a .36 caliber. Or maybe .35, depending how you round (.355″).

what does lswchp mean

Lead Semi Wad Cutter Hollow Point. A type of bullet.

is prvi partizan ammo safe in m1a?

I’ve used their .308 Winchester 168 grain match ammo in mine, and it’s been fine.

There’s nothing on the list that seems to say otherwise. My experiences with Prvi ammo have been good, and the reviews and comments I’ve read online have been generally positive about Prvi ammo in general. IMHO it’s not the best ammo in the world, but it’s good stuff and I have no aversion to shooting it in my guns.

where to store pistol home defense

I would say, where it’s handy to serve it’s purpose. I keep the dishwasher near the kitchen sink, because that’s where it’s most handy for its purpose. I keep the TV remote control by my La-Z-Boy recliner because that’s where it’s most handy for its purpose. I keep the toilet paper next to the toilet because that’s where it’s most handy for its purpose. Think about these examples. If the useful tool was not where you wanted it when you wanted it, what good would that be? Why do people store their remote controls up by the TV? If I wanted to get off my butt to change the channel, I wouldn’t have a remote control in the first place. 😉

But of course, you may have additional issues to consider, such as children in the home. I always liked Kathy Jackson’s take on things. Go read her stuff. No point in me duplicating it here.

Another possible issue is appearances. Depending who you are and/or where you live, to have a rack of guns openly about in the house may be no big deal, or it may be impermissible. You may have to consider other options.

When I think about where to store, my main concerns are access and safety. To ensure those who should get to it can get to it promptly when needed, and those you shouldn’t get to it can’t. And to be safe about it to ensure no one, save the one deserving it, gets hurt. But I am not a lawyer, and this is not legal advice.

will a 9mm stop a person

A 9mm what? Oh, I’m sure they mean bullet.

If it’s placed correctly, yes it can.

.45 vs 9mm handgun difference

One shoots a .45 caliber bullet, the other a 9mm caliber bullet. Duh! 😉

3 dots on my nuts

I don’t want to know what that’s all about.

fingers hurts when typing

“Doctor, it hurts when I do this.”

“Don’t do that.”

best offensive gun

Now I admit, that’s a search term twist. Most people are always searching for the best defensive gun or other defense-related terms.

I would say that it doesn’t really matter. To be offensive or defensive depends more upon your mental state, your skills, your situation; that is, you. The gun, it’s just a lump of steel. It’s not the gun, it’s what you do with it.

Or maybe they don’t mean offensive as in “going on the attack.” Maybe they mean the best gun to offend someone with. I guess again it would depend. Paul Helmke, any gun. Carolyn McCarthy, any gun with a shoulder thing that goes up. For Xavier, he’s got a whole collection of ugly guns and shows them off every Sunday. For Charlton Heston, the one taken from his cold dead hands. For Ted Nugent, the one that caused him to miss that white-tailed deer. 🙂

Snow Leopard cometh

Mac OS X 10.6 “Snow Leopard” is due tomorrow, August 28, 2009.

Macworld has a series of articles discussing the new OS version.

As a Mac software developer I have to keep up with such things. Frankly, the Snow Leopard update isn’t all that sexy for end users. You’ll see there’s no massive nor major feature list upgrade, which is a change. Every upgrade of Mac OS X so far has been a big step forward, so this is the first small step. Frankly what that points to is a maturing of the OS, and I think that’s welcome. We don’t have to be chasing the latest thing all the time and plunking down a lot of money to do so. Well, at least end-users don’t have to be… what Snow Leopard really brings about are a lot of under-the-hood changes that affect us developers far more.

Still, I have people asking me if they should upgrade. That’s up to you. Some people like to have the latest stuff, so if you like being on the cutting edge, then by all means be there at midnight when it goes on sale. One big feature for end-users is built-in support for Microsoft Exchange. If you have to work in an Exchange-based environment, you may find this quite welcome.

I must admit that I’m still a bit of a hold-out from converting fully to Apple’s own software. I still use Microsoft Entourage for my email because frankly it’s been the best Mac email client for a number of years. I have moved my calendaring to iCal (tho ToDo’s remain in Entourage because iCal’s doesn’t cut it), and with the purchase of the iPhone I have to use the Mac’s Address Book a lot more (thankfully Entourage can sync between its address book and Address Book.app). But with the massive amount of email, folder organization, rules, automation, and other such things it’s just tough for me to make the transition… probably take me a day or two just to try to get it all set up, and when I’ve attempted it in the past I discover Mail.app just isn’t quite there. But now with the Exchange support built-in, there may be more feature parity and it may work out. So I’ll probably reevaluate it at some point. The reality is, you do get further on the Mac working with Apple’s technologies because things like Address Book, iCal, Mail, etc. are all well-integrated into the system. They mesh with your iPhone better. Plus since developers can have access to such things (e.g. the Address Book API’s) the greater user experience can be enhanced if you’re taking advantage of what Apple provides. While some people don’t like this “monopoly-style” approach to things, it’s actually what makes the Mac such a great end-to-end experience. Instead of lots of disparate parts that don’t really hook together well causing the end-user a lot of frustration in accomplishing simple tasks, you’ve got parts that integrate well together from the hardware level through the OS lower layers to the higher layers to the end applications, and with everything hooking together, things can “just work.” User experience is so important and that’s what really differentiates Mac from other platforms.

So we’ll see. For me the key is being able to get my work done in a day with minimal-to-no hassle. So far so good, so it’s tough to want to change unless I can see improvement in that area.

But being a developer, I have been using Snow Leopard for a while and find that it’s just another upgrade. Being a “minor” upgrade for users, the impacts to me as a developer mean that I’ll still be supporting Mac OS X 10.4 “Tiger” for some time. Believe it or not, users are still using Tiger a fair amount. I can’t say why, but one possible reason is Tiger is the last version of the OS to include “Classic” support. If people are still relying upon Mac software from years gone by that was never rebuilt to be Mac OS X native, they would want to stick with Tiger. Trouble is, it’s going to be harder and harder to maintain that. Snow Leopard itself is Intel-only: PowerPC-based Macs are officially heading off into the sunset. Still, there’s not a whole lot at least in the work I do that would force one of my products to be Snow Leopard-only, and while I’m certainly working on a few Leopard-only things, so long as Tiger users exist and continue to buy software while holding out on that 4+ year old OS well… we’ll keep supporting Tiger users. Of course one potentially limiting factor will be Apple’s developer tools. Snow Leopard’s version of Xcode 3.2 does not install things for targeting 10.4… you have to do a custom install to get them (seems to be SDK 10.4 and gcc 4.0.x); so the writing is on the wall even from Apple: move forward.

Frankly, that makes sense for Apple. You see, at the heart of it all Apple is a hardware company. To make things like Mac OS X, iWork, and other bits of software, that’s really only done to make the hardware functional and useful. Macs, iPods, iPhones — it’s all hardware. The family iMac is a PowerPC G5-based iMac. It’s long in the tooth, no doubt. I’ve been wanting to replace it with a new Intel-based iMac for some time, but I have a rule with hardware purchases. You see, everyone always wants the best and wants to minimize obsolescence. There will always be something bigger, better, faster, cheaper somewhere on down the line, so there’s really nothing you can do about it. So you use what you’ve got as long as you can, push it until you truly cannot wait any more… not just desire wait, but some larger need. Then buy the best you can afford. So now that PowerPC is officially dead to Apple, eventually the family iMac just won’t be able to cut it any more. It should last a bit longer, but push is coming to shove and a new purchase is in the wings. Works well for Apple’s bottom-line, doesn’t it? 🙂