The Lumber Room

"Consign them to dust and damp by way of preserving them"

Archive for the ‘entertainment’ Category

Free, defiant, and without a security label

leave a comment »

James Mickens is a CS researcher (“Galactic Viceroy of Research Magnificence”) who among other things writes wrote for the online version of Usenix’s magazine ;login: (called ;login: logout, published every other month). Here are some of his articles:

  1. [May 2013] The Saddest Moment
  2. [July 2013] Mobile Computing Research Is a Hornet’s Nest of Deception and Chicanery
  3. [September 2013] The Slow Winter
  4. [November 2013] The Night Watch
  5. [January 2014] This World of Ours
  6. [March 2014] To Wash It All Away

Reading these is an epiphany akin to one’s first encounter with Dave Barry or Airplane!

(Plug by Raymond Chen too.)

See also this video, where he answers questions like “What’s the best piece of advice you have ever received?” (Answer: “The best piece of advice was probably ‘Stay out of jail’. That came from my dad.”)

Edit [2014-03-13]: Apparently the March 2014 column is his last for the magazine; updated post.

Written by S

Wed, 2014-01-08 at 13:53:11 +05:30

The potions puzzle by Snape in Harry Potter and the Philosopher’s Stone

with one comment

Sometime this week, I reread the first Harry Potter book (after at least 10 years… wow, has it been that long?), just for contrast after reading Rowling’s adult novel The Casual Vacancy (on which more later). Anyway, in the penultimate chapter there is a puzzle:

He pulled open the next door, both of them hardly daring to look at what came next — but there was nothing very frightening in here, just a table with seven differently shaped bottles standing on it in a line.
“Snape’s,” said Harry. “What do we have to do?”
They stepped over the threshold, and immediately a fire sprang up behind them in the doorway. It wasn’t ordinary fire either; it was purple. At the same instant, black flames shot up in the doorway leading onward. They were trapped.
“Look!” Hermione seized a roll of paper lying next to the bottles. Harry looked over her shoulder to read it:

Danger lies before you, while safety lies behind,
Two of us will help you, whichever you would find,
One among us seven will let you move ahead,
Another will transport the drinker back instead,
Two among our number hold only nettle wine,
Three of us are killers, waiting hidden in line.
Choose, unless you wish to stay here forevermore,
To help you in your choice, we give you these clues four:
First, however slyly the poison tries to hide
You will always find some on nettle wine’s left side;
Second, different are those who stand at either end,
But if you would move onward, neither is your friend;
Third, as you see clearly, all are different size,
Neither dwarf nor giant holds death in their insides;
Fourth, the second left and the second on the right
Are twins once you taste them, though different at first sight.

I became curious about whether this is just a ditty Rowling made up, or the puzzle actually makes sense and is consistent. It turns out she has constructed it well. Let’s take a look. This investigation can be carried out by hand, but we’ll be lazy and use a computer, specifically Python. The code examples below are all to be typed in an interactive Python shell, the one that you get by typing “python” in a terminal.

So what we have are seven bottles, of which one will take you forward (F), one will let you go back (B), two are just nettle wine (N), and three are poison (P).

>>> bottles = ['F', 'B', 'N', 'N', 'P', 'P', 'P']

The actual ordering of these 7 bottles is some ordering (permutation) of them. As 7 is a very small number, we can afford to be inefficient and resort to brute-force enumeration.

>>> import itertools
>>> perms = [''.join(s) for s in set(itertools.permutations(bottles))]
>>> len(perms)
420

The set is needed to remove duplicates, because otherwise itertools.permutations will print 7! “permutations”. So already the number of all possible orderings is rather small (it is \frac{7!}{2!3!} = 420). We can look at a sample to check whether things look fine.

>>> perms[:10]
['PNFNPBP', 'NPPBNFP', 'FNNPBPP', 'PPPFNBN', 'NPPNBFP', 'PFNNBPP', 'NPBPPFN', 'NBNPPFP', 'NPPFBNP', 'BNPFNPP']

Now let us try to solve the puzzle. We can start with the first clue, which says that wherever a nettle-wine bottle occurs, on its left is always a poison bottle (and in particular therefore, a nettle-wine bottle cannot be in the leftmost position). So we must restrict the orderings to just those that satisfy this condition.

>>> def clue1(s): return all(i > 0 and s[i-1] == 'P' for i in range(len(s)) if s[i]=='N')
...
>>> len([s for s in perms if clue1(s)])
60

(In the code, the 7 positions are 0 to 6, as array indices in code generally start at 0.)
Then the second clue says that the bottles at the end are different, and neither contains the potion that lets you go forward.

>>> def clue2(s): return s[0] != s[6] and s[0] != 'F' and s[6] != 'F'
...
>>> len([s for s in perms if clue1(s) and clue2(s)])
30

