Sunday, November 19, 2006

My current hack for syncing text files (well, _a_ text file) between a Mac and a Palm, using the MacNoteTaker conduit - NoteTakersFriend.sh:

#!/bin/bash
#It seems like growlnotify can not be launched by NoteTakersFriend

#could probably rewrite simply with rsync
#gotta wait until the first sync is done
#watchfile /Users/Surly/Documents/Palm/Users/Palm\ Users
#-60 second interval

#IF Conduit Manager is not an active process OR if that UserData file exists then execute NoteTakersFriend
#watchedfileboils
#this is definitely checkable through Applescript (see itunes status mod.)
#newer=ls -t /Users/Surly/Documents/Palm/Users/Surly/NoteTaker/remind*|awk '{print $1}';
#simpler: TIME=`date | awk '{print $4}'`

#DEBUGGING:
#It seems like something sometimes gets screwed up such that this file gives no echo output.
#The cure to this sleeping sickness seems to be somewhere in running (at least pasting the
#commands into a sh shell), thecure.sh (basically commenting out the if [ "$?" != "0" ] line and it's fi terminator)
SyncMode=`diff /Users/Surly/Documents/Palm/Users/Palm\ Users /Users/Surly/Documents/Palm/Users/Palm\ UsersSyncOnce |cut -c 112-117`;
newer=`(set \`ls -t /Users/Surly/Documents/Palm/Users/Surly/NoteTaker/remind*|awk '{print $1}'\`; echo $1)`
#echo "$newer"
#if (lastntfif [ "$SyncMode" = "differ" -a "$newer" = "/Users/Surly/Documents/Palm/Users/Surly/NoteTaker/remind.txt" ]; then # = for strings and -eq for numbers
# if [ls -t /Users/Surly/Documents/Palm/Users/Surly/NoteTaker/remind*|awk '{print $1}'=~s/remindmergetracker
#if (change date of NoteTaker/remind.txt >change data of remind.txt)

#deal with line feed discrepancy
#merge osx old palm
userspath="/Users/Surly/Documents/Palm/Users/";
fileold="/Users/Surly/Documents/Palm/Users/Surly/tmp/remind.txt";
file="/Users/Surly/remind.txt";
filepalm="/Users/Surly/Documents/Palm/Users/Surly/NoteTaker/remind.txt";
filemerged="/Users/Surly/Documents/Palm/Users/Surly/tmp/remind.txt.merged";


cp $filepalm $filepalm.tmp
tr '\015' '\012' <$filepalm.tmp > $filepalm
rm $filepalm.tmp
#instead of diffing palm and laptop versions, just check last time
#NoteTaker/remind.txt was touched
diff -q "$file" "$filepalm" >/dev/null;
if [ "$?" != "0" ]; then #$?==0 when files are identical (no differences)
#if [ diff -q "$file" "$filepalm" >/dev/null 2>&1]; then
#echo "$file1 and $file2 differ"
merge -p $file $fileold $filepalm >$filemerged
cp $fileold $fileold.1
cp $file /Users/Surly/remind.bak
cp $filemerged $filepalm
cp $filemerged $file
cp $filemerged $fileold
#cp $userspath/Surly/tmp/remind.txt.merged
#cp $userspath/Palm\ UsersWriteOnce $userspath/Palm\ Users
cp $userspath/Palm\ UsersSyncOnce $userspath/Palm\ Users
touch $userspath/Surly/NoteTaker/remindmergetracker
#the assumption here is that nothing happens on the palm between the
#read sync and the write one - i.e., days do not go by
#defense against such intervening stretches? Maybe on reboot cp ReadPalm to default

#another possible loophole: Conduit Settings is open, NTF runs, then Conduit
#Settings closes, saving its prior settings
#open -a /Applications/Palm/Conduit\ Manager
echo "HotSync again to synchronize NoteTaker" | /usr/local/bin/growlnotify -s -a /Applications/Palm/HotSync\ Manager
#man 1 growlnotify for help
echo "NoteTaker sync mode =>2: Sync with Palm"
fi
#identical files
#NoteTaker/remind.txt was newer than
else
if [ "$SyncMode" = "differ" ]; then
echo "NoteTaker sync mode 1: Read from Palm"
else
echo "NoteTaker sync mode 2: Sync with Palm"
fi
fi


#manual sync again?
#if so, then must worry about even or odd number of syncs
#or else come up with some kind of timing gimmick or something

#TO automate for an entire directory of synched files modify:
#for file1 in *; do
#for file2 in *; do
#if [ "$file1" != "$file2" ]; then
#if [ ! diff -q "$file1" "$file2" >/dev/null 2>&1 ]; then
#echo "%file1 and $file2 are identical"
#fi
#fi
#done
#done


