Begin main content

Apple Museum

After a rejig of my office, there is finally room for the Apple museum. More pieces to come!

Apple Museum

Your eyes don't deceive you, that is a 5 1/4 inch drive - the processor direct slot has an Apple // card in it (which was designed for the LC, which my parents bought it with, but it works great in the Colour Classic).

09:10 PM, 22 Feb 2012 by Mark Aufflick Permalink | Comments (0)

Apple Push Notifications Talk—Screen/Audio recording now available

Thanks again to the guys at the Apple University Consortium for inviting me to speak at /dev/world 2010. The screen/audio recordings are now available. I have linked to them (and the rest of the /dev/world presentations) on my APNS talks page:

http://mark.aufflick.com/talks/apns

07:00 PM, 02 Mar 2011 by Mark Aufflick Permalink | Comments (0)

Quickly add PDFs to iTunes/iBooks

Being able to transfer PDFs to iBooks on your iPad and iPhone is really handy. But sometimes it's a pain to either make or track down an actual PDF file. Here's how to do it painlessly.

For any non-PDF document, you can print to PDF and open it in iTunes. But you can collapse that with this neat tip from MacWorld.

If you want to quickly add a document or a web page to your 'Books' collection in iTunes, all you need to do is to create an alias of iTunes and drag it to ~/Library/PDF Services. Now, when you're browsing the web or viewing documents and you decide that you want to read them later on a portable Apple device just hit Print, click the PDF button on the bottom left corner of the window and choose iTunes. iTunes will launch and receive the PDF. Next, sync your device and you're ready to go.Source

