Monday, December 28, 2009

Paste Special... Unformatted in Office Mac 2008 PowerPoint

Geez. Too much time looking into such a simple thing. I'm a big fan of using the keyboard instead of the mouse -- much faster for me. No one seems to have a good answer for a keyboard mapping of pasting into PowerPoint 2008 for the Mac. Word, people seem to have. As close as I could easily get is using System Preferences -> Keyboard, Keyboard Shortcuts, Application Shortcuts. And none of the Microsoft Applications even show up so one has to use "All Applications". Lame. Here's a screen shot.

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/

+    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/ -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/ -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-> = 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


find $WHERE -type f -exec $MD5 '{}' ';' | sort |
    while read a
        b=`echo "$a" | cut -c 1-32`
        c=`echo "$a" | cut -c 34-`
        if [ "$b" = "$prev" ];
            rm -v "$c"

Friday, November 20, 2009

Windows 7

So, I'm basically liking Windows 7. Take everyone's advice and skip Vista. Of course go to 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 "". 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/, create a file named firefox.cfg that contains:
lockPref("network.proxy.http", "");
lockPref("network.proxy.http_port", 8080);
lockPref("network.proxy.ssl", "");
lockPref("network.proxy.ssl_port", 8080);
lockPref("network.proxy.ftp", "");
lockPref("network.proxy.ftp_port", 8080);
lockPref("network.proxy.type", 1);
2) edit /Applications/ 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
gunzip mysql-5.0.87.tar.gz
tar xf mysql-5.0.87.tar
cd mysql-5.0.87
./configure --prefix=/usr/local
make install
export PATH=/usr/local/bin:$PATH
mysql_upgrade --socket=/var/lib/mysql/mysql.sock
/usr/local/bin/mysqladmin shutdown

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

Thursday, September 17, 2009

pptpconfig on ubuntu

One thing that fedora does better out of the box than ubuntu is PPTP VPN configuration. That dang Network Manager just doesn't work. pptpconfig does, and on FC8 yum installs it no problem. No such luck in Ubuntu 9.04. I was able to work around it all, but it wasn't easy. I retrieved the following:

Did "sudo alien" and "dpkg --install" for each. Same thing for both of:

Used synaptics to install libgtk1.2. Did "sudo pptpconfig" and was off and running, except I had to add a route by hand:

sudo route add -net netmask dev ppp0

Really shouldn't have been that hard...

Sunday, September 6, 2009

Universal Transverse Mercator (UTM) to GPS Lat/Long

I often use "WGS84" maps for accessing the backcountry. Their measurements are in "Easting" and "Northing", meters from the equator and prime meridian, approximately. The page at does a great job of converting for me.

Wednesday, July 15, 2009

Java and financial calculations

In general, Java isn't designed for financial calculations, but scientific ones. Java's float and double types don't have the rounding (to cents) and necessary precision for financial calculations. I wrote a small program to illustrate this that calculates monthly mortgage payments and the total payment. Here is the output:
Actual monthly payment = 2704.65
Actual total payment = 973674.00
---------- float ----------
Float monthly payment = 2704.654
Float total payment = 973675.44
---------- double ----------
Double monthly payment = 2704.6540626894594
Double total payment = 973675.4625682053
---------- BigDecimal ----------
BigDecimal monthly payment = 2704.65
BigDecimal total payment = 973674.00

The first two lines are what should be produced. The second and third sections are what Java's float and double types produce, leading to one overpaying their loan. The third section uses Java's BigDecimal class, setting all the precision and rounding values. It's messy to say the least, but this is what it takes to get the values correct. Here is the program:
import java.math.BigDecimal;
import java.math.MathContext;

public class Amort
public static void main (String args[])
System.out.println ("Actual monthly payment = 2704.65");
System.out.println ("Actual total payment = 973674.00");
System.out.println ("---------- float ----------");
System.out.println ("---------- double ----------");
System.out.println ("---------- BigDecimal ----------");

static void doubler()
double principal = 417000.00;
double annual = .0675;
double rate = annual / 12.0;
double years = 30;
double months = 12 * years;

double monthly = (principal * rate) /
(1.0 - (Math.pow ((1.0 + rate), -months)));

System.out.println ("Double monthly payment = " + monthly);
System.out.println ("Double total payment = " + monthly * months);