The third clue says that the smallest and largest bottles don’t contain poison, and this would be of help to Harry and Hermione who can see the sizes of the bottles. But as we readers are not told the sizes of the bottles, this doesn’t seem of any help to us; let us return to this later.

The fourth clue says that the second-left and second-right bottles have the same contents.

>>> def clue4(s): return s[1] == s[5]
...
>>> len([s for s in perms if clue1(s) and clue2(s) and clue4(s)])
8

There are now just 8 possibilities, finally small enough to print them all.

>>> [s for s in perms if clue1(s) and clue2(s) and clue4(s)]
['PPNBFPN', 'BPNPFPN', 'BPFPNPN', 'BPPNFPN', 'PNPFPNB', 'BPNFPPN', 'PPNFBPN', 'PNFPPNB']

Alas, without knowing which the “dwarf” and “giant” bottles are, we cannot use the third clue, and this seems as far as we can go. We seem to have exhausted all the information available…

Almost. It is reasonable to assume that the puzzle is meant to have a solution. So even without knowing where exactly the “dwarf” and “giant” bottles are, we can say that they are in some pair of locations that ensure a unique solution.

>>> def clue3(d, g, s): return s[d]!='P' and s[g]!='P'
...
>>> for d in range(7):
...   for g in range(7):
...     if d == g: continue
...     poss = [s for s in perms if clue1(s) and clue2(s) and clue4(s) and clue3(d,g,s)]
...     if len(poss) == 1:
...       print d, g, poss[0]
... 
1 2 PNFPPNB
1 3 PNPFPNB
2 1 PNFPPNB
2 5 PNFPPNB
3 1 PNPFPNB
3 5 PNPFPNB
5 2 PNFPPNB
5 3 PNPFPNB

Aha! If you look at the possible orderings closely, you will see that we are down to just two possibilities for the ordering of the bottles.
Actually there is some scope for quibbling in what we did above: perhaps we cannot say that there is a unique solution determining the entire configuration; perhaps all we can say is that the puzzle should let us uniquely determine the positions of just the two useful bottles. Fortunately, that gives exactly the same set of possibilities, so this distinction happens to be inconsequential.

>>> for d in range(7):
...   for g in range(7):
...     if d == g: continue
...     poss = [(s.index('F'),s.index('B')) for s in perms if clue1(s) and clue2(s) and clue4(s) and clue3(d,g,s)]
...     if len(set(poss)) == 1:
...       print d, g, [s for s in perms if clue1(s) and clue2(s) and clue4(s) and clue3(d,g,s)][0]
... 
1 2 PNFPPNB
1 3 PNPFPNB
2 1 PNFPPNB
2 5 PNFPPNB
3 1 PNPFPNB
3 5 PNPFPNB
5 2 PNFPPNB
5 3 PNPFPNB

Good. Note that there are only two configurations above. So with only the clues in the poem, and the assumption that the puzzle can be solved, we can narrow down the possibilities to two configurations, and be sure of the contents of all the bottles except the third and fourth. We know that the potion that lets us go forward is in either the third or the fourth bottle.

In particular we see that the last bottle lets us go back, and indeed this is confirmed by the story later:

“Which one will get you back through the purple flames?”
Hermione pointed at a rounded bottle at the right end of the line.
[…]
She took a long drink from the round bottle at the end, and shuddered.

But we don’t know which of the two it is, as we can’t reconstruct all the relevant details of the configuration. Perhaps we can reconstruct something with the remaining piece of information from the story?

“Got it,” she said. “The smallest bottle will get us through the black fire — toward the Stone.”
Harry looked at the tiny bottle.
[…]
Harry took a deep breath and picked up the smallest bottle.

So we know that the bottle that lets one move forward is in fact in the smallest one, the “dwarf”.

>>> for d in range(7):
...   for g in range(7):
...     poss = [s for s in perms if clue1(s) and clue2(s) and clue4(s) and clue3(d,g,s)]
...     if len(poss) == 1 and poss[0][d] == 'F':
...       print d, g, poss[0]
... 
2 1 PNFPPNB
2 5 PNFPPNB
3 1 PNPFPNB
3 5 PNPFPNB

This narrows the possible positions of the smallest and largest bottles (note that it says the largest bottle is one that contains nettle wine), but still leaves the same two possibilities for the complete configuration. So we can stop here.

Conclusion
What we can conclude is the following: apart from the clues mentioned in the poem, the “dwarf” (the smallest bottle) was in either position 2 (third from the left) or 3 (fourth from the left). The biggest bottle was in either position 1 (second from the left) or 5 (sixth from the left). With this information about the location of the smallest bottle (and without necessarily assuming the puzzle has a unique solution!), Hermione could determine the contents of all the bottles. In particular she could determine the location of the two useful bottles: namely that the bottle that lets you go back was the last one, and that the one that lets you go forward was the smallest bottle.

