Saturday, August 13, 2011

VirtualBox: Mac OS X 10.5.8 Guest on Mac host with Core i7 processor

The Leopard 10.5.0 Retail DVD booted and installed perfectly using VirtualBox 4.0.12 on my MacBook Air. After applying the 10.5.8 combo updater, unfortunately, the VM would kernel panic while booting. The culprit was the AppleIntelCPUPowerManagement.kext. The 10.5.8 kext doesn't seem compatible with Core iX processors.

The solution is pretty simple, and clears up another well-known problem as well: 100% usage of one core at all times:

1) Boot the VM using the 10.5 Retail DVD and launch Terminal
2) Delete the offending kext:
rm -rf /System/Library/Extensions/AppleIntelCPUPowerManagement.kext
3) Reboot and enjoy!

The post that tipped me off to this solution also suggested installing a dummy kext, however I could not locate a 10.5.8 compatible NullCPUPowerManagement.kext. I skipped that and have not noticed any ill effects.

Wednesday, August 3, 2011

Detecting Plugin Functions and Properties in JavaScript

Peter Michaux's feature detection article really saved my bacon.

I recently had to debug some IE 7 ++ bugs in our JavaScript API. I found some crusty functions that were supposed to determine if a function or property exists on a loaded plugin object (ActiveX in IE, NPAPI otherwise). The functions were returning a false negative in IE 7 or newer unless users turned on compatibility mode.

Since we already had Prototype as a requirement, I figured I'd use their isFunction. The logic worked fine on browsers other than IE :(

Logically, all the well-known JavaScript frameworks' implementations of isFunction are highly optimized and may not work as expected with bipolar JavaScript host objects (e.g. plugins, window, document, alert), at least on IE.

Michaux's approach was clean and worked consistently for our needs across all our supported browsers. Note: I never saw the "else" code path exercised, but left it in.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Check to see if a property (function or field) is defined for the given object.
 * This function is reliable for native and host objects.
 * @param object {Object} - the object to test.
 * @param propertyName {String} - name of the property to test.
 * @type Boolean
 * @return true - if property is defined,  False otherwise.
 */
 _propertyExists: function( object, property ) {
        //tweaked version of Michaux's detection function:
        //http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
        var isProperty = false;
        var theType = typeof object[property];
        if( theType != 'undefined' ) {
            isProperty = true;
        }
        else {
            try {
                // This test would error for ActiveX but
                // those test will have returned above 
                // because typeof result will have been 
                // 'unknown'.
                if( object[property] ) {
                    isProperty = true;
                }
            }
            catch (e) {}
        }
        return isProperty;
 },

Saturday, July 30, 2011

Via Gus Mueller: Tracking down app rejections with productutil

Gus Mueller shares some great tricks after spelunking into Application Loader. What he's found could help MAS developers with complicated apps decode vague rejection messages.

http://shapeof.com/archives/2011/07/stupid_productutil_tricks.html

Monday, April 18, 2011

Mac App Store Submission troubles behind corporate network


An error occurred while connecting to the transport host https://itmsdav.apple.com: Operation timed out

Could not start delivery: all transports failed diagnostics

Last week we ran into a somewhat tricky issue when trying to submit one of our apps to the Mac App Store. Our group has already successfully submitted and updated three different apps, so this took us by surprise.

The errors returned by Application Loader, while a bit obtuse, smelled of corporate proxy or firewall. I assumed our authenticated corporate proxy was to blame, since lots of software doesn't play nicely with it -- error reporters, some built-in updaters, etc. Perhaps Apple had changed something on their end, who knows? 

Bypassing the proxy using the invaluable Authoxy didn't do the trick, nor did trying with Xcode 4's built-in tools. In fact, nothing worked until in desperation I  threw the app on my personal Mac and submitted it from outside our company network. Bingo. The upside is that the update is in review at the time of this posting. The downside is that nobody seemed to think much of my demand of having the company reimburse the cost of my MacBook :P


Next submission (when we're not up against a deadline), we'll have to get to the bottom of this with IT. Will update the post if I learn anything specific.
Update:
Since moving to another office location inside the same corporate network, we now get a different error. This one seems to eventually go through after failing a few times at 471 bytes.

com.apple.transporter.util.StreamUtil.readBytes(Ljava/io/InputStream;)