Computers Can Remember Things

One feature that I’ve been missing from mplayer for years and years is the ability to remember how far you’ve watched a movie.  Like, if I’ve been watching a movie, but then I stop the movie because I want to watch a TV show, then mplayer doesn’t helpfully remember where you left off.

So I’ve added a totally trivial fix to mplayer that just records all the shows you’ve watched (and how far into the file you’ve watched them) to the ~/.mplayer.positions file.

I’ve put the result (along with the previous hacks) on github.  And, of course, I’ve amended movie.el to use this data to start off the movie at the correct spot.

This will save me several seconds per week, I bet.

The changes are probably not that useful as is, but if somebody wants to take this idea an add it to mplayer proper, then … that would be nice.  Perhaps.

Plastic Bags Considered Arty

The Floor

What is that lovely expressionistic piece of art on the right, you say?

Let me tell you a story.

I went shopping for groceries at ICA today.  I left the bags on the floor in the kitchen.

The kitchen floor has heating cables.  The cables switched themselves on.

The red text on the plastic bags melted.

The Bag

No, the the floor does not get toasty warm.  It just gets pleasantly warm.  But obviously ICA is using plastic that melts at very low temperatures.

I should sow them for a million megabucks!

Or I could just get the floor repainted, which I was kinda planning on doing, anyway…

(The picture on the top right was taken after scrubbing at the redness with White Spirit for ten minutes.  It didn’t help much.)

So much drama!

Compositing Text Over Images

8 Inch USB Screen With Composited Text

I have a number of small USB-powered screens scattered across the apartment that displays various stuff that I find myself wanting to know.  In particular, I always want to know what music is playing. And I sometimes want to know what temperature it is outside.  (And I can tap the screens to pause the music.)

So I want to display the sleeve of the currently playing album, and I want to display the group/album/track name.  And on the screen in the “office”, I want to display the temperature in the room and the temperature outside.  Because I want to know how many layers of wool I have to put on before going outside.

“This should be easy enough to script up with ImageMagick”, you’re probably thinking.  But I want the font be Futura, and I want the text to have a “shadow” around it so that it can be read no matter what the background (i.e. the sleeve) looks like.

My go-to tool for all text-based things is LaTeX.  (Yes, I know.)  And after fiddling around a bit with LaTex and netpbm, I got the look I wanted.  (“A bit” is a euphemism for “a few minutes every day for a couple of weeks until it didn’t look hideous”.  (And “a few” is a euphemism for “a lot of”.))

This Is A Button

The solution I settled on was to take the output from LaTeX, convert it into pnm, and then blur the outlines for a number of times.  Then I used this blurred image as the alpha channel on a black image.  By then compositing all these images over each other (the background image first, then the black image with the alpha channel giving the outlines of the text, and then the text itself on the top), I got the result you can see on the image at the top.

Probably not usable for anybody else as is, but I’ve put the scripts up on GitHub anyway.  Somebody out there may want to do something similar some day, and perhaps this will help in some way.

And publishing code like this always helps.  It’s been through so many iterations that the code was just a total nightmare, and cleaning it up (as one does) before publication makes the code more maintainable for my personal use, too.

March 9th, 2012

Dear Diary,

I’ve switched the SSD disks back to the LSI MegaRAID SAS 9260-8i controller again, and did some final benchmarks.

I’m comparing reading bits of the Gmane spool in semi-random (i.e. ext4 directory) order, name order (which is also the same order as the files were created), and finally, just reading a big hunking file.  I’ve done this on a spinning disk, with soft RAID, and with the MegaRAID. The last two are over five Samsung 830 512GB in RAID5 mode.

 Semi-random orderName orderSequential reads
Spinning disk234 files/s2 MB/s6062 files/s48 MB/s130 MB/s
Soft RAID5 over SSDs4076 files/s32 MB/s8103 files/s64 MB/s264 MB/s
LSI MegaRAID SAS 9260-8i over SSDs4564 files/s36 MB/s18708 files/s148 MB/s580 MB/s 

So, for the thing that matters — semi-random reads — we get a 20x improvement going from spinning magnetic disks to SSD.  However, the difference between using soft RAID over SATA2.0 versus using that spiffy MegaRAID SATA3.0 card isn’t very thrilling in my realistic use case.  

However, being able to read the 19K files per second when I’m doing, say, re-indexing or statistical analysis, will certainly be nice.  I’ll probably not get that speed when the machine is under load and serving out messages at the same time, but it’ll be a lot better than a contested spinning disk.

So to conclude:  The LSI MegaRAID 9260-8i was a waste of time and money.  I should just have soft RAID-ed the thing, as was my original plan.  But since I’ve got the card now, I might as well just use it.

I’ve now started the real syncing of the entire spool to the new machine.  That’ll probably take a few days, but I’m aiming for replacing the Gmane news server with the new machine sometime next week.  This will hopefully mean the end of all those “load over 16” login denials.

And, Diary, since it seems that some people are able to hack into you and read my most secret thoughts, I’m going to go back to writing you with a quill pen on parchment again.  Surely Google won’t be able to access you there.