Thursday, June 16, 2011

Hardest Trivia Questions Ever: Part 3

The third in our series (Part1 and Part 2 are still available) aims for quality over quantity. I'm hand editing all of these now. If you haven't read the others, each question is formulated based on an entry from the "Did you know" section of Wikipedia.

Q: ____ of the 10th Parachute Battalion was awarded a posthumous Victoria Cross for his actions during the Battle of Arnhem?
A: Captain Lionel Queripel

Q: Rogier van der Weyden's painting (c. 1435, pictured) may contain a self-portrait of the artist as Saint Luke, displaying his affinity with the patron saint of the arts?
A: Saint Luke Drawing the Virgin

Q: anti-communist activist ____ pledged to shave his well-known Solzhenitsyn beard if Moldova united with Romania?
A: Gheorghe Briceag

Q: Iñigo Ed. Regalado wrote the novel ____ in 1921 when adultery was a sensitive topic in Philippine literature?
A: May Pagsinta'y Walang Puso



Q: the ____ (pictured) is the tallest dam in Austria?
A: Kölnbrein Dam

Q: ____ was given a diamond ring as reward for being Bonnie Prince Charlie's food taster?
A: Samuel Ward

Q: Saint John Sea Dogs defenceman ____ continued to play for the ice hockey team even after they fired his father as head coach?
A: Nathan Beaulieu

Q: many Buddhist temples in Japan have a hidden ____?
A: roof

Q: the Sultan of Johor's Oxford-educated wife, ____, earned her degree in Chinese studies and advocates the use of English in Malaysia?
A: Raja Zarith Sofia

Q: Temple Owls men's basketball player ____ has been called "Pepe Sanchez with a jump shot"?
A: Juan Fernandez

Q: ____ served the longest term as mayor of Albania's capital Tirana in the pre-WWII era?
A: Ismail Ndroqi


Q: blues legend ____ made his broadcast debut playing live gospel music on WGRM in Greenwood, Mississippi?
A: B.B. King

Q: the Hymn to Enlil is part of a sequence of Sumerian scribal training scripts called the ____?
A: Decad

Q: the 1562 Danish-Russian Treaty of ____ has been called a milestone in European history?
A: Mozhaysk

Q: ____ was appointed as vice president candidate for the Ricardo Alfonsín ticket for the 2011 Argentine general election?
A: Javier González Fraga

Q: Emily and Anne Brontë's ____ was an early form of science fiction?
A: Gondal

Q: ____ earned a PhD in Belarusian literature before becoming the vice president of the International Federation for Human Rights?
A: Ales Bialatski


Q: in Bach's cantata for Pentecost Monday, ____, a verse from the meeting of Jesus and Nicodemus (pictured) is paraphrased in a unique duet, illustrating the theme exaltation?
A: Erhöhtes Fleisch und Blut, BWV 173

Q: the Californian commune ____ was founded using money from both entertainment industry executives and from an LSD deal?
A: Black Bear Ranch

Monday, June 13, 2011

Android roadbumps

