Tuesday, 12 December 2017

Web Tutorial: Christmas-themed LESS Demo (Part 1/4)

Hey, guys.

Christmas won't be here for another couple weeks, but this tutorial is a four-parter. Not only are we going to be using HTML, CSS and (very minimal) JavaScript, we will be using LESS.

Here's some reading about LESS. (http://lesscss.org/)

We're using LESS for this case because it's more maintainable. You'll see what I mean in due course. For this, you'll also need a pre-processor to convert the LESS file into CSS. Me, I'm just running it through my Apache server. There are other, perfectly valid alternatives, so feel free to use them.

What are we making?

It's a Christmas webpage that will change in appearance and layout depending on the option you select. We will be making three different themes - Red, Green and Blue, in keeping with the RGB color system.

Setup

First, let's get your setup right. This is how it should look like, with a HTML file, index.html in the main directory and thee sub-directories: img, css and js.


In the css directory, create a file named styles.less.

In the img directory, I've placed a few images. You can pick them up here.

In the js directory, you need the less.min.js file. This one may be picked up here.

Today, you will be working only with index.html and styles.less.

Getting started

Here's some HTML. Here, we have a link to the stylesheet styes.less and the JavaScript file, less.min.js.

index.html
<!DOCTYPE html>
<html>
    <head>
        <title>Xmas 2017</title>
        <link rel="stylesheet/less" type="text/css" href="css/styles.less" />

        <script src="js/less.min.js"></script>

        <script>

        </script>
    </head>
   
    <body>

    </body>
</html>


Since we're going to be dealing with three different themes, we need to ensure that the HTML and body are prepped. This won't have any visible effect on the page, not yet at least. But we'll set the padding and margin properties to zero so that they'll work better across browsers. The HTML and body's height are set to 100% of the screen height, and we set a default font size of 14 pixels.

styles.less
html, body
{
    height:100%;
    padding:0px;
    margin:0px;
    font-size:14px;
}


Now, we'll need to hit the ground running, fast. This page will be subject to many on-the-fly CSS changes, so it's important that we structure it well. Make it robust. That may mean a lot of inner and outer divs. In fact, we'll start with one big outer div with a class of container. Within are three other divs, one for your header, one for your body and one for our footer. They're all styled using appropriate CSS class names, and we will add those classes later.

index.html
<!DOCTYPE html>
<html>
    <head>
        <title>Xmas 2017</title>
        <link rel="stylesheet/less" type="text/css" href="css/styles.less" />

        <script src="js/less.min.js"></script>

        <script>

        </script>
    </head>

    <body>
        <div class="container">
            <div class="header_wrapper">

            </div>

            <div class="body_wrapper">

            </div>

            <div class="footer_wrapper">

            </div>
        </div>
    </body>
</html>


Within each of these, we'll have another div with a class of content_wrapper.

index.html
<!DOCTYPE html>
<html>
        <div class="container">
            <div class="header_wrapper">
                <div class="content_wrapper">

                </div>
            </div>

            <div class="body_wrapper">
                <div class="content_wrapper">

                </div>
            </div>

            <div class="footer_wrapper">
                <div class="content_wrapper">

                </div>
            </div>
        </div>


Now let's put some content in there. There will be more divs, each with an appropriately named CSS class.

index.html
<!DOCTYPE html>
<html>
        <div class="container">
            <div class="header_wrapper">
                <div class="content_wrapper">
                    <div class="header">
                        MERRY CHRISTMAS!
                    </div>
                </div>
            </div>

            <div class="body_wrapper">
                <div class="content_wrapper">
                    <div class="content1">

                    </div>

                    <div class="content2">

                    </div>

                    <div class="content3">

                    </div>
                </div>
            </div>

            <div class="footer_wrapper">
                <div class="content_wrapper">
                    <div class="footer">
                        This site was produced by <i>TeochewThunder</i> &copy; 2017. All rights reserved.
                    </div>
                </div>
            </div>
        </div>


That's what we have at the moment.


Now, let's put some content in the body. A random Christmas carol in the first div and some Lorem Ipsum text in the second. Leave the third one blank.

