« June 2006 | Main | August 2006 »

July 14, 2006

MOTU, my friend

MOTU Symphonic Instrument appears to be working on my case-sensitive file system now. Let's just say that there's a symlink in /Library/ pointing application\ Support to Application\ Support.

No. I. am. NOT. kidding.

Erg. Seems this only works on the PPC version. Back to the Intel drawing board.

July 10, 2006

Python from objective-C

I've been working on getting python objects to instantiate in objective-C and have put together a little demo app as a learning tool for myself. It may not be the best way to python from objc, but it works. I hope it's helpful.

http://www.jonathansaggau.com/cocoa-dev/test.tgz

XCode should build the bundle for you when you hit Build and Go. You'll see a bunch of stuff in the log window that shows you that the python object is firing on all cylinders and that calling the super class that's written in objc works as expected, etc. You'll want to look in the NIB file to see how it's all connected.

How it works:
I subclassed an objc object (JSAbstractTest) in python (Test.py), using of the NIB file to indicate the class hierarchy. You don't necessarily *have* to subclass in this way, you could use a protocol like Bob suggests on the pythonmac-SIG. The protocol method is cleaner, for instance, when you don't really want to implement any of the functionality of the class in objc. This will allow you to do things you might want to do in the compiled language while offloading some functionality to our friendly "batteries included" python. (This is such fun).

Also useful (http://pyobjc.sourceforge.net/doc/intro.php) so we know what the bridge is expecting:

* Python numbers (int, float, long ) are translated into NSNumber instances. Their identity is not preserved across the bridge.
* Python str is proxied using OC_PythonString, a subclass of NSString. A Python str may be used anywhere a NSString is expected, but unicode should be used whenever possible. OC_PythonString will use the default encoding of NSString, which is normally MacRoman but could be something else.
* Python unicode is proxied using OC_PythonUnicode , a subclass of NSString. A Python unicode may be used anywhere a NSString is expected.
* Python dict is proxied using OC_PythonDictionary, a subclass of NSMutableDictionary. A Python dict may be used anywhere an NSDictionary is expected.
* Python list and tuple are proxied using OC_PythonArray, a subclass of NSMutableArray. Python list or tuple objects may be used anywhere an NSArray is expected.
* Python objects that implement the Python buffer API, except for str and unicode, are proxied using OC_PythonData, a NSData subclass. Objects that implement the Python buffer API such as buffer, array.array, mmap.mmap, etc. may be used anywhere a NSData is expected.

Armed with the above information, I coaxed a UDP networking toy written in python to send messages to SuperCollider based on the activity of an image stream coming from my iSight through a quartz composer project. WOO HOO!)

(I've also posted this to pythonmac-SIG, where I'm sure to get comments to refine this post. In the meantime, take this with a grain of salt.)

July 05, 2006

Oh, we're just going to take your internet away

Here's what the ISP for one of my clients did today:
1. They called a non-technical contact at the client indicating that there had been some kind of phishing fraud related to ebay originating at one of their IP addresses. (Not bloody likely as users at that location have no access to servers there and the servers have very few ports facing "the world.")
a. Left a phone number to the "network investigations unit."
b. Left a ticket number
c. TOOK BOTH THE PRIMARY AND BACKUP INTERNET (T1) CONNECTIONS DOWN at the client's main office!
2. I called the number they left.
a. Line's busy
b. Line rings forever
c. Answering machine....
d. Line rings forever
3. I called the usual tech support number
a. Support rep. indicates that the "network investigations unit" has put an "administrative hold on the lines"
b. Support rep. indicates that the "network investigations unit" can't be contacted internally, rather the support rep. has the same phone number I've been given.
c. Support rep. indicates that the "network investigations unit" is small and can best be contacted by leaving a message or an email. (I did both)
d. Support rep. indicates candidly that the "network investigations unit" has the tendency to take customers' connections down and then make it impossible for the customer to contact them.
4. I moved the main database server for the client to another location a few blocks away (this takes a couple of hours).
a. I assume that the "network investigations unit" decided that it was best to screw only the main part of the business... to the tune of roughly $ 20,000.00 per day of lost revenue (hence the backup internet connection).
5. As of yet, I have still heard nothing from the "network investigations unit."

Question:
What would you do if your ISP took your main and redundant Internet connections down on (apparently) a report from a third party and refused to be contacted?

July 04, 2006

Spotted in New Jersey

A fat, helmetless, man on a Harley Davidson with a propane tank balancing on the gas tank... cigarette in hand.

I guess head injury is the least of his worries...

Parallels' problem isn't case-sensitivity.

With the help of Drew Thaler's instructions on how to grab disk access by running an app in gdb, it looks like the bug in Parallels Workstation was even weirder than the case-sensitivity problem. Parallels uses QT, a cross-platform GUI toolkit to handle user interface presentation, rather than the much-more-common-on-OSX-but-not-cross-platform toolkit called cocoa. Unfortunately, it follows my library search path to get to QT. My installation of QT is broken. (I've known this for a while and haven't had the time to rebuild it from source). Why doesn't Parallels force inclusion of QT from the app bundle? I don't know. Bug report filed.

See the extended entry for Drew's instructions (thanks Drew!)

[start target app under GDB, and break early in the initialization process]
% gdb /Applications/Parallels/Parallels.app/Contents/MacOS/Parallels
(gdb) b __dyld__ZN4dyld24initializeMainExecutableEv
(gdb) run
Breakpoint 1, 0x8fe03116 in __dyld__ZN4dyld24initializeMainExecutableEv ()

[now that it's launched and we can target it, in another window, run fs_usage]
% sudo fs_usage -wwf filesys Parallels > ~/Desktop/fs_usage.Parallels.txt

[back in the gdb window]
(gdb) continue

[app does whatever it does, and crashes. We're done.]
[ctrl-c to kill fs_usage]
[back to gdb]
(gdb) kill
(gdb) quit