Archive for the 'OS X' Category

zzzZZZ

This feels over engineered but…

I have always wanted to be able to put my Mac Pro to sleep using the power button on the Dell display I have connected to it. If you put the Mac to sleep and then turn off the display it will wake the mac up again due to the USB disconnect of the USB hub in the display.

I came across sleepwatcher which allows you to do stuff like this

Create a config file containing something like 

timeout=100
idle=if [ `system_profiler SPUSBDataType | grep "Apple Keyboard" > /dev/null; \
    echo $?` -eq 1 ]; then /usr/local/sbin/sleepwatcher -n;fi

(I have my Apple Keyboard connected to the USB hub in the display.) Then edit the sleepwatcher Launch script to use that config file - make the launch command look like this

/usr/local/sbin/sleepwatcher -d -V -s /etc/rc.sleep -w /etc/rc.wakeup -f /config/file

Restart sleepwatcher and press the power button on your display and wait 10 seconds…

Now must just remember that this will occur whenever I disconnect the keyboard.

log(0.5) and the OS X calculator

The OS X calculator is one of my favorite applications and I use it every day for work (I find  the binary display in the programmer view especially useful). So I was very surprised when I noticed that it was giving me the wrong answer for log(0.5). I was getting log(0.5) = 0.301 when it should be -0.301. Strangely 1-log(0.5) was correctly shown as 1.301. Well today I discovered that this only happens if you enable “Show Separators” in  the View menu.

Does anyone else see this or is it just me?

sshd on OS X

I have been trying to understand how the SSH server settings are controlled on Leopard. To turn sshd on you tick the remote login box on the sharing preference pane. You can then control which users are allowed to log in by selecting them in the “allow access for” section.

But where does it store the settings? Traditionally you would have added a clause like

AllowUsers jad
 to /etc/ssh/sshd_config. However OS X does not do this, instead it adds a file called
/private/var/db/dslocal/nodes/Default/groups/com.apple.access_ssh.plist
containing what appears to be a list of users in the remote  login group. I have no idea what uses this file. Is it a modified  version of sshd or is something cleverer at work?
And, what was wrong with the old way?

Totally useless error messages

Why do some applications always generate such rubbish error messages. I am using eclipse for a project and it has just failed to start. The error on the screen was

That file contains this:

!SESSION 2008-07-08 08:34:44.307 -----------------------------------------------
eclipse.buildId=I20080617-2000
java.version=1.5.0_13
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86, WS=carbon, NL=en_US
Framework arguments: -keyring /Users/jad/.eclipse_keyring -showlocation
Command-line arguments: -os macosx -ws carbon -arch x86 -keyring /Users/jad/.eclipse_keyring -consoleLog -showlocation

!ENTRY org.eclipse.osgi 4 0 2008-07-08 08:34:45.312
!MESSAGE Application error
!STACK 1
org.eclipse.swt.SWTError: No more handles
at org.eclipse.swt.SWT.error(SWT.java:3803)
at org.eclipse.swt.SWT.error(SWT.java:3695)
at org.eclipse.swt.SWT.error(SWT.java:3666)
at org.eclipse.swt.widgets.Display.createOverlayWindow(Display.java:741)
at org.eclipse.swt.widgets.Display.internal_new_GC(Display.java:2300)
at org.eclipse.swt.graphics.GC.(GC.java:149)
at org.eclipse.swt.graphics.GC.(GC.java:115)
...

Why do I need all the junk? Why didn’t the message on the screen just say something like. “Sorry, the application failed to start. The reason was - No more handles.”. Even better, it could explain what a handle is and how to fix it or provide a link to a knowledge base.
 

So I don’t forget again

To exclude the annoying ._ files from tarballs built on OS X 10.5.x do this

export COPYFILE_DISABLE=true

Thanks to this thread for the answer.