Ted Leung on the air
Ted Leung on the air: Open Source, Java, Python, and ...
Ted Leung on the air: Open Source, Java, Python, and ...
Fri, 06 Feb 2004
Developer response time
One thing that I'm really enjoying about the Macintosh is the abundance of small responsive developers. Take my more recent experience: I've been getting more and more reluctant to disconnect the PowerBook and work outside my office. The reason? I'm using a big 21" (1856x1392) monitor in the office. When I "undock", all of my windows move into semi-reasonable positions (but not sizes) for a 1280x854 display. So there's a bunch of time that I waste to rearrange and resize all the windows. When I "re-dock" I have to the same thing to get back to optimality for the big screen. This is compounded by the fact that I'm using virtual desktops. What I need is something that rearranges and resizes the windows based on the presence or absence of an external display. This being a Macintosh, I figured that this was exactly the kind of job for AppleScript (I suppose you could argue that this is a feature request for CodeTek Virtual Desktop, but I don't believe so). So I started looking for a way for AppleScript to figure out how many displays there were. I wasn't having much luck, and figured that I was going to have to write a scripting extension that could talk to Cocoa/Carbon and get the job done myself. I even went as far as downloading an Apple Code sample.
Tuesday I came across Extra Suites which is a package of scripting extensions that can do all sorts of stuff. One of the extensions lets you get information about the screen - dimensions, etc. Alas, It only worked for a single display. I say worked, because late Tuesday night I sent e-mail off the the Kanzu e-mail address, asking about multiple display support. Wednesday morning when I sat down in front of my machine, there was a prerelease of Extra Suites 1.0.2 that contained a new command to count the number of displays, and the screen info command had been extended to take the display number as a parameter. I'm not sure I've gotten such quick response from an open source project... Needless to say, the $10 for Extra Suites is less than the cost of the relevant Cocoa books and the time and hassle of figuring out how to do this myself.
So the next step is for me to figure out enough AppleScript to write a window layout script that can position the relevant windows (I have a standard setup) according to the display configuration. They'll even (mostly) be on the right virtual desktop, because CodeTek Virtual desktop can switch desktops from AppleScript -- I have a request in to them to move single windows across virtual desktops -- maybe in the next release. Once I get that going, Kanzu is going to get my $10. It's just a small matter of time and programming.
[00:09] |
[computers/operating_systems/macosx] |
# |
TB |
F |
G |
5 Comments |
I'm not sure I've gotten such quick response from an open source project...
quite strange to hear that from a guy who works for an open source company, and generally is not true!
Posted by seriozhcka at Fri Feb 6 01:45:18 2004
quite strange to hear that from a guy who works for an open source company, and generally is not true!
Posted by seriozhcka at Fri Feb 6 01:45:18 2004
FYI, you can buy all the Cocoa books you want and they're not going to do you any good in this case. Scripting Extensions are Carbon beasts, and the APIs to enumerate display hardware live in CoreGraphics. I'm pretty sure that CoreGraphics is not even covered anywhere other than Apple's electronic documentation, and last I checked most of the relevant Carbon books are really old-world pre-carbon books that are out of print (but were reprinted by fatbrain a few years ago, I don't know if that is still the case).
What I'm trying to say is that OS X is a pretty new platform, and you shouldn't waste your money on books. There's perhaps two or three worth owning if you need someone to hold your hand while you learn Interface Builder and the Foundation/AppKit frameworks, but that's about as far as they go in my experience. Also, these frameworks are not really stable.. Every new release of OS X adds a slew of enhancements to these frameworks. Two particular instances of AppKit enhancements in 10.3 that I have experimented with are the addition of programmable word completion to all text views (used in PyInterpreter, an example now included with PyObjC), and an entirely new paradigm of developing controllers (first called the Controller Layer, but now called Cocoa Bindings), which is used by Bill's latest WebServicesTool example (depends on Twisted, but also comes with PyObjC as an example). Anyways, I'm pretty sure all the books out there are stale, and if the books covered CoreGraphics, they'd probably be stale too. I'm relatively sure Apple has done quite a bit of good there considering the performance enhancements.
You might have better luck just writing it in C, AppleScript is pretty annoying ;) That's something I'm working on, I should have a new release of aeve (my Apple Events <-> Python bridge) at some point in the near future.
Posted by Bob Ippolito at Fri Feb 6 04:30:17 2004
What I'm trying to say is that OS X is a pretty new platform, and you shouldn't waste your money on books. There's perhaps two or three worth owning if you need someone to hold your hand while you learn Interface Builder and the Foundation/AppKit frameworks, but that's about as far as they go in my experience. Also, these frameworks are not really stable.. Every new release of OS X adds a slew of enhancements to these frameworks. Two particular instances of AppKit enhancements in 10.3 that I have experimented with are the addition of programmable word completion to all text views (used in PyInterpreter, an example now included with PyObjC), and an entirely new paradigm of developing controllers (first called the Controller Layer, but now called Cocoa Bindings), which is used by Bill's latest WebServicesTool example (depends on Twisted, but also comes with PyObjC as an example). Anyways, I'm pretty sure all the books out there are stale, and if the books covered CoreGraphics, they'd probably be stale too. I'm relatively sure Apple has done quite a bit of good there considering the performance enhancements.
You might have better luck just writing it in C, AppleScript is pretty annoying ;) That's something I'm working on, I should have a new release of aeve (my Apple Events <-> Python bridge) at some point in the near future.
Posted by Bob Ippolito at Fri Feb 6 04:30:17 2004
Seriozhcka,
I believe in giving credit where credit is due, and the folks at Kanzu did a great job as far as I am concerned. As far as open source projects go, response time varies. I seriously doubt that Linus will respin a version of the kernel for you overnight, or that the httpd developers at the ASF will either. I work for OSAF, and I am a member of the ASF, so I definitely believe in open source, but that doesn't mean that people who write commercial software can't be responsive if they choose to.
Posted by Ted Leung at Fri Feb 6 10:16:38 2004
I believe in giving credit where credit is due, and the folks at Kanzu did a great job as far as I am concerned. As far as open source projects go, response time varies. I seriously doubt that Linus will respin a version of the kernel for you overnight, or that the httpd developers at the ASF will either. I work for OSAF, and I am a member of the ASF, so I definitely believe in open source, but that doesn't mean that people who write commercial software can't be responsive if they choose to.
Posted by Ted Leung at Fri Feb 6 10:16:38 2004
Bob,
Thanks for the lesson on Cocoa vs Scripting Extensions. I was wondering if that was going to turn out to be a problem, but fortunately, I didn't get far enough down the path.
Applescript is pretty annoying, but I've got enough other little tasks that I want to try that I'm going to bite the bullet on this for now. Assuming that I can get it working, I want to try a rewrite using either AppScripting or aeve (when it's ready). Are you going to be at PyCon? I would love to meet you in person...
Posted by Ted Leung at Fri Feb 6 10:19:09 2004
Thanks for the lesson on Cocoa vs Scripting Extensions. I was wondering if that was going to turn out to be a problem, but fortunately, I didn't get far enough down the path.
Applescript is pretty annoying, but I've got enough other little tasks that I want to try that I'm going to bite the bullet on this for now. Assuming that I can get it working, I want to try a rewrite using either AppScripting or aeve (when it's ready). Are you going to be at PyCon? I would love to meet you in person...
Posted by Ted Leung at Fri Feb 6 10:19:09 2004
Yeah, I'll be speaking at PyCon.. I'll actually be out in SF sometime this month (probably in about 2 weeks) to talk to some potential employers, maybe even OSAF (I'm kinda interested in doing the UI framework stuff for Chandler).. I'll let you know!
Posted by Bob Ippolito at Fri Feb 6 11:55:34 2004
Posted by Bob Ippolito at Fri Feb 6 11:55:34 2004
You can subscribe to an RSS feed of the comments for this blog:
Add a comment here:
You can use some HTML tags in the comment text:
To insert a URI, just type it -- no need to write an anchor tag.
Allowable html tags are:
You can also use some Wiki style:
URI => [uri title]
<em> => _emphasized text_
<b> => *bold text*
Ordered list => consecutive lines starting spaces and an asterisk
To insert a URI, just type it -- no need to write an anchor tag.
Allowable html tags are:
<a href>
, <em>
, <i>
, <b>
, <blockquote>
, <br/>
, <p>
, <code>
, <pre>
, <cite>
, <sub>
and <sup>
.You can also use some Wiki style:
URI => [uri title]
<em> => _emphasized text_
<b> => *bold text*
Ordered list => consecutive lines starting spaces and an asterisk