I hope to document this in the future, but basically I just set NoteTaker conduit settings (to read from Palm, write to Palm, whatever) through HotSync Manager and then copied the Palm Users file to those named in the script.

Tuesday, November 14, 2006

pluck - A perl script to simplify saving web pages for offline browsing on a Palm

Plucker Desktop, the program to convert web pages and text files into a format readable on the Palm (using the Plucker viewer), is purported to not work on Intel Macs. Whatever - I always found it a very clicky program and have wanted for years to install a command-line equivalent. Stymied by problems with compiling the Plucker Python distiller, I looked briefly at payware iSilo, but it, too, is not yet working on Intel. I dug around in the Plucker Python distiller and found a version of the Python scripts which can be run directly by just plopping them wherever.

Then I wrote a simple perl script for processing those .webloc files that I drag off the [Safari|Shiira] address bar:

#!/usr/bin/perl -w
@files = ;
foreach $file (@files) {
if ($file=~/\s/)
{$newfile=$file;
$newfile=~s/\s/_/g;$newfile=~s/\'//g;$newfile=~s/\#//g;
$newfile=~s/\&//g;$newfile=~s/\://g;$newfile=~s/\;//g;
$newfile=~s/\|//g;$newfile=~s/\?//g;$newfile=~s/\"//g;
$newfile=~s/\(//g;$newfile=~s/\)//g;$oldfile=$file;
$oldfile=~s/ /\\ /g;$oldfile=~s/\'/\\'/g;$oldfile=~s/\;/\\\\;/g;
$oldfile=~s/\&/\\\&/g;$oldfile=~s/\:/\\\:/g;
$oldfile=~s/\|/\\\|/g;$oldfile=~s/\?/\\\?/g;
$oldfile=~s/\"/\\\"/g;$oldfile=~s/\(/\\\(/g;
$oldfile=~s/\)/\\\)/g;
`mv $oldfile $newfile`;
print "mv $oldfile $newfile\n";
}
}

$i=0;
@files = ;
foreach $file (@files) {
$URL=`strings $file/rsrc | grep http | sed '/^.http/s//http/' | head -1`;
$URL=~s/\s+//g;
$URL=~s/\//;
$URL=~s/\<\/string\>//;

print $URL;print "\n";
$originalfile=$file;
$justfilename=$file;
$justfilename=~s/\/Users\/Surly\/plucker\/to-pluck\///;# WITH .webloc
$pdbname=$justfilename;
$pdbname=~s/\.webloc//;
$pdbname=substr($pdbname,0,20);
$p='/Users/Surly/Documents/Palm/Users/Surly/Files\\ to\\ Install/';
`/Users/Surly/bin/PyPlucker/Spider.py --maxdepth=1 --home-url=$URL -f $p$pdbname`;
`mv $originalfile /Users/Surly/plucker/plucked/$justfilename`;
}

Yeah, it's ugly, but it works.

Then it was necessary to use Fink to install netpbm for processing some of the image files. This failed on jpegs, and even though I had set up ImageMagick (twice, since Fink also did an install) and had set image_parser = ImageMagick in .pluckerrc Spider.py was seemingly still defaulting to netpbm. Anyhow, I noticed that there were some more image processing settings under the [POSIX] section of the .pluckerrc file so I installed libjpeg and then in the .pluckerrc file set djpeg_program = djpeg. And now it all seems to work.

What's left to do: devise a scheme for handling the more complicated plucking jobs: like those that require altering the default maxdepth value (1 seems _so much_ better than 2) or those that need special URL matching; Folder Actions for automating the plucking; catching errors in parsing and not moving the .webloc file under those circumstances.

The bottom line: Plucking on an Intel Mac is not that hard to set up.

Monday, November 13, 2006

Compatibility problems between old (2.1.something) and new (2.9.something) versions of Octave - there are a lot of them. Apparently many of them are for "compatibilty" with Matlab, while sacrificing (fairly draconianly, in some cases) backward compatiblity with Octave.


  1. The old method of setting the path where Octave looks for other function files has changed from setting a LOADPATH environment variable in .octaverc to something like this:
    addpath (genpath ("~/Library/Octave"));
  2. Aquaterm, the way to get Octave to plot in OS X with Gnuplot but without X11, is displaying some kind of wonky behavior in its 1.0.2 incarnation. This may be entirely Aquaterm's fault - the old version (0.3?) was also wonky and required a "close all" command in Octave to get old plot windows killed. I'm still working on this, but excising the "close all" commands at least allows a function to plot to the same windows when called twice.
  3. At some point back in 2004, Octave switched from defaulting to column vectors to defaulting to row vectors because that's what Matlab does. If you routinely use the construction
    for i=1:n, x(i)= whatever ; end;,
    this is a serious monkey wrench heading your way.

    The simplest solution that I have found so far is to go through the code and replace
    x(i)= constructions with x(i,:) constructions. This will ensure backward compatibility of the script.