index.html
            <div class="body_wrapper">
                <div class="content_wrapper">
                    <div class="content1">
                        <p>
                        O come, all ye faithful,<br />
                        Joyful and triumphant,<br />
                        O come ye, O come ye to Bethlehem.<br />
                        Come and behold Him,<br />
                        Born the King of Angels!<br /><br />

                        O come, let us adore Him,<br />
                        O come, let us adore Him,<br />
                        O come, let us adore Him,<br />
                        Christ the Lord.
                        </p>

                        <p>
                        Sing, alleluia,<br />
                        All ye choirs of angels;<br />
                        O sing, all ye blissful ones of heav'n above.<br />
                        Glory to God<br />
                        In the highest glory!<br /><br />

                        O come, let us adore Him,<br />
                        O come, let us adore Him,<br />
                        O come, let us adore Him,<br />
                        Christ the Lord.
                        </p>

                        <p>
                        Yea, Lord, we greet Thee,<br />
                        Born this happy morning;<br />
                        Jesus, to Thee be the glory giv'n;<br />
                        Word of the Father,<br />
                        Now in the flesh appearing,<br /><br />

                        O come, let us adore Him,<br />
                        O come, let us adore Him,<br />
                        O come, let us adore Him,<br />
                        Christ the Lord.
                        </p>
                    </div>

                    <div class="content2">
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus porttitor nec lectus ac eleifend. Pellentesque egestas et eros sit amet porttitor. Cras finibus tristique justo, quis fringilla mauris pulvinar sit amet. Aliquam semper, leo ut ullamcorper porta, sem arcu auctor nulla, sed elementum ex massa vitae sapien. Aliquam sit amet vestibulum orci, ut convallis ante. In hac habitasse platea dictumst. Quisque lacinia gravida velit et tempus. Vestibulum et mi quis tortor ornare blandit vitae id tortor.
                    </div>

                    <div class="content3">

                    </div>
                </div>
            </div>


Yep, getting there.


For the footer, let's create a drop-down list which we'll use to select the theme.

index.html
            <div class="footer_wrapper">
                <div class="content_wrapper">
                    <div class="footer">
                        This site was produced by <i>TeochewThunder</i> &copy; 2017. All rights reserved.
                        <br />
                        Select Theme:
                        <select>
                            <option value="theme_red" selected>Red</option>
                            <option value="theme_green" >Green</option>
                            <option value="theme_blue">Blue</option>
                        </select>
                    </div>
                </div>
            </div>


Got all that?


This first part is a little short. But we're getting somewhere soon, promise!

Just one last thing...

Make this change to the HTML.

index.html
        <select onchange="change_css(this.value);">
            <option value="theme_red" selected>Red</option>
            <option value="theme_green" >Green</option>
            <option value="theme_blue">Blue</option>
        </select>


And then create the change_css() function in your JavaScript. In this case, we pass in the selected value of the drop-down list as an argument. The parameter is newcss. We grab the body tag using the getElementsByTagName() method. This returns an array of all elements that are named "body". There's of course, only one body tag, so just reference the first element and set the CSS class to newcss. This causes the body to be styled differently every time you select a different value from the drop-down list!

index.html
        <script>
            function change_css(newcss)
            {
                var body = document.getElementsByTagName("body");
                body[0].className = newcss;
            }
        </script>


However, since we haven't written any of the CSS classes, you will see no visible change right now...

Next

The first theme is coming up! Don't go away!

Thursday, 7 December 2017

Ten Absolutely Terrible Code Puns

Due to the nature of reserved words being used in code, sometimes puns get worked in between the lines. I'm just going to explore ten of them today, coming from different languages.

1. String 

Many of these are type declarations. This is a prime example in C++.


string bikini = "Hello world";

2. Char

Again in C++. This pun has mostly regional flavor.


 char kwayteow = '';


3. Double 

This one is a particular favorite. Due to the NSFW nature of the second example, I'm only gonna illustrate the first example.


double Ds = 0.0;
double penetration = 0.0;

4. Dim

This one is in QBasic.


DIM SUM = 0

5. Sub

Another QBasic example, rather convoluted.


SUB marine (torpedo)
    'code here
END SUB

6. Split 

The JavaScript split() method!