>>> for (d,g) in [(2,1), (2,5), (3,1), (3,5)]:
...   poss = [s for s in perms if clue1(s) and clue2(s) and clue4(s) and clue3(d, g, s)]
...   assert len(poss) == 1
...   s = poss[0]
...   assert s.index('B') == 6
...   assert s.index('F') == d
...   print (d,g), s
... 
(2, 1) PNFPPNB
(2, 5) PNFPPNB
(3, 1) PNPFPNB
(3, 5) PNPFPNB

It is not clear why she went to the effort to create a meaningful puzzle, then withheld details that would let the reader solve it fully. Perhaps some details were removed during editing. As far as making up stuff for the sake of a story goes, though, this is nothing; consider for instance the language created for Avatar which viewers have learned.

Added:
See also http://www.zhasea.com/logic/snape.html which does it by hand, and has a perfectly clear exposition (it doesn’t try the trick of guessing that solution is unique before reaching for the additional information from the story).

Written by S

Mon, 2012-10-22 at 02:00:12 +05:30

ABBA’s The Day Before You Came

leave a comment »

[A bit too much on a stupid pop song. Move along. :-)]

The Day Before You Came is the last song that ABBA recorded. It is interesting for more than being their swansong: it is also highly atypical of ABBA.

Here is the song (Link is to Dailymotion because Youtube has videos only of live perfomances):

The music and the video are non-ABBAish too (gone are the exuberance and the outlandish clothes, the video is almost entirely Agnetha with the others getting only a few seconds of screen time and no action), but confining ourselves to the lyrics:

Must have left my house at eight, because I always do
My train, I’m certain, left the station just when it was due
I must have read the morning paper going into town
And having gotten through the editorial, no doubt I must have frowned
I must have made my desk around a quarter after nine
With letters to be read, and heaps of papers waiting to be signed
I must have gone to lunch at half past twelve or so
The usual place, the usual bunch
And still on top of this I’m pretty sure it must have rained
The day before you came

I must have lit my seventh cigarette at half past two
And at the time I never even noticed I was blue
I must have kept on dragging through the business of the day
Without really knowing anything, I hid a part of me away
At five I must have left, there’s no exception to the rule
A matter of routine, I’ve done it ever since I finished school
The train back home again
Undoubtedly I must have read the evening paper then
Oh yes, I’m sure my life was well within its usual frame
The day before you came

Must have opened my front door at eight o’clock or so
And stopped along the way to buy some Chinese food to go
I’m sure I had my dinner watching something on TV
There’s not, I think, a single episode of Dallas that I didn’t see
I must have gone to bed around a quarter after ten
I need a lot of sleep, and so I like to be in bed by then
I must have read a while
The latest one by Marilyn French or something in that style
It’s funny, but I had no sense of living without aim
The day before you came

And turning out the light
I must have yawned and cuddled up for yet another night
And rattling on the roof I must have heard the sound of rain
The day before you came

It is putatively a love song, but it makes no explicit declaration of love. The entire lyrics of the song are merely a catalogue of an average day’s events. The song is a timetable. You’ve got to admire the sheer cheek of this, if nothing else. :-) (a la Peter Cushing lives in Whitstable.)

Yet it is interesting. I think this could be argued to be a first-class example of svabhāvokti, the achievement of a poetic effect by simply and ably describing things as they are. The author of the song describes her usual boring routine, presumably to contrast against her much-changed life after meeting the “you” of the song. This is an inversion of the much more common poetic convention, that of recalling time spent in love, time spent together, etc. (Bilhana’s चौरपंचाशिका Chaura-panchashika comes to mind.)