static void floater()
float principal = 417000.00F;
float annual = .0675F;
float rate = annual / 12.0F;
float years = 30.0F;
float months = 12.0F * years;

float monthly = (principal * rate) /
(float) (1.0F - (Math.pow ((1.0 + rate), -months)));

System.out.println ("Float monthly payment = " + monthly);
System.out.println ("Float total payment = " + monthly * months);

static void bigger()
MathContext mc2 = new MathContext (2);
MathContext mc4 = new MathContext (4);
MathContext mc6 = new MathContext (6);
MathContext mc8 = new MathContext (8);

BigDecimal principal = new BigDecimal (417000.00, mc8);
BigDecimal annual = new BigDecimal ("0.0675", mc4);
BigDecimal twelve = new BigDecimal ("12", mc2);
BigDecimal rate = annual.divide (twelve);
BigDecimal years = new BigDecimal ("30", mc2);
BigDecimal months = years.multiply (twelve);

BigDecimal monthly = principal.multiply (rate).divide
(power (BigDecimal.ONE.add (rate), -360, 10)),
2, BigDecimal.ROUND_HALF_UP);

System.out.println ("BigDecimal monthly payment = " + monthly);
System.out.println ("BigDecimal total payment = " +
monthly.multiply (months));

static BigDecimal power (BigDecimal a, int p, int scale)
boolean negative = p < 0;

if (p == 0)
return (new BigDecimal ("1"));
else if (p == 1)
return (a);

if (negative)
p = -p;

BigDecimal result = a;
for (int i = 2; i <= p; i++)
result = result.multiply (a);

if (negative)
result = BigDecimal.ONE.divide
(result, scale, BigDecimal.ROUND_HALF_UP);

return (result);

Monday, June 29, 2009

Remote X11 via ssh and Xnest

One of the coolest things I've found recently is Xnest. I can "ssh -X" into a UNIX box and do "Xnest :1 -query" to get the XDMCP general login window. Slick. Apple-Click gives me a right click from my OSX box.

Removing VESA mode after ubuntu install

To install ubuntu on a machine with a "Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 03)" chipset, I had to use the "VESA" install mode. Once installed it wouldn't use any other so I had to remove the 'Driver "vesa"' line from /etc/X11/xorg.conf for ubuntu to use the higher screen resolutions available. I still haven't found out how to make compiz work under ubuntu; it did under RedHat...

ssh tunnel to exim4

In order for exim4 to pay attention to a client connected via an ssh tunnel, one has to add the IP address of the machine to the "dc_relay_nets" line in /etc/exim4/update-exim4.conf.conf.

mutt default colors

Mutt's default color scheme is white on black. To use the terminal's default color scheme, one must have a "color normal default default" line in their .muttrc. Why? No clue. Shouldn't that be the default?

Command-line ubuntu upgrade

I've a bunch of short things I need to catch up on. Here's a few:

sudo apt-get upgrade

To remove an older kernel:
sudo dpkg -l | grep linux-image
sudo dpkg -r

Friday, June 12, 2009

OpenSSH frustrations

I've written before about OpenSSH not working with an OSX box, but the troubles are bigger than that. I've had on-going problems transferring files from either a FC or Ubuntu box to sourceforge. Very strange. Poking around, there were references to DNS being an issue, and sure enough, if I use the IP address of the remote host instead of the host name, the transfers work no problem. What's up with this??? I check both the forward and reverse lookups with no issues. What would cause the stalling behavior? No clue.

