June 2007 Archives

PSIG 104 | JS <3 ObjC June 26, 2007 12:04 AM

(What is PSIG? | PSIG 104 announcement)

Items of Interest
  • The meeting began with a session of forced pre-WWDC iPhone speculation ^^;
  • Dave announced he'll be writing a column on beginning Mac programming for MacTech!
  • Definitive guide to SQLite: SQLite is great for read-heavy apps, like blogs, but it's limited when comes to writing, as you can only write when no other accesses are occurring.
  • Learn F-script in 20 Minutes, The Wizard of Menlo Park
  • Tom: iden.tify.us was featured on Mashable!
  • Paul: Building windows machines "a royal pain in the tush" -- alas no combo updates.
  • Wolf on backups: Rsync works well except for resource forks; however, if you really care about maintaining absolute data integrity, use SuperDuper. (This reminds me, I totally had a dream the other night that my only-partially-backed-up MacBook fell apart into tiny irreparable pieces. Oh, and that random thunderstorm last week completely toasted one of our WinXP boxes. Heh...)
  • Hacking MacOSX Tiger
  • Paul got into true old-fashioned Show and Tell mode and presented to us some random, interestingly-designed objects: Voss water bottles, weird tape dispenser, an impact stapler.
  • Gorman's been busy with wedding preparations. "Does it involve writing software?!?" "Yeah..." He's doing an WebObjects app for his wedding registry.
  • Dan quotes his Roosevelt professor on the Unix lab which is actually comprised solely of Emacs: "Why Macs? I start the semester with 16 working machines, and I end the semester with 16 working machines."
  • Wolf: The Accidental Mind
  • Wolf on the relative lack of interest in HOPL III: "This is why software's doomed."
  • WebKit open source web browser engine -- looks like a neat project. The new Web Inspector sounds especially interesting.
JS <3 ObjC

Introduced in OS X 10.4, the JavaScript-ObjC bridge is currently the only officially-supported bridge. The bridge makes it easier to work with AJAX libraries, JavaScript plugins, JSON and DOM (jquery). It also gives you access to regexes (which aren't built into Cocoa) and helps you build WebKit UIs. It's somewhat limited compared to other bridges as it was created specifically for the development of dashboard widgets (which, essentially, are just webpages made with HTML, CSS, and JS). The bridge automatically morphs over numbers, strings, and arrays, but not dictionaries.

Running JS from Objc is simple:
- [WebView stringByEvaluatingJavaScriptFromString:]

With a WebView (which can be hidden), you can call any JS from ObjC.

For security reasons, there is more resistance when calling ObjC from JS. By default, all ObjC selectors and keys are excluded from JavaScript access. You override the boolean methods isSelectorExcludedFromWebScript and isKeyExcludedFromWebScript to allow access.

Security note -- anyone can open up your package and view the JS and HTML, so it's a good idea to put the more sensitive stuff in the compiled ObjC. (However, says Wolf, f-script would get you through that, too :).)

Last weekend I was at BARCamp Chicago! Perhaps a post on that at some point...

5 Comments

PSIG 103 | PackageMaker June 25, 2007 11:05 PM

(What is PSIG? | PSIG 103 announcement)

Items of Interest

Installer packages

.pkg -- The package format includes two key components: archive.pax.gz, where files are gzipped up with the pax archiving tool, and archive.bom, which contains the permissions metadata pax can't handle.

.mpkg -- Meta-packages are packages of packages, often used by Apple for system software. This is what enables the screen of checkboxes that allows the user to specify which components to install.

PackageMaker.app is Apple's GUI tool for making .pkg files. It's nice in that it gives you a sort of realtime preview of your installer, but it's hard to understand and crashy (it actually crashed during the demo). One thing to note is that when PackageMaker refers to "root," it's actually talking about your source folder, where you recreate your directory structure. Another thing interesting is that if you set your identifier (i.e. com.violasong.pkg.killerapp) in the package version, the install button will display "Upgrade" instead of "Install" if it detects an older version.

Other notable tools are Iceberg, an open source GUI packaging tool with a more direct UI, and the Pacifist extraction tool, useful for extracting your files without Installer.app for sanity-checking purposes.

It is recommended that you use GUI packaging tools only to generate the required description.plist and info.plist files, which can then be modified and reused to work with an automated command line solution. Wolf gives us a handy script that provides just that! You will unfortunately have to decipher a code in order to acquire said script.

Or if you are lame, you can click here instead. Enjoy!

Art notes: I have explored a few different possibilities in anthropomorphizing packagemaker.app.

  • In my polisci notebook, a doodle of cheery young fairy girl packaging a sweet potato into a box. There is also a bad sketch of an elf wrapping a pumpkin in a square of cloth.
  • In Photoshop, a blood-soaked, battle-scarred humanoid with glowing eyes and long green hair, packaging a small magic fruit into a golden capsule. After several evenings of high-res labor, I pretty much deemed it unfit for public viewing or further development.
  • In Photoshop, a weeping grayscale Cherokee man holding a large cracked egg.
  • In my proper sketchbook, a hasty pen drawing of an ugly version of the fairy girl holding a small version of the humanoid's magic fruit capsule.
  • Also in my sketchbook, a terrible pencil sketch of a foodservice operator eating the .PKG icon; the only image I decide to show the world, naturally.

No Comments