My Computing Stuff

I run several computers using Mac OS X. Here are some useful hints:

Invisible files

To make a file invisible:

$ /Developer/Tools/SetFile -a V file-name

(upper case V)

To make a file visible:

$ /Developer/Tools/SetFile -a v file-name

(lower case v)

Safari Plug-Ins

I installed/updated my Adobe reader, and the next time I used Safari, it asked me if I wanted to install the Adobe plug-in to make Safari use the Adobe reader for PDF files. I said yes at the time, but after a bit of use, found it too slow. Granted, it does have more features, but not the one I wanted, which was to open it up outside the browser. With the standard Preview option, this was just a right-mouse pull down "Open in Preview", very convenient. But how to get back to Preview?

A bit of Googling revealed the answer. In Tiger (10.4) and Leopard (10.5), there is a folder /Library/Internet Plug-Ins/ that contains all the plug-ins. Remove the one called AdobePDFViewer.plugin, restart Safari, and you are back with Preview.

And while on the subject of Safari, here's how to change the default browser preference:

  1. Open Safari (/Applications).
  2. From the Safari menu, choose Preferences.
  3. Click the General button.
  4. Choose a different browser from the Default Web Browser pop-up menu.
(from http://support.apple.com/kb/HT1637)

Time Machine Repair

A colleague had difficulties recovering his Time Machine backups when he had his motherboard replaced, and he sent me this URL about a fix. It seemed like good insurance to add it to this page: http://www.macosxhints.com/article.php?story=20080128003716101

OpenOffice recovery documents

When Open Office (version 3) "loses" its recovery files, and keeps asking to recover (non-existent) files, edit the file: /Users/ajh/Library/ApplicationSupport/OpenOffice.org/3/user/registry/data/org/openoffice/Office/Recovery.xcu to delete the element nodes containing the offending file path. Then save this file, and restart OpenOffice.

Finding out the screen resolution

I run a number of different displays, and when starting up various programs I need to know the current screen resolution. This little script does the trick:

        #!/bin/bash
        #
        # screenres      determine screen resolution 'HEIGHTxWIDTH'
        # screenres -w   determine screen resolution 'WIDTH'
        # screenres -h   determine screen resolution 'HEIGHT'
        # 
        res=`xdpyinfo | awk '/dimensions/ {print $2}'`
        if [ "$1" = '-h' ] ; then
          # extract height and print
          expr "$res" : '.*x\([0-9]*\)'
        elif [ "$1" = '-w' ] ; then
          # extract width and print
          expr "$res" : '\([0-9]*\)'
        else
          # print full resolution
          echo $res
        fi
      

Automatically changing the Desktop Picture in Snow Leopard

I had a cool little script that changed the desktop background picture (aka wallpaper) automatically, according to parameters stored in an XML file. See this Multithreaded Image Viewer for details. Most of it was pretty plain python programming (I even set it as an exercise in concurrent programming one year), but it relied upon a shell script setBackground.sh that used an Applescript script to do the actual picture change via a set desktop picture to file MyPicFile.

But then it broke in Snow Leopard, for reasons I do not understand. Attempts to find how to do this task via much Googling also proved fruitless. While fiddling around with the standard Apple Change Desktop Background pop-up memu, I hit on the idea of having a folder with only one image in it, and setting the reload time to 5 seconds, the shortest reload time.

Hence this new script for setBackground.sh. It looks like this:

      #!/bin/sh
      FOLDER=/Users/ajh/Pictures/Desktop
      FILE=$1
      
      rm $FOLDER/*
      ln -s $FILE $FOLDER
    

I used a soft link without thinking about why. It could be a hard link, I guess.

(20100330:094441) And this is not perfect by any means. It breaks on my laptop when I put it to sleep, or change locations, or both, or neither (hard to say which, since it seems very erratic!) Every so often I have to invoke "Change Desktop Background", and reselect the folder in which the temporary item is placed.

Filename extensions

I noticed while using Keynote that my filename extensions were getting thrown away. I was not the only one to be puzzled by this behaviour, so I thought I should comment on the fix required.

Go to the Finder Preferences, and click the Advanced tab. Under Snow Leopard, the top check box should be "Show all filename extensions". If this is unchecked, click it, and your filename extensions will magically reappear!

For some reason, Apple appears to have changed the default value on this from Leopard to Snow Leopard, leaving many users puzzled as to what is going on.

Fixing the X11 "Focus Follows Mouse" hassle

In a terminal, type:

    defaults write org.x.X11 wm_ffm -bool true
and then restart X11.

This page maintained by John Hurst.
Copyright Monash University Acceptable Use Policy
1909 accesses since
29 Jan 2008
My PhotoMy PhotoTrain Photo

Dynamically generated at 20140124:1600 from an XML file modified on 20100609:1049.
Maintainer use only; not generally accessible: Local Server Home Server Hurst Server CSSE Server

1979 accesses since 29 Jan 2008, HTML cache rendered at 20140414:1717