Useful Consumer Review

My old tv machine worked ok, but it was too slow to play the files MakeMKV ripped from BluRay disks.

So I bought a new one from QuietPC. I’ve bought a couple from them before, and they seem to make reliable, fanless machines.

So here are the notes on problems getting the video working under Debian Linux. Sigh.

The motherboard is Gigabyte H87N-WIFI, the VGA is “Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller”, which is a Haswell HD Graphics thing.

First of all, if you have xserver-xorg-video-modesetting installed, get rid of it. For some reason or other, X -configure prefers this generic driver over the Intel driver, which is pretty nonsensical. It’s not accelerated, so you can’t really use it for much of anything.

After getting rid of it, you’ll get the Intel (i915) driver instead, which works OK. Except if you want to watch video. Then you get lots of tearing. There’s a newer “tear free” version of the Intel xorg driver that fixes this problem, but it’s not included in Debian testing, even.

So go to the Intel page and download the “xf86-video-intel – 2.99.906” package. It compiles easily enough (just need to install some -dev packages). Install it by moving the intel_drv.so file after compiling over the one supplied by Debian. It should work fine. (Unless you’re reading this some time after March 2014.)

Hey! Now you can watch video. Except when the i915 driver loads, the HDMI screen turns all grey. For some reason or other, i915 jacks the backlights on the monitor up to max, leaving me with a very, very pale and bright TV.

After googling for hours, I finally found this. So you have to say

xrandr --output HDMI3 --set "Broadcast RGB" "Full"

to get black to be black. “Yay.”

I got an integrated BluRay slot player in the machine, because I thought that would look tidier than the external USB drive. However, MakeMKV says the following when I try to use it: “Drive BD-RE MATSHITA BD-MLT UJ265 1.00 has RPC protection that can not be bypassed. Change drive region or update drive firmware from http://tdb.rpc1.org. Errors likely to follow.” Indeed. And there is no region free firmware for this drive, so I’ll just continue to use my external BluRay drive.

Anybody know of a region-free slot-in slimline BluRay drive?

The Tellstick control unit didn’t work any more, because they’ve removed the “vendor” and “product” options from ftdi_sio. So this doesn’t work any more:

options ftdi_sio vendor=0x1781 product=0x0c31

Instead you have to say

modprobe ftdi_sio
 echo 1781 0c31 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id

Yeah, that makes sense…

Finally, the machine has tons of USB3 ports, and just two USB2 ports. I thought that would be a plus, but it seems like my tiny USB monitor doesn’t like being plugged in to the USB3 ports. The kernel says “Cannot enable port 3. Maybe the USB cable is bad?” and the monitor drops connection.

Well, maybe the cable really is bad? It’s always the cable’s fault!

(This is where I go to look for a new cable. And I find one, and switches the cable, and everything works perfectly! It’s always the cable!)

Gack.

See? It almost works out of the box. I mean, finding out all this only took me eleven hours…

It’s the year of Linux on the Desktop any… decade… now.

One! Hundred! Movies!

I used to be a major movie nerd. Watched a couple a day. Went to the Cinemateque regularly. And then I stopped.

It was probably a combination of things. First of all, starting a movie meant turning the music that’s playing off, and I hate doing that. And I feel that you have to pay a certain amount of attention to movies that you don’t have to with TV series.

I can do the dishes while watching True Blood, but it would be odd to do that while watching Alphaville.

One further disincentive was that I was starting to feel a bit fed up with movies in general. “Here’s a new set of people that I have to concern myself with and care about for the next 90 minutes. Whyyyy!” I kinda think that’s a somewhat normal reaction, and explains some of the popularity of movie serials and TV series. You don’t have to care about a new set of characters.

So: Fuck movies.

On the other hand, TV sucks, and there’s quite a number of really excellent movies out there. So I’ve been trying to get back into the swing of things, but not quite succeeding.

So now I’m going to make a concerted effort to see a bunch of movies. 100 of them. Before summer.

And to up the stakes (not difficult, considering the project), I’m going to learn how to mix cocktails, too. I’ve never been into making cocktails, so I’m going to learn how do to at least one per movie.

I may have over-purchased ingredients.

Art Comic Book Store Finder Wanted

I’ve been travelling a fair bit the last couple of months. One of my favourite things to do in furrin cities is to visit comic book stores. However, finding the interesting stores isn’t trivial.

If you’re reading the comics blogs religiously, and you travel to the conventions, and you know a lot of other people who have the same interests, you just know which stores are the good ones.

The current minimum standard for a good art comics store is (after thorough research) that it should have 1) some Michael DeForge, 2) some issues of Copra, 3) a Gabrielle Bell mini, and 4) a smattering of local, hand-made comics. In addition to the Drawn & Quarterly and Fantagraphics perennials that you can find anywhere.

