Wednesday, December 23, 2009

Ripping ISOs under OSX

sudo umount /dev/disk1s0
sudo dd bs=1m if=/dev/disk1 of=NameOfIso.iso
and, perhaps most importantly:
drutil burn NameOfIso.iso
This last one helps a lot -- mounting via Disk Utility seems to corrupt certain ISOs...

Thursday, December 17, 2009

Small Linuxes (Linuxi?)

For no good reason, other than curiosity, I wanted to install Linux on an ancient IBM thinkpad 240 maxed out with 192M (!) of dram and a 10G hard drive. I was able to install Ubuntu 9.04 on it, but with some work. The laptop will not boot from its USB (1.0!) port automatically. I had in the past taken the drive out, put it in a desktop, and use that configuration to load OSes. This time, I was able to modify the autoexec.bat file on a wakepup floppy to point to the correct vmlinuz and image files on the USB attached CD (the floppy for Ubuntu didn't recognize it, and neither did smart boot manager) That worked well enough, and 9.04 run okay, if slowly. I then upgraded the machine to 9.10. It did nothing but swap, totally thrashing, just running the OS with no applications. No happiness there. I then tried Damn Small Linux, but it wouldn't recognize the video modes and I couldn't find a workable VGA cheat code. Knoppix was up next, with similar results. Puppy Linux installed without a hitch and that's what the machine is running now...

Overall, too much time spent for too little gain. Should have surplussed the machine and bought a $200 slightly more capable used machine. FWIW.

Monday, December 14, 2009

GNU smalltalk 3.1 on OSX 10.6

I tried to get GNU smalltalk running on Snow Leopard, but ran into trouble. First, it segmented but I found a fix online saying to make a change around line 628 in sigsegv/configure.ac:

+    macos* | darwin*)
+ AC_CHECK_FUNC([vm_region], [CFG_STACKVMA=stackvma-mach.c]) ;;


That helped, but then I ran into the following:

(gdb) run --no-user-files --kernel-dir=/Users/beaty/src/smalltalk-3.1/kernel --image=/Users/beaty/src/smalltalk-3.1/gst.im -iQ /dev/null
Starting program: /Users/beaty/src/smalltalk-3.1/.libs/gst --no-user-files --kernel-dir=/Users/beaty/src/smalltalk-3.1/kernel --image=/Users/beaty/src/smalltalk-3.1/gst.im -iQ /dev/null
dyld: Library not loaded: /usr/local/lib/libgst.7.dylib
Referenced from: /Users/beaty/src/smalltalk-3.1/.libs/gst
Reason: image not found

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00007fff5fc01065 in __dyld_dyld_fatal_error ()

So, I had to:
export DYLD_LIBRARY_PATH=$HOME/lib:/usr/local/lib:/lib:/usr/lib:$HOME/src/smalltalk-3.1/libgst/.libs:/Users/beaty/src/smalltalk-3.1/sigsegv/src/.libs

At that point, it bus errored. Firing up gdb gave:

Program received signal SIGBUS, Bus error.
0x0000000100048190 in _gst_mem_alloc (h=0x100200ca0, sz=16) at alloc.c:222
222 blk->vSmall.free = mem->next;
(gdb) where
#0 0x0000000100048190 in _gst_mem_alloc (h=0x100200ca0, sz=16) at alloc.c:222
#1 0x00000001000233bf in _gst_tenure_oop (oop=0x101014890) at oop.c:738
Previous frame inner to this frame (gdb could not unwind past this frame)


And at that point I gave up (partially because it installed without a hitch on a Linux box) and used MacPorts to grab gst. That worked, but I had hope to install only gst instead of all that MacPorts installs along with it. Dunno if this will help anyone, but maybe it will...

Thursday, December 3, 2009

Remove duplicate files on a Unix system

#! /bin/sh -e

if [ "$#" = "0" ]; then WHERE=.; else WHERE=$1; fi
if [ "`uname`" = "Darwin" ]; then MD5='md5 -r'; else MD5=md5sum; fi