var banana = "The Quick Brown Fox Jumps Over The Lazy Dog";
var arr = banana.split(" ");

7. Throw 

JavaScript again!


var up = "Error";
throw up;

8. Catch 

JavaScript yet again.


try
{
    //code here
}

catch(cold)
{
    //code here
}

9. Die 

PHP's die() function can be a source of unintended comedy as well...


$hard = "Program terminated.";
die($hard);

10. SQL 

This almost should be a blogpost on its own!


SELECT COUNT(dracula) FROM transylvania;

Done cringing yet?

Pretty awful, eh? If they got any cheesier, we'd be making pizzas!

catch(youlater){}
T___T

Sunday, 3 December 2017

Film Review: Silicon Valley Season 1

Some time back, a friend recommended that I watch Silicon Valley. It took me a while to get off my arse, and boy was I blown away. This series, at least the first season, was excellent. As I write this, Silicon Valley has just completed its fourth season.


A lot of stuff in there is rip-roaring funny, and even the cringe-worthy moments are pretty amusing. If you're a techie, you'll get a lot of these references. Even if you're not, just watching the geeks mill around trying to get things to work, is a rewarding experience.

Warning - many spoilers, lots of motherfucking profanity and politically incorrect jokes

You think nerds don't swear? They do. In spades.

There might also be a couple nude scenes in there, none of which are particularly titillating unless man boobs is your thing.



Finally, the show tends to be very vulgar. You have been duly warned!

The Premise

The story revolves around a group of engineers who create a product, set up a company around it and attempt to take it to launch, chronicling the numerous obstacles and setbacks they encounter along the way. The season ends with a huge victory, but with foreshadowing of even more, This is just the beginning of their trials and tribulations.

This being the first season, and if my experiences with TV serials are any indication, this will be the simplest, most uncomplicated one.

The Characters

Thomas Middleditch as Richard Hendricks. The shy nerd with  beyond awkward social skills, who happens to be a brilliant programmer. Through Season 1, we see him transform to his more assertive self, especially in front of a computer console. Middleditch starts off not being very memorable in the role, but by the end of the season, he totally nails the character. To be fair, it's hard to be charismatic in a role that requires you not to be.

TJ Miller utterly hams it up as the obnoxious, crude and egoistical Erlich Bachman. I last saw Miller in Office Christmas Party and Deadpool. He's every bit as good here, in fact more so. He comes off as this unrepentant douchebag with a few redeeming personality traits here and there. Richard Hendricks may be the protagonist, but as a supporting character, Bachmann threatens to steal the show with every appearance. There are few things to come out of his mouth that aren't descriptively profane, side-splitting funny or scenery-chewing.

Zach Woods plays the anxious but gentle Jared Dunn. It's an understated performance and we never really get a handle on how important the character is to the team until the show focuses on the business side of things. That's where Woods shines, bringing his character's sharp administrative mind to the fore. As forWoods himself, I found that face vaguely familiar and a search of his filmography caused me to realize that I had seen him before in the opening scenes of the Ghostbusters remake.

Kumail Nanjiani is Dinesh Chugtai, the Pakistani programmer whose insecurity is stamped upon his puppy-dog eyes. The character interacts mostly with Gilfoyle, and their chemistry together is amazing. He also provides a perfect platform for some of the racial jokes in the show.

Martin Starr as Bertram Gilfoyle. Gilfoyle is this snarky nihilistic dude, and a Satanist. He's also the infrastructure guy of the team. He and Dinesh bicker constantly and it's riveting to watch. Martin Starr delivers his lines with deadpan deliciousness. You may have seen him in Spiderman: Homecoming.

Nelson "Big Head" Bighetti is played with just the right amount of dazed goofiness by Josh Brener. He adds a charming quirkiness to the show with his gee-shucks demeanor. The character is a slacker who does what he does for fun and isn't really serious about his job. He represents the laid-back geek stereotype.

The late Christopher Evan Welch plays the eccentric but brilliant businessman Peter Gregory. We see him as this unfriendly and stand-offish dude who somehow always has a method to his seeming madness.

