Category Archives: Technology

Haskell #1 in the Shootout

Wow. Some Haskell hackers have started paying a small bit of attention to the Great Computer Language Shootout site, and the results are impressive.

Haskell now takes first place in the lines of code competition. In the CPU time competition, Haskell is also doing quite respectably: it beats out OCaml by a small margin, and defeats Java, C++, Python, Perl, Erlang, Ruby, Mono, Tcl, etc. by significant margins.

These links are all using the Shootout default weightings for individual tests.

The only downside to the Shootout is that the programs — for all languages — are not really idomatic and don’t show off a language’s natural beauty. Sounds like it’s time to gather up some Haskell hackers to rally around the PLEAC effort as well.

Firebird was almost interesting…

I was looking at the Firebird database recently. Free Software, very feature complete, and one neat feature was that it could run either client/server (like PostgreSQL) or as a standalone .so (like Sqlite). I was starting to look into using it.

Then I discovered it only supports i386 on Linux, and no progress has been made in 3 years on that.

So I will not be trying Firebird.

I thought we had all learned by now that portable code is a good thing. Guess not.

I will be sticking with PostgreSQL as my preferred RDBMS for awhile.

NiMH Rechargable Batteries and Charger Review

I’ve been using NiMH batteries for quite a few years now. Ever since my first-ever digital camera came with a free AA charger and four free rechargable NiMH batteries. I’m still using that charger, and it’s been almost 10 years.

I have a few complaints about my existing charger. It won’t charge AAA batteries, and it doesn’t have a discharge feature. Without that, it can be difficult to avoid shortening battery life due to the memory effect which even NiMH batteries are susceptible to. Also, it charges batteries in pairs, which can result in various charging problems when dealing with batteries of uneven charge or uneven storage characteristics.

Also, many of my batteries were old.

So, I set out to find a better charger, and to find the best current NiMH batteries.

The Charger

A little Googling revealed a very useful page at Steve’s Digicams. They suggested the Lacrosse BC-900 Advanced Charger. I ordered this unit from Thomas Distributing and must say it is a very slick unit. It has four main modes: charge, which does a simple charge-until-full; discharge, which will discharge then charge a battery; refresh, which discharges then charges the battery repeatedly until no increase in capacity is measured; and test, which checks the condition of the battery.

The charging and discharging current is fully configurable. I opt for a gentle, slow 200 mA charging current. But others can increase it to many times that. The BC-900 has a built-in temperature cutoff circuit, so it will pause charging if your batteries are about to overheat.

The BC-900 can charge up to 4 AA or AAA batteries simultaneously. Each battery is charged individually, and each battery can have its own mode and charging/discharging current set.

The unit comes with some starter NiMH AA and AAA batteries, plus a carrying case for batteries and the charger. Thomas Distributing also added four more free AA NiMH batteries (nice).

Batteries

I found the Great Battery Shootout site to help with choosing batteries. I eventually chose Maha Powerex batteries and have been happy with them as well. They come in various different capacities (including some larger than are listed on the shootout page) and Thomas Distributing had good prices.

Hope this helps if you’re planning on using rechargable batteries.

Video Game Consoles

I’m thinking of getting a video game console system. Trouble is, I haven’t really followed the market since the days of the original Nintendo. I do own a N64, but I didn’t really research it before I bought it, and it looks pretty bad on our HDTV.

So I’m hoping someone out there can give me some advice, or some links to sites that could give me some advice. I have no idea at all where to start.

My criteria to begin with are:

  • Support for HDTV systems. Are there any widescreen (16:9) game systems or games out there? That would be ideal.
  • Not about to be end-of-lifed. I want it to be able to play new releases for awhile yet.

Hello, ext3. Goodbye, reiser4.

So I’ve been trying out various filesystems over the past few months, by converting a few machines to them and using them on a daily basis.

I’ve found that reiser3, JFS, and XFS are all risky and actually corrupt data on crashes. JFS also has a few weird bugs that make the kernel oops, and sometimes cause filesystem corruption. All of the above also have starvation issues, where one IO-intensive process can dramatically slow down everything on the system (by a factor of 100 or more).

Reiser4 has proven better — only one small issue that I can recall. But it’s got a huge problem: no ability to resize a Reiser4 partition. That is rather ridiculous these days, and really reduces the utility of LVM. (Hans says he’ll make it resizable when someone pays.)

So I’ve tried out ext3 again, for the first time in a few years. I’m using data=ordered,commit=300 (or 600 on some machines), which still makes it safer than the other journaled filesystems.

And I must say that it is impressive. The old bottlenecks that I was used to were gone. The thing is reliable and fast, and scales well. I’m going to move everything back to ext3.

So why do Hans’s benchmarks show reiser4 being better? For one thing, most benchmarks measure throughput, not response time, so things like starvation don’t cause black marks in them. Most of them don’t even use multiple processes to simulate real-world activity anyway. Plus, ext3’s default mount options (commit=5, for instance) are much more conservatve than other filesystem’s. To get a fair test, one should increase that commit= number on ext3.

Here’s another discussion about ext3.

Some nice code: libarchive

Yesterday, while looking for information on the format of tar files, I discovered libarchive, which is part of FreeBSD. libarchive and read about 5 different tar formats, 4 different cpio formats, zip, and ISO images, and supports gzip and bzip2. It can also write 2 different tar formats plus cpio and shar. Very nice.

Oh, and its tar.5 is the best reference on the tar format I’ve seen.

I’ve packaged up libarchive and bsdtar (the default tar on FreeBSD, which is built using libarchive) for Debian.

The Linux Link Tech Show

Probably the most unexpected result of purchasing a Motorola v551 phone is finding out about The Linux Link Tech Show. (One of the people involved had e-mailed me asking about bluetooth under Linux on that phone.)

I’ve listened to about 2 hours of back episodes now. It’s great. I can’t believe it’s been 2 years that they’ve been doing this and I just now learn of it.

They’ve invited me to be a guest on the show next Wednesday evening, September 21. I think it’ll be a lot of fun.

Plus, they’ve got an Asterisk setup. Always like the opportunity to do something cool with Asterisk.

Perl, Powered By Haskell

Autrijus Tang is well-known for developing the first working Perl 6 interpreter, Pugs. Pugs is written in Haskell, my new favorite language. Perl.com has an interview with Autrijus, and page 2 of that interview gets particularly interesting. Here are some quotes from Autrijus:

Haskell . . . is faster than C++, more concise than Perl, more regular than Python, more flexible than Ruby, more typeful than C#, more robust than Java, and has absolutely nothing in common with PHP.

(If it has nothing in common with PHP, it must be great, right?)

Haskell is a pure functional language optimised for conciseness and clarity. It handles infinite data structures natively, and offers rich types and function abstractions that give Haskell programs a strong declarative flavor–the entire Pugs compiler and runtime is under 3000 lines of code.

Most languages require you to pay a “language tax”: code that does nothing with the main algorithm, placed there only to make the computer happy. [Java, anyone? — jgoerzen]

On the other end of spectrum, we often shy away from abstracting huge legacy code because we are afraid of breaking the complex interplay of flow control and global and mutable variables. Besides, the paths leading to common targets of refactoring–those Design Patterns–are often non-obvious.

Because Haskell makes all side effects explicit, code can be refactored in a safe and automatic way. Indeed, you can ask a bot on to turn programs to its most abstracted form for you.

Go check out the interview (page 2) for more, including a demo program that Autrijus wrote to show off Haskell.

Thanks to metaperl for the link.