16 May, 2007

Motorcycles, revisited

Sandy now has a motorcycle license. Or rather, as soon as she goes to the DMV she just has to pass their written test and gets the "M" designation. I, however, failed the class. In a very frustrating way. For most of the class I was on a DR 200 for most of the class. I had tremendous difficulties with both the rear brakes (situated under your right foot) and with the gearshift (which is situated at the tip of your left foot). The reason for this is I wore my enormous Vasque boots for protection. I couldn't feel where the controls were with my foot, and I couldn't fit my feet where they were supposed to be, so I rode very poorly, in general. Once I got the bike moving, it was a lot easier to drive. I was situated, my feet were properly placed (or at least clutching the bike in roughly the right place), and I had no problems handling the bike. A lot of the stuff you learn for high speed driving in a car applies to a bike. MSF talks about having a "twelve second" view down the road. Yeah, that's about right, as I think about how I drive the Subaru when we're pushing it hard.

So I dropped the bike. That's the big news, I guess, other than Sandy passing or my failing (I think the latter was much less expected than the former). I'm okay. It was on a tight left turn, and I wasn't leaning far enough out (bringing my center of gravity down to the point where it upset the bike). The bike fell out from under me, landed more or less across my waist, and no big deal. But the handlebars were perpendicular to me as the bike was coming down, and I took a real big hit to rib #3 on my left. Right about at the sternum, maybe an inch or so left. It's broken. I mean, you can feel it. Plus, I'd broken ribs before, and knew what the feeling was.

The instructor asked me if I wanted to go to the hospital and I said no. The reason for this is there is no way to "mend" a broken rib. You get X-rayed to make sure you haven't punctured your lungs or heart, and they give you percocet if you're lucky, tylenol #3 or motrin 800 if you're not, and send you on your way. Congratulations, you've broken a rib. Enjoy your pain.

