all is discovered: jared's public blog

Whatever I feel like the whole Internet should know.

Tuesday, August 19, 2008

pokerglory released

This program will take OFX/QFX import files from your bank containing records of transactions and put their contents into an SQLite database, where you can query them. It's written in Haskell and released under the GPLv3.

Download source, or get via darcs:

darcs get http://dingoskidneys.com/~jaredj/pokerglory

Tuesday, August 12, 2008

freecycle

I have several old computers, which are too slow and too loud and too big for me to find use for them. Fortuitously, there's a discussion up on Slashdot on what to do about this, which pointed me to Freecycle. Marvel of marvels, there's a Freecycle group in my small burb town. I'ma post my stuff. The other suggestions were Craigslist (which hasn't worked for me so far), putting the stuff out on the curb (in the weather?), or paying a small fee to Office Depot or Staples.

They also said in that thread and this one that if someone offers to recycle your old electronics for free, the odds are that they're shipping them somewhere in the Third World and dumping them, because it's cheap and it makes other people's kids get lead poisoning instead of ours. The slashdotters said ban.org can tell you who does this and who doesn't.

Saturday, June 7, 2008

the failings of the motorola w755 from verizon

i had a motorola e815. verizon has a "new every two" program. i decided to get a thinner phone. i got the w755 which has similar features and is lighter and thinner. here are the things i've found so far that suck about the w755. these are the things cell phone makers and salesmen completely forget to mention.


  • one less navigation button. the button in the center of the four directions ("OK") was used in the e815 to navigate into things and change them. in the w755 interface it's more frequently used for saving and exiting. this is a frustrating change.

  • i haven't found a way to assign ring tones to groups of contacts. i had all my contacts in groups, with a ringer for each group. i can still assign ringers per person, but i don't really want to diddle with that much info.

  • nine member group maximum. arbitrary and useless.

  • no three digit speed dials.

  • buttons are harder to push.

  • buttons reach closer to the edge of the phone, causing thumb strain.

  • no more viewing contacts by category.

  • on the e815, many text fields would do something sane if you started typing into them. on the w755, they sit there looking dumb.

  • the w755 thinks every new appointment you put in is going to start at 9:00 PM and end at 9:30 PM.

  • every time you put in a new appointment, you have to tell the w755 you want to use iTAP to enter it. the e815 had a setting for this, for each kind of entry field. that meant setting it 8 times - but i never had to mess with it again.

  • on the e815 the microSD card is hot-swappable. on the w755 you have to take the battery out to get to it.

  • i had to move the files around on the microSD for the w755 to see them.



things that are cool:

  • more interface themes

  • vibrator feedback when you press the touch buttons on the front

  • "in case of emergency" built into phone

  • hold down numbers to speed dial, e.g. hold 6 instead of 6, #, Send

  • USB charge port

Friday, May 23, 2008

car audio: the story so far

I have a rather nice 2001 Chrysler 300M with an Infinity audio system.

The lower front door speakers in my car blew. I replaced them with equivalent Infinity 6022si speakers.

A small speaker in one of the rear doors blew. I called Crutchfield, and they told me that the 300M they researched didn't have those speakers. I offered to tell the tech the number on the back of the speaker when I got it out; he declined and suggested I search the Internet for what other people had done about my problem. Boo, Crutchfield.

When my new front door speakers started going in and out and sounding squishy, I knew the problem wasn't the speaker, but the amplifier(s). I found out that I have a standard Chrysler radio with CD changer, which is hooked up to an Infinity sound imager thingy, which further amplifies and shapes the sound. At this point, my CD changer had permanently ingested two CDs, one of which it had forgotten existed. I had become disenchanted with NPR, and I already hated what the rest of radio has become.

I took the radio, CD player and sound imager out of my car. (hole in car; pieces on table.) On the way out, I tried to poke around in the CD changer and dislodge some of the stuck CDs. I only succeeded in knocking one farther inside. Now the CD changer thinks its life consists of making five small whining sounds, then happily blinking four yellow lights.

I bought a Gumstix Verdex XM4-bt, with an audiostix2 and a netwifimicroSD-FCC card. The combination is the size of a large pack of gum (thus the name), and has about 15% of the computational power of my desktop PC. It runs Linux and does WiFi, Bluetooth, Ethernet, stereo audio, microSD cards, USB and a couple of serial ports. I've got a Vorbis player on it, and I'm working on installing a speech synthesizer.

I've found in my searching of the Web that the CD player communicates the disc, track and time information to the radio using the J1850 automotive data bus, and it seems likely that the nifty buttons built into my steering wheel communicate using the same bus. I've got an ELM327 chip on the way from ELM Electronics, which can convert the signals from that bus to a serial port so that my Gumstix can listen to them.

With the Gumstix, a hard drive attached via USB, the ELM327, a car ATX power supply, some custom electronics, custom software, and an amp, I hope to arrive at a music player for my car that knows what to do when I push the buttons on the steering wheel, talks, doesn't break, plays patent-free music formats, and is made of Free software.