It is linguistically interesting as well: with few exceptions, the verbs are all accompanied by “must have”, “I’m certain”, “undoubtedly”, “I’m sure”, or “I think”. [I'm not sure what this characteristic of the verb is called. In the old days I think we'd just call it verb tense, but now "tense" is reserved for verb forms that indicate time, and "tense/aspect/mood" is used instead. I don't know what this particular "must have"-type of construction is called: a Google search throws up terms like near-certainty mode, deductive, non-factual, evidential, presumptive, etc.] It’s as if the author isn’t sure. (It is remarkable that, in general, adding “I’m certain” or “undoubtedly” makes a statement less certain.) One interpretation is that the narrator after meeting her lover no longer remembers her life from before; so different it has become. But considering the level of detail, is this really possible? Besides, how much can a daily routine really change? The trains will still run at the same time, at any rate. A different possibility suggests itself: that the narrator is simply unreliable.

Suddenly a lot of things make sense: she is not describing her life “before you came”. She hasn’t met anyone at all, but is instead hoping to meet someone that will turn her colourless life exciting. The song is not reminiscences about a dull past (who would want to do that?), but she is instead imagining how different she will feel in the future after finding someone, yet so sad is her case that all she can imagine and describe is her present. The video lends credence to this idea: it starts with a scene of her daily commute, a guy appears and the video goes into a (presumably) imagined mode, before the guy disappears and she’s back at the same train station.

This would finally explain why the prevailing mood of the song, as experienced by the listener, is not one of love (it does not evoke śṛṅgāra शृङ्गार in other words): instead it is one of melancholy and weariness.

See also: Guardian article.

Written by S

Fri, 2012-08-03 at 01:10:56 +05:30

Posted in entertainment

On songs in Bollywood

with 3 comments

A rambling email I’d sent a while ago, lightly edited. Disclaimer: I haven’t thought about any of this too deeply, some of it is regurgitated wisdom, some of it stuff I’d been meaning to say for a while, and some of it is rubbish if you think about it, but anyway… a bit of harmless fun. Also it was written on a bus when I was extremely bored and verbose.


On Wed, Aug 11, 2010 at 8:19 AM, Vipul Naik <email redacted> wrote:
Subject: Trends in Bollywood music
> Hi,
>
> I am not sure whether these trends that I spot are just figments of my
> imagination, since the movies I watch aren’t a representative sample.
>
> * Duos seems way down, particularly the kind where the male and the
> female alternate and get symmetric time on the song. Solos seem to be
> way up.
>
> * In an earlier era (e.g., the DDLJ days) song time meant that the
> plot of the movie literally stopped. Nowadays, the plot often keeps
> moving even through the song, typically between the singing parts, and
> sometimes, even while the singing is going on. In other words, the
> songs seem to be much more situational and the actions and words of
> the songs have more of a bearing on the plot of the movie and its
> progression.
>
> * The use of chorus is down and the use of special effects and
> high-pitched singers is up.
>
> Question: (i) Have you noticed similar trends in Bollywood? (ii) Why
> these trends, if so? (iii) Are similar trends engulfing Mollywood,
> Tollywood, etc.?
>
> Vipul

(i): Not just your imagination. These trends have been around and increasing for a few years (as I’ve noticed them, at least).

(iii): It’s not just Bollywood, but also (to a lesser extent) other regional cinema (extrapolating from the very few Kannada/Telugu/Tamil movies I see bits of. :p)

(ii): To some extent, the answers to “why” are straightforward: new music directors come in, who want to ‘experiment’ and ‘innovate’ and ‘break with the past’, fashions change and audience tastes change accordingly, previously unavailable special effects become available. To this extent, such trends exist everywhere in the world.

But wrt how the songs are *situated* in the film, I think there’s a more profound change going on in the nature of Bollywood. In short, there are fundamental differences between traditional Bollywood and Hollywood (and between Indian art forms and modern Western art forms in general), and of late, the traditional grammar and idioms of Bollywood are being replaced by Western (specifically Hollywood) ones. (And in regional languages, the influence comes indirectly through Bollywood.) The Western influence on Bollywood is not new at all — it has existed since the very beginning, and is evident even in the name — but earlier Western influences used to be “Indianised” before being adopted wholesale.

As you noticed, in Bollywood the songs used to be interludes, not part of the plot: the song was usually used (besides being there for plain musical entertainment) mainly to express, say, love, longing, fantasy, hope, etc., and to dwell on some emotion or idea: to say something better than it could be said in words, and to prolong a feeling for an extended duration. The songs were thus part of the emotional structure of the film: whatever other events a film may contain, a film with many happy/sad songs felt a happy/sad film, etc.

This inspiration/structure comes from traditional Indian (either folk or “high culture”) forms of theatre. At points of high emotional impact, the performance switches from dialogue to song. You can see this at a glance in the structure of, say, Sanskrit plays like Shakuntala or Mṛcchakaṭika.

The closest analogue in Western art that mixes dialogue and music is opera, which has long been out of popular fashion. It has had little to no influence on the grammar of Hollywood, which seems to draw more from plays on the stage. (Perhaps opera has had a little indirect influence, through Broadway through Gilbert&Sullivan.)

The fundamental difference I spoke of is something like the following: Western art aims for “cognitive realism”, while Indian art aims for “affective/emotional realism”. In Hollywood, plots are supposed to be realistic, and events onscreen depict what may actually happen. (This is often violated of course, most egregiously in action films, but the idea is present.) In Bollywood, this is less important than getting the right feeling or emotion across.

A copy of the universe is not what’s required of art; one of the damned things is ample.

When in a Bollywood film the scene suddenly shifts to a couple dancing with a troupe of uniformed dancers in the background, we experienced viewers don’t really think “where did these background people come from? how did they all learn to dance the same way?” etc.—we understand that it’s not supposed to be real, that the background and scenery are present simply to accentuate the idea or emotion, exuberance or whatever. A typical Hollywood viewer’s initial reaction may be to consider the song as part of the plot, and wonder *why* a couple is dancing around trees instead of making out.

This is also why in Bollywood we’ve had melodrama, overacting, SRK’s hamming, overexplained jokes etc. — it’s ok to not act “real”; what’s important is that the audience react the right way. (In the early days of Hollywood filmmakers explicitly took pains to get rid of the trained actors’ “stage acting” and delivery, which was found excessively expressive for the screen.) A Hollywood movie as a whole typically tries to tell one story well, most Bollywood ones aim to be a fully satisfying meal with all emotional flavours. :-) (“Masala”, etc.)
[Consider overexplained jokes: they're intellectually unsophisticated, but they serve to prolong the humour. In India you must have met some old people who, after a joke is told, unnecessarily repeat or explain it…]

So songs were there just for effect; now with the Hollywood influence such breaks in the plot are out, but filmmakers still feel compelled to include songs with no idea why they’re adding them. Duets are on the decline because they’re less plausible (as part of the plot) than solos: you could imagine someone singing to oneself; it’s a private act that could be entirely in someone’s head, but pairs of people generally don’t sing to each other “in real life”. (Even in the duets that we do have, the actors less frequently move their lips to the song.)

[Another difference between Indian and Western art, though not related to your question: Indian art tends to care more about the resulting art work itself, and its effect on the viewer, than about the identity of the artist. Many of the valued works of art from the classical past are even anonymous! Western art is more about the artist's skill and effort and achievement; a copy of the work has less value than the original. Pablo Picasso is a great painter because he started a "brave" revolution in the art world, whether or not his paintings themselves are actually pleasing to the eye. The corollary to movie songs is that playback singing is perfectly natural in India: to result in the most pleasing song, get the best person to do the job. Playback singers are often bigger stars than actresses: over the decades, actresses may come and actresses may go, but Lata Mangeshkar goes on forever. :-) In Hollywood playback singing is considered "cheating"; the actress is "supposed" to do the singing herself and show off her skill. Audrey Hepburn did not get even an Oscar nomination for her classic performance in _My Fair Lady_ — was it because there was resentment at her "stealing" the role from Julie Andrews (who was given the Oscar that year for another film!), or because her songs were dubbed?]

Then there are other possible reasons for the trends you noticed:

* Duets were common, when showing intimacy in Bollywood films would risk disapproval both by the censor board and the “family audience” (though each member of the family probably wouldn’t mind if watching alone :p). A song could be just an expression of love, with details perhaps “suggested” by the song but left to the viewers’ imagination and sensitivity. Those taboos are gone. The censor board doesn’t care so much now, and ever since (say) Dil Chahta Hai, film-makers realise they can afford to make money with films that appeal only to urban multiplex audiences, ignoring conservative/family audiences. Duets are less “necessary”; an actual onscreen act of intimacy may have more impact than a song.

* Popular music in India used to be (in terms of cassette sales etc.) almost exclusively film music. Now that films need not (or cannot) be in charge of providing all the country’s music needs, they have slightly less of an incentive to make “context-free” music that is “reusable” outside the film (radio and TV airplay, cassettes and CDs, etc.) and feel free to inject plot into the songs. (Not that this happens; most songs lyrics still have near-universal applicability, even if the video pursues the plot.) Also, with soundtracks of films being released separately, we can have dialogue onscreen but still not in the song, and we have songs produced for the film sountrack that aren’t even present in the film (perhaps because they couldn’t be worked into the plot). (I wonder why this didn’t happen earlier, though.)

See this article (whether or not you like Kuch Kuch Hota Hai):
“HOW TO WATCH A HINDI FILM: The Example of Kuch Kuch Hota Hai” by Sam Joshi.
Not the best on the topic, but gives a general idea of aesthetic theory.

You can see unrelated complaints about Bollywood’s new generation of inauthentic wannabe-Hollywood movies here, for instance.
And apparently the book by greatbong.net also complains about “the new internationalised wannabe Bollywood, a world of burgers, fries, Coke, tank-tops and faux-accented American English.”
(Added later: Also see the beginning of this post.)

Though mere imitation-Hollywood is pointless and unbearable (what with rapper costumes and all that), I do think it’s good that Bollywood is moving towards more realism, less melodrama, etc.
But one can’t help feeling that something innocent has been lost. :-)

Written by S

Sun, 2010-10-03 at 14:39:38 +05:30

Mastermind

with 6 comments

Surely the most brilliant sketch ever, if not the funniest:

It’s from the BBC show The Two Ronnies, by Ronnie Barker and Ronnie Corbett. It’s probably their most famous sketch after Four Candles.
Read the rest of this entry »

Written by S

Sun, 2010-02-07 at 18:51:26 +05:30

Posted in entertainment, Uncategorized

Tagged with , ,

Extreme image compression: the Twitter challenge

with 3 comments

If a picture is worth a 1000 words, how much of a picture can you fit in 140 characters?

Mario Klingemann (Quasimondo on Flickr) had a fascinating — call it crazy if you like — idea: can you encode an image such that it can be sent as a single Twitter message (“tweet”)? Twitter allows 140 characters, which seems like nothing. It’s pretty much guaranteed that you’ll be able to get nothing meaningful out of so few bits, right?

Well, he came up with this, using a bunch of clever tricks: using the full Unicode range for “characters” (Chinese, etc.) to squeeze a few more bits’ worth, representing colours as blends of just 8 colours (3 bits!), and arriving at a Voronoi triangulation through a genetic algorithm:

© Quasimondo:Flickr/CC-BY-NC (210 bytes?)

“Mona Tweeta” © Quasimondo:Flickr/CC-BY-NC (210 bytes?)

The one on the right is the real Mona Lisa, and the left one is what fits in 140 characters, specifically the message: “圑嘌婂搒孵怤實恄幖戰怴搝愩娻屗奊唀唭嚟帧啜徠山峔巰喜圂嗊埯廇嗕患嚵幇墥彫壛嶂壋悟声喿墰廚埽崙嫖嘵奰恛嬂啷婕媸姴嚥娐嗪嫤圣峈嬻尤囮愰啴屽嶍屽嶰寂喿嶐唥帑尸庠啞彐啯廂喪帄嗆怠嗙开唅恰唦慼啥憛幮悐喆悠喚忐嗳惐唔戠啹媊婼捐啸抃岖嗅怲幀嗈拀唹坭嵄彠喺悠單囏庰抂唋岰媮岬夣宐彋媀恦啼彐壔姩宔嬀”

This is pretty impressive, you’d think, for 140 characters. But it gets better. Brian Campbell started a contest on Stack Overflow, and some brilliant approaches turned up.

Boojum wrote a nanocrunch.cpp, based on fractal compression, which can do this (on the left is the original, for comparsion):

Boojum-origby Boojum [490 bytes] by Boojum (490 bytes)

Sam Hocevar wrote img2twit, which segments the image into square cells and tries to randomly assign points and colours to them until something is close. It can do this:

img2twit-origimg2twit-dec
img2twit by Sam Hocevar (250 bytes?)
You can watch a movie of the image evolving; it’s pretty cool!

There were also attempts at converting the image to a vector format and encoding that instead. Needless to say, it works well for vector-like images:
so-logoso-logo-decoded (almost perfect!)

but it’s hard to even convert some images to vector form:
autotrace by autotrace (before compression!)

Finally, this is how Dennis Lee’s record-holding “optimizing general-purpose losy image codec” DLI does:

DLI-comp

Comparison: JPEG at 536 bytes, img2twit at 534 bytes, DLI at 534 bytes

Or if you want to be fair and compare at 250 bytes, here’s img2twit and DLI:

img2twit at ~250 bytes, DLI at 243 bytes

img2twit at ~250 bytes, DLI at 243 bytes

Amazing!

For silly amusement, you can read a liberal translation of the original message, or the Reddit thread with ASCII porn.

Disclaimer: I did not participate in any of this, and I know nothing about image compression, so no doubt there are errors in the above. Please point them out. All images are copyright the respective owners, and the quote in the first line is by Brian Campbell on Stack Overflow.

Written by S

Sun, 2009-05-31 at 13:37:44 +05:30

Dan Brown parody

with 8 comments

Dan Brown is a hilariously bad writer. The Da Vinci Code was an outrageously successful book.
So it was only inevitable that in addition to all the delicious criticism of Dan Brown’s writing,1 there would also be a number of parodies of his books published, and indeed there have been several.2 While looking for something in the library, I found The Da Vinci Cod: A Fishy Parody by “Don Brine” (real name Adam Roberts) and quickly proceeded to borrow it and read it. It was a good two hours spent, which is more than can be said for Dan Brown’s books themselves. Although the author is a professor of literature at London University, the book manages to remain true to the awful writing and plot of the original. I heartily recommend reading the book if you come across it; for a taste of what it’s like, some excerpts follow. You can also see parts of the book at Google Books.
Read the rest of this entry »

Written by S

Sun, 2008-12-28 at 23:45:27 +05:30

Pop culture potpourri

leave a comment »

More procrastination material.

Snape’s on a plane!

Read the rest of this entry »

Written by S

Mon, 2007-12-03 at 18:01:54 +05:30

Posted in entertainment

Tagged with , ,

Playful Pixar

with one comment

Pixar’s 4-minute short film Red’s Dream (1987) has credits at the end that roll by inconspicuously, but if you take a second glance at the disclaimers, you’ll find they actually say:

All characters and events are fictitious. Any resemblance to actual persons or appliances, living or dead, is purely coincidental. The FBI investigates crimes. Mark Leather wrote a paint system but his name is really here just to impress girls. No portion of this movie, including the soundtrack, may be reproduced in any manner. Always wear a helmet.

Their 1988 short Tin Toy says:

Any resemblance to actual toys or children is unintentional. To open, press down while turning cap. Pixar and RenderMan are registered trademarks of Pixar. Seatbelts save lives. No portion of this movie, including its sound track, may be reproduced in any manner or we won’t be your friends anymore. This bag is not a toy. Keep out of reach of children.

It also has a “Babies John looked at a lot” section in the credits.
Several of the movies seem to have a “very very special thanks to Steve Jobs” and the like…

Written by S

Sun, 2007-11-25 at 00:30:53 +05:30

Posted in entertainment

Tagged with , ,

Films I saw

with 3 comments

Some cleanup…

Here’s the LSC schedule.

Grindhouse: Planet Terror isn’t exceptionally good (but yeah, I seem to pick up on the zombie film culture by watching parodies of it, like Shaun of the Dead, first). Death Proof should not be watched as part of Grindhouse. See it independently — the full version basically has a lot more girl talk, but that’s what makes Tarantino special, anyway. Builds up pace better.

Knocked Up: Pretty ok.

Hot Fuzz: Heh. I had already seen this before and still went to see it. From the makers of Shaun of the Dead, comes an action film.

Paris, Je T’aime: I really do love Paris. The film is rather uneven, etc… I think I’ve written about this already in another post.

Ocean’s Thirteen: Awful. Even compared to Eleven. The sequels just keep getting more smug, not actually better.

The Lives of Others: Very very good. Please watch.

Read the rest of this entry »

Written by S

Sun, 2007-11-04 at 01:41:09 +05:30

Posted in entertainment

Tagged with ,

Film I saw

with 3 comments

The LSC plays movies every weekend, to which I get free admission, and I usually watch all the films, no matter how bad I expect them to be :-)