prev=""

find $WHERE -type f -exec $MD5 '{}' ';' | sort |
(
    IFS='\n'
    while read a
    do
        b=`echo "$a" | cut -c 1-32`
        c=`echo "$a" | cut -c 34-`
        if [ "$b" = "$prev" ];
        then
            rm -v "$c"
        fi
        prev="$b"
    done
)

Friday, November 20, 2009

Windows 7

So, I'm basically liking Windows 7. Take everyone's advice and skip Vista. Of course go to http://www.howtogeek.com/howto/windows-vista/disable-caps-lock-key-in-windows-vista/ and disable the stupid CAPS LOCK key. When I needed to add a HP LaserJet 1020 attached to a Mac Mini, I needed to download the "Adobe Universal Postscript Printer Driver" and specify "Generic Postscript Printer" and "http://192.168.1.100:631/printers/HP_LaserJet_1020". Also, Adobe's reader didn't do a good job of printing a pdf to that printer, but foxit it did. Strange.

I'd love to hear the logic behind not being able to do an upgrade from XP to W7 without saving all one's files and doing a clean install.

Wednesday, November 4, 2009

dansguardian on OSX

sudo port install dansguardian
sudo launchctl load -w /Library/LaunchDaemons/org.macports.dansguardian.plist
sudo mkdir /opt/local/var/run
sudo port install squid
sudo launchctl load -w /Library/LaunchDaemons/org.macports.Squid.plist
Once this is done, one has to force the browsers to go through Dans. For Safari, System Preferences -> Network -> Advanced -> Proxies and set localhost and port 8080 to what you want filtered:

For firefox, it's a little more complicated

1) in /Applications/Firefox.app/Contents/MacOS, create a file named firefox.cfg that contains:
//
lockPref("network.proxy.http", "127.0.0.1");
lockPref("network.proxy.http_port", 8080);
lockPref("network.proxy.ssl", "127.0.0.1");
lockPref("network.proxy.ssl_port", 8080);
lockPref("network.proxy.ftp", "127.0.0.1");
lockPref("network.proxy.ftp_port", 8080);
lockPref("network.proxy.type", 1);
2) edit /Applications/Firefox.app/Contents/MacOS/greprefs/all.js and add these two lines:
pref('general.config.obscure_value', 0);
pref('general.config.filename', 'firefox.cfg');
You'll need to check these every time you upgrade firefox...

Tuesday, November 3, 2009

MySQL upgrade for FC10 to FC11

I, and many other people apparently, ran into a MySQL bug while upgrading from FC10 to FC11. The error messages included "Fatal error: Can't open and lock privilege tables: Incorrect key file for table 'host'; try to repair it". It looks like there were MySQL v4 tables, and not running an upgrade for 5.0 created a problem for 5.1. Googling found one answer to be downgrading to 5.0, upgrading the tables, upgrading to 5.1 and doing another upgrade. Why either MySQL or FC couldn't do the right thing is beyond me. Anyway, removing the 5.1 libs breaks a lot of other programs, so I took the approach of building and installing 5.0 in /usr/local, doing the upgrade using that set of binaries, then going back to using the 5.1 binaries in /usr. This did the trick. I might have been able to use "rpm --prefix-", but didn't try. Here is the approximate incantation.
cd /usr/local/src
wget mysql-5.0.87.tar.gz
# from http://dev.mysql.com/downloads/mysql/5.0.html#source
gunzip mysql-5.0.87.tar.gz
tar xf mysql-5.0.87.tar
cd mysql-5.0.87
./configure --prefix=/usr/local
make
make install
P=$PATH
export PATH=/usr/local/bin:$PATH
/usr/local/bin/mysqld_safe
mysql_upgrade --socket=/var/lib/mysql/mysql.sock
/usr/local/bin/mysqladmin shutdown

export PATH=$P
/usr/bin/mysqld_safe
mysql_upgrade --socket=/var/lib/mysql/mysql.sock