As some of my readers know, I'm writing Android apps. It's been slow. The Java learning curve is actually fairly steep (at least as compared with high level languages I've been working in like Perl, Python and so forth). Just to give you a taste of what you have to look forward to if you want to do some Android development, here's what I've been fighting with today.

First, I had a really silly problem. I had a list and I'd defined a callback called onItemSelect for it. I set a breakpoint in this method and ran the app under the emulator. Click. Click. Click... nothing. I kept going over the code and trying to figure out how this could happen. Click. Nothing. Damn!

So then I was just messing around in the emulator and accidentally hit the scroll wheel. Bang! My callback is invoked! After scratching my head for a second, I had a brain storm. I checked to see if there was an onItemClick callback, and indeed there is! What onItemSelect does is apparently handle selecting, but not clicking on an item. What I'm not sure of is how you could manage to select an item without clicking on it outside of the emulator... honestly, I can't figure out of this is even useful. Maybe if you used the D-pad to navigate a list...

Then, I was trying to write a class that handles a download for me. It needed to take two parameters that represent callbacks. Now, Java is kind of neurotic about insisting that there's no such thing as a function, so when you want to do something that's clearly functional like passing around a callback, you have to do it in terms of an object oriented behavior like sub-classing. I can't begin to explain how horribly wasteful this is in terms of coding and efficiency, but let's just get past that. Here's what I tried to write:

Class file A.java:

import B;
class A {
  public void registerCallbacks() {
    B.new(new B.OkCallback() {
      @Override
      public void callback(String result) {
        // do stuff with result
      }
    },
    new B.FailCallback() {
      @Override
      public void callback(String message) {
        // deal with failure represented by message
      }
    }).execute();
  }

And in B:

  class B {
    public void execute() {
      // do stuff
    }
    public abstract class OkCallback {
      public abstract void callback(String);
    }
    public abstract class FailedCallback {
      public abstract void callback(String);
    }

Ignoring the obvious duplication (since it wasn't that simple in my real code), there's only one error, but it's a really hard thing to find if you're new to Java: "static" is required on the definition of both abstract classes. I'm not entirely sure why you would ever define a non-static, abstract, nested class, but I guess there's some application for declaring child classes... still, it seems like this kind of runaway syntax is just absurd. To give you an example, let's look at a hybrid functional/OO language like python:

  from B import B


  def handleResult(result):
    # do something with result
  def handleFailure(message):
    # do something with failure message
  class A(object):
    def registerCallbacks(self):
      B.registerCallbacks(handleResult, handleFailure).execute()

Python file B.py:

  class B(object):
    def execute():
      # do stuff...

Notice that, not only is the code simpler, but the extra layers of object-creation, subclassing and all of that noise are gone from the call stack. You pass a function to B and it invokes it when needed, with the appropriate parameters.

Even in Perl, functions can be passed as subroutine references and invoked by the caller. In C and C++, function pointers aren't the same thing at all, but for simple callbacks, they work well enough.

Java is fundamentally flawed in this way, and I'm hoping that they crank out a version 8 or whatever, wherein they finally give up and allow real functional programming.

Saturday, June 11, 2011

Tracy Morgan's Rant

In case you're not aware, here's what happened: Tracy Morgan did a standup routine where he said some ugly things about homosexuals in Tennessee. His comments included referring to homosexuals as God's "mistakes" and saying that he'd stab his son if he came out of the closet.

So, now the Intertubes are abuzz with pro- and anti-Tracy Morgan rants. The ones that seem to be gaining the most traction are from Roland S. Martin, a CNN analyst, who supported Morgan; and then there's Wanda Sykes, a fellow African-American comedian who is also a lesbian, and disagreed strongly with Martin, engaging him in an informal debate on twitter.

A few points before I weigh in:

  • Lots of folks want to talk about Morgan's right to say what he likes. This is kind of absurd. Whether you feel he should or should not have included the material in his routine, it's pretty clear that there are lines we don't cross without consequences. I don't think anyone seriously thinks Morgan doesn't have the right to say these things, but many believe that the public should be outraged by them.
  • Martin's defense has some interesting rabbit holes in it. He uses Carlin as a defense, since Carlin had a routine about the word, "nigger." A worse comparison could not possibly be drawn, of course. Carlin was a wordsmith of the highest order whose satire changed the way a nation viewed their own language. Morgan isn't satirizing the gay and lesbian community, he's being crude and insensitive because it might get a laugh.
I imagine that it's pretty clear what I think of Morgan's comments. What might not be so clear is why I'm posting this in his defense. Morgan is a comedian. I happen to think he's not a very good one, but that's not relevant. A comedian's job is to push us right up to the edge of what we're willing to accept in a social context, make us uncomfortable and then play with our sense of balance. Morgan shoved his audience over the edge, and that was a mistake. He apologized for making that mistake. It's a professional hazard, but if he doesn't make the mistake again, it's in the gay and lesbian community's best interest to demonstrate restraint and graciousness in this situation.

I would like Morgan to say something about the impact his comments might have on young men and women who are closeted. His words may well have hurt them more than he can imagine, and issuing a heartfelt apology to them would go a long way. Hell, if he really wanted to turn this around, now might be a great time for him to do his own "It Gets Better" video...

So, while I think Martin's evaluation of the situation was poorly thought out, and while I do agree with those that called for (and got) his apology, I'm not sure why people are going overboard, here. Morgan isn't a politician or a reporter, he's a comedian. That doesn't get him out of having to apologize when he crosses the line, but I think it affords him an easier acceptance of that apology.

Wednesday, June 8, 2011

Film rating and review in the US and UK

I've been listening to Mark Kermode's film reviews for a few years now, and one of the things that I find really fascinating is the British perspective on ratings and review of films. In the U.S. the MPAA has a relatively secretive process by which films are reviewed, and that process has come under fire for decades now as being too lax in many areas and overly restrictive in others. I never really thought there was much wrong with the MPAA until I saw how the British system worked. Now I wonder how we became so entrenched with what is clearly a second-rate system.

Here's how their system works: The British Board of Film Classification (BBFC) is an independent organization which represents the film industry, somewhat like the MPAA. However, they publish general details of the selection criteria and general makeup of their "examiners" staff and have an extensive library of reviews which go into extreme detail on each of their decisions. Parents who want to determine if a film is suitable for a child can easily scan these detailed descriptions and come to their own conclusions based on their own values. This also gives the average moviegoer and citizen the opportunity to see how a film was judged and what criteria are being used to assign ratings. If a film receives a restrictive rating that moviegoers think was incorrect, they can provide detailed feedback to the BBFC, responding point-by-point to the ruling. Another interesting difference between the MPAA and the BBFC is that the MPAA is a film industry lobby and engages in a number of anti-piracy efforts. They are supported by their industry members. The BBFC, on the other hand, is a ratings board only, and are supported by the fees they charge to review films which are based on running time (and thus the amount of their time spent watching the film).

Let's look at an example. If I go to the MPAA's Web site, and select "Find a Film Rating" I'm sent to "FilmRatings.com" a Web site which the MPAA runs, which says the following about linking to their site, "You may not link to any portion of the Site from any other web site without first obtaining the specific written permission of the MPAA, which permission may be withheld in the MPAA's sole and absolute discretion." You can find that on the site's terms of use page. The site is entirely Shockwave Flash, and does not allow the selection or copying of text. If you search for "Thor" you see several titles, including the recent "Thor (2011)" which has next to it, "Rated PG-13 for sequences of intense sci-fi action and violence." That's it. There's no other details on the review process. If you click on the title, you're taken to the IMDB, a commercial site run by Amazon.com which lists the film-makers and sometimes lists plot details, but more often than not, these details are not focused on potentially objectionable content and may be blank until a film is officially released or longer.

By contrast, the BBFC has a plain old, standard HTML page which has no linking restrictions and which allows copy-and-paste just like any other normal Web page. They have an entry for Thor 3D and Thor 2D. I selected Thor 3D. At first, you are only given a simple, "Contains moderate fantasy violence" but there is a link with a disclaimer that tells you that clicking the link will show the full review with potential spoilers for the film. That extended review, which I include here only for comparison, and with any spoilers edited out, is as follows:

THOR is a fantasy action film based on the Marvel Comics superhero. Thor is a powerful but arrogant warrior and heir to the throne of Asgard. However, his reckless actions spoiler and he is spoiler. This gives spoiler, an opportunity to spoiler. The film was classified '12A' for moderate fantasy violence.


The BBFC's Guidelines at '12A'/'12' state 'Moderate violence is allowed but should not dwell on detail. There should be no emphasis on injuries or blood, but occasional gory moments may be permitted if justified by the context'. The film includes several scenes of moderate violence, including kicks, punches, and a couple of headbutts. However, the violence is generally fantastical in nature and most commonly involves either superheros or non-human characters (eg the spoiler). The only fight scene of note that is set in the real world occurs when spoiler. The blows delivered are quite heavy, featuring crunchy sound effects, but there is no discernible blood or injury detail. Sight of impacts is hidden and the action is extremely rapid, with the emphasis firmly on Thor's attempts to spoiler. Earlier in the film, there is a fight scene between spoiler, during which spoiler is stabbed spoiler. The end of the spoiler, which is covered in blood, emerges from spoiler's back, after which spoiler is carried off by spoiler. However, spoiler recovers quickly and this brief moment of bloody detail occurs within a clearly fantastical context. The film has a generally light-hearted tone throughout and this helps to diminish the impact of the violence.


THOR also includes scenes of moderate threat. Spoiler are potentially scary and intimidating. However, the threatening sequences, which are neither frequent nor sustained, are broken up by other material, including comic interludes. The film also contains some very mild language, including the terms 'dumbass', 'God' and 'hell'.

From that, I could imagine many parents deciding that they thought the film was unacceptable for their children, while many others would decide the exact opposite. The point is that they would have that choice.

In a perfect world, I'd like to see the MPAA bring BBFC-style transparency to their process and provide:
  • A stand-alone group which is funded by fees charged to review films
  • Hiring guidelines for reviewers and other staff
  • Demographic and industry background information about reviewers (in general terms, not per-reviewer)
  • A freely quotable list of their reviews with a reasonable terms of use policy
  • Complete details of reviews that allow parents and others to make their own decisions
I don't think any of that is pie-in-the-sky thinking, and if the MPAA can't manage to make such changes, then perhaps it's time to pass the torch to a less industry-insider-controlled body.

It's not a ratings board's job to come up with decisions that everyone will agree with. That's impossible. Instead, it should be their job to provide the public with enough information on which to make an informed decision about what constitutes appropriate entertainment for themselves and those for whom they are responsible. The BBFC may have its faults, but it does essentially that. The MPAA does not.

References:

Sunday, May 29, 2011

Netflix and Amazon instant indie films: my top picks

I keep stumbling on great indie films on Netflix and Amazon's video on demand services, and though I've mentioned a few of them here before, I think it's worth recapping the best of the last few years:

Monsters
Netflix: Instant Queue
Amazon: VoD Rent, Buy

Monsters is hard to pin down, and it's definitely the sort of film which many will be disappointed with because they walk in with the wrong expectations. Let's clear it up right away: there are giant, alien monsters in this movie, but it's not a giant monster movie. Ultimately, it's closer to a wartime travelogue than anything else. Our heroes are trapped in Central America some time after Mexico and parts of Central America are overrun by an alien infestation, accidentally returned from space by a NASA probe. The aliens appear briefly from time to time, but for the most part are just there to provide the motive force that keeps our heroes moving. The question the film silently asks is: who are the monsters and to whom? An excellent movie I'm happy to recommend.

(more after the break)

Friday, May 20, 2011

Building an Android App Development Workstation

I've recently started doing Android App development. It's actually not trivial to get started, and I hit a number of difficult roadblocks along the way. I started off by thinking long and hard about OS. I'm a Linux guy at heart, and Android is Linux-based, so a Linux system seemed the right choice, but I didn't want to have to have two desktops, and in my spare time I also play Windows-based games, so in the end I decided on Windows with a Linux virtual machine.

Next up was my choice of hardware. I already have a good keyboard, mouse and display, so I only needed the box. Along the left, I've linked the Titanium Gamer AMTI7013 which is roughly the same hardware that I bought (though I got mine at MicroCenter). This has the Sandy Bridge-based i5 2500K. The system I picked up had more RAM, so you might want to explore picking up some extra if you buy that box.

My primary performance concern was the Android emulator. It's slow and greedy, so I wanted plenty of RAM and at least 2 if not 4 cores so that it would be guaranteed plenty of dedicated instruction pipeline.

Having picked the hardware, I needed software. It's amazing how much software you have to install to get going. I started with the Android Development Tools (ADT) installation guide. But in the end, I had to install all of this (I'll describe this for the Windows setup, since I'm not running the emulator under Linux):

Optional components that I found useful included:

A few tips on getting things installed: make sure that you create a new directory that's separate from everything else (I made it C:\Dev) to put all of the downloaded items in. It's important that you not place Eclipse into existing system areas, since it doesn't always play nicely with the Windows file protection model.

Some notes about your app. You're going to need to sign it eventually, so you might as well get that out of the way when you're still in the "hello world" stage of development. To save a signed APK, just right-click on the top-level project name under the "Package Explorer" in Eclipse and select "Android Tools -> Export signed application package..." Once you've done this, you can use that key that you created for lots of useful purposes, not the least of which is to interact with Google APIs for services like Calendar and Maps. For example, there's a document that Goolge provides on extracting the md5 signature of the key and using it for access to the Maps API. To do that, you'll need the keytool program that came with Java SE, and can be found in that package's "bin" directory.

I'll continue to post more as I learn and get my first application up on the app market. Enjoy!

Tuesday, April 26, 2011

ASUS Wireless-N Router and Repeater

I just bought this handy little device, and I couldn't be happier. I've bought D-Link and Linksys in the past, and they've always managed to introduce some annoying complexity that I shouldn't have to deal with. But the ASUS was plug-and-play. I'm using it as a repeater and as a bridged physical switch. I plugged it in, turned it on, pressed the red button on the back and the corresponding button on my primary router, and then plugged my TiVo into the back. Boom, all set.

My signal strength on my Droid is now much better when I'm on the second floor, and Netflix has stopped stuttering. All is well with the world.

A shout-out to the Micro Center sales guy that pointed me at this device. You made my day.