Amanda Crew as Monica Hall. Didn't think much of the character at first, but she started to grow on me as the series went on. A flower among the thorns, but she's a lot more than eye candy - she presents the logical business side that the gang badly need, so much so that Jared starts feeling threatened in another really funny, yet touching segment near the end.

Matt Ross plays Gavin Belson, CEO of Hooli, as this aggressive ruthless and competitive with over-the-top hamminess that rivals Erlich Bachmann. It's a great performance which cements the CEO as a flawed human being with a lot of money and single-minded vindictiveness. His comic timing is just about perfect.

Comedian Jimmy O. Yang as Jian Yang. Jian Yang is this awkward Chinese nerd with horrible pronunciation and really atrocious command of English. He doesn't get many scenes here, but the ones he has with Erlich are hilarious. It's even more amazing when you consider that Jimmy O. Yang is a pretty articulate dude outside of the show. Check out his stand-up routine!

Ben Feldman as Ron LaFlamme. He only appears in one episode and is mentioned in passing in others, but boy does he make his presence felt every time he shows up. Smarmy and sleazy with a roguish charm, he totally represents the frat-boy culture that Silicon Valley keeps taking potshots at. But the impression we get is that he has to be more than passingly competent - after all, he was recommended by Peter Gregory. Eerily resembles a much younger Robert Downey Jr.


Austin Abrams as Kevin "The Carver". A teenager who radiates cockiness and confidence. Totally seems to have his shit together, and the entire gang is taken in by his reputation as a hacker, right up to the point where he royally screws everything up. Check out this amusing Burn-down Chart above!

Andy Daly as the unnamed doctor. Now, this seems to be very antithesis of what a doctor should be. Obnoxious and insensitive with a penchant for taking potshots at his patient Richard Hendricks, Daly is hilarious in this role and a welcome presence in the few scenes he does show up in.

Bernard White is Denpok, Gavin's spiritual advisor. Lends an air of serenity to the scenes he appears in, but there's a very subtle smell of bullshit surrounding every action. It's too early to tell, but I have this feeling that time will reveal him as a charlatan. If that's truly the end-game, White's performance here is brilliantly understated.

Jill E. Alexander as Patrice. Gavin's personal assistant, who seems totally star-struck by Gavin and acts like some gushing fangirl.


Aly Mawji and Brian Tiechnel as the brogrammers at Hooli who are set up as Richard's competition. They share an easy vibe and were pretty watchable.

The Mood

We actually kick off with a party atmosphere, with Kid Rock providing the music, live. Throughout the series, there are basically a few atmospheres - noisy party time (Flo Rida and an offscreen Shakira cameo at some point in the show), geek gathering with light-hearted geek banter, crunch time with techs furiously concentrating, and presentation time (which either takes place in an office, or in the finale, a big stage).

Ultimately, a lot of it is kept light. There's very little tension, and honestly, expectations are kept so low that even if the Pied Piper Team fails, it just doesn't feel like that big a deal.

What I liked




Erlich's t-shirts. Props to the costume department!


NipAlert, Spinder, Panic-A-Tech - all the utterly ridiculous app ideas that are being pitched oh-so-earnestly by their creators.

Every time Richard gets pedantic. It's predictable but funny.

Erlich's initial dislike of Jared coloring everything he says.

Erlich telling Richard to "be an asshole, or this company will die". Later, in the same episode, when he finally pushes Richard too far, Richard does start talking like an asshole and Erlich's impressed. It was a smart jab at the Steve Jobs Myth and the likes of Travis Kalanick.

The gang taking turns to simulate shouting company names during sex, after Erlich tells Richard that a company name has to be some "primal", that can be screamed out during intercourse. This is a perfect example of the entire show's very casual locker room talk style. Also, I'm not even slightly gay, but objectively, TJ Miller's way of saying "Aviato" is pretty sexy.

The Peter Gregory segment with the Burger King fixation. It's not that funny, but it does show just how brilliant this guy is, in a very convoluted way.

Jared successfully plays Gilfoyle off against Dinesh and makes them both work extra hard in the process. It's funny because his psychological ploy is painfully transparent, and yet the egos of the two programmers make them rise to the challenge.


Dinesh using a decision chart to decide if he should sleep with Gilfoyle's girlfriend. Just so geeky.


