getting linux wireless working

Ok, it all works correctly in the office, as we have a 802.11g wireless hub, but when I’m at home this isn’t the case – it’s only 802.11(a/b).
All I get is a complaint that it can’t set the bit rate.
Grrrr.

dtrace in the morning

Well I have a presentation from 12.00 -> 12.30 tomorrow in DCU. It’s on Dtrace. This will be my first presentation on Dtrace in front of an audience of more that 10 people. With any luck I should have them all converted to using the One True Tool. Scary to be putting work related stuff here, but I think people should know that I have a mostly un-life.

writeable constant strings

Another one of those silly problems in C programming that occasionally crops up.
Depending on the compiler, declaring a char * variable pointing to a string constant can cause that string to go into the .text segment of the application. This segment is marked as readable and executable; but explicitly not writeable.
When you try to write to this address it issues a memory protection fault (SEGV on linux). Solutions are:

  1. copy the string using strdup before writing to it. This means you need to remember to free the memory once the function has completed.
  2. use alloca and strcpy to populate the string. This eliminates the need to free the memory, but adds a bit to the set-up overhead

Nontheless, you should never be writing to values obtained from a constant; you never know where it’s been (poor blighter).

Font preferences

I’ve been using the font called ‘proggy clean’ for all my programming needs for the last while and find it a very capable font for editing programs. Everything is clear and easy to work with.
It came up today as it is a great typeface for use in LCD projector demonstrations. It’s available from http://www.tactile3d.com/tristan/

loopback file system

Most people think that you can only mount a directory onto another file system, which is true most of the time. Most file systems have code to prevent you from mounting a filesystem on a file,
not the loopback file system under Solaris (I’ve not checked on linux). With this lovely beast you can mount a file on top of another file.
Say you’re on an unsupported operating system
, and every time you try running a script it moans at you using a dialog that the OS you’re running on is not supported. You copy the file locally and make the changes to it. Then through the magic of lofs you issue:

# mount -f lofs /tmp/fixedfile /dist/brokenfile

then when you issue a /dist/brokenfile it runs your new /tmp/fixedfile, without you having to copy anything else to the new location.
This comes in handy when you’re trying to install a machine over NFS and you can’t write to the /etc/default/login file which has a

CONSOLE=/dev/console

.
you fix the file, use the mount -f lofs /tmp/login /etc/default/login and then you can telnet to it with ease to do some last minute checks before rebooting the machine from the comfort of your home.

Palm KeyClick hack

I’ve got to put in an entry to the keyclick hack, becuse people have started to look for it. I have a search form, but it’s not linked into the other elements of the site. By adding this entry, linking to the keyclick hack I’m ensuring that it will be findable when people go looking for it. There have been a minimum of 2 searches for palm related stuff.
Anyway the keyclick hack is at https://www.petesh.com/palmos/. I’m sure I’ll put some more stuff in there.
{p}

Time for a wee bit of math (minimap)

Ok,
We have the X position:
– getMapXPos()
this is a fraction of the overall display:
(getMapXPos() / getMapWidth())
multiply by the width of the display.
Making sure to order them such that there is never a zero value
for the multiplication.

More palm5/6 woes

the high resolution support for the PalmOS5 is driving me nuts.
little new pieces of the API seem to appear every now and again that make older code stop working. The testing matrix looks like:

  • pre palmos 3.5 device
  • palmos 3.5 device
    • grey
    • color
  • palmos 4 device
    • grey
    • color
  • palmos 5 device (simulator)
    • 320×320 resolution
  • palmos 5.?? device (simulator)
    • collapsible display, reorientable display
    • 1, 1.5 and 2x resolution
  • palmos 6 device (simulator)
    • all the 5.?? matrix

It’s quite a trek to make sure that it works in all the devices. I need to codify the testing matrix.

Need to change the distribution algorithm

The distribution algorithm results in some silly output. There are times
where zones that are adjacent to power plants have no power.
I need to flag power shortages as well.
It looks like wasps find me sweet…