Yesterday I saw 1408. It is a horror film based on a Stephen King short story. (It is about room 1408 of the Dolphin Hotel, where…)

The movie isn’t bad at all. It even has a happy ending. (The director’s cut apparently doesn’t.)

I saw a poster that said it

ranks with The Shining as one of the best Stephen King adaptations ever.

Obviously, the guy forgot about The Shawshank Redemption.

One might argue that Shawshank wasn’t a horror movie, but then again, neither was The Shining.
Really: Watch the trailer, it’s hilarious:
[Created by Robert Ryang. A contest-winning entry.]
Read the rest of this entry »

Written by S

Mon, 2007-10-22 at 04:30:59 +05:30

Film I saw

leave a comment »

Yesterday I saw A Mighty Heart. It is about Daniel Pearl, the American journalist who was kidnapped in Pakistan. Angelina Jolie plays his wife. It’s hard to make a good film where everyone already knows the ending, but it’s a pretty good attempt. Everything looks authentic. (Although the outdoor shots were shot in Karachi, the indoor shots — including everything involving Jolie — were in Pune.)If you pay attention, you can find the scene where the police carry out a raid and confiscate the “computer” — a monitor.Jolie did a good job, I thought. Moving film.

Written by S

Sun, 2007-10-14 at 03:26:27 +05:30

