Monday, September 8, 2008

erlang

My favorite usergroup around here has to be the Utah Ruby User Group. The topics are often related to rails, but there's usually some good topic that wanders beyond rails.

Surgeworks sponsors the group and gives out technical books at our meetings. I got the pragmatic bookshelf erlang book. It's quite fascinating. It was fun to see footnotes comparing erlang with prolog and ruby. I like learning about computer languages and it was great fun sitting down with this book.

erlang "objects" if you can call them that are sort of artifacts of the language rather than explicit constructs. It reminds me of the way one of my college instructors "discovered" objects with us in a scheme lecture.

I carefully read the first part of the book and skimmed the rest. The second part of the book has a good level of detail that requires you to be in a project to make best use of it. Hopefully some day I will :)

Finally, erlang has the absolute best name for its included db, "Mnesia".

Friday, May 9, 2008

reviving a cobalt

Surgeworks had a cobalt raq2 kicking around so I asked if I could try to get it running. I was able to put debian on it. Netbooting the installer resulted in "unit boot failed". Watching the serial console reveals the kernel elf binary was corrupt when it came time to execute it.

In the end it worked using another computer to put the installer on the hard drive temporarily.

download nfsroot.tar.gz referred to in http://www.cyrius.com/debian/cobalt/install.html
fdisk the hard drive, remove all partitions, create a single primary partition, at least 5MB
format the boot partition with mke2fs -r 0
untar nfsroot.tar.gz into the partition
move everything to the top directory: mv nfsroot/* .
modify default.colo to load everything from the disk instead of network:
-nfs {dhcp-next-server} {dhcp-root-path} vmlinux-2.6.18-6-r5k-cobalt {initrd}
+load vmlinux-2.6.18-6-r5k-cobalt {initrd}

Then put the drive in the cobalt, boot up, and let the installer take over the whole drive. The temporary partition gets overwritten.

Thursday, April 10, 2008

cracks in acts_as_paranoid

This may be my first rails blog entry. It's born out of pure frustration. :)

When you destroy an activerecord object that uses acts_as_paranoid, the record is flagged instead of actually deleted. You can then look at the database and review those deleted items. Combined with acts_as_audited you get an interesting audit trail.

acts_as_paranoid monkeys with AR to pull this off. Unfortunately there are times when cracks show through.
  1. When you call find, do not use :include to join in a paranoid model unless you make arrangements to drop out deleted records
  2. If you want to use a :through relation with a paranoid model, you must add a clause to drop deleted records.
The latter you do with something like:
has_many :movies, :through => :dancer_movies, :conditions => ['dancer_movies.deleted_at is null']
I'll add more as I discover them.

Monday, March 24, 2008

AT&T Tilt

I have been using a Treo 700p for almost two years now. Verizon replaced my motorola e815 flip phone with the 700p when their forced-upgrade killed bluetooth dialup networking.

My Verizon contract is up and I'm ready for a change. I had considered Sprint for the cheaper data and the possibility of wimax in the next year or so. I decided to go with AT&T for a few reasons...
  • GSM is handy for traveling, use in a laptop, experimenting with my neo1973
  • Using GSM 3G, some phones can do voice and data simultaneously
  • Verizon wireless has been very heavy-handed (It was not fun when they started having billing errors and sending me bills for $2000+)
  • It'll be fun to have a phone with a GPS.
  • I would love to use an iPhone 3G instead, but the SDK can't support background processes and the iPhone won't do DUN or PAN
The tilt is able to do DUN with my n810 and my ubuntu laptop, but it can be tricky.
  • Simultaneous voice and 3G data doesn't work with DUN. This reveals that MS sends the DUN client direct to the GSM chip instead of creating a virtual modem like we have with the bluez dund.
  • I followed the tip to reset the phone when it was counting down to install some extra software. Apparently the extra software disables features.
  • In Ubuntu, I had to log out and run a command like "passkey-agent --default 9876" before firing up DUN. The phone & laptop kept failing to pair when entering a pin using the gnome gui.
  • The internet sharing app DOES allow for simultaneous data and voice (using PAN).
  • The phone delivers data rates up to about 580kbps. *Much* better than the older ppc devices I tried.
  • My neo1973 with original gsm firmware can use this new sim card. It's the first sim I have had success with.

Sunday, March 16, 2008

Dead spider


Nextlink's Spider bluetooth headset is infamous for its failure rate. It's a great headset with a class 1 radio and decent features, but it seems many of them were fitted with lipoly cells that can't hold their charge well. When a lipoly cell runs down below 3.0v, the battery can be permanently damaged so it's a significant problem.

I kept my set plugged in whenever I wasn't using it, but last night it finally went south when the plug came out of the power socket and allowed the battery to drain. After that, the LED would not turn on with any amount of fiddling. I opened it and found the battery, swelled, registered just a touch over 0v on the multimeter. This means it's dead and isn't coming back.

I attached a battery harvested from a helicopter. Now the headset works properly and I don't have to worry about the battery getting too low. It's just not so stylish any more.

Sunday, March 9, 2008

Neo1973: No wifi/3g/battery life? no problem



I decided to rig a better setup for USB host. What I did was open the hub and short the +5v provided to client ports to the +5 on the uplink port. This makes the hub unusable for other purposes, but gives me a nice single-cable solution for a neo hub. I just needed to add a female usb a to mini usb adapter.

The usb device in the picture provides speedy data through verizon cdma/evdo.

I was able to get fastcharge to work on connection. In /etc/udev/rules.d/neohub.rules:

SUBSYSTEM=="usb", ACTION=="add", PRODUCT=="1410/2110/0", RUN+="/etc/udev/scripts/neohub.sh"

and in /etc/udev/scripts/neohub.sh:

#!/bin/sh
echo -n fast_cccv > /sys/devices/platform/s3c2410-i2c/i2c-adapter/i2c-0/0-0008/chgmode

/etc/rcS.d/S98host:

#!/bin/sh
echo host >/sys/devices/platform/s3c2410-ohci/usb_mode

Some issues remain:

  • this would need to be reworked for freerunner
  • there are no decent linux drivers for usb wifi that give us master mode to make an AP