I don't know what I'm going to do about the license. I might be able to pass the class if we could both adjust where the pedals are (they're all adjustable) and get me shoes that meet the requirement for the class but which are thin enough to fit into the right places.

Broken rib. Shit, this hurts.

Documentation and more.

Sandy had surgery today. So I spent a lot of time in the hospital doing nothing
but farting around on the laptop (because worrying wasn't going to make her any better).

I originally wanted to munge through my itunes library with ruby and then see if I could push that into last.fm so it had a "history" going back to 2002 or thereabouts (right now I'm around 2,200 tracks on last.fm, I think). Anyways, so I gets to my hackings and I get stuck right around the top. I want to create a class that will be a container for both the track metadata and the track data itself. But what's the syntax? I start looking around for ruby documentation and find nothing. In fact, I see this bit of evilness:

What the hell was Apple thinking? They have mostly functioning ruby, perl, and python installations, which is A Good Thing on user-focused Unixes. But where perl and python have been given not just documentation but examples, ruby has no documentation (not even the documentation that ships with the distribution), and is in fact so poorly supported that we have (good) monstrosities (good in the way that japan loves Godzilla; with apologies to Rob and his monster) like Locomotive. Locomotive is cool, but it only includes the relevant documentation necessary for Rails. And who can blame them? Rails is good stuff, and really, I should alreadyhave a full set of ruby documentation if I want to be hacking rails, right?

Anyways, the grapevine tells me there's a lot of the snake going around in Cupertino. That kind of worries me because I both fear and loathe its snakely ways. While I don't see anyone "kicking ruby out of the base install," I also don't see there being examples in Leopard's Developer disc for ruby (prove me wrong, Fred! please!). Conversely, I bet there will be lots more python examples. It kind of bugs me that there's so much love for the snake, that perl is (of course) included because it's essentially a legacy language, but ruby is sort of thrown in as an afterthought. (and speaking of afterthoughts, how's this for an idea: publish an API to the iTunes Music Store just like Amazon, Google, and so many other renaissance companies. Let your customers build tools that sell your products! You can keep your DRM – even though I know how you hate it, Steve – but let people search through the store and make purchases!)

So, getting back to the documentation thing, I couldn't remember the exact syntax for setting up the classes I needed to, and I couldn't find the documentation which would have revealed it for me. I spent what was probably enough time to find out from just reading the source searching frantically for some hidden ruby.tgz or man install (there are gadzillions of .rb files after you install things like Locomotive; I could have gone through these and infinite-monkeyed their syntax, but I really wanted to go by the documentation since I don't feel that comfortable with ruby yet), and came up entirely empty.

What else was there to do but reach for the tourniquet, find a vein, and dust off my perl habit? Really, it's all there, and documented and stuff (remember, the original goal was to read the iTunes Music Library XML; I am aware there are projects that do this already, so remember again that I am in the hospital waiting for my wife to come out of surgery without intarwebs access).

So I set up a simple class:


package Track;

sub new {
my ($track_id, $name, $artist, $album) = (@_);
return undef
if grep undef, ($track_id, $name, $artist, $album);

# pid is optional, and should be in the metadata, but the user
# may find it convenient for it to be here as well.
$pid = pop if 5 == @_;

bless {
track_id => $track_id,
name => $name,
artist => $artist,
album => $album,
# our syntax fails here
( defined $pid ? pid => $pid : () ),
}, shift
}

1;


I ordinarily use Class::Contract or Params::Validate in object creations, but Apple is missing them in their perl install. Anyways, looking at the above, the tricky part is the "pid" pieces. Apple has what they call a "Persistent ID." I am willing to trust that it is what they say it is. It looks something like "ACE4901A5ECC96A5", so it's probably unique and can be used as a primary key, or whatever. Worth saving, but not necessary to have, per se.

So I give the user the option to provide the PID as the last argument to the constructor, but there's a problem with the blessing. We're returning them a blessed hashref, which is quite fashionable as objects go (your coworkers will love get angry with you if you return blessed \$^O, sub { foo } or other perl miscellany). However, because it is a hash, we have to have a key for pid. But what if the user didn't give us a pid to begin with?

I added the last line to the blessed hashref to leave an empty list as the last element (this would prevent the returned hash from having a "pid" key at all). The notion being, the ternary question of whether pid is defined results in either a ( pid => $pid ) key/value or in the empty list. Personally, I thought that was clever, and got me out of the problem of leaving the pid key in there and having users covet my object's internals, seeing "pid," and making use of it.

But beware your operators, my hackers! Their precedence, which might precede or follow! Beware the parenthesied ternary operator and shun the frumious empty list!

Documentation in hand, I consult perlop(1):


Ternary "?:" is the conditional operator, just as in C. It works much like an if-then-else. If the argument before the ? is true, the argument before the : is returned, otherwise the argument after the : is returned.


Ternary has much higher precedence than the comma operator, so I think what perl is actually seeing the comma operator where the second half of the ternary – the ':' – is supposed to be. It has been said that only perl can parse perl. It is ambiguities like this that cause people to say this (and are a large part of why I am wholeheartedly and stupidly in love with it).


# original: ( defined $pid ? pid => $pid : () ),
# correct : defined $pid ? (pid => $pid) : (),


One, two! And through and through! The vorpal operator went snicker-snack and left the last element of this hash either a key-value pair or an empty list.

... And then went galumphing back.

It's amazing what you can do with a little documentation. It's not especially amazing how little can be done without it. It took me two days of floundering through icky ruby documentation to figure out how to talk over a Unix socket, when all the necessary information was available in one perl man page (to be fair, also in socket(2); but this applies to ruby as well)

I've spent most of the last week just hacking around on my own shit. I've picked up enough ruby to be dangerous, and I've even started getting back into munging XML and SQL with perl. It's such a shame that, while I love to program, when I program for a living, I never get to write anything I love writing. It would be nice to be in a polylingual environment, where I could say "you know, today I think I'm going to write this solution in ruby as long as nobody minds." I hear Google's like that. On the other hand, they think that somebody who was stupid enough to spend ten years of their life in college is actually smarter than somebody who spent those same ten years in the career of their choice. I digress.

So the reason I've had time to hack for myself is that I'm waiting for a few investigations to finish up before we can execute project Taipei, where I will be working with Dr. Ikari at NERV. I can't wait for the briefing. O frabjous day! Callooh! Callay! Details to follow.

12 May, 2007

Bikes


So today we ride for the first time. 250's, and not any faster than 25mph. Some of you may know that we have both recently fallen in love with Ducatis. The good news is, there are not only Ducati dealers in Taiwan, there is a Ducati Monster Club!

11 May, 2007

Writing

I just got a little bit of writing done. I'm deep in the pit of despair that is where all my writing comes from, and a bit of it needed to get "to paper." But here's the good news:


  • Naked asian chick
  • Swinging boobies
  • Milla Jovovitch moves (think RE)
  • Trouts
  • And a variant on Reynolds' melding plague.... only I explain it.

10 May, 2007

Listening to GPS

I am actually able to read a raw NMEA stream from my GPS device now. Here is the code:


# this socket is our prolific driver to the GPS
pro = '/dev/cu.PL2303-12345678'

gpssocket = File.open(pro, 'r+')
deciphered = String.new()
decoded = Array.new()

while FileTest.readable?(pro)
82.times { |i| c = gpssocket.getc; deciphered << c.chr }
puts deciphered
decoded << deciphered
end


Easy 'nuff, right? Problem is the sucker goes to sleep and needs to be awake with the command "ASTRAL". GPSy X knows how to wake the device, so I'd like to be able to watch its traffic. Unfortunately, all the "usb sniffers" out there are for catching chating spouses and password snarfing. Nothing so pedestrian as just trying to see the data. Anyways, to talk to the GPS, we need this code:


def self.marshal()
payload.split(//) { |chr| checksum = checksum ^ chr.unpack("%C") }
payload + "*" + checksum.to_s
end


Only I don't know what else has to go with the ASTRAL message. Sending it just ASTRAL nets garbage. I suspect there are a bunch of other things to send (my guess is eleven items, for eighty-two chars).

I'm still figuring out how to make objects in Ruby, and a lot of the literature is very confusing. When I do get my objects, though, I've got a marshalling method (it's not a sub! it's not a function! this is Ruby! it's a method!!), so all I gotta do is come up with a perl script to parse the NMEA spec and output Ruby objects.

09 May, 2007

The biggest problem with Ruby

The biggest problem with Ruby, in my experience, has been the community. A few years back I was interested (I looked at it in 2003, but all the japanese scared me away; I looked at it again in 2004, but there was no real "place" for it at the office – a perl shop), but this time around, I decided I was just going to trudge through it. Afterall, this Rails stuff is really catching on, right?

I own a deadtree copy of the "Pickaxe Book." This book is now available online. Back when I bought it, I thought it showed a language with promise. I really liked the idea of everything being an object, and was ready to get into it. But the code samples were icky, and the authors kept harping on the same kind of example (the infernal music jukebox).

Any programmer who is worth a damn will know and love list functions, like map (and in the case of perl, we have grep and sort. These functions allow us to do very, very powerful things. Here's an example:


my %db_lexicon = map {
shift @{ $oracle_sth->fetchrow_arrayref() } => $_
} @{ $postgres_sth->fetchrow_arrayref() }


My perl is a little rusty, especially with regards to DBI, but the notion is I can iterate through an Oracle database based upon data from a Postgres database, in the same operation. Once you've figured map out, using anything else (including traditional iterators and such) becomes silly, boring, or both.

Today (and really, last night), I find myself working with data coming from my GPS. It's a lot easier to read when you've run chr() (the perl convention) or b.chr (the ruby convention). Since it's a huge pile of text, I figure the best way to go through it is with map.

Well, let's go looking for the map documentation.

The perldoc available online is precisely two clicks from the front page to the page I want.

With Ruby, I get this very cute and pretty page. However, it's not exactly clear where I should be looking for the list of methods available to an object (such as an array). If you were to click the "programming ruby" link, you descend into the Pickaxe Book. If instead you scroll down (I have a 13" screen, so yes, I have to scroll down to see that), you see Core Documentation which looks like it might be the right thing. Turns out, it is, but you'll only find map (and there are many different maps!) after you've scrolled through an interminable list of eight thousand lines of... stuff.

And of course, I love to harp on the IRC people. When I was on DALnet #perl ages and ages ago, I was happy to help anyone with one exception (no web!). I was told to "stop reading five year old documentation" when referring to the Pickaxe book.

So my impression of the Ruby community is about the same as it was in 2004, and in 2003. It's a language that's coming along, getting a community, documentation is taking form, and so on. Maybe in two or three years it will have something that looks like this and not this:

08 May, 2007

Bits per second




Not bytes, not MiB, nor any of that stuff you kids grew up with. We had bits per second, and we liked 'em. My god, the day my father brought home a Supra 14.4 (that's kilobits) to replace our Supra 2400 was like Christmas. Sure, it was for his job and stuff, but that didn't preclude me spending hours and hours and hours on the internet.

But does anyone actually know how to configure a serial port these days? I remember a few years ago having to scrounge around for DB9 to DB25 adapters, and those nefarious Sparcs who were built null (most of the time you had to nullify the adapters, too). Even back in 2001-2003 people seemed to get it.

By way of segue, that's the last time Ruby/SerialPort was updated. And not, I might add, by the original author. I have been trying very hard to get that cheap GPS of mine to talk to this cheap MacBook of mine, and having very little success. Of particular consternation is that I chose to record telemetry from the GPS with Ruby and SQLite (rather than my de rigeur Perl and Postgres).

And so here I sit. Do I read it as a file, just pretending there's data in there that will never end? Some sort of suspicious tail -f routine? Or, do I take the more appropriate approach and treat a unix socket as, well, a Unix socket?

I've never really had to ask just how fast the IO library of perl reads from a file, but my guess is it's a skosh faster than 4800bps. I surmise ruby is the same way. But, deciding to try anyways:


# this socket is our prolific driver to the GPS
pro = '/dev/cu.PL2303-12345678'


gpssocket = File.open(pro, 'r')
deciphered = String.new()

iter = 0

while (input = gpssocket.getc and iter < 100)
iter += 1
deciphered << input
end

puts deciphered.dump


There's that "iter" limit there because it tends to wander off into la-la land, not having found anything resembling $/ (this is also why I use getc instead of gets). The output is interesting, in that it contains many repeated characters. This makes me think that I'm missing something.

The "socket" method (as opposed to the above, "file" method) fares no better:


require 'socket'
require 'serialport.so'

# this socket is our prolific driver to the GPS
pro = '/dev/cu.PL2303-12345678'

begin
gpsstream = SerialPort.new(pro, 4800, 8, 1, 0)
deciphered = String.new()
iter = 0

while (input = gpsstream.getc and iter < 100)
iter += 1
deciphered << input
end
end

puts deciphered


Ruby is a really cool language. I am enjoying the time I am spending in it. But it would seem that the Rails folks and the Web folks have taken a perfectly respectable language, and removed some of the more useful parts, or glossed them over, saying things like "why in the hell do you want to talk to a serial port anyways? use C!"

What makes me sad about this is I see a lot of perl's youth in ruby of today. It's by their own admission not incredibly popular, but it gets more and more popular. The documentation continues to get better, and products like Locomotive make it very shiny indeed.

But does anyone remember when perl was the "CGI language?" That people were learning perl to write the most hideous html the internet has ever seen (some of them still doing so!)? Is it possible that Ruby, Rails, and Web 2.0 are going to lead to the stagnation that is perl today (disclaimer: I've seen and used Pugs, and think it's really cool. But do I expect to ever see perl6 in production? No.)?

Furthermore, will anyone care? I've been asked if I know the difference between RS-232 and RJ-45 on interview questions, but it was more of a joke to see if I knew it. I'm thirty years old, and I'm already an old fart to these guys. Sooner or later, serial devices will disappear. Maybe even IP4 will disappear. DECNet probably won't, but then, they're the only ones that will survive the apocalypse.

Shampoo and conditioner.

[An important tip: use conditioner instead of soap as your solo shower lube; soap isn’t supposed to go inside a vagina and it can really sting if it gets inside a penis.]


(via)

This, ladies and gentlemen, is the reason I read Shay's column (NSFW, of course). Not the hentai porn, not the discussions of futanari (and there are more!), or even the "cockblogging wednesdays." (you can figure that one out without links)

No, I read the column because I want to know which hair products are appropriate for internal use. In the shower.

07 May, 2007

Ruby and NMEA

It appears there's a guy who already has Ruby code to read a NMEA stream, but it's not exactly what he's interested in. I'm also having trouble finding something in Ruby resembling a state machine (like POE or Twisted).

Since, really, all I'm doing is reading a stream from a file (in this case, it's a UNIX socket), and looking for data that feels like NMEA. When that happens, I can create any number of classes for the protocol (hey, it's complicated and ugly, but it's nowhere near as bad as IMAP4).

Admittedly, my googling hasn't been overly aggressive, but all I've found is people who have implemented their own project-oriented state machines. I could gank their code and make it work for me, but I prefer one of two options: either a well-accepted and used library (in the case of POE) or one I wrote myself (one neck to choke... uh.. mine).

There is probably somebody screaming at me that I can use a big conditional statement (because NMEA isn't really asynchronous) to handle this. Well, I grow tired of adding new conditionals when data changes or the unthinkable happens ("TIFFs? in MY integer string? Never!").

More ruby code for Last.fm

Disclaimer: I am nominally a perl coder. This means I can read Ruby, and more or less can "pick up Ruby" pretty quickly. But I am not a professional Ruby programmer, and this code may be ugly, inefficient, outright broken, or all three of the above.

Disclaimer 2: (this one's from Last.fm)
Note: Do not exceed one request per second to ws.audioscrobbler.com or any other Last.fm webservice without prior arrangement. If you're attemping anything high-traffic, we'd appreciate a heads-up first, as we don't have infinite resources. Either post in the audioscrobbler forums or contact Russ.

I didn't hear back from Russ, but as I haven't been pounding the site at all, I don't expect this to get anyone's knickers in a wad (except Ruby experts who think I did things the wrong way).

So, here's the code (apologies if the Blogger engine breaks it).


#!/usr/bin/ruby

# More stuff here
require 'net/http'
require 'rexml/document'
include REXML

# Some constants
baseurl = 'http://ws.audioscrobbler.com/1.0/user/'
username = 'avriette'
datafile = '/neighbours.xml'

# Let's make the user class up here.
class LFpeer
def initialize(username, url, avatar, matchpct)
@username = username
@url = url
@avatar = avatar
@matchpct = matchpct
end
end

# Grab the neighbors list from last.fm, turning it into xml
neighbors = [ ]
neighbor_data = Document.new( Net::HTTP.get_response( URI.parse( baseurl + username + datafile ) ).body )

XPath.each( neighbor_data, "//user" ) { |element|
neighbors << LFpeer.new(
XPath.match( element, "//user:username" ),
XPath.match( element, "//url" ),
XPath.match( element, "//image" ),
XPath.match( element, "//match" )
)
}



That should get you started. It just pulls down a list of your neighbors and makes them into objects. Upon having your neighbors, you should be able to do a Net::HTTP.get_response using baseurl from above, LFpeer.url, and re-iterate over the whole thing again. However, in so doing, you'd make one request, followed by fifty requests (and you could then traverse that list, etc), which violates their request for no more than one request per second.

Posting this feels a little like WP:BEANS, but I don't think I've published anything too "beansy." That having been said, please don't abuse last.fm.

Oh, and they're hiring. So maybe if you do something spiffy, they'd be cool with that.

Also, advogato, advice on any screwups I made in my Ruby are appreciated. I am truly and totally infatuated with the language, and expect to be finding uses around the house for it (my GPS daemon, some robotics projects, and so on...)

06 May, 2007

Writing Ruby for tools


(not likely to be taken for Nina Simone or KRS-One)

Rather than figure out the current state of perl, I decided today I was going to hack together my tool in Ruby. The notion is pretty simple. Last.fm gives us the ability to see what our "friends" are listening to. They also give us the ability to listen to "radio" (which they don't clarify whether it's sponsored or not) that is "recommended" based upon our tastes. Minor digression here, but what exactly is the recommendation for somebody who loves Velvet Acid Christ, Nina Simone, and KRS-One? It strikes me that that particular Venn Diagram would be, uh, distorted.

So I got to thinking, if I find what other people who are listening to, who also listen to the same things I am listening to, and I get enough of a sample size, there should be a reasonable amount of overlap. Maybe there are five records out of the fifty or so "neighbours" I have at Last.fm listen to the same thing, and maybe I haven't got it.

This leaves the statistics. I'm very surprised that Last.fm doesn't have a simple "recommend music" feature. Anyways, so I now have a script that will pull down all of my neighbors' recently listened to music, and stores it in Sqlite. The problem now is that I have a script that takes a second to pull down fifty of my friends. I can then pull down untold numbers of records that they listen to, and do this in seconds. I'd even like to ruby-on-rails it so that others could do the same with their accounts. But Last.fm requests that we don't make more than one request a second. I have an email in to them asking permission.

And things start to get very curious if I add in the Amazon interface (Amazon has a SOAP interface where I can pull data from them) so that I could pull down Amazon reviews of that music (which I occasionally pay attention to). But Amazon itself has recommendations for me, based on my ten-year purchase history with them. Sounds to me like I could have just written myself a new toy.

Oh. And, it's 45 lines of Ruby code, with ample commenting. I could probably have done it in less code in perl, but boy would it have been ugly.

05 May, 2007

Photoshop 10


Adobe's Creative Suite 3 is pretty neat. I am really impressed with how far Photoshop has come. I find myself wondering whether the interface is as nice on Vista as it is on the Mac. It occurs to me with all the fancy bells and whistles (and batch operations!!) I will require a machine with big brass clanking ones. And, as I don't especially feel like paying Apple $7,000 for a machine, it will be a PC.

The software is capable of taking garbage images (f-stop set at 18 instead of 2.8 for example) and rescuing them. I have only tried this with NEFs, so it may be that the data in the RAW files contains "the picture I really meant to shoot."

Also, hadn't heard of this "DNG" format, which Adobe tells me is a "digital negative." Maybe it's an agnostic RAW format. Wouldn't that be great?

02 May, 2007

Rate my recruiter


I've been mulling over building a Ruby app to list the recruiters who contact me and what they're looking for. I get maybe fifteen of these emails a day. I try to reply to all of them, telling them that I'm not presently looking, and thank them for their time. They always ask me to refer people I know who are looking (e.g., if I turn down a Solaris/HPUX job, I might know somebody who could do the job, and who is looking).

However it kind of feels like it would be advertising, and I'm sure there's some liability in there. Also, by publishing their contact information, it almost ensures that they will get a lot of emails from people who don't fit the profile they're looking for (which are admittedly pretty poor).

Being Ruby on Rails, it wouldn't even be really hard to make it user-interactive, where people could add new recruiters to the database.

I'm not proposing re-implementing Monster or Dice or any of that, but it seems that there are companies (Red Hat for one) who are looking for a specific type of person. And, that type of person is the sort of person who's likely to be in my social circle. And it always stings to see an entry on advogato about somebody being laid off or that they're having a hard time finding work.

And golly, I'd have to host the pig. Dreamhost for the win, I suppose.

01 May, 2007

Building irssi on Darwin

gordon% uname -a
Darwin gordon 8.9.1 Darwin Kernel Version 8.9.1: Thu Feb 22 20:55:00 PST 2007; root:xnu-792.18.15~1/RELEASE_I386 i386 i386

  1. Build pkgconfig
  2. Build glib
  3. Build GNU gettext
  4. Build irssi

Why does this have to be so hard? Sure, I could use fink or DarwinPorts (or whatever it is they're called), but then I trust that somebody else built my software correctly and without backdoors. At least rolling from scratch I have a little faith in what is produced. It also means that I have the source around if I need to hack something into it (whereas downloading a tree you inevitably wind up with a different copy than the one you're running).

But, really, isn't irc just a glorified telnet client? irssi is very shiny, no question about that (thank you, Sungo) but would it be so hard to ask for a --dont-build-stupid-shit flag or a --glorified-goddamned-telnet flag. I don't necessarily want ircII, but there's no reason irssi has to be so complicated.

And, if you really want to go digging and start fucking jihad, the perl implementations of irc clients and servers take orders of magnitude less code to run. Because, really, we're talking about text over a socket, right?

Speaking GPS

This gorgeous piece is from Aquamist. It's a dual-pump setup for Perrin's 600+hp H6 STI. I could totally put that together myself.

I speak a number of protocols, as most of us do. The old "telnet to the mailserver and ask it what's wrong" kinds of tricks. I've never, however, spoken to a GPS receiver. Boy, is it a chatty sonovabitch. ZTerm couldn't keep up with the data coming across the port, and would continue to spew even when the receiver was disconnected.

$GPGLL,36000.0000,N,72000.0000,E,000213.991,V*12
$GPGSA,A,1,,,,,,,,,,,,,50.0,50.0,50.0*05
$GPRMC,000213.991,V,36000.0000,N,72000.0000,E,0.000000,,101102,,*38
$GPGLL,36000.0000,N,72000.0000,E,000212.991,V*13
$GPGSA,A,1,,,,,,,,,,,,,50.0,50.0,50.0*05
$GPRMC,000212.991,V,36000.0000,N,72000.0000,E,0.000000,,101102,,*39
$GPGGA,000213.991,0000.0000,N,00000.0000,E,0,00,50.0,0.0,M,0.0,M,0.0,0000*77
just going on and on for pages and pages. Tens of megs of pages, even. The GPS receiver in question is a Pharos GPS-360, which is approximately the cheapest GPS receiver ever made because it is made largely from mulched babies, and distributed free with Microsoft Streets & Trips (which is kinda garbage compared to Google Erf Pro).

Anyways, it's speaking NMEA, which is mercifully easy to parse. I thought to myself, I could just write a perl script to sit on the socket (with the '360, it's actually a serial device with a serial to USB adapter inline. That itself requires a driver, which is available on sf.) and spew out data to syslog or whichever (I want to verify the top speed of our STI – everyone says it's electronically limited at 145mph, but we've seen 155+ in the car. With telemetry, this is easier to prove). Of course, because the protocol is plaintext and serial (as opposed to parallel, which is harder), somebody has already written a module that speaks NMEA and can return perl objects with locations, etc. The API looks a bit bare, but I'm sure I can embrace and extend where necessary.

So I think the first trick is to write an OS X Dashboard Widget, since they're pretty simple to put together. After that, I may buy one of the more fancy GPS's, like this one from Arcom. There are amazing things you can do with robotics if you have the right sensors. Even LIDAR is coming down to commodity pricing.

I was asked about a week ago, "do you have any hobbies?" My answer was "my job is my hobby." It seems to me that I could spend some of my time in Taipei building a solid EE foundation from which to work up. And, I just love to solder (there were not "solder suckers" when I was a kid playing with breadboards. These things have to be one of the coolest inventions ever.) Something about the smell, or maybe just knowing that you're making a machine. Maybe the adjective for the feeling Asimovian. An Asimovian feeling of creation sent a chill down his spine as the GPS daughterboard and avionics daughterboard spoke for the first time. Hm.

Okay, I'll stop before I get too romantic.

So how did we get from GPS to 600+hp STI's? Well, when I get my own software figured out for the GPS receiver, the next step is to buy hardware. Like PC/104+, and things like that. The whole point of the entry is that I am looking forward to hardware hacking, and since I have such a strong software background, I am expecting to be able to do things that inspire sequoia-sized wood (at least for myself; I'm sure somebody on advogato is going to complain that I don't need 600hp, and I kill babies and trees. They'll be cheerfully ignored).

(note: copious links added specifically because many of us never get a chance to see this sort of stuff. spend an hour or two. look around.)

Let's sing the doom song.


Today is bath day, for both cats. Natasha is on the left, Killer is on the right. And yes, I took photos of them and published them on the internet, violating the Geneva Conventions requirements for treatment of prisoners. But, they'll smell much nicer afterwards. And, bathing a cat is such a traumatic experience for both the owner and the cat that I can probably dig right into the nasty emails I have waiting in my inbox, and quite cheerfully at that.

(note: the cats were given a sedative before the water started, so it's less traumatic for them, but it's still no picnic.)

Red Hat is hiring

They are looking for consultants, sales engineers, and a few instructors. I mention this because they keep pestering me, and I don't really know anyone looking right now. They say they want a bachelors and would prefer RHCE's, but part of the ramp-up is training. Rates are attractive, and there is a bonus schedule. The recruiters who have been contacting me have been saying Red Hat would like to grow their business by over 50% this year. I've been told they're trying to hire on as many as thirty new people.

Red Hat is located in McLean, Virginia, which is a nice enough place for tech workers (I don't know if they have relo). It's close to DC, but not too close. I've worked with their employees in the past (as a customer, and as a competitor), and I've liked every single one of them.

Just so the email addresses aren't way out in the open, I'll post a comment to this entry on my blogger page with the people to get in touch with if you want to send along a resume.

30 April, 2007

Still no luck with the mini's wireless card

Despite help from Open Species on advogato, I am still stymied by the same error message. Looking through the console log, I see:

KisMAC[314] Error could not instanciate driver WaveDriverAirportExtreme

And then bazillions of chmods and chgrps (presumably as it moves kexts around for the wireless). I think I'm just going to give up trying to get the mini to be some surreptitious wireless pilferer/cracker. I just wish I knew why. It completely baffles me that the card DTRTs on one machine, and FOADs on the other. When they're supposed to be identical.

And, (Mousse, pudding, Open Species, whichever you prefer to be called), I followed your directions, but I am just not ready to delve into the Darwin kernel. I was just starting to understand the 2.4 Linux kernel when 2.6 came out, and I've more or less given up on being in there, elbow-deep and hacking. Rather, I'll sit here and let brave people such as yourself go at it, submit patches as necessary, and work on other things like binutils, fileutils, and so on. Thanks for trying to help out, though.

Features I'd add to Skype

  1. Understand the Mac address book. Don't require me to import the entries from it, just show them to me in a pane. Alternately, a little "SkypeOut" button could be added in Address Book.app, but that would break a wall I'd rather not break.
  2. Grouping of contacts. Either through the Address Book (which has groups), or through its own mechanism. I want to be able to put coworkers in their own group that I can expand or minimize when needed. Considering iChat, Address Book and many other applications (generally instant messaging applications, which Skype sorta is) have this feature, it seems to be kind of an egregious omission. Probably not hard to add, and maybe even somebody at Skype is reading this.
  3. Handle people with multiple phone lines better. I know somebody who has two home lines, a mobile, two office lines, an office fax, and a phone that's wired into the car (this is a GM thing). That's seven phone lines for one person. In Skype's contacts list, it just shows Foo Foomaker seven times. I have to click one of them and arrow around to find the right number (which I frequently don't remember). So, put cutesy little icons next to people's names, or come up with a better way to segregate numbers.
  4. Voice dialing. I can log into my Mac with my voice. I could do that way back in the Centris/Quadra days. I'd like to be able to tap my headset, say "Don Beyer Subaru" and have it just call the dealership.
  5. Similarly, it would be nice to be able to end the call by tapping the headset. Essentially, this item and the above are just improvements to Skype's handling of Bluetooth headsets. My Motorola V620 can handle this, and it's got a lot less proc.
  6. Codecs and other goodness on the call. While I am normally happy with the call quality (it is imperative you use a headset or dedicated mike, or it will always sound like crap), maybe one in ten calls is just awful. The "extra info" dialogue says everything is going fine, no packets lost, etc. It would be nice if the connection could be switched to a more robust protocol or the codec could be changed based on the conditions of the call (living room versus beltway traffic).

All in all, though, I've been living with Skype for a month or so now, and despite one of my customers being incredibly obtuse and blaming Skype/VOIP for being unable to reach me (even though they had an AT&T POTS line, a mobile line, and the Skype line), it's gone very well. I love this software. And I've only spent about 5 euros.

(edit: I added the "contact grouping" feature after originally publishing this post)

29 April, 2007

What's wrong with this picture?



What is the difference between the 0x86 and the 0x87 in these two Macs? bling is a Core Duo Mac Mini, and gordon is my C2D MacBook. I suspect that it's a version number or something. Frustratingly, a slog through Google's code search yields nothing more than they are both Atheros cards.

However, when I try to use KisMAC to get bling on one of the local "open" networks, it's actually unable to get the driver working:

So while the cards would appear to be substantially identical Atheros cards something about the mini's card perturbs KisMAC, and it won't function. Also frustratingly, I have an Orinoco PCMCIA card which is excellent for this sort of work, but naturally both my MacBook and my Mini lack PCMCIA cages. I'm starting to think I should get one of those USB 802.11 devices, but wonder if they are as good as the Orinoco units.

When my next laptop makes it into my lap, I think I'm going to make sure it's got room for an additional wireless card for just this kind of thing. Frown.

28 April, 2007

iTunes gift certificates


Anyone deciding they want to get rid of some cash they had sitting around, let me know. I've got a pile of stuff I want to pull through iTunes Music Store, but can't justify it (yet). Part of this is that I have 16-25 books (paper) sitting in my "to read" pile.

But, the number of books is just increasing. I'd say about 1/2 of those books were related to a book I'm writing. So ostensibly, you could be buying me a book that would make a book you'll eventually wind up buying and reading better.

The iTunes store desperately needs wish lists. Sort of like I desperately need an adoring fanbase who will come buy me stuff from my wish list (like I bought Rachel Lucas goodies from her list. Sigh.)

27 April, 2007

Tell me what you think about the Z

Comments encouraged. I really, really, love my Z. So let me explain the plan for the Z.

It's an 1982 280ZX Turbo. I've done a lot of work to it, but most of it was half-assed and it needs help. It needs paint, and it needs Recaros. It also needs the floor boards done, and a half-cage, and the dash has to be redone in aluminum. The engine needs to be yanked. The suspension needs to be replaced, starting with control arms and struts/shocks, and of course it needs a new set of tires. I also have decided that it's going to get the rear end out of a Subaru STI (the Subaru/Nissan compatibility out back is common knowledge). All told, I think it's about $10,000 worth of work to my Z, before we get into the motor. The mill itself (an RB26) is about $3,000. The work therein is about $6,000 to maybe $10,000 more in internals.

That leaves the 82 chassis at about $25,000 worth of work.

Specs are: 2,400lbs, 650hp, or a ratio of 3.7lbs/hp

I'm also considering a Factory Five Racing Cobra chassis. The car is built to be a beast. I get it in pieces, and can install everything as I go along. I can pick up a 95 Mustang for $5,000. I can then upgrade the parts that are hosed for maybe another $7,000. Same price for the RB26, $3,000. But the install is easy. Because we're not dealing with a unibody, and there's plenty of room, the actual assembly is a lot easier. I can still run an R200 or R230 out back because we're not using a Ford 427. It would be 600-700hp from a turbo RB26, applied to the back on an independent suspension, in a car that was lower to the ground, and a roadster.

The FFR chassis is $15,000 worth of parts, and I think their kits go for in the neighborhood of $30,000. So we could call it $45,000, but in reality it will be somewhere lower than that. And, the power to weight ratio of an 1,800lb car, with 650hp, is 2.8lbs/hp.

Do all the engine management with Hydra from element Tuning (and Phil is the fucking man, folks), and really the major difference between the cars is I would have 275 rubber on the Cobra and 205 rubber on the Z.

The cars would be pretty similar in performance. One, being a Cobra, is going to be a top-off roadster. The Z would be suitable for taking out in the cold.

Performance-wise, they would both be 3-second 0-60 cars, possibly 2-second with the Cobra.

But here's what's got me thinking. It might be easier to just be rid of the Z, and go with a Cobra, because the parts on the Cobra are new, whereas the parts on the Z require lots of "reconditioning."

I love my Z. It's part of my youth I'll never get back, and if I sell it, it might get wrecked by somebody who doesn't deserve it. But should sentimentality keep me in the car when the Cobra is so much better a choice?

26 April, 2007

Psychosis, freedom, and firearms.

This is just a casual reminder, folks: psychosis is temporary. To forbid people to own firearms if they have been "declared mentally ill" is to forbid able, healthy people to own them. It is to assert that there can be no recovery from mental illness. Not only is psychosis treatable by a wide variety of medications and "talking therapy" (as well as things like ECT), but that treatment is optional because the United States Bill of Rights guarantees what providence has given me – life and liberty.

The BoR does not guarantee me the right to kill people. Fortunately, being mentally ill and killing people are two entirely different things, and likewise do not belong on the same piece of legislation.

If you've never been mentally ill, you have no business making this decision. Please, try to come to an informed opinion on this and talk to somebody you know who has had issues with it. Ask them if they felt treatment was helpful.

The last thing I want to point out here is that most people now believe the USA PATRIOT Act is garbage. It is a shining example of legislation crafted under fire, hastily, with snazzy, press-attractive verbiage and features, which was over-arching and over-bearing and in the end served only tyrants. Unlike the PATRIOT Act, however, Virginia will not have a large number of people, or an ethnic class (cf., Arabs) who are being "oppressed." Instead, we may have representation from NRA-ILA, but certainly not ACLU. And everyone loves to hate the NRA.

Instead, the smaller groups of gun owners and the formerly- and presently- mentally ill, will bear the brunt of this legislation, to no definable (read: measurable) effect, with the possible exception of soothing the enraged sensibilities of the shooting victims' families.

Were it not so silly and trite, I might conjure up some sentimental statement about weeping for the loss of Virginia's decency in human rights and civil liberties. Instead, I'll happily depart for TPE, and perhaps resettle somewhere safer like New Hampshire or Texas. Let's hope it doesn't become some federal crusade to round up all the mentally ill and incarcerate them.

25 April, 2007

My status as a hack



I did throw stones at the "My Beloved Monster" dude, frankly because I don't like the notion of Yet Another Pity Circle Jerk Book. Not because he's a bad person, because I don't like his daughter, or whatever. In fact, I find it interesting. I'm just not about to go and read another one of those books. And, when I originally wrote that, I said "there, I've thrown a stone, somebody's going to come along and eviscerate me." Furthermore, I misspelled loathsome. So, my mistake. I expected the complaints, either from him or somebody who adores him (he has groupies!). It happened. No surprise there. I'm not sure why somebody would respond that I am a "hack," however. I've stated numerous times that I keep this weblog for two reasons.

  • I live in Virginia, and my family is scattered throughout California, Minnesota, Taiwan, and other places I don't have a lot of contact with. My friends are in even more places than that, and some of them I have almost no interaction with whatsoever, except via the internet. This means I get emails from them saying "hey, I haven't heard from you in x weeks, what have you been up to?" Now most of them read this via RSS or even manually. I no longer have to type up these enormous diatribes about the content of my lungs or insomnia or whether and where I am working. This is for them, and because I am lazy.
  • I am in fact writing a book. Books, even. And they're all collected in a little pile, and I tend to them lovingly, when I have time and inspiration. As I've said before, when I write a story like Sharks, it's very hard for me to empathize and "get back into" the frame of mind I was in when I started writing it. So I keep a trail of breadcrumbs for myself here. I can go way back, to 2003, before I had actually started writing, and see what was going on in my mind back then. There are so many half-opened, half-written books there that I can't help but to get distracted or lost when I context-switch between them. The readership of this page is actually so low, I don't mind it being public. That may change in the future, but for now, it's a fun experiment. For me.
What reminded me I needed to post this (I had a draft sitting around) was Scalzi's similar post recently. Quoting,

Which means, of course, that this site is always egocentric, not just sometimes. I'm happy the site entertains the lot of you, really I am, and I'm generally fond of you all in that Internetty way. But at the end of the day, it's more important that the site entertains me. If I decided to put ads on the site, I could make a lot of money from it, but then I would have to start worrying about maximizing returns every damn time I wrote rather than writing what interests me. If I just wrote about politics, or tech, or whatever, I could probably get more people coming in -- single-topic sites are the ones that get the most traffic, as a cursory glance at Technorati's Top 100 makes perfectly clear. But then I would be bored out of my skull. And this is exists in large part so I won't be bored out of my skull.

Anyways, this should serve as fair warning. You're either here because you're a friend of mine or family and find me interesting enough to read this drivel (or I've begged you to not make me repeat it), or you're here because I'm an unpublished hack of a writer (and this doesn't bother me). Let me swim a little in my hackishness for a second, and quote myself:

Strange. They don't know what I'm writing, other than it's fiction. And those that have said they'd like to read the book, well, depending on how well you know me, you might not like to read 120,000 words that came out of my head. I'm not writing this book for anyone but me. If it gets published, hooray, that's great. I'll never get rich, and you can't make a movie out of it because it is just so brooding, sullen, and mean. I can self-publish, and put a copy of my book on my shelf. And that will be good enough for me.

Hopefully this clears that bit up.

(as a post script, looks like the Monster guy got himself published. congratulations. you sure do got a purdy mouth....)

You know it's bad when

You fall asleep clutching a bottle of Afrin to your chest so that you can quickly apprehend that snot when it comes out of the nostril that was so thick with snot as to be untreatable. Nyquil in the fridge? Check. Trusty bottle of Afrin? Check.