Archive for the ‘os x’ Category

cleaning the not so mighty mouse

Sunday, November 9th, 2008

Every once in a while the scroll ball on my Mighty Mouse stops working.  According to google, this happens to approximately everyone who owns one.  Cleaning with a little bit of cotton and alcohol worked for a while, but recently I lost the ability to scroll down.  Doh.

After trying all the usual methods I found this wonderful description of flossing the scroll ball with tape.  Worked like a charm!

Swapping the Alt and Windows keys on a USB keyboard under Mac OS X

Friday, October 24th, 2008

I was making things too hard again.  The mac control panel lets you swap modifier keys on a per-keyboard basis.  That’s enough to solve the problem of the Apple and Option keys being backwards on a USB windows keyboard when used with a mac.  (I had given up on using the control panel stuff before because it can’t do arbitrary key remapping.)

it boggles the mind…

Sunday, July 6th, 2008

I was reading the handy Apple OpenGL Programming Guide for Mac OS X when I found a joke right in the middle of the “Using Extensions to Optimize” section, of all places!

Note that OpenGL does not use DMA for a power-of-two texture target (GL_TEXTURE_2D). So, unlike the rectangular texture, the power-of-two texture will incur one additional copy and performance won’t be quite as fast. The performance typically isn’t an issue because games, which are the applications most likely to use power-of-two textures, load textures at the start of a game or level and don’t upload textures in real time as often as applications that use rectangular textures, which usually play video or display images.

What a bunch of pranksters!

Wait a sec, you guys are serious?!

If this were an episode of Star Trek, now would be a “set phasers to kill” moment.

incremental search for cocoa

Tuesday, June 24th, 2008

After downloading the plugin ages ago, I finally got around to installing the incremental search input manager which adds emacs-style incremental search to cocoa text widgets on OS X. I had problems getting it to work on leopard until I discovered some Leopard-specific issues with input managers. What I ended up doing was:

  1. build from source using XCode
  2. sudo cp -pR IncrementalSearchInputManager /Library/InputManagers
  3. sudo chmod -R go-w /Library/InputManagers
  4. sudo chown -R root:admin /Library/InputManagers
  5. sudo chmod a-x /Library/InputManagers/IncrementalSearchInputManager/IncrementalSearchInputManager.bundle/Contents/MacOS/IncrementalSearchInputManage

Of course while writing this post I discovered that there’s a universal binary available on the author’s site, so maybe I didn’t need to rebuild at all. In fact, I was trying to use a PPC binary on an intel machine the whole time, so maybe the instructions in the readme are, in fact, ok. The whole situation is confusing though, as the sourceforge wiki seems not to be updated and most of the pages linked to on the web are MIA.

Anyway, it can be done, and life is happy.

Update: or maybe not.  I can’t get it to work in Mail.app or Xcode.  Doh.

building an fltk app on Mac OS X

Wednesday, May 21st, 2008

This is how I set up a FLTK project under XCode 3.0, which is current as of this writing. I assume that fltk is installed under /usr/local; if not then modify appropriately. This will produce an OS X application, meaning something you can double-click in Finder to run. Note that the link line below forces the project to be statically linked against the fltk libraries, instead of a dynamic link. The reason I do it this way instead of dragging the libraries into the project is because that part of XCode is horribly broken — a library reference in the GUI translates to the gcc command line option ‘-llibname‘ which will search for the library and prefer dynamic libraries.

Note also that the following settings will produce an app built with the default system SDK, so on Leopard it will build against 10.5 and not work on Tiger systems. To build a universal binary you need to make sure fltk was built against 10.4u and set the Base SDK Path appropriately.

  1. create a c++ command line tool project
  2. delete the command line program target
  3. add a new target of type Carbon C++ Application
  4. under the target “Build” preferences (command-i):
    • add the following to Other Linker Flags:
      -framework CoreServices -framework ApplicationServices -framework IOKit -framework AGL -framework OpenGL /usr/local/lib/libz.a /usr/local/lib/libfltk.a /usr/local/lib/libfltk_images.a /usr/local/lib/libfltk_jpeg.a /usr/local/lib/libfltk_gl.a /usr/local/lib/libfltk_png.a
    • add /usr/local/include to Header Search Paths
    • optionally add a precompiled header to be included everywhere (search for prefix)

  5. drag sources into the Source folder (or something else you create). be careful with the copy files into group option, it’s enabled by default.
  6. delete the automatically generated main.cpp
  7. Build and you’re done!

libdc1394 on OS X Leopard

Sunday, May 11th, 2008

After upgrading to Leopard I started getting the error message “Could not create LocalIsochPortInterface”. Eventually I found that building libdc1394 against the universal SDK did the trick, like this:

./configure CFLAGS=-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386

Clearly something has changed in 10.5.

encryption and backup

Saturday, April 26th, 2008

I have a laptop. I use it for pretty much everything. A couple weeks ago during cherry blossom season, it was my job to stake a claim on some prime blossom territory with a big, blue tarp and then.. hold it. So I hauled my laptop along and got some work done while waiting for the party to start. After the battery died, I got up to take some pictures. With my face pressed to the viewfinder I sensed someone behind me, near my tarp. It was an old guy on a bike pointing at my laptop sitting alone on the ground. I gather he didn’t think that was the best place for a laptop, alone on the ground.