The part in the final episode where the group was earnestly discussing how long it would take for Erlich to give every male in the audience a hand job, complete with variables and mathematical formulae. I must have watched that scene a thousand times. Dinesh, Gilfoyle and Erlich were in total engineer mode, and it was hilarious to behold considering the subject matter. Even Jared got in the act. This actually ended up as the subject of a paper in real life!

Even the racist stereotypes in there seem to be there purely to take jabs at racism. And for every obvious racial negative stereotype that's shown, there are plenty of counter-examples. Take Jian Yang, for instance. We see him as this stuttering fresh-off-the-boat Chinese who seems really slow on the uptake. But throughout the show, we see some intelligent-looking Asian dude who tells his boss on the phone that "this kid Hendricks and Pied Piper just ran a two-minute mile and we should get on this" in very articulate English, Dan Melcher's wife (played by a gorgeous Lynn Chen) who seems smart and friendly.

What I didn't

The first couple episodes weren't really that interesting. Plenty happened, but somehow the characters didn't quite grow on me until maybe the third episode.

Monica and Richard's budding romance seems irrelevant, but I guess we'll see if it actually goes somewhere in later seasons.

Some of the sideplots were funny but seemed like total time-wasters. Example, Richard being obsessed with Sherry. And Jared being kidnapped by the automated car.

The sideplot where Dinesh gets sexually aroused by Gilfoyle's Java code was pretty amusing, but I thought it was established early on that Dinesh was the only guy in there that did Java? But, that being said, the dialogue is classic Gilfoyle.

Damn, I was really hoping that Richard would puke on Monica in the final scene of the last episode, the way he did to Erlich in an earlier episode. Didn't happen, though.

Conclusion

This is a really smart statement on the state of Silicon Valley. A lot of it is played for laughs, but at the core of it, there are several jabs at the geek culture and the pretentiousness, superficiality and bullshit ("making the world a better place", the brogrammer culture, buzzwords like "lo-mo-so" for a few examples) that permeates much of the industry. Also, a heartwarming story about the underdog that beats the big, evil corporation. What's not to love?

This is a tech drama-comedy, sure, but it's also very human. Everyone's foibles are there on show, and even the bad guys are easy to relate to. I'm really looking forward to watching the other seasons.

My Rating

9 / 10

So-long, mo-fos!
T___T

Sunday, 26 November 2017

Spot The Bug: Spacing Out

I'm pleased to bring you yet another edition of Spot The Bug. This one's tiny, so keep your eyes peeled...

Back in action.

Just recently, as part of a programming exercise, I was working on a Password Strength Validator. My idea here was for there to be a text field, and as the user types in a password, there is a label describing the input's password strength as Excellent, Good, Moderate or Weak. For this, I used jQuery to process everything.



It mostly went well. The function I created to determine the password strength did its job and returned the correct values - a password strength indicator (e.g., "Weak") and a more detailed message as to what was wrong with it (i.e, "Password is too short"). The CSS and styling were all fine. I tested it with sample input.

What went wrong

Oh, it looked like everything was wrong. The indicator failed to come on no matter what I typed.



Here's the code. I won't go into detail with the getPasswordStrength() function. Suffice to say, the function worked as expected.
<!DOCTYPE html>
<html>
    <head>
        <title>Password Strength Validator</title>
        <style>
            .password
            {
                display:block;
                width:20em;
            }

            .strength
            {
                font-size:2em;
                font-weight:bold;
                transition:all 1s;
            }

            .comments
            {
                font-size:1em;
            }
        </style>

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script>
            function displayPasswordStrength(password)
            {
                if (password.length == 0)
                {
                    $(".indicator.strength").html("");
                    $(".indicator.comments").html("");
                }
                else
                {
                    var pwd_strength = getPasswordStrength(password);
                    $(".indicator.strength").html(pwd_strength.strength);
                    $(".indicator.comments").html(pwd_strength.comments);

                    if (pwd_strength.strength == "Excellent")
                    {
                        $(".indicator.strength").attr("style","color:#00FF00");
                    }

                    if (pwd_strength.strength == "Good")
                    {
                        $(".indicator.strength").attr("style","color:#FFFF00");
                    }

                    if (pwd_strength.strength == "Moderate")
                    {
                        $(".indicator.strength").attr("style","color:#FF4400");
                    }

                    if (pwd_strength.strength == "Weak")
                    {
                        $(".indicator.strength").attr("style","color:#440000");
                    }
                }

            };

            function getPasswordStrength(password)
            {
                ...
            }
        </script>
    </head>
    <body>
        Password:
        <input class="password" oninput="displayPasswordStrength(this.value)">
        <div class="indicator">
            <span class="strength">
               
            </span>
            <span class="comments">
               
            </span>
        </div>
    </body>
