Logging in from PC to MacOS

I have a few aliases and functions running in my ~/.profile, and some of them run MacOSX applications - for instance I like to edit files in SubEthaEdit, but I like to just use the word edit as the command to start the process. This is all well and good, until I’m remotely accessing a command line only, and try to edit a text file. If I’m logged into the Mac, up pops SubEthaEdit, and if I’m not logged in, I see kCGErrorRangeCheck : Window Server communications from outside of session allowed for root and console user only INIT_Processeses(), could not establish the default connection to the WindowServer.Abort trap Not much fun at all. So I wrote a function that will run the right program if I am remotely logged in. I found that Terminal sets the environment variable TERM_PROGRAM to 'Apple_Terminal'.

function edit
{
  if test `echo $TERM_PROGRAM` == 'Apple_Terminal' ; then
      open -a 'SubEthaEdit.app' "$*" &
  else
      pico "$*"
  fi
}

So far so good. But when I exit pico from my other terminal, I see an error of: -bash: test: ==: unary operator expected What’s happening is that the echo $TERM_PROGRAM is displaying “” (empty string) which test doesn’t like on the left hand side of a “==”. So the first lines of my ~/.profile are now:

if test `echo $TERM_PROGRAM""1` == '1' ; then
 export TERM_PROGRAM='Unknown'
fi

This took me a while to twig to - for ages I was just happy to have the error appear! The only issue with this is if I telnet from my imac (where the variable is set) into the same machine - you then lose the ability to automatically run the graphical programs set up in the functions. The other programs I use differently according to where I am are:

  • appswitch - use as a replacement for ps, kill, and to show/hide running programs.
  • SubEthaEdit - use as edit, and sedit (edit as Super User).
  • openman - a new window for each man page, allowing them to stay open while I keep working.

I also have a function called browse, that opens the current (or supplied) directory in the Finder. I’d love to be able to tell Windows Explorer to open this, but this would require some heavy duty inter-machine communication.

PuTTY shortcut

I sometimes have to use the PC next to my imac, and when I want to start a shell session, I use PuTTY. Now, usually I have to go through the process of either filling in the address of my mac, or click on the profile and load it, before clicking open. However, it’s possible to just edit the Windows Shortcut, and add the name of the server (or IP address) after the Target: information. Make sure the server name or address is not inside the quotes, and there is a space between them. Now, double-clicking the shortcut will connect to the server. It’s also possible to connect to a different port number. Update: If I’d read the FAQ, I’d know you can also use a -load mysessionname switch to load all of the settings from a saved session. Now if I could just get MacOSX telnetd to accept environment variables from the telnet client!

Cross Compilation NSLU2/MacOSX

So, I’ve built the toolchain - it’s about 69Mb raw, which zips to about 26Mb. Tarring and BZip2ing it reduces it to 18Mb. What I want to know is: is it only the stuff in bin/ that is used when cross-compiling? If so, this compresses to around 3.6Mb, which is small enough to post for others to use… Also, it’s possible to just copy the armv5b-softfloat-linux-* files (I used ln, so they are still in the original spot, but take up no extra room) to a place in your path. From what I’ve just read, the only thing really used is the compiler, but surely the linker is too. I have built a hello.c program, but cannot test it until I get my NSLU2.

NSLU2 MacOSX Toolchain

I’ve just paid for (and expect to receive in the next couple of days) a large (160Gb) USB Hard Drive, and in the next week or so I’ll also buy a Linksys NSLU2 NAS device, to share the HDD with all devices in my network. One of the reasons I decided on this route is the extreme hackability of the NSLU2 - it comes with a cut-down version of Linux with only SMB sharing turned on, but by flashing a new ROM it’s possible to set it up as a complete server. I aim to use it for mainly sharing files, but just for fun I’ll try and build python for it. I had a whole lot of experience building python for BeOS/PPC a few years back. It started to run into problems when building sockets and anything that used mmap(), and after about 2.2 I’m not sure I ever got it to work correctly again. Building the cross compilation toolchain to allow me to do this from MacOS X is quite complicated: you have to download about 60Mb of source code, and then build it. More details on this page. My notes on the topic follow: Make sure you reference the nslu2/bin directory in your path before the other location where the tools you installed are. Bash looks in the order they appear in the environment library list, so if expr is in two places, the first one it is found in is used, for example. The good news is, if the files have been downloaded, and the build fails, it is smart enough not to try and re-download them. Make sure you follow the instructions carefully - I did a make install instead of the cp src/expr $HOME/local/nslu2, and it failed dismally.

Most Played Music Meme

Most Played Music Meme Originally uploaded by Michael Heilemann.

Follow the instructions…

Zire Screen part 2

Well, it didn’t seem to completely fix it. Ages ago, after reading some book (called something like “How to do Everything with Your Palm (TM) Handheld, Third Edition” (Dave Johnson, Rick Broida) I stuck some tape over the Graffiti area, and I think this was causing (or contributing to) the problem. Since some of it was almost under the lip surrounding the screen, it was a little hard to remove. Almost all gone now, and the problem seems to be gone. Or nearly, anyway.

Zire Screen Issues

I love my Palm Zire - I keep all of my contact details, expenses, etc on there. The only thing I don’t do with it right now is email - but that’s only because the Mail.app conduit doesn’t handle emails sent properly - and it’s usually easier to use Gmail. Imagine my chagrin, then when weird stuff began to happen - extra screen taps (that I didn’t make) interfering with my use of the handheld. It meant that I couldn’t read my eBooks under certain lighting (halogen downlights seem to worsen the problem). Same with driving at night - perhaps there is some flickering, or the sodium lights affected it too. It came to a head when it began to mark my To-Do items as ‘Done’. This is unbearable - how do I know if I’ve cleaned the car or not, if my Zire says I have? I searched through the PalmOne site and forums (by the way, they still haven’t acknowledged the Zire 21/Digital Mobile Phone resetting issue, apparently!) and finally found a post that said to re-calibrate the screen. Easier said than done, since the problem had become so bad as to cause other programs to be run, and when I finally managed to get into the Prefs, and then the Calibration section, random taps were causing the little red circles to jump willy-nilly from top to bottom. Eventually I got in three presses before the gremlins, and bingo, problem solved. Moral of this story: if you start having problems with extra screen taps, run the calibration program sooner, rather than later!

Safari in Dock

I don’t use Safari. I keep removing it from my Dock (right next to the Finder icon), yet it keeps reappearing! And not every time I restart/log-in.

Changing Signature in Mail.app

I wrote a script some time ago that puts a new fortune into my Mail.app signature. However, it doesn’t seem to save the signature between restarts of the application, unless I manually open and then close the Preferences window (and the Signatures pane of this window). How bizarre!

Year Old Post

Temporary Post.