Jaldhar Vyas: Unfortunately They Don't Make Squeeze Costumes
Jersey City needs a candy stimulus.
Jersey City needs a candy stimulus.
Regular readers of this blog (yes, both of you!) may remember
the computer/broadband/
directory that this post appears in as the collection of my Comcastic (yeah
right) experiences with my ISP.
But I think this week may top everything. I'll just try to jot down some notes before I forget all the gory details:
nvram configuration variables of my
trusted wrt54g router in order to add
the older daughter's shiny new iPod Touch to the set of 'permitted' MAC addresses.
This router, running a custom Linux variant called OpenWRT
had essentially not been upgraded since I first installed it, and still required a quick reboots after updating of
configuration values. However, that worked fairly flawelessly for 4 1/2 years. Until Tuesday.
atftp and tftp binaries worked reliably, and whether the router prefers
.bin images over .trx images when using the tftp protocol. But lo and behold
this worked, and I configured a shiny new
Kamikaze aka 8.09.1 version of
OpenWRT.
This even connected to the cable modem once I helped with DNS entries.
OpenWRT generally rocks, and this new release is a lot nice than the more
bare-bones version I used to run.
mtd command from the
commandline.
macro index <F8> "<shell-escape>rm -rf ~/.mu/results; mu-find -o l -l ~/.mu/results " "mu-find"
macro index <F9> "<change-folder-readonly>~/.mu/results\n" "display mu-find results"
The first one query (you) for the search string, the second
jumps to the results opening the virtual Maildir (which is useful,
especially when you want to go back to the last query you did). I
update the index every two hour with the following cron entry:
31 */2 * * * on_ac_power && mu-index -q
Beside a corner
case bug which is close to solution, updating the index is very
fast, usually a few seconds; index size is about 150 Mb. To
conclude, my initial goal (message path lookup via Message-ID) is
easily achieved as follows:
$ mu-find -f P m:20091030112543.GA4230@usha.takhisis.invalid
/home/zack/Maildir/INBOX/cur/1256902638_0.25702.usha,U=37563,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S
In addition to that, I've now gained all-maildirs full-text
search from within Mutt
As a concluding remark, Enrico pointed me to
Not much
mail, but it seems to be (by authors' own admission)
in early stage of development. Also, AFAIU it aims to be a
MUA, whereas I'm
perfectly fine with Mutt, I just need from time to time to
integrate it with other components of my daily work flow.
A few weeks ago I was trying to get GRUB2 for PowerPC back to work on my
PowerBook G4 15", and had some problems getting OF doing the right thing.
Not being an OF expert at all, I found myself making things a bit worse,
ending up with an unbootable laptop and, what a classic, unable to boot my
old rescue CD to get yaboot back in its place.
So I googled a bit and ended up deciding that, given the boot parametres
and some other stuff like the system's clock were doing strange stuff,
reset-nvram would help getting things in a better shape that
would at least permit CD booting. So there, reset-nvram, followed
by reset-all, as found in all the OpenFirmware cheatsheets I
found all over the web, and damn it, nothing changed and I was back into the
OpenFirmware prompt. I used the power button to reset the laptop once again,
and that was the last time I saw something functional on the PowerBook.
Now, when I start the computer, all I hear is the Apple startup sound,
followed by the sound of the CD drive (which has eaten an Ubuntu 5.10 CD)
trying to spin up for a pair of seconds, and then nothing. There's nothing
displayed on the LCD, or any other sign of life . My searches in Google
indicate this is a logic board failure and you can imagine that is not cheap
to get fixed by Apple support.
I've tried numerous keyboard combo tricks I didn't even know about, and
none seem to work. The computer doesn't seem to be responding to the builtin
keyboard, an Apple USB keyboard I borrowed, or an external display. I'm
annoyed because I've looked after this laptop really well and it was in a
really good condition, so I'm going to see if it can be fixed for a reasonable
amount.
Apple care in Val ncia is not an option. They say a logic board (if this
is really what is causing trouble) costs around 500 , so I'll have to explore
other ways. The first one is trying to find out if these symptoms (nothing
on the display, key combos don't appear to work, etc.) really point to a
fried logic board or could be something else. I've tried removing the RAM
and replacing it with my old one, but that didn't work either. So, if anyone
reading this has some Apple PowerPC hardware experience and can share some
of their knowledge and suggestions, I'd be really, really grateful.
Plan B involves hiring a coworker, who I believe is the son of
McGyver, to try to get it repaired for me. This would involve buying spare
parts in eBay or some other place to try to get the replaced. Again,
suggestions, donations and ideas are welcome in this front too. :)
Jose Vicente loves fixing stuff, and right before the Summer he already
showed what he can do with a screwdriver and some patience. Some weeks before,
I had managed to shatter the LCD screen of my Nokia 6500s when I lost my grip
while climbing down a mountain in El Cad , and the phone in my pocket hit a
big rock. The phone worked, but I all I could see in the screen were some
cracks in random colours. People suggested I should get a new phone, but I
really don't want to generate even more polluting waste when all that was
needed was replacing a cheap component.

My phone during its stay in McGyver's hideout
Tim Bunce mentioned my blogpost about Benchmarking serialization modules in a post on the perl5-porters mailing list. He wished that someone would make that benchmark into a distribution on CPAN.
How can I refuse. So here it is, Benchmark::Serialize is just uploaded to CPAN. (Might be some time before it appears).
Besides making the script into a module I also added a list of the size of the serialized data to the output. A replacement of the original script is available in the examples directory.
(I planned on naming the module Benchmark::Serialization, but my fingers slipped. Should I rename it?)
Compleat is an easy, declarative way to add smart tab-completion for
any command-line program. For a quick description, see the README. For
more explanation and a brief tutorial, keep reading...
Background
I'm one of those programmers who loves to carefully tailor my development
environment. I do nearly all of my work at the shell or in a text editor,
and I've spent a dozen years learning and customizing them to work more
quickly and easily.
Most experienced shell users know about programmable completion, which provides
smart tab-completion for for supported programs like ssh and git. (If you are
not familiar it, you really should install and enable bash-completion, or
the equivalent package for your chosen shell.) You can also add your own
completions for programs that aren't supported but in my experience,
most users never bother.
When I worked at Amazon, everyone used Zsh (which has a very powerful but
especially baroque completion system) and shared the completion scripts they
wrote for our myriad internal tools. Now that I'm in a startup with few other
command line die-hards, I'm on my own when it comes to extending my shell.
So I read the fine manual and started writing my own completions. Over on
GitHub you can see the script I made for three commands from the Google
Android SDK. It's 200 lines of shell code, fairly straightforward if you
happen to be familiar with the Bash completion API. But as I cranked out more
and more case statements, I felt there must be a better way...
The Idea
It's not hard to describe the usage of a typical command-line program.
There's even a semi-standard format for it, used in man pages and generated by
libraries like GNU AutoOpt. Here's one for android, one of the SDK
commands supported by my script:
android [--silent --verbose]
( list [avd target]
create avd ( --target <target> --name <name> --skin <name>
--path <file> --sdcard <file> --force ) ...
move avd (--name <avd> --rename <new> --path <file>) ...
(delete update) avd --name <avd>
create project ( (--package --name --activity --path) <val>
--target <target> ) ...
update project ((--name --path) <val> --target <target>) ...
update adb )
My idea: What if you could teach the shell to complete a program's arguments
just by writing a usage description like this one?
The Solution
With Compleat, you can add completion for any command just by writing a
usage description and saving it in a configuration folder. The ten-line
description of the android command above generates the same results as my
76-line bash function, and it's so much easier to write and understand!
The syntax should be familiar to long-time Unix users. Optional arguments are
enclosed in square brackets; alternate choices are separated by vertical
pipes. An ellipsis following an item means it may be repeated, and
parentheses group several items into one. Words in angle brackets are
parameters for the user to fill in.
Let's look at some more features of the usage format. For programs with
complicated arguments, it can be useful to break them down further. You can
place alternate usages on their own lines separated by semicolons, like this:
android <opts> list [avd target];
android <opts> move avd (--name <avd> --rename <new> --path <file>)...;
android <opts> (delete update) avd --name <avd>;
...and so on. Rather than repeat the common options on every line, I used a
parameter <opts>. I can define that parameter using the same usage syntax.
opts = [ --silent --verbose ];
For parameters whose values are not fixed but can be computed by another
program, we use a ! symbol followed by a shell command to generate
completions, like this:
avd = ! android list avd grep 'Name:' cut -f2 -d: ;
target = ! android list target grep '^id:' cut -f2 -d' ' ;
And any parameter without a definition will just use the shell's built-in
completion rules, which suggest matching filenames by default.
The README file has more details of the usage syntax, and instructions
for installing the software. Give it a try, and please send in any usage
files that you want to share! (Questions, bug reports, or patches are also
welcome.)
Future Work
For the next release of Compleat, I would like to make installation easier by
providing better packaging and pre-compiled binaries; support zsh and other
non-bash shells; and write better documentation.
In the long term, I'm thinking about replacing the usage file interpreter with
a compiler. The compiler would translate the usage file into shell code, or
perhaps another language like C or Haskell. This would potentially improve
performance (although speed isn't an issue right now on my development box),
and would also make it easy for usage files to include logic written in the
target language.
Final Thoughts
Recently I realized that parts of my work are so specialized that my parents
and non-programmer friends will probably never really get them. For example,
Compleat is a program to generate programs to help you... run programs? Sigh.
Well, maybe someone out there will appreciate it.
Compleat was my weekends/evenings/bus-rides project for the last few weeks (as
you can see in the GitHub punch card), and my most fun side-project in
quite a while. It's the first "real" program I've written in Haskell, though
I've been experimenting with the language for a while. Now that I'm
comfortable with it, I find that Haskell's particular combination of features
works just right to enable quick exploratory programming, while giving a high
level of confidence in the behavior of the resulting program. Compleat 1.0 is
only 160 lines of Haskell, excluding comments and imports. Every module was
completely rewritten at least once as I tried and compared different
approaches. This is much less daunting when the code in question is only a
couple dozen lines. I don't think this particular program would have been
quite as easy to write at least for me in any of the other
platforms I know (including Ruby, Python, Scheme, and C).
I had the idea for Compleat more than a year ago, but at the time I did not
know how to implement it easily. I quickly realized that what I wanted to
write was a specialized parser generator, and a domain-specific language to go
with it. Unfortunately I never took a compiler-design class in school, and
had forgotten most of what I learned in my programming languages course. So I
began studying parsing algorithms and language implementation, with Compleat
as my ultimate goal.
My good friend Josh and his Gazelle parser generator helped inspire me
and point me toward other existing work. Compleat actually contains three
parsers. The usage file parser and the input line tokenizer are built on the
excellent Parsec library. The usage file is then translated into a
parser that's built with my own simple set of parser combinators, which were
inspired both by Parsec and by the original Monadic Parser Combinators
paper by Graham Hutton and Erik Meijer. The simple evaluator for the usage
DSL applies what I learned from Jonathan Tang's Write Yourself a Scheme in
48 Hours. And of course Real World Haskell was an essential
resource for both the nuts and bolts and the design philosophy of Haskell.
So besides producing a tool that will be useful to me and hopefully others, I
also filled in a gap in my CS education, learned some great new languages and
tools, and kindled an interest in several new (to me) research areas. It has
also renewed my belief in the importance of "academic" knowledge to real
engineering problems. (I've already come across at least one problem in my
day job that I was able to solve faster by implementing a simple parser than I
would have a year ago by fumbling with regexes.) And I'll be even happier if
this inspires some friends or strangers to take a closer look at Haskell,
Parsec, or any problem they've thought about and didn't know enough to solve.
Yet.
The 5 year old IBM Thinkpad T43 that I have been using at work was showing its age: overheating, poor response on disk operations (saving a small file in vi seems to be taking increasingly long times), it doesn't boot sometimes and I have to power cycle it. However, I was putting up with it because the newer T series laptops from Lenovo don't come anywhere close to the quality of the T43. But the final nail in the coffin was a crack in the LCD.
So I got myself a Lenovo X200 about a week ago and I am liking it so far. The weight, battery life, performance and the form factor are a big win. What I don't like about it is:
I managed to resist for a while, but after thinking about it for a couple of weeks, I've cracked and ordered a Pandora, which is a tiny palm-top cum gaming console, with an OMAP3530 (ARM Cortex A8) running at 600MHz, a smidgen larger than a Nintendo DS.
I'm not really interested in the gaming side, but am thinking that now that DisplayLink seems to be somewhat supportable on Linux I'll be able to plug it into a decent monitor when I'm home, and that the 10 hour battery life and pocket size will be great when I'm not.
Hopefully it'll be built and shipped in time for Xmas.
A couple (?) of days ago, I uploaded wtop to the archives (more precisely, to experimental), but what does this little tool do? Quoting directly from the project's page:"wtop is like "top" for your webserver. How many searches or signups are happening per second? What is the response time histogram for your static files? wtop shows you at a glance. "
Couchdb came onto my radar since distributed stuff is interesting to me
these days. But most of what was being written about it put me off, since
it seemed to be very web-oriented, with javascript and html and stuff
stored in the database, served right out of it to web browsers in an
AJAXy mess.
Also, it's a database. I decided a long, long time ago not to mess with
traditional databases. (They're great, they're just not great for me. Said
the guy leaving after 5 years in the coal mines.)
Then I saw Damien Katz's
talk about how
he gave up everything to go off and create couchdb. Was very inspirational.
Seemed it must be worth another look, with that story behind it.
Now I'm reading the draft O'Rielly book,
like some things, as expected don't like others[1], and am not sure what to
think overall (plus still have half the book to get through yet),
but it has spurred some early thoughts:
... vs DVCS
Couchdb is very unlike a distributed VCS, and yet it's moved from
traditional database country much closer to VCS land. It's document
oriented, not normalized; the data stored in it has significant structure,
but is also in a sense freeform. It doesn't necessarily preserve all
history, but it does support multiple branches, merging, and conflict
resolution.
Oddly, the thing I dislike most about it is possibly its biggest strength
compared to a VCS, and that is that code is stored in the database
alongside the data. That means that changes to the data can trigger
processing, so it is mapped, reduced, views are updated, etc, on demand.
This is done using code that is included in the database, and so is always
available, and runs in an environment couchdb provides -- so replicating
the database automatically deploys it.
Compare with a VCS, where anything that is triggered by changes to the data
is tacked onto the side in hooks, has to be manually set up, and so is poorly
integrated overall.
Basically, what I've been doing with ikiwiki is adding some smarts
about handling a particular kind of data, on top of the VCS. But this is
done via a few narrow hooks; cloning the VCS repository does not get you a
wiki set up and ready to go.
There are good reasons why cloning a VCS repository does not clone the
hooks associated with it. The idea of doing so seems insane; how could you
trust those hooks? How could they work when cloned to another environment?
And so that's Never Been Done[2]. But with couchdb's example, this is
looking to me like a blind spot, that has probably stunted the range of
things VCSs are used for.
If you feel, like I do, that it's great we have these amazing distributed
VCSs, with so many advanced capabilities, but a shame that they're only
used by software developers, then that is an exciting thought.
Needless to say, my vacation is going quite well.
I've taken many pictures, read many books, written many reviews, and
haven't thought about work (paid or volunteer) at all for about a week and
a half. I'm slowly starting to recharge, although after this summer, a
nice long vacation was exactly what I needed and I'm glad there's
more of it left.
I'll be back on line a bit more in about another week. In the meantime, I
wish everyone a happy, productive time if you're not on vacation and a
relaxing time if you are!
Next.