After he left it took me about two seconds of thought to figure out he was right. It also didn’t take me long to realize that, being a laptop, my macbook pro is all too vulnerable to pretty much every form of data loss imaginable, including theft, lost luggage, me being scatterbrained, crushed in a crowded train, …. scary stuff.

That’s it. It needs to be backed up.

Since it’s a Mac, and since I just upgraded to 10.5, my first thought was “Time Machine!” And shortly thereafter I had a new Time Capsule on my shelf backing up the machine. Nice.

But in my googling, I realized that encryption would be a good idea to. Having once been a victim of identity theft, I’m really not eager to repeat the experience. I suspect that my corporate clients would be none-too-happy to hear that details of their new products/research were about to be on bittorrent, either.

But no problem, this is Leopard! We’ve got FileVault, right?

Kinda.

Encryption and backups are really a necessity for laptops, when you think about it as I reluctantly did. Unfortunately FileVault and Time Machine don’t quite have that synergy thing going. FileVault will encrypt your home directory, and TM will back it up, but only after you’ve logged out. Er, I mean while you’re in the process of logging out. Which for me is like, never.

Some googling and some experience have brought to light that:

- TM is not all that stable. It’s crashed on me once already, probably because I closed the lid while it was working. That isn’t hard to do, btw, since it’s almost always working.

- when using FV, you can no longer use TM’s GUI to restore files. Oops.

- with FV, your home directory backups become way less efficient with disk space, and they weren’t very efficient to begin with.

So now I’m looking for a replacement. There are lots of programs out there, but most of them are of the mirror/duplication variety. Yes, it’s nice to have a bootable external drive as a backup, but it won’t do you much good if a big chunk of the filesystem gets corrupted and then duplicated before you notice. So SuperDuper! and its ilk are kinda out for me.

To make a long post short, I think I’ll go with CrashPlan. It’s pretty flexible, very professionally done (and I wouldn’t say that of many programs), and works on OS X, windows, and even linux. Its reason for living is to do off-site backups, and it can be coerced into doing local backups if you have more than one pc. It will also backup a FileVaulted home directory while mounted (with the backup encrypted, of course). It does versioning, and it even does it the smart way: by saving only the parts of the file that have changed.

time machine woes

Tuesday, April 15th, 2008

Time Machine stopped working today with system.log containing the error: “/System/Library/CoreServices/backupd[629]: Indexing a file failed. Returned -1130 for: /.DS_Store”

nice.

After much googling and poking around, I saw that the mount point for the backup drive (a time capsule) in /Volumes was hanging around even after the drive was unmounted, probably thanks to Spotlight placing a .DS_Store file there. After removing the directory and installing some updates (including updates to TM and TC) all seems back to normal. Not sure what did the trick, or what caused the problem (sleeping the machine while TM was running?)..

OS X drawing apps

Wednesday, November 28th, 2007

So I need to do a bunch of technical illustrations.. what to use?  I hope to avoid buying Illustrator just now, so looking at free and low-cost alternatives, the major players seem to be:  Inkscape

  • no patterns built-in
  • pattern creation and editing is clumsy
  • no support for named styles
  • styles and patterns can’t be shared across files
  • kinda buggy
  • PDF export doesn’t play well with Preview.app
  • everything keyboard-accessible
  • good features for diagramming like glue points and connectors
  • no auto-save (not reliable anyway).  not sure if Inkscape crashed or X11, but an hour’s work is gone just the same.
  • X11 app, so integration is not so good

Lineform

  • only bitmap pattern fills, not so great for a vector editor
  • few primitives
  • no support for diagramming
  • otherwise nice UI, fast, quite nice

Intaglio

  • good feature set
  • lightweight
  • good AppleScript support
  • no support for diagramming
  • crashed at least once on my Intel MBP

Lineform and Intaglio are both well done, but Lineform is still a bit immature, and both programs are clearly designed first with graphic design in mind. In the end, Inkscape seems to have the largest feature set, convenient primitives, support for diagrams with connectors, and it’s free. I really want to like Lineform and Intaglio, but for commercial software of that price (~$90), they really need to work on their non-artistic features to make it worth the purchase to me. As it is, I think I’ll end up buying Illustrator somewhere down the line.  Of course I may be on the wrong track completely; perhaps I should be looking at CAD software instead of illustration.

Mail.app.weird

Thursday, November 22nd, 2007

Finally got around to switching one of my other domains to elahost, which is hosting this site. The web site moved over pretty smoothly, but mail proved to be another matter entirely.

Having created an identical mail account on elahost before changing the dns entries, I expected to be happy after simply changing the mail server in Mail.app setup. Indeed I was able to send and receive mail without interruption after hitting “ok”, but suddenly my inbox and sent folders were empty!

A moment’s thought told me I should have expected this, since I was using IMAP. Ok, that mystery solved. But why now can I not see any folder but “INBOX” on the new server?!

Not sure why, even now that it’s working. I seem to have fixed it by changing the username from “me+domain.com” to “me@domain.com”, two forms which the provider docs say should be equivalent. Don’t know if I knocked something loose in Mail.app, or if it’s a bug in whatever mail account system they’re using on elahost..