busy-bee.net buzz buzz buzz goes the honeybee home | blog | links | about me

linux to an imac

2005

June



2004

April

March



2003

November

August

June

March

February

January



2002

December

November

October

September

August

July
apple don't let you write pagers (yet?)
virtual desktops
forcibly unmounting disk images
permalinks
useless but educational
death by forking
renaming files
geek t-shirts
UI Gods?
disk images from the cli

June

May

April





2002-07-31 13:00 / apple don't let you write pagers (yet?)  »

Well, I spent quite a few hours over the weekend trying to write myself a pager (virtual desktop navigator). Unfortunately, it isn't possible without reverse engineering OS X's 'Core Graphics System' - there is no published way to either (a) get the process owner of a window (the current unpublished way, I think, it was trial and error with the parameters on my part, being EXTERN_API (OSErr) CPSGetWindowOwner(int windowNumber, ProcessSerialNumber* PSN);), or (b) modify (move, resize, NSAffineTransform) a window that your process did not create. As, for instance, the dock does. Without these two functions, we just have the one app per workspace pager, each app with all its accompanying windows.

This does make me wonder just how worth my $20 CodeTek's thing below might be. After all, these apis <apple-voice-of-authority>can and will change</apple-voice-of-authority>. I extremely doubt the current version will work with jaguar. I also doubt that I can GPL anything I might come up with as well, if it depends on all this secret stuff.

Maybe I should've actually read my OS X license before publishing this (bear in mind that a google search for the function above currently brings up nothing; and I spent *hours* scouring the web and, um, using nm, to find out just half of what I needed to know).

Anyway, the consequence of all this - that there will be no legitimate fully-functioning open-source pagers or future-proof closed source ones until Apple either deems them worthwhile enough to write one themselves or else they finalise the Quartz/CGS api - is disappointing. Unless someone can tell me otherwise, that is.

This page leads to some nice CGS stuff though (used to be on a .mac account, this is a copy): CGSPrivate.h, e.g. CGSGetConnectionIDForPSN, CGSGetWindowList.

2002-07-26 17:42 / virtual desktops  »

I've been using Space.app (screenshot large, small) for months now. It's good but it doesn't have all the features you'd expect. The most annoying for me is that it won't let you have different windows from the same app on different workspaces. This is of course a little crippling for anyone who likes lots of terms kicking about. But, the lovely author Riley Lynch has made it lovely QPL (interesting code to read, with all that process table stuff).

QPL'd unlike CodeTek's virtual desktop (screenshot large, small, pager bottom left), which is closed source and priced at $20. You're restricted to two workspaces till you pay. This does have all the features you'd want - apart from a slightly weird non-Aqua pager appearance, and icons rather than names for the mini-app windows - e.g. drag windows between desktops, auto-activation of last topmost window when you switch, the multi-window thing; it also mimics Windowmaker's 'after switching show desktop name in centre of screen then fade', which was once my rather lame reason for switching to Windowmaker from Afterstep.

So, do I (a) pay for codetek's, or (b) use my teach-myself-cocoa time to help hack Space. I think (b) - I just need some time.

2002-07-24 18:33 / permalinks  »

I've finally added them to this page. They look like this: '#x187'. This page reckons I need an 'id' tag instead of 'name' in my '<a name>'s to be xhtml compliant, but the validator still validates ...

2002-07-24 21:09 / forcibly unmounting disk images  »

Had a disk image from a .dmg file that I couldn't finder eject, got rid of it with hdiutil eject <disk> -force, where <disk> was the filesystem in df, minus the '/dev/'. Eek: tried the same with umount -f <disk> and it didn't immediately disappear from the finder and couldn't be remounted.

2002-07-17 14:43 / useless but educational  »

just like my degree ...