But I’m pretty oblivious when it comes to the “comics community”. I find myself in a city, and I google for “best comic book store”, and I invariably end up at the local Superhero Dungeon & Games. For instance, I discovered Desert Island Comics in Brooklyn on like my seventh visit to New York.

This time I did a bit more research, and I managed to stop by Comix Experience in San Francisco (very nice, indeed) and the Wow Cool store in Cupertino (extremely nice; we were down in Palo Alto and I convinced my friends to stop by on the way back to SF after reading about it on The Beat and The Comics Reporter).

In London, I stopped by Gosh Comics (got lots of British floppies) and Nobrow (got lots of… Nobrow comics).

Couldn’t someone, somewhere, make an Art Comics Store Finder? Please. Avoid having people going to to Ye Comics Basement in vain, and guide us to the right stores.

Profit!

Offensive Code

While writing code to format Roman Numerals, I was made aware of the Rosetta Stone collection of code snippets to do the same.  I read the code, and after looking at it for a few minutes, I found myself oddly offended.

By the code.

Here it is:

(defun ar2ro (AN)
  "translate from arabic number AN to roman number,
   ar2ro(1666) returns (M D C L X V I)"
  (cond
   ((>= AN 1000) (cons 'M (ar2ro (- AN 1000))))
   ((>= AN 900) (cons 'C (cons 'M (ar2ro (- AN 900)))))
   ((>= AN 500) (cons 'D (ar2ro (- AN 500))))
   ((>= AN 400) (cons 'C (cons 'D (ar2ro (- AN 400)))))
   ((>= AN 100) (cons 'C (ar2ro (- AN 100))))
   ((>= AN 90) (cons 'X (cons 'C (ar2ro (- AN 90)))))
   ((>= AN 50) (cons 'L (ar2ro (- AN 50))))
   ((>= AN 40) (cons 'X (cons 'L (ar2ro (- AN 40)))))
   ((>= AN 10) (cons 'X (ar2ro (- AN 10))))
   ((>= AN 5) (cons 'V (ar2ro (- AN 5))))
   ((>= AN 4) (cons 'I (cons 'V (ar2ro (- AN 4)))))
   ((>= AN 1) (cons 'I (ar2ro (- AN 1))))
   ((= AN 0) nil)))

First of all, I really don’t like the repetition of the constants (1000 … 1000, 900 … 900).

Second of all, I don’t like that the subtractive elements (CM for 900) are in there explicitly, since they can be easily derived.  You may argue that it’s defensible in this case, since there aren’t really that many possible Roman “digits”, but writing repetitious code like that is error prone.  (And virtually all the Rosetta Stone examples, in all the languages, do the subtractive elements explicitly.)

Which leads me to the third point, which is that the algorithm is wrong.  9 is encoded as VIV, since whoever typed this forgot to write the “9” line.

The offensive part is, I think, that this is code that no humans should write.  It’s so pattern-based that one should write code that generates that code.  But in that case, you might as well just write the algorithm “properly”, which leads to smaller code, anyway:

(defvar roman-numeral-mapping
  '((1000 . "M") (500 . "D") (100 . "C") (50 . "L")
    (10 . "X") (5 . "V") (1 . "I")))

(defun format-roman-numeral (number)
  "Format NUMBER into a Roman numeral.
Roman numerals look like \"XCVII\"."
  (let ((mapping roman-numeral-mapping)
         values roman elem subtract)
    ;; Add the subtractive elements ("IV", etc) to the mapping.
    (while (setq elem (pop mapping))
      (push elem values)
      ;; We use the feature that the subtractive element is alternatively
      ;; one or two elements further along in the list.
      (when (setq subtract (elt mapping (mod (1+ (length mapping)) 2)))
        (push (cons (- (car elem) (car subtract))
                    (concat (cdr subtract) (cdr elem)))
              values)))
    ;; Compute the Roman numeral.
    (dolist (value (nreverse values))
      (while (>= number (car value))
        (push (cdr value) roman)
        (setq number (- number (car value)))))
    (apply 'concat (nreverse roman))))

Remove the comments, and it’s fewer lines.

(Now, this might be characterised as “smarty-pants programming”.  The normal way to have a variable that flips between 0/1 would be to, well, have a variable that flips between 0/1.  Instead I’m using the decreasing length of a list (modulo 2) to get the same effect.  It’s slower, and it makes the code more obscure, but, hey, it saves a couple of lines.  Other than that, I don’t think I’ve cheated much.)

I don’t often see code that I think is downright offensive.  I mostly see good code, or bad code, or WTF code, but seldom code that squicks me out.  But the Rosetta code did.