</html>


Why it went wrong
As mentioned, the function was working, and firing off upon input. But nothing was being changed on the front-end!

And when I finally found it, I had such a good laugh.
                    $(".indicator .strength").html(pwd_strength.strength);
                    $(".indicator .comments").html(pwd_strength.comments);


This basically means that the element with the class strength within the indicator div was supposed to reflect the strength property of the passwordStrength object returned by the getPasswordStrength() function, and the element with the class comments would display the comments property.

But look closely at the selector on the first line. It was instead looking for an element with both the CSS classes strength and indicator! Same for the next line - looking for an element with both the CSS classes comments and indicator. And came up short.

How I fixed it

I could have just started using ids instead of classes, but really, that would be complicating what was essentially a very simple fix. Just add spaces where they're supposed to go.
<!DOCTYPE html>
<html>
    <head>
        <title>Password Strength Validator</title>
        <style>
            .password
            {
                display:block;
                width:20em;
            }

            .strength
            {
                font-size:2em;
                font-weight:bold;
                transition:all 1s;
            }

            .comments
            {
                font-size:1em;
            }
        </style>

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script>
            function displayPasswordStrength(password)
            {
                if (password.length == 0)
                {
                    $(".indicator .strength").html("");
                    $(".indicator .comments").html("");
                }
                else
                {
                    var pwd_strength = getPasswordStrength(password);
                    $(".indicator .strength").html(pwd_strength.strength);
                    $(".indicator .comments").html(pwd_strength.comments);

                    if (pwd_strength.strength == "Excellent")
                    {
                        $(".indicator .strength").attr("style","color:#00FF00");
                    }

                    if (pwd_strength.strength == "Good")
                    {
                        $(".indicator .strength").attr("style","color:#FFFF00");
                    }

                    if (pwd_strength.strength == "Moderate")
                    {
                        $(".indicator .strength").attr("style","color:#FF4400");
                    }

                    if (pwd_strength.strength == "Weak")
                    {
                        $(".indicator .strength").attr("style","color:#440000");
                    }
                }

            };

            function getPasswordStrength(password)
            {
                ...
            }
        </script>
    </head>
    <body>
        Password:
        <input class="password" oninput="displayPasswordStrength(this.value)">
        <div class="indicator">
            <span class="strength">
               
            </span>
            <span class="comments">
               
            </span>
        </div>
    </body>
</html>


Now it works!


Moral of the Story

jQuery is really neat and all, and selectors are easy to use. And also easy to get wrong if you're an idiot like me. This was not a syntax error, maybe not even a logic one. It was pretty much a typo. Oh, the horror. See how even a space can ruin your day?

Looks like another bug squashed. Excellent!
T___T

Wednesday, 22 November 2017

Film Review: The Girl With The Dragon Tattoo (2011) (Part 2/2)

As with any remake, comparisons with the original are inevitable. The 2011 remake of The Girl With The Dragon Tattoo finds itself in the unenviable position of being compared to both the 2009 version and the novel. In my review, there were far more things that I mentioned liking than not liking; however, that's mostly because the things I didn't like were a result of unfavorable comparisons with the 2009 version, which I'm saving for this part.

Characters


2009
2011

