Archive for the ‘entertainment’ Category
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:
- [May 2013] The Saddest Moment
- [July 2013] Mobile Computing Research Is a Hornet’s Nest of Deception and Chicanery
- [September 2013] The Slow Winter
- [November 2013] The Night Watch
- [January 2014] This World of Ours
- [March 2014] To Wash It All Away
Reading these is an epiphany akin to one’s first encounter with Dave Barry or Airplane!
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.
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
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 ). 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 != s and s != 'F' and s != '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 == s ... >>> 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 ... 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)] ... 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[d] == 'F': ... print d, g, poss ... 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.
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 ... 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.
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).
[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.
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
> 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
> * 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.?
(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. :-)
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:
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.
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:
Finally, this is how Dennis Lee’s record-holding “optimizing general-purpose losy image codec” DLI does:
Or if you want to be fair and compare at 250 bytes, here’s img2twit and DLI:
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.
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 »