There are some nice features in this new version of Octave, including allowing matrices of arbitrary dimensionality.

Thursday, November 09, 2006

I'm switching (at least temporarily) to the Shiira web browser for three reasons:

1) Firefox is the only OS X browser that works with Gmail's keyboard shortcuts, but all browsers run out of memory eventually so a second browser is needed for actual browsing.

2) Safari is great, but the new version (2.0.4) has serious problems with keyboard navigation (page up/page down/home/end keys are unresponsive, and tabbing gives undesired results).

3) Shiira (1.2.2) finally has a substitute for Firefox's keyword searches and Safari's AcidSearch add-on: it is called "custom search engines" and is found under the Window menu. And like everything else on Shiira, it works.

Thursday, September 28, 2006

From the This American Life Update from September 27, 2006:

NEWS FLASH! This week we're introducing our brand-new custom Flash player from Pupu Platters Studios, which allows you to stream our MP3 archives for free while preserving your ability to pause, fast-forward and rewind. You don't have to do anything special – the player will open automatically whenever you click on our streaming audio links. So, if you were frustrated with streaming options this summer please give us another try. We're ready to rumble!

ALSO -- CHEAP DOWNLOADS! Our back catalogue is now $.95 a show at the Apple Music Store. Download high-quality files quickly and easily! Have TAL listening parties, and use the money you save on snack trays!


The Flash player works pretty well. It loads the whole sound file so you can jump around by dragging the time indicator. The fast-forward and rewind buttons are inoperative under Safari 1.3.2. What would be nice is if there were a menu for each episode so you could click on the different Acts to jump to them. Also there should be keyboard shortcuts for navigation. Overall this is a step up from the Real Player and the deliberately crippled m3u option.

Saturday, September 02, 2006

Mindstorms of the LEGO variety

Friday, September 01, 2006

Alternatives to PowerPoint for making presentations on OS X

The best alternative seems to be Apple's Keynote as it is a) cheaper and b) better designed. Microsoft's PowerPoint program has serious issues with PDF files. If you try to paste one into your presentation, it converts it to some other format, and (as an example) you lose any transparency that you might have had in it. Keynote handles PDF's perfectly.

I tried using NeoOffice but it just seemed to require immense amounts of RAM, and was therefore unusable.

I like the idea of a completely different approach like Prosper (LaTeX templates for presentations) or S5 (XHTML, CSS, and Javascript approach), but these script-like schemes completely ignore one of the essential features of a presentation creation program: A simple drawing program. I've got the equation and plot angles covered (LaTeX Equation Editor and the publication-quality R), but a simple drawing program continues to elude me. For now I will stick with Keynote.
Star Trek Inspirational Posters:

CAPTAIN JAMES T. KIRK: I'm sorry, I can't hear you over the sound of how awesome I am.

Thursday, August 31, 2006


Top Ten Rentals to Avoid On a First Video Date.
#6: Freaks. There's something about this Tod Browning classic that will lead a woman to hate you and everything you stand for. After seeing this movie with you, she will call your parents and request that you be put somewhere where you will be of no further harm to yourself or others.

- from Ian Shoales' Perfect World

Tuesday, August 29, 2006

OK, let's recap the ongoing saga of This American Life's streaming policy. The world's greatest radio show was an early pioneer in making its episodes available over the Internet. For many years, I have enjoyed the streaming functionality (supporting the show through buying merchandise and the occasional donation (OK, once)). A few months ago, TAL switched from the Real Audio streaming format to streaming mp3 via the .m3u playlist format. This was great, allowing listening with a variety of programs, including iTunes. But apparently a lot of people realized that it was possible to download the mp3 file directly, and this ruffled someone's feathers (something like "contractual obligations" were mentioned), causing a shift to a gimpy, non-downloadable kind of stream which disables all the navigation features except for "play". Now comes a new development, announced in this exerpt from the August 24, 2006, This American Life Update newsletter:

COMING SOON: MP3 STREAMING RELIEF
If you've been frustrated with this summer's less-than-ideal streaming MP3 functionality, relief is in sight. We plan to introduce a new, user-friendly Flash player for our streaming files sometime in September; it'll reinstate all the things you've been missing (fast forward, pause, rewind,etc).

They are also going to drop prices of old shows from 4 bucks to 95 cents!

Here are a few early episodes which are not available as streams, but can be purchased through the iTunes Music Store: Episode 8 - New Year, Episode 11 - Enemies, and the irresistibly titled Episode 17 - Name Change/No Theme.

My advice? Snap up some of those cheap episodes before something even weirder happens!