Noomi Rapace's Lisbeth Salander (2009) vs Rooney Mara's Lisbeth Salander (2011) - this one is a very close call, and it's extremely hard for me to pick a clear winner between the two. That's because while these two fine actresses bring forth markedly different Lisbeths, they're both Lisbeth. Albeit different aspects of Lisbeth that can be inferred from the novel. Noomi Rapace portrays the hard-as-nails Lisbeth Salander who will fuck you up if you cross her. There is no question at all, that should you accost her and fail to kill her, whose ass is going to be thoroughly kicked. It radiates through every pore of the actress. Rooney Mara's Salander, on the other hand, exudes the other side of Salander - the antisocial, awkward and emotionally stunted persona is played up, noticeably more so than the awesome capacity for ass-kicking. It's a testament to the complexity of the character written by the late Stieg Larsson that two different people could conceivably portray her so convincingly.

Who looks more the part? Well, from the neck up, Mara is pale as a ghost and Rapace has this psycho glare going on. Both are thin - Mara more so, Rapace more athletic. So far so good. Mara, however, has significantly larger boobs than Rapace, whose chest really mirrors the description of Lisbeth Salander having a boyish figure. Plus, the unshaven pits which pretty much hammer home the "antisocial monster" vibe. I think Rapace kind of wins here, at least in the body double department. She's uncomfortable to look at.

2009
2011
Michael Nyqvists's Mikael Blomkvist (2009) vs Daniel Craig's Mikael Blomkvist (2011) - there's no contest here. Michael Nyqvist is significantly older, chubbier and hairer than Daniel Craig in the movie. Just look at Craig's glorious naked torso and tell me that belongs to a journalist that has been described to be battling the middle-age bulge. That aside, Craig just isn't right for the role. Not even considering that Nyqvist got there first and did such a spectacular job that filling his shoes would be nigh impossible. Michael Nyqvist's Blomkvist is one that the average sedentary moviegoer can identify with - not the rugged good looks, chiselled torso and superspy coolness of Daniel Craig.

I mean, not once during the entire scene where Martin Vanger tortures and almost kills Mikael Blomkvist, could I believe that this guy was in danger of getting killed. Come on, that's Daniel Craig!

Craig is also a lot more animated with his movements, what with the squinting, head motions and hand gestures. Nyqvist used his face. His eyes.


2009
2011



Peter Andersson's Nils Bjurman (2009) vs Yorick van Wageningen's Nils Bjurman (2011) - Peter Andersson is far older, creepier and predatory than Yorick van Wageningen in this role, who musters a sleazy vibe at best. The 2009 Nils Bjurman's rape of Lisbeth was played with significantly more violence (though both on-screen rapes are just as horrific).

2009
2011
Peter Haber's Martin Vanger (2009) vs Stellan Skarsgård's Martin Vanger (2011) - Peter Haber did a fine job. That said, Stellan Skarsgård beats him hands-down with his portrayal. Skarsgår's Martin Vanger positively screams snake near the end.

2009
2011



Lena Endre's Erika Berger (2009) vs Robin Wright's Erika Berger (2011) - I think both actresses are pretty competent in their own way and could look like an Erika Berger. Unfortunately, they're given so little to do in this movie that Erika's awesomeness in the novel just doesn't translate very well here. A limp stalemate.

2009
2011
Tomas Köhler's Plague (2009) vs Tony Way's Plague (2011) - Tomas Köhler's Plague shared an acerbic camaraderie with Lisbeth Salander in the Swedish version. Tony Way's Plague just comes off as a dick, and lacks the presence that made Tomas Köhler's Plague stand out.

Story

Certain story elements are more in line with the novel's, and some are simply done better - more well-executed, more value in their inclusion.


2009
2011
First off, the techy bits in the 2009 version come across as a little too retro in comparison with the 2011 version. Look at the font, for instance!  The 2011 version doesn't go over the top showcasing Lisbeth's hacking skills, and still shows a reasonable UI. To be fair, I think it's more the sign of the times. The 2009 version wasn't released in an age where Google, Facebook and YouTube had become that mainstream.

2009
2011
How Lisbeth's laptop gets damaged. In the novel, it cracks when a car backs up over it, which is, well, boring. The 2009 version shows us that it got damaged when Lisbeth gets attacked by a bunch of guys in the subway, whom she fights off like an enraged badger, using a broken bottle. The 2011 version shows us that a snatch thief grabs Lisbeth's bag (again, in the subway), and in the ensuing tussle on the escalator (where she naturally kicks his ass), it gets damaged. And Lisbeth just coolly glides down the escalator later. Both are suitable plot points leading to the death of that laptop and showing us Lisbeth's aggression. The 2009 version feels more visceral and Lisbeth takes more lumps in this one. The 2011 is just a little too neatly done. Too slick.