Posted in entertainment

Tagged with , ,

Al Gore has NOT joined George Bernard Shaw

leave a comment »

I want to be pedantic here.

George Bernard Shaw used to be the only person to have both a Nobel (Literature) and an Oscar (Screenplay). Now Al Gore, who had earlier allegedly won an Oscar (Best Documentary), has won a Nobel (Peace). And unlike Shaw, he’s won an Emmy as well. And been vice-president, and almost-president.

An impressive list of achievements, no doubt, but the first part isn’t true: Al Gore didn’t personally win an Oscar; the film featuring him did (it won two, actually). The director called him on stage during the acceptance speech and Gore even spoke; that’s probably the reason for the confusion.
Full details:

  • The 2006 Academy Award for Documentary Feature was awarded to “An Inconvenient Truth directed by Davis Guggenheim”.
  • The 2007 Outstanding Creative Achievement in Interactive Television Primetime Emmy Award was Awarded to Current TV
  • “The Nobel Peace Prize for 2007 is to be shared, in two equal parts, between the Intergovernmental Panel on Climate Change (IPCC) and Albert Arnold (Al) Gore Jr. for their efforts to build up and disseminate greater knowledge about man-made climate change, and to lay the foundations for the measures that are needed to counteract such change.”

(BTW: An Inconvenient Truth also won the Academy Award for Best Original Song: “I Need to Wake Up” – An Inconvenient Truth Music and lyrics: Melissa Etheridge. Apparently, it is the first documentary to win 2 Oscars, and the first to win a best original song Oscar.)