I was trying to change my DNS config on the command line (why? because I'm not in front of my machine), and didn't even consider that the UN*X or at least FreeBSD and Linux standard of /etc/resolv.conf would be used by OSX. Not an unfounded assumption, given e.g., the comments at the head of /etc/hosts.

Anyway - it is used, but - weh-hey - it doesn't have to be! You can use a netinfo database instead. Try a nidump -r /locations/resolver / to see what, if anything, you've got there already. If nothing, then create a new path with niutil -create / /locations/resolver. Add keys with niutil -createprop / /locations/resolver nameserver <your nameserver> and niutil -createprop / /locations/resolver domain <your domain> if you want to search a domain as well. (If you need more than one DNS entry, it looks like niutil -appendprop does the job.)

To test it: move /etc/resolv.conf somewhere else, and send a SIGHUP to lookupd with kill -HUP `cat /var/run/lookupd.pid`. Then ping some computer or other and see that the name resolves.

Hopefully the network system preferences pane should pick these changes up .. I just need to get home and check. And one day maybe I'll tweak the cache settings in lookupd, which is sometimes a little sluggish (that might be my ISP though).

2002-07-15 12:32 / death by forking  »

Not sure how far this applies, and for which file types exactly, but if you're gonna send attachments from an OS9 machine to, um, anything else, then stuff everything up first. Fonts without resource forks don't seem to be fonts at all.

I don't think tar picks them up either ... :"The primary reason for moving application resources out of resource forks is to enable applications to be seamlessly moved around different file systems without loss of their resources; this would include methods such as BSD commands, FTP, email, and Windows and DOS copy commands.".

2002-07-12 10:55 / renaming files  »

I was going to say how easy it is to rename files without a GUI, but Part 3 below took a while for me to figure out because of spaces in filenames and xargs not having the -i switch on my mac ... anyway though:

There seems to be quite a few bits of shareware - or maybe 'spivware' if you go with oblomovka (more blogs akin to this) - that replicates functionality that can be easily done in the shell. So, combined with I think someone on macslash's site who asked "is the shell for anyone except geeks", I thought I'd just show how it can be used it to, e.g., rename files. This is all in zsh by the way (or bash), *not* the default tcsh, which I've never learned.

Part 1:
Rename all files called .html to .shtml:
for i in *.html; do mv $i "`basename $i .html`.shtml"; done

Part 2:
As 1, but with the date in YYYY-MM-DD prepended to the filename:
for i in *.html; do mv $i "`date +%Y-%m-%d``basename $i .html`.shtml "; done

Neither of those recurse though. For that you need find (aside: locate is miles quicker than sherlock for finding files, find is miles more customisable. I haven't even checked that it is ...). So:

Part 3:
As 1, but for all subdirectories as well:

find . -name "*.html" |
while read fname
  do mv "$fname" "`dirname $fname`/`basename $fname .html`.shtml" 
done

The only thing here that you won't find easily with man (man zshmisc for the for,while) is the backticks. Basically, if you surround a command with backticks it and the ticks are substituted with the result of executing the command.

Er .. that'll be $15 please ;-)

2002-07-11 12:37 / geek t-shirts  »

I usually hate these things - they're almost invariably far too large and not funny to anyone except your sysadmin. But Susan Kare did the original Mac icons - many many applauds for her - and I think they transfer pretty well to t-shirts. I've gone for the command key - which is sufficiently abstract that no-one else will know it's a com-poo-ta thing.

2002-07-09 12:03 / UI Gods?  »

The last entry I gleaned from the darwin-users mail archive. Unfortunately Apple's list archives are currently extremely poor, with no concept of threads, barely intelligible urls, messages displayed in their entirety in plaintext, and search results summaries consisting of the first four lines of the mail headers, i.e. the path they took through the bloody SMTP servers.

2002-07-01 16:03 / disk images from the cli  »

Mounting disk images (.dmg) from the command line, whilst logged in remotely, is easy - find out your numerical uid with id -u, then use disktool -c <uid> to get round the fact that "autodiskmount does not, by default, mount removable media when there is no 'console user'" then finally mount with hdiutil mount <image> and it should be in /Volumes.

  mod_perl -- Speed, Power, Scalability