2009
2011

Bjurman coercing our super hacker Lisbeth into blowing him. I have to give the prize to the 2009 version here. It was more drawn out and the overall result was more creepy. The 2011 version just felt... sleazy. Also, this might be a minor point here, but I prefer the 2009 version's take of Lisbeth washing her mouth later. She actually sticks her fingers down her mouth and scrubs!

Rape scenes. Both 2009 and 2011 versions depicted the horrific rape of Lisbeth Salander at the hands of Bjurman quite ably. Though I must say the 2009 version felt way more violent, mainly because Bjurman actually smacked Lisbeth around first.

Bible clues. In the novel, Mikael is stumped by the names and numbers on the list until his daughter Pernilla points out that they were taken from the bible. The 2011 version stays true to this, while the 2009 opts to cut out Pernilla as a character and have Lisbeth deliver the message. Both work well, I guess, though bonus points to the 2011 version for including this detail.

Sex scenes between Mikael and Lisbeth. In the 2009 version, Mikael is dumbfounded when Lisbeth expresses a desire to have sex with him out of nowhere. After doing it, Lisbeth refuses to cuddle. Her coldness is totally in character here. In the 2011 version, Mikael and her do it with vigor, and the scene fades to black with no mention of it later. Later on, Lisbeth sternly tells Mikael to put his hand back under her shirt, and they end up having sex again. This didn't really ring true for me. Also, in the 2009 version, Mikael and Lisbeth's naked bodies aren't exactly conventionally beautiful. The sex feels more real. In the 2011 version, Lisbeth has great skin and nice tits and ass, and Mikael has one hell of a sculpted body. This just forcefully reminded me that I was watching a Hollywood remake.

Reunion of Harriet and Henrik Vanger. The 2009 version's reunion was touching in all its emotional honesty. The 2011 version felt a little... rushed.

Cinematography

The 2011 version boasts very nice camera angles and majestic landscapes. In these areas, it stands out significantly next to its comparatively drab-looking predecessor. The sets, in particular, are markedly different.

2009
2011

Milton Security (2009) vs Milton Security (2011) - There's not much to choose between these iconic scenes where Dirch Frode and Dragan Armansky speak with Lisbeth in the Milton Security conference room. The 2009 version of the office is more warm, while the 2011 version is more sterile. One interesting thing I noted in the 2011 version is that there's hardly a shot of all three of them in frame at one time. Either Lisbeth has her back to us and is out of focus, or Dirch and Dragan are. Wonder why.

2009
2011

The Millennium (2009) vs The Millennium (2011) - The 2009 version of The Millennium's office had a cosy homely feel to it. The 2011 plays this up even more, but somehow it just feels too clean.

2009
2011

Plague's apartment (2009) vs Plague's apartment (2011) - The 2009 version is dark, smoky and dank, like some kind of lair. With a greenish tinge, even! The 2011 is a tad more spacious. Doesn't really carry the vibe.

2009
2011

Martin Vanger's basement (2009) vs Martin Vanger's basement (2011) - both versions are remarkably clean and bright. A great deal of thought seems to have been put into them. We see the cages, the torture instruments, the apparatus used to suspend Mikael, and so on. Both are great, and I can't reasonably choose a winner here.


Conclusion

The American remake is a remarkably polished effort. It's certainly more stylish than its predecessor. And that's all it really has going for it. Story-wise, it offers nothing really new. Rooney Mara's new take on Lisbeth Salander was interesting, and Stellan Skarsgård stood out as Martin Vanger. The rest of the acting was... meh. Still, brave and commendable effort, I suppose. Though "outstanding" might be a bit much.

Personally? I prefer the Swedish version. It did way more for me, raw as it might have felt sometimes. Of course, seeing as I've seen more of the 2009 version, including its sequels, I may be biased here.

The remake doesn't suck! It's a Mara-cle!
T___T