As for Shaw:

  • The 1925 Nobel Prize in Literature was awarded to George Bernard Shaw “for his work which is marked by both idealism and humanity, its stimulating satire often being infused with a singular poetic beauty.”
  • The 1938 Academy Award for Writing Adapted Screenplay was awarded to Pygmalion – Ian Dalrymple, Cecil Lewis, W.P. Lipscomb, George Bernard Shaw from the play by George Bernard Shaw.

Note that this is a 1938 film, not My Fair Lady. (That one was nominated in 1964 but didn’t win, and Shaw was dead by then and had nothing to do with the film. He had forbidden any of his plays from becoming musicals, so the musical My Fair Lady could be made in 1956 only after he had died in 1950.)

Written by S

Fri, 2007-10-12 at 20:58:35 +05:30

Canon

leave a comment »

“No Woman, No Cry” by Bob Marley
“Sk8ter boy” by Avril Lavigne
“Torn” by Natalie Imbruglia
“With or without you” by U2

They all have Pachelbel’s Canon in them?

From watching (Rob Paravonian’s Pachelbel rant.

Written by S

Mon, 2007-10-08 at 23:10:15 +05:30

Why was there so many sick animals in Vietnam?

leave a comment »

Ali G interviews a veterinarian:

Ali G is incredible. More videos:

Read the rest of this entry »

Written by S

Mon, 2007-10-08 at 22:44:03 +05:30

Oui, vivant

leave a comment »

Paris, je t’aime

Apparently, the Faubourg Saint-Denis segment (the one with Natalie Portman) was shot very quickly, and even used to recruit other directors to the project. Written and directed by Tom Tykwer. Must remember the name. He made Lola Rennt. The actor in the segment is blind in real-life too. (The movie here, but don’t watch it unless you are able to turn the volume up enough…)

I was actually considering visiting the Pere Lachaise cemetery in Paris when I was there (the segment with Oscar Wilde’s grave). Apparently the entire cemetery has been vandalised by Jim Morrison fans. Of all the great people buried there, …

Apparently the reason I understand so much of the French of the woman in the last segment is not because she is speaking slowly, but because she isn’t speaking proper French.

Now, Wikipedia says

Initially 20 topics representing the 20 arrondissements of Paris were planned but two of them (the XVe arrondissement directed by Christoffer Boe and the XIe arrondissement by Raphaël Nadjari) were not included in the film because they could not be properly integrated into the movie.

which seems absurd. I cannot imagine how the segment with the beauty products salesman in Chinatown integrates with the rest of the movie — or with anything else in the world. WTF was that?

The film also has Juliette Binoche (from Trois Couleurs: Bleu).

iTunes says my play count of We’re all in the dance is 15. Oh well… this happens to me very frequently after I see a film — I remember playing Requiem For a Dream on a loop for nearly an entire day. BTW Feist’s 1234 is featured in the new Apple iPod Nano ad (TODO: fix this link when it gets broken.) And I didn’t think it had both French and English just because I couldn’t catch some English parts, it really had both.

Written by S

Thu, 2007-09-20 at 19:19:17 +05:30

Optical illusions

leave a comment »

The Best Visual Illusion of the Year Contest. The 2007 winner… simplicity.

Written by S

Mon, 2007-08-20 at 13:53:29 +05:30

Posted in entertainment

“On the internet, nobody knows you’re a dog”

leave a comment »

The popular phrase, and an article about it. The image can be found easily, here for example.

Written by S

Thu, 2007-07-26 at 09:55:07 +05:30

Posted in entertainment

Tagged with , ,

Harry Potter editions across the pond

leave a comment »

Ugh. But whatever.

The US editions have always had more pages.

The actual differences (wow!) couldn’t possibly contribute anything significant to that difference, either way.

Apparently it’s because they use a bigger font, more whitespace, and have a picture at the beginning of every chapter. (?!)

A source here (Yahoo answers), complete with embarrassingly stupid answers.

Other sources are here and here (same thing), and other possible reasons (generally speaking) include these.

There, now I can close those tabs…

Written by S

Mon, 2007-07-16 at 20:43:44 +05:30

Posted in entertainment

Tagged with

Short movies

with one comment

There’s Movies in Fifteen Minutes by Cleolinda Jones. Writes awesomely, sometimes. Knows stuff. Has written a book. My favourite is Troy, although lots of them are good, Prisoner of Azkaban for example.

There’s Movie-A-Minute, which has ultra-condensed versions of the movies.

There’s Movies in 30 seconds enacted by bunnies. Which are great!

There’s movies in 5 seconds on Youtube, which consist of frames from the actual movie…

There’s also The Reduced Shakespeare Company, which has done things like the Star Wars movies old and new.

Written by S

Mon, 2007-03-19 at 15:13:49 +05:30

Posted in entertainment, funny

Follow

Get every new post delivered to your Inbox.

Join 67 other followers