But what about when you've got a PDF already open in Preview (say you clicked a PDF download link)? Sure you could save to desktop, drag into iTunes, delete it. Or find 18e3764.pdf in your download folder etc. But if you're any kind of Mac commandline nerd, you will already have DTerm installed (if you don't - do yourself a favour and go check it out).

So you have a PDF open in Preview (or any other PDF app) - just hit your DTerm shortcut key combo (mine is Command-Shift-Enter), then type open -a iTunes then hit Command-Shift-V. (this pastes the path of the current window's file into the DTerm commandline) and hit Enter.

Now your PDF is in iTunes, already highlighted ready for you to change the title if needed.

10:30 PM, 18 Aug 2010 by Mark Aufflick Permalink | Comments (0)

Debugging release/autorelease issues in Cocoa

So your code crashes with an EXC_BAD_ACCESS in objc_msgSend and there is *none* of your own code in the stack trace. Bummer. Since all we know from objc_msgSend is that it's trying to call a method on an object. Since we got EXC_BAD_ACCESS you can bet your bottom dollar that it's attempting to call a method on a freed pointer, so there's no obvious way of finding out what the object was. We can, though, easily find the method. Read Greg Parker's excellent post So you crashed in objc_msgSend(). For the iPhone simulator on my Mac I need to do this at the gdb prompt to decode the eax register:

(gdb) x/s $ecx
0x980530c4:	 "release"
you can see that the selector in the second argument is "release". Now we're getting somewhere, we know an already freed object is trying to be released. Since there is none of our code in the stack trace it's a fair bet that it's happening when the autorelease pool is releasing.

There are a few tricks in your toolbox for tracking down over-released objects. There's the NSZombieEnabled, NSAutoreleaseFreedObjectCheckEnabled and other environment variables which will give you better logging rather than just crashing.

I've found this is not always reliable (logs from the above builtin debug options showed that the over-release was on an NSCFDate object, when in fact it was an NSNumber). Sometimes you also just want to trace through exactly what is happening with your retain/release/autorelease cycles. That's what we're about to achieve here.

Ok, so you have a unit test that replicates this problem right? I use the excellent GHUnit by Gabriel Handford. If not you'll have to play around a bit to narrow down your problem code. In my case, I wanted to confirm that a particular unit test was failing during the autorelease pool release. Best way is to wrap the offending code in a new autorelease pool. Then it will be freed inside your code, which you will see in the stack trace, and confirm you have found the reason. My unit test now looks like:

(Note that the code examples, embedded in github gists, are not showing up in my RSS feed. I'll fix that later, but for now please read the original post)

Now when I fail with EXC_BAD_ACCESS my stack trace looks like this:

Where line 91 of CJTestCJCard.m is the [pool release] call above. So something is being added to the autorelease pool, and is *also* being fully released, or maybe it's being added to the pool more times than it is being retained. There doesn't seem to be a way to interrogate the contents of the autorelease pool (which is a shame) but we log some really useful info by overriding a few methods, like NSObject's release and autorelease methods, so we can see when things are being added to the pool and when things are being released. This is some funky stuff, but since we're only doing it in our unit test class, not code we're going to release you can sleep soundly at night. Here's how I effected logging in release and autorelease.

Add this to the top of your unit test class, before your current @implementation:

Now in your unit test class @implementation, you can use the setupClass method to effect the method implementation switcharoo:

Now your log will be filled with log lines like:

This can help when tracking down tricky releasing bugs. Note that not all classes seem to comply. For instance I see plenty of log lines for NSCFString, but never any release lines. I assume that NSCFString release implementation is a bit different since it's a toll free bridged object - getting that to log is an exercise left for the reader!

If you're interested in the functions I used above to interact with the runtime, check out the Introduction to The Objective-C Programming Language and Objective-C Runtime Reference. Note that the code above works fine in the iPhone simulator. It should be fine on 64 bit Mac apps, but you may need to diddle the method structs manually in 32 bit Mac apps since they use the legacy Objective-C runtime (which you can read about in the Objective-C 1 Runtime Reference).

Also note it won't work on the iPhone itself, so to save constantly commenting out code, you can wrap the offending code in #if TARGET_IPHONE_SIMULATOR #endif pairs.

08:38 PM, 13 Jan 2010 by Mark Aufflick Permalink | Comments (2)

Safari 4.0.2

Unfortunately the recent Safari 4.0.2 update doesn't seem to have fixed the cpu usage runaway with Google Apps email. Basically after some time (say 10 minutes) of having Google Apps email open, Safari 4 goes to 20% cpu usage and stays there.

It's a bug in either Google's Javascript or in Safari because the cpu utilisation is minimal in the first 10 minutes, and drops back to zero again as soon as you close the tab with Google Apps email.

I was *really* hoping that the "Nitro stabilisation" improvements would resolve that.

06:22 PM, 12 Jul 2009 by Mark Aufflick Permalink | Comments (0)

Adding Apple Remote Support to your Cocoa App

Here is the presentation I gave at last month's CocoaHeads:

Or you can download the pdf from the CocoaHeads AU Google group: apple_remote.pdf.

08:24 PM, 04 May 2009 by Mark Aufflick Permalink | Comments (0)

CocoaHeads Sydney - May 7th 2009

CocoaHeads Sydney is steaming along with our fourth monthly meeting on the trot this Thursday.

Last month at CocoaHeads Sydney I gave a lightning talk showing how to add Apple IR support to your Cocoa app. I have uploaded the slides to the files section of the google group. In the presentation I also showed how I used the LaTeX beamer class to make pdf slides, and I used the open source SplitShow application to give the presentation (using my Apple IR support of course!) You can get SplitShow from the google code project but you'll have to build from the trunk to get the IR support which has not yet been included in a release.

We also had Ben Hill show us the impressive prototype of an OpenGL iPhone game he put together using cocos2d.

This month our very own Jude Sutton will be giving us a presentation on the Authorisation Services and related APIs.

This month's details:

When: Thursday May 7th, 6:30pm
Where: UTS Broadway CB10.07.114. ie. Building 10, Level 7, Room 114
Calendar:

All details are published monthly on the CocoaHeads AU google group.

Hope to see you there!

08:12 AM, 03 May 2009 by Mark Aufflick Permalink | Comments (0)

CocoaHeads Sydney - March 5th 2009

I'm excited our Sydney CocoaHeads meetup next week, looking forward to expanding on our great start of 20 odd people (that is 20 or so people, although many of us may also be odd...).

André's talk last month was an interesting delve into Objective-C internals and creative ways to make use of that knowledge. (slides).

This month I am pleased to announce that Nathan Day, who was in our meeting last month, will be presenting something that instead saves you from having to know about some of the nastier internals of the Cocoa framework&#8212his extensive collection of public frameworks.

Nathan was guest speaker at Brisbane CocoaHeads last Thursday and has agreed to make a repeat performance for us.

The location will again be UTS although the room may be different as the semester is approaching, stay tuned for details.

There are details about subscribing to the google calendar on a page in our group: http://is.gd/kEtW

Or you can use this link to add the March meeting to your own calendar: http://is.gd/kEud

I'll update the calendar meeting with the room details etc. when I have them and will also email the cocoadev list etc. closer to the day. Looking forward to seeing you all there!

06:59 AM, 24 Feb 2009 by Mark Aufflick Permalink | Comments (0)

Native MacOS Umbrello in KDE4

One of the consistently popular pages on this website is my blog entry about building Umbrello on MacOS. Umbrello is the KDE UML modelling program. UML modelling programs are mostly surprisingly rubbish, so Umbrello being not rubbish is one of the better ones and it's open source to boot.

It has, though, been tough to build on MacOS even just under X11 (as witnessed by the long list of comments on my earlier blog with various configure recipies). KDE4 promises to resolve that with the native MacOS Qt support allowing Mac native applications.

The Mac KDE project has beta downloads of the (nearly) full KDE environment for Mac. All the bits you need are at http://mac.kde.org/ but note they are hosted on an ftp server that allows you to only download one file at a time, so let one finish before you start the next. No compilation or commandline trickery needed - just installing normal MacOS packages.

After installing the various bits you will find a KDE4 folder in your Applications folder. Here's Umbrello running on my Mac:

There are a few oddities - I could maximise the window, but not drag the window size to anything other than the original or the maximum, but otherwise it seems quite solid.

06:38 AM, 17 Feb 2009 by Mark Aufflick Permalink | Comments (5)

The most awesome case mod ever

Such an awesome idea. You could shoe-horn all sorts of awesome things into a Disk ][ case. The working In Use light is a nice touch, but I bet it doesn't make the right sound :)

Disk II Mac with DVD

Via: Cult of Mac.

11:24 PM, 16 Feb 2009 by Mark Aufflick Permalink | Comments (0)

25 years of Macintosh--illustrated timeline

I have owned or used every item in this picture except for the Lisa and Macintosh Portable (though I have seen both of them at one stage). I even have the eWorld disks still and DB has a copy of the (pictured) MacWorld edition 1.

Via @guykawasaki

04:28 AM, 27 Jan 2009 by Mark Aufflick Permalink | Comments (2)

MacBook (Nvidia) video flicker or "tearing" on scroll/video

My new MacBook has an annoying issue. Especially after sleep, the GPU goes a bit mental and has issues with high bandwidth data - eg. fast scrolling or video (eg. YouTube) playback. It seems basically that it just can't ship the bits to the display fast enough because if you scroll slow enough there is no flickering.

After sleep/wake it is really bad—to the point that it distracts. It is in multiple applications (Safari, Xcode) so I assume it is a video driver issue. Some 'net reports for MacBook Pro users say that it is not an issue if you choose the faster GPU on that laptop (the GeForce 9600M GT) suggesting that it is a driver/chipset issue with the Nvidia GeForce 9400M.

I found one tip that improved the situation, when you get the problem you can force some sort of vido reset by pressing Control-Shift-Eject (you might need to hit a key or wiggle the mouse to wake the screen back up again).

It doesn't completely eliminate it, but at least in normal non-video use you don't notice it so much.

Since a reset of some sort improves it, I assume it is something to do with the way the chipset is brought up after sleep so hopefully either a driver or firmware update should be able to either resolve it or if it is a chipset issue at least work around it.

06:25 AM, 25 Jan 2009 by Mark Aufflick Permalink | Comments (2)

CocoaHeads Sydney - February 5th 2009

After the very successful, and inaugural, Christmas beers event held by Sydney CocoaHeads in December, our first meetup for 2009 will occur on Thrusday February 5th.

What is CocoaHeads?

CocoaHeads is a global collection of groups devoted to discussion of Apple Computer's Cocoa Framework for programming on MacOS X. During monthly meetings, members present on their projects and offer tutorials on various programming topics.

February, the ever interesting André Pang will be speaking. You can find more details about the Sydney meetup by joining our Google Group: Sydney CocoaHeads.

There is also a calendar you can subscribe to:

    

Or add just this upcoming meeting to your calendar:

09:06 AM, 21 Jan 2009 by Mark Aufflick Permalink | Comments (0)

heads up 'tunes featured on iLoveMacApps.com

James Powell has featured heads up 'tunes on his iLoveMacApps.com and also has some neat feature suggestions.

I'm not sure where the slowdown he is seeing is coming from so I'll quiz him on that, but clicking the song and hiding the dock icon are good ideas.

He has a pretty eclectic playlist :)

06:51 PM, 19 Jan 2009 by Mark Aufflick Permalink | Comments (0)

Unibody MacBook VGA = sucky

Last week I bought a new Unibody MacBook. Nice and fast, perfect size, so far so good.

Then I connected it to my venerable (but still awesome) Silicon Graphics 22" CRT monitor with the mini displayport -> VGA adapter.

I knew the maximum resolution supported via VGA was going to be 1600 x 1200 from the manual (p66) which was fine with me since that is the resolution I usually use.

What the manual and tech specs page gives no mention of is that the highest refresh frequency you can run at 1600 x 1200 over VGA is 60 Hz. That's enough flicker to drive you mental immediately (and give you a headache in about a quarter hour).

The next resolution down offered is 1400 x 1050 at 85 Hz. Plenty fast enough, but that's 450,000 less pixels. No thank you.

Thankfully, with the magic of DisplayConfigX you can change the refresh/resolution combinations MacOS X will offer you. You can't squeeze any more bandwidth than the hardware maximum, but you can make different compromises. I figured I can run 1600 x 1200 at 65 Hz (too flickery), 1536 x 1228 at 67 Hz (still too flickery) or 1472 x 1177 at 69 Hz. This last combo is just about palatable as long as I boost the brightness a little (to increase phosphor persistence) and degauss regularly.

DisplayConfigX is $12 USD, but that's easily worth the 26,2544 pixels I have reclaimed thanks to its flexibility.

Of course Apple's tech specs and docs should have provided the relevant detail. Not that that would have changed anything (other than a frustrating discovery) since to my mind the 15" laptops are just a shade too big and heavy (I am upgrading from a PowerBook 12" remember...).

02:11 AM, 12 Jan 2009 by Mark Aufflick Permalink | Comments (5)

What? No new Mac Mini?

I was ready to buy one today :(

No mention of Snow Leopard either - I guess the new hardware and Snow Leopard go hand in hand, so look for a "special event" at 1 infinite loop sometime this quarter I guess...

Now what do I do? I need to replace my broken 15" PowerBook media centre, but I'll die if a new mac mini comes out after I buy the current one :(

05:04 PM, 06 Jan 2009 by Mark Aufflick Permalink | Comments (0)

Retro Mac nerd alert

Kath and I both had food poisening on the weekend (I'll spare you the details) so I've been couch bound for a few days. What better iq-free way to kill some time than by geeking out with mac emulators. After numerous games of Shufflepuck Cafe, Glider, Prince of Persia etc. I stumbled across this insane website:

http://www.my-old-macintosh.de/

The eWorld app is mind-bendingly cool. And if you leave it alone you get flying toasters.

06:54 PM, 30 Dec 2008 by Mark Aufflick Permalink | Comments (0)

Installing avrdude via MacPorts

avrdude is a program that you use to download compiled software to the (excellent) Atmel AVR line of microprocessors.

Trying to install the current avrdude via MacPorts can hit a snag though, because there is a flex source file (lexer.l) which won't compile with the version of flex that MacPorts installs (if you have ever installed flex via MacPorts).

The Apple supplied flex is fine, so the Portfile just needs a little addition to point the ./configure in the right direction.

Edit the portfile:

/opt/local/var/macports/sources/rsync.macports.org/ release/ports/cross/avrdude/Portfile

And add the following line to the end:

configure.env-append LEX=/usr/bin/flex

Now you just need to rebuild:

sudo port clean avrdude
sudo port install avrdude

Job done!

05:08 PM, 18 Dec 2008 by Mark Aufflick Permalink | Comments (0)

Welcome to Macintosh - the documentary

Christmas present idea if anyone's listening :)

Welcome to Macintosh —the documentary for the rest of us.

09:30 PM, 01 Dec 2008 by Mark Aufflick Permalink | Comments (0)

XML

Blog Categories

software (41)
..cocoa (23)
  ..heads up 'tunes (5)
..ruby (6)
..lisp (4)
..perl (4)
..openacs (1)
mac (21)
embedded (2)
..microprocessor (2)
  ..avr (1)
electronics (3)
design (1)
photography (26)
..black and white (6)
..A day in Sydney (18)
..The Daily Shoot (6)
food (2)
Book Review (2)

Notifications

Icon of envelope Request notifications

Syndication Feed

XML

Recent Comments

  1. Mark Aufflick: Re: the go/Inbox go/Sent buttons
  2. Unregistered Visitor: How do make a button to jump to folder
  3. Unregistered Visitor: Note I've updated the gist
  4. Unregistered Visitor: umbrello is now an available port on macPorts
  5. Unregistered Visitor: Updated version on Github
  6. Unregistered Visitor: Modification request.
  7. Unregistered Visitor: Accents and labels with spaces
  8. Unregistered Visitor: Mel Kaye - additional info
  9. Unregistered Visitor: mmh
  10. Mark Aufflick: Thank you