Friday, April 11, 2008

how to back up a 50GB directory to DVD's with bash one-liners

The following one-liner produces a bunch of numbered text files in the current directory containing lists of directories under the current directory to put on each DVD.

rm -f *-disc.txt; n=1; a=0; for i in *; do size=$(du -s $i | awk '{print $1}'); tent=$[ $a + $size ]; if [ $tent -ge 4700000 ]; then echo "$i pushes disc size to $tent; pushing to next disc"; n=$[n+1]; a=$size; else a=$tent; fi; nn=$(printf "%02d" $n); echo $i >> $nn-disc.txt; done

Variables:

  • n is the number of the text file we're presently writing to.

  • a is the (accumulated) size of this disc so far.

  • i is the directory we're on (i doesn't stand for anything, it's just what my fingers type after "for.")

  • size is the size of a directory. (Or file, I suppose: my directory only contains other directories.)

  • tent is how big this disc would be if we stuck that directory on it (tentative).

  • 4589843 isn't really a variable - it's 4.7 * 1000 * 1000 * 1000 / 1024, i.e. the number of kibibytes in 4.7 gigabytes. (See wiki:IEEE 1541 for more; the issue is whether sizes are expressed in powers of ten or of two.)

  • nn is n padded to two digits with leading zeros as necessary (e.g. 01, 04, 07, 10).


The following one-liner tests the work of the first.

(for d in *-disc.txt; do du -ch --si `cat $d` | sed "s/total/all in $d/"; done) | grep 'all in'

Note that the --si makes (GNU) du give numbers as powers of 10, so if the output says something greater than "4.7G" you have a disc that's too big. But it doesn't, because the previous one-liner worked properly.

The following one-liner burns the discs.

for i in *-disc.txt; do echo "******** insert blank disc ********"; read; nn=${i%-disc.txt}; growisofs -Z /dev/dvd -r -V flac-backup-$nn -graft-points $(cat $nn-disc.txt | sed 's:^\(.*\)$:/\1=\1:'); done

${i%-disc.txt} is bash-specific, I believe, and evaluates to $i with the -disc.txt stripped off the end.

growisofs runs genisoimage to create the image that goes on the DVD. genisoimage takes the directories handed to it and puts all their files in the image. So to make the directories be directories on the DVD, we have to tell genisoimage to graft their contents under their names, by specifying -graft-points and giving parameters like /divine-discontent=divine-discontent. That's what the cat-sed thingy does.

So. Things about bash that average shell users may not know:

  • $(command) evaluates to the output of command, just like `command` does; but the $() are nestable.

  • ${variable#prefix} strips prefix off of the value of variable.

  • ${variable%suffix} strips suffix off of the value of variable. There's more to these two; see the bash man page, and look for the "Parameter Expansion" section.

  • $[arithmetic expression] does math. - Oops, you're supposed to use $((expression)). See the "Arithmetic Expansion" section of the man page.


Some people complain that bash is bloatware. I think they're right, but as long as we've nearly all got it on our Linux boxen, might as well use its full capability, right?

Finally, I'd like to note that I tried to do all of this in Haskell first. Instead of calling du, I wrote my own. It was pretty, but long. Instead of merely tossing something onto the next disc when this one's too big, I tried to find an optimal packing. It was going to be my next Haskell project. Well, that was too big and involved, and when it didn't happen in one night, it got postponed indefinitely, and now, months later, I got it done in two hours including blogging it. Maybe next time, Haskell.

Friday, December 21, 2007

simplicity in computer languages

Can Java be saved from death by feature bloat?

Michael says that some features proposed for addition to Java are proposed in order to make writing in it easier, but that they make reading and learning the language harder, because "to make sense of it all, you still have to understand the whole story."

I think these sorts of extensions are the analogue of slang in natural languages: you can get a lot more said in less words, you alienate people who don't know the slang, it may consist not only of odd words but also of ambiguous grammar, and to learn what it means you have to find out a story. For example, "Bob's your uncle" means that the rest of what you have to do is easy. (Few in the US seem to know this, because the story is from across the pond.)

Slang can be OK in natural language because you can know who your audience is, and if you're not sure they understand, you can say it again a different way without being boring, and your listeners will synthesize your overall meaning. But in programming languages, if you say exactly the same thing twice, you've wasted your time and that of your reader; and if you say nearly the same thing twice, either there's a little thing you meant to say different, which the reader must sleuth out, or you goofed up, and it's not always obvious which. If you have to say nearly the same thing twice, I think your language is not well matched with your message.

Friday, November 23, 2007

reading is important

The Future of Reading (A Play in Six Acts)

Most of the things I read on other people's blogs, I read using Google Reader, and if they're cool or important, I share them, and they show up on my homepage and here on this blog, off to the side.

This article is important enough that I will write a post just to point to it.

Blog posts I think are cool