It also appears that OpenSSH plays around at the IP level. It really shouldn't, being an application-layer protocol and all. I've used Jsch ( to good effect and we all know Java doesn't play at the IP layer. Indeed, I have been using jsch to tunnel instead of OpenSSH.

Oxymoron: Microsoft Intellitype

Ran into a problem with a Dell Latitude 830 when connected to an external projector: PowerPoint and other programs would zoom to 400% no matter what. When scaled back, they would zoom again. I found one reference to this strange behavior: Remove Intellitype and things were good again. It appears it only affects Latitude 800 series, but I can't be sure of that of course.

Sunday, June 7, 2009

exim4 and spamassasin

There seems to be no one easy place to find out how to integrate the two. Here's one.
  1. Get (yum or apt-get) and install exim4-daemon-heavy, spamassassin, and sa-exim. Configure exim4 the way you need it, but use the "split" configuration scheme.
  2. Change the line in /etc/exim4/sa-exim.conf to SAEximRunCond: 1 It says you can comment it out but you can't. That leaves SAEximRunCond undefined which means false.
  3. Make sure /etc/exim4/update-exim4.conf.conf has dc_use_split_config='true'
  4. Edit /etc/exim4/conf.d/main/02_exim4-config_options and uncomment the 'spamd_address' line
  5. sudo update-exim4.conf -v
  6. sudo service exim4 restart

Friday, May 8, 2009

sendmail to exim

So, I've had it with sendmail. And I'm pretty proficient with it -- my first "real" job was partially devoted to keeping it running for CSU. Exim looks like a pretty good replacement that a lot of people I had to remove an 'exec' out of my .forward to spamassassin, and then just removed the .forward as exim knows enough to look for a .procmailrc anyway. To see the queue, do 'exim -bp'; to forcibly flush it, do 'exim -qff'. In sendmail, it was 'mailq' and '/usr/lib/sendmail -oQ/var/spool/mqueue -q -v'

Sunday, May 3, 2009

Multiple USB drives with the same name but different mount points and udev

lsusb -v | more

$ udevadm info --name=/dev/sdc1 --query=all
P: /devices/pci0000:00/0000:00:1d.7/usb5/5-8/5-8:1.0/host6/target6:0:0/6:0:0:0/block/sdc/sdc1
N: sdc1
S: disk/by-id/usb-Maxtor_OneTouch_2HAAE8JF-0:0-part1
S: disk/by-path/pci-0000:00:1d.7-usb-0:8:1.0-scsi-0:0:0:0-part1
S: disk/by-uuid/798610cb-bde3-4d9d-8773-675d1255ea59
S: block/8:33
E: ID_MODEL=OneTouch
E: ID_SERIAL=Maxtor_OneTouch_2HAAE8JF-0:0
E: ID_TYPE=disk
E: ID_BUS=usb
E: ID_PATH=pci-0000:00:1d.7-usb-0:8:1.0-scsi-0:0:0:0
E: ID_FS_USAGE=filesystem
E: ID_FS_TYPE=ext3
E: ID_FS_UUID=798610cb-bde3-4d9d-8773-675d1255ea59
E: ID_FS_UUID_ENC=798610cb-bde3-4d9d-8773-675d1255ea59

$ udevadm info --name=/dev/sdb1 --query=all
P: /devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host4/target4:0:0/4:0:0:0/block/sdb/sdb1
N: sdb1
S: disk/by-id/usb-Maxtor_OneTouch_2HAABRGC-0:0-part1
S: disk/by-path/pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:0-part1
S: disk/by-uuid/838eeab8-95c8-4ceb-a571-bc17aaa8a7a4
S: block/8:17
E: ID_MODEL=OneTouch
E: ID_SERIAL=Maxtor_OneTouch_2HAABRGC-0:0
E: ID_TYPE=disk
E: ID_BUS=usb
E: ID_PATH=pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:0
E: ID_FS_USAGE=filesystem
E: ID_FS_TYPE=ext3
E: ID_FS_UUID=838eeab8-95c8-4ceb-a571-bc17aaa8a7a4
E: ID_FS_UUID_ENC=838eeab8-95c8-4ceb-a571-bc17aaa8a7a4

Tuesday, April 28, 2009

Resetting a Motorola H700

The destructions that come with the headset didn't tell how to do a complete reset in order to pair with a new phone. Found this on the net and it worked:
Turn the headset off (flip the boom in) then hold down the talk botton. The indicator should turn solid purple. Keep holding the the talk button and turn the headset on (flip the boom outward) and then it should stay soild purple and ready to pair with your phone.

Wednesday, April 8, 2009

Firefox, Gallery2, FC8, and Java

I couldn't get Gallery2 ( upload applet to work on FC8. I found someone else who couldn't either, but that was with Ubuntu. I had to remove the icedtea plugin and link the Sun Java vm plugin.
rpm -e java-1.7.0-icedtea-plugin-
cd /usr/lib/firefox-3.0.3/plugins
ln -s /usr/java/latest/plugin/i386/ns7/ .

Tuesday, February 17, 2009

Nikon D70 all manual

I have a Tamron 500/8 SP lens that i bought for a Canon A1 years ago. I wanted to use it on my Nikon D70, but it took a little figuring out, for me at least. Basically, one just attaches it and checks the histogram to set the shutter speed in manual mode (rotate the mode dial to M, use the main (back) dial to set the speed). The aperture is fixed. Here are a few shots that demonstrate this:

Not a lot of dynamic range, but hey: they were ducks on a pond...

Wednesday, February 4, 2009

OSX ssh

I have had ongoing problems with OSX's ssh. Connections would essentially time out when transferring a lot of data. Others have too, see and for example. I have packet captures that i'll try to post here. Quick fix is "sudo sysctl -w net.inet.tcp.delayed_ack=2".

More: turning other parameter dramatically increases OSX's performance on high speed links. See for example. I created /etc/sysctl.conf than contains:
More still: the delayed_ack seems to be the critical one...

Wednesday, January 28, 2009

Filtering bogons with iptables

There are a bunch of IP addresses that cannot be used (routed) across the internet. The private IP address ranges typically use for NAT are an example. I wrote a script to grab the unallocated ranges and create iptable rules for each. I thought i would be clever (-: i never learn, do i? :-) and integrate these with system-config-firewall, which appears to be a frontend to lokkit. Going to "Custom Rules", "Add", "ipv4", "filter", and choosing the file makes lokkit crap out with an error AND drop all the other rules. Bad form. I tracked the error down to the apparent fact the lokkit doesn't allow more the nine custom rules, no matter how many files the rules are broken in to. More bad form. So i just add them by hand. I should get around to using ipset for all this... Anyway, here's that script
#! /bin/bash


wget --quiet -O - | \
cut -d ' ' -f 1 > /tmp/unallocated

sed -e '/^$/d' \
-e 's/^00*//' \
-e 's/^/iptables -D INPUT -s /' \
-e 's/$/ -j DROP/' < /tmp/unallocated > $TEMP

sed -e '/^$/d' \
-e 's/^00*//' \
-e 's/^/iptables -I INPUT -s /' \
-e 's/$/ -j DROP/' < /tmp/unallocated >> $TEMP

echo 'iptables -D INPUT -s 10/24 -j DROP' >> $TEMP
echo 'iptables -I INPUT -s 10/24 -j DROP' >> $TEMP
echo 'iptables -D INPUT -s 172.16/12 -j DROP' >> $TEMP
echo 'iptables -I INPUT -s 172.16/12 -j DROP' >> $TEMP
echo 'iptables -D INPUT -s 192.168/16 -j DROP' >> $TEMP
echo 'iptables -I INPUT -s 192.168/16 -j DROP' >> $TEMP

sh $TEMP
rm /tmp/unallocated $TEMP
ci -m "" -l /etc/sysconfig/iptables
iptables-save > /etc/sysconfig/iptables

Sunday, January 18, 2009

Buffing CDs and DVDs

I've had no luck with cheap commercial CD/DVD scratch removers. Tried most -- Memorex, Alera, etc. -- and none removed the kind of scratches i seem to get... What does work for me is using my two-speed grinder that i converted to a buffer to polish my pipes. If you don't have such a beast but have a drill press, buy a couple of mandrels and buffer wheel. I use the lower (1850 RPM) setting, use brown tripoli to remove the scratches then red rouge to remove the marks left by the tripoli. Hold the CD or DVD in the most natural way so that the buffing is radial. Five minutes and you're done.

Wednesday, January 14, 2009

Firefox necessities

OSX necessities (for Mountain Lion)
SoundSource from

Monday, January 12, 2009

OSX internet sharing to ethernet from airport

So, i have an OpenSolaris machine that doesn't easily do wireless, at least i don't want to spend tons of time figuring it out. Right next to it is a Mac Mini that does wireless just fine and therefore also has a spare ethernet port. Trying to be clever, i put a crossover cable between the two, turned on internet sharing from Mini and hoped for the best. The best rarely seems to happen. After once again spending too much time trying to figure out what was wrong, i put a regular ethernet cable between the two and that made things work. I knew Apples typically figure out when they need to perform the ethernet crossover dance all by themselves; i didn't know that doing it for them would cause things to break. One also has to turn on those TCP services one wants to pass through the Mac; Remote Login (ssh) and Personal Web Sharing in my case. DNS and NTP seem to run through just fine; UDP isn't on OSX's ipfw firewall map...