“A multiculturist would bring bring marshmallows to a suttee.”

— Timid1

iGrep


Just got a complaint from a user about a Perl script that wasn’t handling regular expressions correctly. Specifically, when he typed:

ourspecial-cat | grep 'foo\|bar'

he got a match on “foo” or “bar”, but when he typed:

ourspecial-grep 'foo\|bar'

he got nothing at all.

My surprise came from the fact that the normal grep worked, when everyone knows that you need to use egrep for that kind of search, and in any case, since the entire regular expression was in single-quotes, you don’t need the backslash. Removing the backslash made our tool do what he wanted, but broke grep.

Sure enough, if you leave out the backslash, you need to use egrep or grep -E, but if you put it in, you can use grep. What makes it really fun is that they’re the same program, GNU Grep 2.5.1, and running egrep should be precisely the same as running grep -E.

Makes me wonder what other little surprises are hidden away in the tools I use every day…

America versus Japan


If you go to Amazon Japan and search for “k-cup”, you will not find single-serving coffee makers and supplies.

If you go to Amazon US and search for “k-cup”, you will not find DVDs featuring extremely busty women.

If you go to Amazon Japan and search for “Kカップ”, you will find both, but you’ll have to scroll down a bit to see the coffee.

Clear Keep, XKCD


First thing that drove me crazy when I moved to Silicon Valley:

more...

Effective index use in MongoDB


Three basic rules to keep in mind when trying to index that massive crapload of data you just shoved into MongoDB:

  1. All indexes must fit in physical memory for decent performance.
  2. A query can only use one index.
  3. A single compound index on (x,y,z) can be used for queries on (x), (x,y), (x,z), or (x,y,z). However, prior to 1.6, all but the last field used from the index had to be an exact match, or you might get a full table scan instead.

more...

The thing which the chief does not have


Sign at Nijo Castle, by Flickr user cathou_cathare

This entertaining picture was recently posted to engrishfunny.com. As is often the case, the uploader pretended that he took the picture, conveniently failing to link to the Flickr user who posted it two years ago. (TinEye to the rescue!)

Please do not see it while drinking drink.
The PET bottle caps it and put it in a bag, and please carry it.
Please see the thing which the chief does not have after finishing drinking.
城内では、飲料水を飲みながら観覧することはできません。
ペットボトル等については、キャップをしてカバンなどに入れて持ち歩くか、キャップのできないものについては、飲み終えてからご観覧下さい。ご協力のほど、よろしくお願いいたします。

The first half of the translation is almost comprehensible, although it inexplicably leaves out the opening clause in the first line, “Inside the castle”. The third sentence is supposed to say “finish drinks that can’t be capped before viewing (the castle interior)”, but as any Ultraman fan knows, “kyappu” is not only phonetic for a bottle cap, but also for “captain”…

[Update: The Flickr user thanked me for adding a quick translation as a comment. English isn’t her native language, which made the Engrish particularly baffling.]

The Mahoromatic Fitness Plan


  1. Hire a live-in maid/cook/combat android.
  2. Hide porn in your bedroom.

more...

Mahoro for less


You don’t see a lot of this in Japan: thinpack re-releases of anime series at a less-than-rapacious price. Usually you have to buy the N-year-old DVDs at their original insane price with little or no discount, unless you have a reshipping service to handle used-goods dealers who don’t ship internationally.

I guess that Mahoromatic is still a hot property, because both seasons are getting “limited edition” thin-packs, released a month apart for ¥5400 each (1, 2).

(ah, turns out there was an earlier box set for about twice this price, and a recent Blu-ray set for about three times this price)

Dear Sony,


Most people don’t read much of the manual that ships with a camera. Some because they already know what they’re doing, and just need a few keys facts about specific features. Others because the quick-start guide covered batteries, power, and how to get at their pictures, and they really have no use for 90 pages of details on what every possible sub-menu does.

This, however, is no excuse for putting useless information into the manual. For instance, the descriptions you’ve chosen to explain the “image styles” in my a850, a high-end DSLR aimed at serious photographers:

  • Clear: For capturing images in a clear tone with limpid colors in the highlighted area, suitable for capturing radiant light.
  • Deep: For capturing images with deep and dense color expressions, suited to capturing the solid presence of the subject.
  • Light: For capturing images with bright and uncomplicated color expressions, suited to capturing refreshingly light ambience.

Compare to some of your other descriptions in the same section, where for instance the Vivid style is described with the words “saturation and contrast are heightened”, Neutral with “saturation and sharpness are lowered”, Landscape with “saturation, contrast, and sharpness are heightened”, and Night View with “contrast is attenuated”. These factual statements are followed by descriptions of their effect and intended use, where Clear, Deep, and Light are just fluff.

This is not a translation problem, because they’re fluff in the Japanese manual as well: “クリア:ハイライト部分の抜けがよく、透明感のある雰囲気に表現する。光の煌めき感などの表現に適 している”. This is about as clear as “limpid”, which is, ironically, as clear as mud.

dpreview’s test images from the optically-identical a900 suggest that Light and Deep are roughly equivalent to mild over/under-exposure, but sadly there’s no side-by-side of Clear and Light to see how they differ.

“Need a clue, take a clue,
 got a clue, leave a clue”