Saturday, 26 April 2014

Saturday - The Future of Healthy Longevity

Today, I went to a presentation on longevity, quite a popular subject amongst the London Futurists, second only to the Singularity. It was done in three parts, the first by Phil Micans:


Phil discussed the issue that ran through all the presentations: that absolute longevity (how long you live) is only as important as how healthy you are, otherwise the suffering, and it's associated cost to society, make the extra years pointless. He mentioned various new technologies, especially peptides, which have produced amazing results, including growing back one chap's finger tip:


Next on was Avi Roy, who discussed the possible areas of research and narrowed it down to nine different areas, each area affecting different diseases to a greater or lesser extent:


The effect being that if you address one factor, affecting one type of illness, another illness replaces it. All the nine factors have to be tackled together.

The third speaker was Tuvi Orbach, who discussed the effect of lifestyle on longevity.


He's a bit of an advert for his subject, being 65. Healthy living!

Wednesday, 16 April 2014

Dependency Injection with Google Guice

One of the problems that we get in software development, specifically in the design of software classes, is that of the connection between classes. If one class uses another directly, even though it works, this can cause problems later on and is known as "close coupling". Here is a mundane example:

//a really dumb message sending class
public class MessageSender {
    public void sendMessage(String message) {
        System.out.println(message);
    }
}

//another dumb class that uses the message sender
public class MessageUser {
    //a reference to the sender object
    private MessageSender messageSender;
    //the message sender object is created in the constructor
    public MessageUser() {
        this.messageSender = new MessageSender();
    }
    //send the message via the sender
    public void sendMessage(String message) {
        messageSender.sendMessage(message);
    }
}

//the main class that uses the message classes
public class MessageMain {
    public static void main(String[] args) {
        MessageUser messageUser = new MessageUser();
        messageUser.sendMessage("This is a test");
    }
}

OK, this is really mundane, but can see that MessageUser cannot use any other way of sending messages. If you want to use another means, say email, you'd have to either change what MessageSender does or change MessageUser to use a different class, call it EMailSender. However, we can now use an interface instead of a class:

public interface MessageSender {
    public void sendMessage(String message);
}

//an implementation of the interface
public class SystemMessageSender implements MessageSender {
    public void sendMessage(String message) {
        System.out.println(message);
    }
}

You still have to change MessageUser, but to use an interface given to, or "injected" into, the MessageUser object via the constructor:

public class MessageUser {
    //a reference to the interface
    private MessageSender messageSender;
    //the interface is sent to the object using the constructor
    public MessageUser(MessageSender messageSender) {
        this.messageSender = messageSender;
    }
    
    public void sendMessage(String message) {
        messageSender.sendMessage(message);
    }
}

This works if we then, in the main class, create the object that implements the MessageSender and pass it to, or inject it into, the MessageUser object:

public class MessageMain {
    public static void main(String[] args) {
        SystemMessageSender messageSender = new SystemMessageSender();
        MessageUser messageUser = new MessageUser(messageSender);
        messageUser.sendMessage("This is a test");
    }
}

Now if we want to have MessageUser send emails we create a class which also implements the MessageSend interface:

//an implementation of the interface
public class EMailMessageSender implements MessageSender {
    public void sendMessage(String message) {
        EMail.textMessage(message);
    }
}

All that then has to be done is create an object of this class in the main class and then pass it to MessageUser, as before:

        EMailMessageSender messageSender = new EMailMessageSender();
        MessageUser messageUser = new MessageUser(messageSender);
        messageUser.sendMessage("This is a test");

This technique, known as Dependency Injection, is quite an important design pattern and is mandatory in certain frameworks, such as Spring.

Introducing Google Guice


So far, so good, and it's difficult to see how this can be really improved upon. However, Guice (pronounced with a J rather than a G) does for dependency injection what Mockito does for unit testing. To introduce Guice into the above example, we have to create another class, an extension of Guice's AbstractModule class:

public class MessageModule extends AbstractModule {
    protected void configure() {
        bind(MessageSender.class).to(SystemMessageSender.class);
    }
}

You can sort-of see what's going on. The module is responsible for creating the class that implements the interface, so whenever the interface is used, the object is bound to it. The magic happens in the Injector, used in the main class:

        Injector injector = Guice.createInjector(new MessageModule());
        MessageUser messageUser = injector.getInstance(MessageUser.class);
        messageUser.sendMessage("This is a test");

Notice that the module hasn't been told about MessageUser, so the Injector is figuring out it's dependencies from the constructor of the class, and this also has to change using the @Inject annotation:

    @Inject
    public MessageUser(MessageSender messageSender) {
        this.messageSender = messageSender;
    }

Now all this doesn't seem like a big deal, if anything we've added lines and classes, but if you've got a lot of classes with umpteen dependencies, Guice can save you a lot of work.

Tuesday, 15 April 2014

Captain America: The Winter Soldier

Being (relatively) cheap Tuesday at Empire Cinemas on th' BasVegas Strip, I took advantage and went to see the latest in the Marvel Avengers franchise. Now an agent of S.H.I.E.L.D., Steve Rogers, a.k.a. Captain America, is confronted with a conspiracy when Nick Fury is attacked.


There's lots of bangs and crashes and a reasonably decent plot, but is a Superhero movie at heart despite higher ambitions. All the team turn up, so it ends up being an Avengers movie without the Avengers, but the acting is ok, if a little pedestrian (it seems a long time ago since Robert Redford was in All The President's Men) and there's a fair number of cameo's, but it's Samuel Jackson, as Nick Fury, and Chris Evans, as th' Cap', that drive the movie.

Saturday, 12 April 2014

Salute 2014

For a change of pace, I went along to Salute 2014, the South London Warlords exhibition at Excel in the London Docklands.

There was a good turn out, with several different styles; historic, fantasy, science fiction and even horror (i.e. zombies), as well as the usual stalls. This was a large scale miniatures battle of Trebbia (Second Punic War: Hanibal vs. Roman Republic):


There was also a very large simulation of Sword Beach, one of the British D-Day landings:


as well as a Space 1889 attack on a Martian city by British Forces:


I got tempted by the stalls, eventually, and bought some model bases from Micro Arts Studio:


Nice!

Wednesday, 9 April 2014

Silicon Valley/Beta's - How Not To Run a Start-up

On Boing-Boing, there's a review of a series starting in the 'States called Silicon Valley, a comedy about a programmer who develops a new compression algorithm and, instead of selling out for gazzilions, takes some seed money and tries to run his own start-up. All very Microserf's:


However, this is not the first time programmers have been on the small screen in a comedy. A few months ago, Amazon created Beta's:


I'd normally just cringe and move on (they're not as good as The IT Crowd by the looks of things)


but the other day I expanded my Douglas Coupland collection with jPod and The Gum Thief. jPod was also made into a TV series, sadly unavailable.

Sunday, 6 April 2014

Mockito Spies

That is the collective noun, not the verb, although I suppose Mockito is spying...

Spies are used to make existing classes into Mockito classes. Say your class under test hooks into a Java listener, so you want some kind of dummy listener for it to hook into. You can't do this with Mockito (at least I can't find a way), but you can make your own:

//listener interface
public interface SomethingListener {
    //change that sends the event
    public void somethingChanged(EventObject e);
}

//our little dummy listener provider
public class DummyListenerProvider {

    private SwitchListener listener;

    //this is used by the class under test
    public void addSwitchListener(SwitchListener listener) {
        this.listener = listener;
    }

    //send event, saying the class is the source
    public void triggerEvent() {
        this.listener.somethingChanged(new EventObject(this));
    }

    //used by the event consumer when the event occurs
    public void switchMeOn(boolean isTrue) {
    }
}

Cool, but you still want all the nice little trinkets that come with the Mockito objects. This is where spies come in. You just wrapper the class using spy instead of mock:

DummyListenerProvider spyListenerProvider = spy(new DummyListenerProvider());

ClassUnderTest underTest = new ClassUnderTest(spyListenerProvider);

spyListenerProvider.triggerEvent();

verify(spyListenerProvider).switchMeOn(true);

Saturday, 5 April 2014

Mockito - An Elegant Stub for a More Civilised Age

In software development, we make use of something called "stubs". These are bits of code that don't do anything at the moment, but allow us to continue coding elsewhere as if they do, replacing them later. They are also used in testing to substitute for more complex objects, and this is where "mocking" (creating "mock" objects) has been developed in object-oriented programming and test-driven development.

As an extension to the college work I've been doing, I've been looking into using mock libraries for unit testing and I've come across Mockito:

The mock objects it creates are, well, amazing to say the least. Say we've got an interface that, in turn, allows us to create a read I/O stream and a write I/O stream, for networking. The interface would look something like this:

//simple interface wrapper around a network socket
public interface MySocket {
    //creates a read I/O stream
    public BufferedReader getBufferedReader() throws IOException;
    //creates a write I/O stream
    public PrintWriter getPrintWriter() throws IOException;
    //indicates that a connection has been successfully made
    public boolean isConnected();
    //closes the connection
    public void close() throws IOException;
}

Now I can actually mock this interface with Mockito in the unit test:
import static org.mockito.Mockito.*;
...
MySocket socket = mock(MySocket.class);
You can now use this mock socket interface in whatever need the interface, so:
SocketThread socketThread = new SocketThread(socket);

Now, unfortunately, the mock doesn't really do anything other than just record what happens to it. Say SocketThread calls socket.close internally when it runs:
//this is in SocketThread.run
socket.close();
...
//if this isn't true, you'll get an exception
verify(socket).close();
Useful, but it becomes a bit more powerful when we add mocks for the input and output streams:
PrintWriter printWriter = mock(PrintWriter.class);
BufferedReader bufferedReader = mock(BufferedReader.class);
when(socket.getBufferedReader()).thenReturn(bufferedReader);
when(socket.getPrintWriter()).thenReturn(printWriter);
You can control exactly what the mock does and when it does it. Very useful for unit testing (and I haven't even begun to use all it's capabilities).

Thursday, 3 April 2014

Flight

Through my LoveFilm/Amazon subscription, this is a film starring Denzel Washington about a man facing up to his own frailties and responsibilities.

After saving most of the crew and passengers of his stricken airliner in a miraculous landing, William "Whip" Whitaker has to deal with problems of his own.


With an excellent story, it's a really good film about a man struggling with his demons. Denzel is a strong central lead, as to be expected, and has an excellent supporting cast, including Don Cheadle, Bruce Greenwood and John Goodman, but Kelly Reilly is good as his girlfriend trying to get him to recognise that he has a problem.

Monday, 24 March 2014

Monday - Designing and Developing Reactive User Interfaces

This evening, I attended a presentation of an implementation of reactive technologies in .Net by Lee Campell and Matt Barrett.



This centred around a trading application written by Lee, Matt and their team, and, perhaps, best to see this as a continuation of the presentation I saw last week at Microsoft. The application, which, they said, will be open sourced, was pretty slick, a combination of Windows Presentation Foundation and the original Microsoft Rx library.

It was a very good and well thought out presentation about an interesting, a prescient, subject.

Saturday, 22 March 2014

Elysium

Through my LoveFilm subscription, a(nother) sci-fi film from Neill Blomkamp, director of District 9. Having been fatally irradiated at work, Max Da Costa (Matt Damon) makes a deal with local activists to break into the orbital space station Elysium for a chance at being healed.


With a rather good plot, breath-taking special effects, and decent acting (although I would have preferred someone Hispanic instead of Damon, but I suppose it required a name to sell it), Elysium makes for a rattling good sci-fi film. I especially liked spangly space station and the robots, but all the weaponry was cool, especially the exploding bullets. Recommended.

Along similar lines, there's a new series out in the states called The 100.


Mmmmmm, teenagers in space. Yeah, I'll give that one a miss, I think, assuming anyone over here is going to buy it.

Thursday, 20 March 2014

Wednesday - Android Livecode, RxJava Architectures on Android at Microsoft

This was an Android Livecode presentation hosted at the Microsoft offices in sunny Westminster.

Yeah, I didn't get it either, and the Microsoft people were not exactly convincing in their reasons for hosting what is, essentially, a presentation for the competition. (For those who don't know, Android is the mobile phone\embedded operating system owned by Google and in competition with Microsoft's Windows 8).

After the introduction, the main presentation was given by a Berliner, Timo Tuominen from Futurice, concerning the use of Functional Reactive programming on Android. This centred around the use of RxJava, an open source library based on a Microsoft library and implemented by Netflix, the video streaming company.



(A well attended presentation, as you can see, but there was free beer and pizza).

RxJava is centered around the use of an Observable class i.e. an implementation of the Observer design pattern from the "Gang of Four" book, on which most event models are based. It seems that the difference between, say, the standard Java listeners and RxJava is that the listeners have to be implemented within the class as you're coding it. Here's something I've been working on for the College:
//custom event maintenance
//this is a list of events that have to
//be serviced when something happens
private List<SwitchListener> listenerList = new ArrayList<SwitchListener>();

public void addSwitchListener(SwitchListener listener) {
 listenerList.add(listener);
}

public void removeSwitchListener(SwitchListener listener) {
 listenerList.remove(listener);
}

private void fireSwitchListener() {
 //parcel up the state of the switch in a SwitchEvent object
 SwitchEvent e = new SwitchEvent(this, isSwitchOn());
 //then send it to every listener in the list
 for(SwitchListener listener: listenerList) {
  listener.switchChange(e);
 }
}

Listeners are all over Java components as it provides a way of passing messages between the components and their containers without the components having references to the latter (a problem known as "coupling").

What RxJava seems to do is wrapper up listeners, or something like them, into a framework that can be applied to any other object. For example, if you want to "listen" to an object so that when it changes you can do something else, or react to it, you can use the Observable class to do it:

Observable.from(names).subscribe(new Action1<String>() {
 public void call(String s) {
  System.out.println("Hello " + s + "!");
 }
});

It does seem to be something that you would think was already in function programming languages, like Clojure and Scala, by default, but RxJava can be used by these, so maybe it isn't?

Overall, the presentation wasn't brilliant as Timo is not a natural presenter, plus he seemed unaware of any of the alternatives (although his boss was there and stepped in to answer the awkward question or two that arose), which was a shame because it does seem like an interesting subject.

Wednesday, 12 March 2014

Tuesday - Java Concurrent Animated

I thought I take a trip into town this evening to see a presentation at Skills Matter by Victor Grazi (complete with "Brooklyn accent") concerning Java concurrency.


Concurrency is always a difficult subject, but not so much the thing itself as what happens when concurrent processes try to access the same resources at the same time. Normally, in Java, this is done via the "synchronized" command. You designate a block of code and wrapper it in a synchronized block:

synchronized(this) {
    Counter.count++;
    System.out.print(Counter.count + "  ");
}

or declare a function to be synchronized:

public synchronized void assign(int i) {
    val = i;
}

However, if one thread gets to the block first, it locks out the any other threads trying to do the same. There's nothing that the others can do about it other than wait.

Victor's presentation was regarding what was available in the Java API, such as Locks, Semaphores, to get around this or avoid it altogether, as well as exploring other aspects of the API such as Thread Pooling.

What made this presentation a little different was the animation of the threads, which were doing little animated circuits to illustrate his points. The source can be found on SourceForge.


As you can see, it looks cute. Plus is does show you the various options available to the Java programmer other than just the ubiquitous "synchronized".

Victor gave a very good presentation of a difficult, but important, subject.

Monday, 3 March 2014

Throne of Blood - "A Man Without Ambition is Not a Man"

Film 4 are currently running a Kurosawa season at the moment, and the latest one was this classic retelling of Macbeth. Samurai Commanders Washizu (Toshiro Mifune) and Miki (Minoru Chiaki), on their way to see their feudal lord Tsuzuki (Takamaru Sasaki), Lord of the Spider Web castle, encounter a fortune-telling demon.


Famous for the final "arrow" scene, I don't think it's as good as Yojimbo or, my favourite, Sanjuro, although the Scottish Play does translate rather well to feudal Japan. Mifune is excellent as the increasingly paranoid and tyrannical Washizu, driven by both his wife (Isuzu Yamada) and his own ambition to fulfil his destiny, whatever the cost, and the whole film has a creepy foreboding quality.

Contrasting with this (through my LoveFilm subscription), and also a story of ambition, is Pain and Gain, a crime "comedy" starring Mark Wahlberg and Dwayne "The Rock" Johnson. Body builder and personal trainer Daniel Lugo (Wahlberg) decides that he wants the high life that he sees some of his clients enjoying.


Although it does have a few funny moments, it's mostly a rather silly and somewhat grim crime caper. Wahlberg isn't too bad, and he's got suitable support in Johnson as a Christian ex-con and Ed Harris as a private eye trying to convince the police to take the whole thing seriously. The real suprise, though, is that it's all true(-ish), making the whole thing rather sad (the protagonists are currently on death row in Florida).

Sunday, 2 March 2014

Jesus Scores for City

That is Jesús Navas who scored the third, and last, goal for Manchester City in the League Cup final against Sunderland.


There's talk of doing the Treble (League Title, Cup and F.A. Cup), but realistically and barring a minor miracle, the League looks to be sewn up by Chelsea. This leaves the F.A. Cup, so a double of sorts is possible, and Chelsea are out of that competition for some reason...

Saturday, 1 March 2014

Monday - Continuous Delivery Gone Bad

At the invitation of my erstwhile and erudite colleague and associate Mr. Laver, I went to a presentation by Gojko Adzic at Skills Matter regarding his experiences and recommendations for continuous delivery, one of the corner stones of agile development.


In quite an interesting, if earnest and intense, presentation, Gojko related some interesting anecdotes, and a few novel ideas.

Notable was that to do justice to continuous delivery, it has to be done with multiple versions, allowing mistakes to be made and features to be added without interrupting the work flow of the customers using the applications. There were a few intakes of breath from the audience, and he didn't disguise the difficulties of this strategy, particularly regarding data versions.

Another was the idea of using fast prototyping techniques, often without any coding whatsoever, to be able to sort out business issues, and that feedback and measuring are also important elements, especially if the project is a success.

All in all, it was quite a good presentation, if a little slow in places, and it was good to see how Matt was faring after starting his new job.

Saturday, 22 February 2014

A Night on the Town - Olde Mitres and Banks

For a change, I went up into London to have a drink with some erstwhile collegues. We started off at The Olde Mitre, one of the oldest pubs in London:


It's built round the back of a church and is a typical London drinking establishment, with a good selection of beers. I had a half of something called "Dark Star Original", a sort of Porter\Mild.


Very nice. After we'd all met up (the pub is down an alley, so very easy to miss), we moved on down to The Old Bank of England (both of them are Fuller's pubs), a complete contrast, and probably the largest pub I've ever been in:


Very grand. I finished the night there and, after fond farewells, wended my way back to BasVegas.

Thursday, 20 February 2014

The Lincoln Lawyer

Back to the movies, this is an adaption of the bestseller by Michael Connelly starring current hot property Matthew McConaughey. Defence Lawyer Mickey Haller (McConaughey), used to dealing with orinary criminals, is suddenly hired to defend Beverly Hills playboy and heir Louis Roulet (Ryan Phillippe).


A very good plot and good script, combined with McConaughey's southern style makes this a superior film and an excellent Friday night pizza movie. McConaughey is excellent, as is the supporting cast, although they are somewhat underused, especially William H. Macy and Bryan Cranston, although it's good to see John Leguizamo and Michael Peña in something, as well as Marisa Tomei as Haller's ex-wife. Recommended.

Tuesday, 18 February 2014

Creating a Custom Java AWT Component – Part 2: Resizing and Segment Control

The whole point of the control is to display a number, so inputting a number is just a case of setting a display value:

private int displayNumber = 8;

public int getDisplayNumber() {
    return displayNumber;
}

public void setDisplayNumber(int displayNumber) {
    this.displayNumber = displayNumber % 10;
    repaint();
}

A simple enough bean compatible getter and setter, but notice that in the setter, I've modulo 10, to restrict the input to single digits. I've also called the repaint method to re-display the component.

Now looking at the paint method, I only display a segment if it's used for a particular number. To determine this, I use the Arrays.binarySearch method on an array of the relevant numbers. For example, on the bottom left segment, which is only used by 2, 6, 8 and zero:

//bottom left
if(Arrays.binarySearch(new int[] {0,2,6,8}, displayNumber) > -1) {
    polygon = createSegment(createSegmentPoints(0, segmentHeight * 2 + segmentWidth, segmentHeight, segmentWidth));
    g2.fill(polygon);
}

Perhaps this is a bit over the top and there's a better way of doing it, but it saves all those OR clauses. This shows the segments and numbers when they are active:

Segment Number
Top 0,2,3,5,6,7,8,9
Top Left 0,4,5,6,8,9
Top Right 0,1,2,3,4,7,8,9
Middle 2,3,4,5,6,8,9
Bottom Left 0,2,6,8
Bottom Right 0,1,3,4,5,6,7,8,9
Bottom 0,2,3,5,6,8

All well and good so far. The only bit left to do is calculating the size of the segments in relation to the size of the panel. If you look at the previous diagram of the component:

SegmentArrangements

you can see that the height is three segment widths and two segment lengths. The width is two segment widths and one length. Using this as a basis, you can than say:

Ws = 2.Wp - Hp

Where Ws is the width of the segment, Wp is the width of the panel and Hp is the height of the panel. Correspondingly:

Ls = 2.Hp - 3.Wp

Where Ls is the length of the segment. You can see that for certain height and width ratios, the width and length of the segments are negative. Therefore:

2.Wp > Hp

and:

3.Wp < 2.Hp

Also:

Ws < Ls

Doing all the maths, we get that 50% < Wp < 60% of Hp. 55% sounds about right. Plugging this into the paint function:

int width = this.getHeight();
width *= 0.55;
int height = this.getHeight();
//set the width as a proportion of the height
this.setSize(width, height);
        
int segmentWidth = 2 * width - height;
int segmentLength = 2 * height - 3 * width;

Testing all this is simple enough. Put it all in a Frame, with a little timer to tick through the numbers:

private LEDPanel led;

public TestFrame(String title){
    //call the superclass constructor with the specified title
    super(title);

    //add the LED panel for testing
    led = new LEDPanel();
    add(led);
    led.setBackground(Color.black);
    led.setForeground(Color.red);
    led.setDisplayNumber(5);

    Timer timer = new Timer();
    timer.schedule(new TimerTask() {
        public void run() {
            led.setDisplayNumber(led.getDisplayNumber() + 1);
        }
    }, 2000, 1000);

    //add the exit listener and set the size
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });

    setSize(200, 300);
    //show the frame
    setVisible(true);
}

Now it's all working tickety-boo, I thought I'd go over the refectoring of the code in the next part.

Creating a Custom Java AWT Component - Part 1: Getting Started

As part of the course I'm on, I'm creating a custom AWT component. It's a derivative of the Panel component and has a number of shapes drawn on its surface using the Graphics2D package.

Figure8

To draw the graphic, I created two methods, createSegment and createSegmentPoints. First createSegment:

private GeneralPath createSegment(int[][] points){
    GeneralPath polygon = new GeneralPath(GeneralPath.WIND_EVEN_ODD, points.length);
    polygon.moveTo(points[0][0], points[0][1]);

    for(int index = 1; index < points.length; index++) {
        polygon.lineTo(points[index][0], points[index][1]);
    }
    polygon.closePath();
    return polygon;
}

This method creates and returns a GeneralPath object, a polygon drawn (using the method lineTo) by a set of points, starting then finally completed with a call to the method closePath. The createSegmentPoints method creates an array of six points:

private int[][] createSegmentPoints(int originX, int originY, int width, int height) {
    int[][] points = new int[6][2];
    if(width >= height) {
        points[0] = new int[]{originX + height/2, originY};
        points[1] = new int[]{originX + width - height/2, originY};
        points[2] = new int[]{originX + width, originY + height/2};
        points[3] = new int[]{originX + width - height/2, originY + height};
        points[4] = new int[]{originX + height/2, originY + height};
        points[5] = new int[]{originX, originY + height/2};
    } else {
        points[0] = new int[]{originX + width/2, originY};
        points[1] = new int[]{originX + width, originY + width/2};
        points[2] = new int[]{originX + width, originY + height - width/2};
        points[3] = new int[]{originX + width/2, originY + height};
        points[4] = new int[]{originX, originY + height - width/2};
        points[5] = new int[]{originX, originY + width/2};
    }
    return points;
}

It uses the ration of height and width to determine if the segment is horizontal or vertical and then figures out the points from there.

Segment


SegmentEnd

Each segment is then rendered to the surface of the Panel in the paint method:

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    int height = 20;
    int width = 100;
    GeneralPath polygon;
    //top
    polygon = createSegment(createSegmentPoints(height, 0, width, height));
    g2.setPaint(Color.red);
    g2.fill(polygon);
    ...
}


SegmentArrangements

There is a problem with flickering on resize as it repaints and this could be solved using double-buffering, which I'll write about later.

Thursday, 13 February 2014

2 Guns and The Yards

I seem to have been watching a lot of films with Mark Wahlberg in them recently. Previously there was the cops-n-crims drama We Own The Night, and now there's these two films. Firstly, The Yards, through the LoveFilm Instants streaming service.

Fresh out of jail, having taken the rap for his friends, Leo (Wahlberg) tries to get a job at the local train repair yard and gets taken under the wing of corrupt fixer Willie Gutierrez (Joaquin Phoenix) and his boss, and Leo's uncle, Frank Olchin (James Caan).


Made by the same director as We Own The Night, and with the same lead actors, the results are pretty much the same. Phoenix dominates as the corrupt and amoral Gutierrez, increasingly desperate as his plans go awry. Caan gives as good as he gets and brings a certain gravitas that only a man who's played opposite Pacino in the Godfather can. Charlize Theron is a surprise though, almost unrecognisable in what must have been, like Wahlberg, one of her first films. Wahlberg also looks young and is outclassed by the rest of the cast, but this was early in his career and you can see, looking at his later films, that he's improved, probably by knowing what roles he can't do as much as what he can.

Speaking of which, I watched one of his latest films, 2 Guns with Denzel Washington. Two agents, Bobby Trench (Washington) and Mike "Stig" Stigman (Wahlberg), unaware of each others true role, rob a bank to implicate a Mexican drugs baron Papi Greco (Edward James Olmos) and end up stealing $43 million belonging to the CIA.


A more-than-decent action film, with a fair amount of genial banter between the two leads. The plot is above average as well, with enough double crosses to make sure you don't take it for granted. The only thing which lets the whole thing down is the support, with Olmos looking like he can't wait for the cheque to arrive and Bill Paxton trying to be a mean CIA agent. Paula Patton is also underused as the love interest, but this is basically a buddy movie with a few twists and lots of bangs and crashes. Wahlberg takes to his role rather well, but is somewhat outclassed by Washington, as you'd expect (he's better than Sly, though). Overall, pretty good and a superior pizza movie.

Friday, 7 February 2014

We Own The Night

A crime thriller from a few years ago. In the late 1980's, night club owner Bobby Green (Joaquin Phoenix) gets embroiled in a struggle between Russian drug dealers and the cops, represented by his brother (Mark Wahlberg) and his father (Robert Duvall).


A good story, if a bit by the numbers, and somewhat unevenly paced. Phoenix is good, but the supporting cast is underused, especially Duvall and Eva Mendes as Green's girlfriend. However, it makes for a better than average pizza movie.

Wreck-it Ralph

An homage to the arcade games of our youth. Wreck-it Ralph, a villain in an old arcade game, realises how unappreciated he is by the other characters in the game and decides to earn their respect by winning a medal.


An entertaining little film, with one or two twists to make the trip worthwhile. It does seem a bit confused at who it's aimed at, though. The plot and characters are really for children (12-year olds at most), but who of that age plays arcade games?

Still, the real joy is seeing arcade characters such as Q-Bert and Pacman "off-duty" in 3D. Recommended, but better for children, of whatever age.

Monday, 3 February 2014

Bllt T Th Hd

(Sorry, that should be "Bullet to the Head": watching Sly for any length of time does that to you). From my LoveFilm subscription, this is a Crime\Buddy movie\whatever. Double-crossed by his employers, hitman "Bobo" Bonomo (seriously) seeks revenge with the help of a cop (Sung Kang).


Actually, if you can switch off the part of your brain that thinks Sly ought to be able to act a little by now, it's not a half-bad pizza movie. Sly is more than ably supported by the rest of the cast, especially Jason Momoa as the villain showing Sly how it's done, and Sarah Shahi as his daughter, but Christian Slater is wasted as a corrupt lawyer. Switch that part of your brain back on, though, and you can see it should have been someone else's movie.

Saturday, 1 February 2014

The Lone Ranger

Through my LoveFilm subscription, after his brother is killed in an ambush, and left for dead, John Reid (Armie Hammer) seeks revenge with the help of Tonto (Johnny Depp), a Commanche outcast.


A superior pizza movie, Depp is a likeable and sympathetic Tonto, unrecognisable in old age, and is well supported, especially by William Fitchner giving it both barrels as the despicable Butch Cavendish, but also by Hammer, as the rube transformed into a western hero, Tom Wilkinson and Helena Bonham Carter. The film isn't too overwheled by the special effects and the plot zips along, so why it wasn't a box-office success I don't know. Maybe it was a Depp too far for some people. As the reporter at the end of "The Man Who Shot Liberty Valance" says, "This is the West, sir: when the legend becomes fact, print the legend!".

The Lego Movie

Seems like Lego have made their own movie and tied in the latest min-figs series:


A barista and an executive-type with amazing hair.

The movie seems a little weird:

Friday, 31 January 2014

The Killing of a Chinese Bookie

An avante garde thriller, directed by John Cassavetes, from the 1970's. A night club owner Cosmo Vittelli (Ben Gazzara), in debt to gangsters, is asked to murder someone else who owes them money.


I can't really recommend the film to anyone much: Vittelli owns possibly the most awful night club I've ever seen, everyone channelling Bertolt Brecht (I actually fast-forwarded through the worst bits, pretty much all of them), although the thriller parts are handled well enough. Apparently, it was significantly cut on release and still bombed.

As an aside, when John Cassavetes died in the 1980's, 2000AD commemorated the event by issuing a Judge Dredd story (Issue No. 627) in the style of the director called "John Cassavetes is Dead", about an old man who's arrested for collecting newspapers.

Wednesday, 29 January 2014

A Canterbury Tale

This is an obscure Powell and Pressburger film from the 1940's, via my LoveFilm subscription. A G.I. Sergent, his British counterpart and a Land Army girl try to solve the mysterious attacks of the "Glueman" in a Kent village.


The film is less about the mystery of who is attacking young women by pouring glue on their hair and more about the effect the war is having on the individuals and the country at the time (Canterbury was bombed in 1943 as part of the so-called Baedeker raids). It's also a big slice of nostalgia, showing a world that was fast disappearing even before the war.

Sunday, 19 January 2014

Dead Man Down and The Numbers Station

Two films from my LoveFilm subscription. The first is a spy thriller with John Cusack and Liam Cunningham. After failing during an assassination, burnt-out CIA agent Emerson (Cusack) is sent to guard a cipher clerk at a remote radio transmission station.


Although the film has a good premise, it lacks substance. Cusack is good enough, and he has good support from Malin Åkerman and Cunnigham, but there's the feeling that there should have been a proper adversary for him, although the limited budget doesn't really help. An opportunity missed.

The second film is a rather good revenge thriller starring Colin Farrell. The vengeance of a criminal, "Victor" (Farrell), against his fellow gang members is jeopardised by his involvement with a neighbour.


Although the film promises to be quite bleak, and even run-of-the-mill, it's raised by the unlikely and awkward romance between Victor and Beatrice (Noomi Rapace), and good support from Isabelle Huppert and Dominic Cooper. Recommended.

Sunday, 12 January 2014

Codes and Ciphers - Cicada 3301

Most of my interest in cryptography is fairly light, more along the lines of general theory and a few easy algorithms, but there is something more serious afoot in th' Internet. It's known as the Cicada 3301 problem, an annual competition, or rather challenge, to the best of the best to crack a series of interlinked cryptography and stenography puzzles. This years puzzle (blogged about by one of the solvers) reads like some kind of techno-thriller without any characters.

The idea seems to be that when someone finds a solution, they are then given instructions on how to post it and an address for a formal interview. There's speculation that it's a convoluted recruitment process for a government agency (NSA? GCHQ?) or the commercial equivalent.

Monday, 6 January 2014

Goon

This is an ice hockey film through the LoveFilm Instant service. Doug Glatt, a bouncer at a local bar, attends an ice hockey game with his friend and accidently gets involved in a fight with one of the players, resulting in him being recruited as an "enforcer" (someone who's job is to wade in when a fight starts and lay out the opposition, protecting the better players from getting hurt).


Based on a true story, it's Forrest Gump meets Slapshot. Seann William Scott is suitably monosylabic as Glatt and Liev Schreiber enjoys himself as Glatt's nemesis, Ross "The Boss" Rhea, but the plot is pretty much the trailer, so it compares badly to either of the other two films. An average pizza move, but perhaps more meaningful if you like ice hockey.

Saturday, 4 January 2014

The Place Beyond The Pines

Through the LoveFilm Instant service, this is a story of two men, the crime that joins them, and the consequences for both them and their sons.


An unusual crime drama, this is three stories told one after the other. The first is about circus motorbike rider Luke Glanton (Ryan Gosling) who, on finding he has a son, takes up robbing banks in a misguided attempt to support the boy and his mother Romina (Eva Mendes). He is finally cornered by policeman Avery Cross (Bradley Cooper) and the second story is what happens to Cross afterwards when he discovers police corruption in the wake of the confrontation. The third story is about their sons who encounter each other fifteen years later and discover what happened.

It's quite a long film, which is hardly surprising given the content, and it does drag a little in places. Gosling does his best as the troubled Glanton, but he can only play one note and that's getting a bit tiresome now. Bradley Cooper does better as the principled, but ambitious, Cross, and the support is good, if somewhat muted. All-in-all a good movie, but requiring some patience, especially at the end.

Deadfall

Another through my LoveFilm subscription, this is a suitably chilly crime story. After their escape from a casino heist has gone wrong, siblings Addison (Eric Bana) and Lisa (Olivia Wilde) split up to make their way to the Canadian border, only to meet up accidentally at someones Thanksgiving dinner.


Not a bad little thriller, with a good cast (notably Sissy Spacek and Kris Kristofferson), but the plot is a bit thin and the dialogue could do with a bit of sharpening up. Good pizza movie, though, and much better than Killing Them Softly.

Cloud Atlas

Through my LoveFilm subscription, this is the adaption of the book by David Mitchell. Six interlinking stories are told interleaved: the journal of an 19th Century man on an Pacific ocean journey; a young composer in the 1930's trying to work for an aged genius; a 1970's journalist investigating the death of a nuclear scientist; a present-day publisher trying to escape from a care home; a recently freed clone in the 22nd century; a primitive goat-herder in a post-apocalyptic future.


I read the book a while ago and it's probably best that you do in order to enjoy the film, or at least make sense of it. To be able to translate such a conceptually complex book into a film is quite an achievement, and it almost works. The visual effects are quite stunning and there must be an Oscar somewhere for the best make-up: Tom Hanks, Hugo Weaving and Hugh Grant are unrecognisable in some of their roles. Both the main and supporting cast are top drawer, especially Jim Broadbent, but what brings the film down, as in the book, is trying to link disparate stories together: it's too flimsy. Still, the film is worth watching.

Friday, 3 January 2014

RED 2 - Getting the Band Back Together

The first film of the new year is the sequel to the comedy\thriller adaption of local hero Warren Ellis' comic book. Frank Moses (Bruce Willis) is trying to settle down with his new girlfriend Sarah (Mary-Louise Parker), but his former life intrudes in the form of a mad scientist (Anthony Hopkins) and a foxy counter-intelligence agent (Catherine Zeta-Jones).


While not quite as good as the original film, this is an entertaining two hours with lots of bangs and crashes. Willis plays to his strengths; Parker is her usual sparky self, especially when confronted with Zeta-Jones as Frank's former flame; the supporting cast is good, with Mirren and Cox enjoying themselves again, John Malkovich typecasting and Hopkins trying not to be Hanibal Lecter. Byung-hun Lee is also good as Frank's supposed nemesis, and Neal McDonough takes a break from Mob City to be a ruthless government agent. The plot lacks a little substance and the dialog could have done with sharpening, but, as sequels go, it isn't nearly as bad as the Expandables 2.

McDonough is also in The Prototype, a thriller based on the notion of the singularity, a concept talked about by the London Futurists quite a bit.


Looks like fun!

Wednesday, 1 January 2014

True Grit

Happy New Year, everybody.

While seeing in the New Year with my Aunt and Uncle in the wild and wooly North West, I brought over the remake of True Grit to watch. Fourteen year old Mattie Ross (Hailee Steinfeld) hires aged Federal Marshal Reuben "Rooster" Cogburn (Jeff Bridges) to bring her father's killer to justice:


Although the original is considered a classic, I was never that enamoured of it. This improves on it slightly, and definitely has the weirdness of a Coen brother's movie, which can be a little arresting in places, although I imagine it stays very true to the book. The support is good, too, if a little underused (with the exception of Matt Damon reprising Glen Campbell's role as the Texas Ranger LeBoeuf). Not a bad little pizza movie, but requiring a little patience.

Wednesday, 25 December 2013

Mud - A Tale from the Riverbank

Merry Christmas, everybody.

An excellent film through my LoveFilm subscription, a modern day Tom Sawyer and Huckleberry Finn, Ellis and his friend Neckbone (Tye Sheridan and Jacob Lofland) find someone living in an abandoned boat they had hoped to take for themselves.


A story of love, fate and growing up, Matthew McConaughey shines as the troubled and desperate Mud. The plot moves at a brisk pace, the dialogue sounds great, and the supporting characters are well played, especially Reese Witherspoon as Mud's girlfriend and Sam Shepard as his father figure. However, this is really the tale of Ellis as he struggles to figure out a complex and dangerous adult world. Very recommended and I wouldn't be surprised if it's in the running for best film or screenplay at the Oscars.

Monday, 23 December 2013

Now You see Me

Through LoveFilm, this is a nice little caper film. Four illusionists (Jesse Eisenberg, Mark Ruffalo, Woody Harrelson and Isla Fisher) are brought together to stage the ultimate act of their careers, but a much grander show is being played out.


It's a pretty good film, with a good cast (Michael Caine and Morgan Freeman supporting) and a reasonable plot, if a little preposterous, plus the magic tricks are imaginitive. A good, if undemanding, pizza movie.

Wednesday, 18 December 2013

Killing Them Softly

Via my LoveFilm subscription, this is an adaption of another novel by the author who wrote The Friends of Eddie Coyle. After two small-time crooks rob a poker game, hitman Jackie Cogan (Brad Pitt) is tasked to sort out the problem.


If Samuel Beckett decided to write the screeplay for a crime film and got Andrei Tarkovsky or Ingmar Bergman to direct it, you'd end up with something like this. I suppose it's meant to be a black comedy, and it is funny in places, but the bulk of it is deadly dull, weary even. In fact, I'd say that it's better to watch the trailer: those are the best bits. Not recommended.

Friday, 13 December 2013

Gangster Squad

As part of my LoveFilm subscription, I watched this merry little cops-and-gangsters tale centred around Mickey Cohen (Sean Penn). John O'Mara (Josh Brolin) is tasked by L.A. Police chief Bill Parker (Nick Nolte) to take down Cohen and his gang.


What might otherwise have been a run-of-the-mill, and more violent, Untouchables clone is enhanced by a half-decent plot and good supporting cast. It's Penn and Brolin's movie, though, and you can feel every punch in the final showdown as they take each other apart. A decent, if undemanding, pizza movie.

Mob City, a series just started in the U.S., covers much the same story, but seems to have a more ambiguous tone:


A few years ago, I read (or tried to read: it's fairly heavy going) City of Quartz, a social, political and cultural history of Los Angeles by Mike Davis.


Despite it's style, it's a fascinating book on a fascinating subject.

P99:L8:W11 P241:L35:W1 P225:L18:W6
P163:L11:W13 P60:L26:W9 P130:L2:W2

Sunday, 8 December 2013

Oxfam Sunday - Wombats and Dodgy £20's

I went up onto the top deck today to take over from Lautaro (it's a Spanish name, but he's a Scotsman), and he'd left on the CD player a reasonably decent compilation, in which was this catchy number from those lovable scousers, The Wombats:


It was a fairly uneventful shift: people seem to be concentrating on getting presents for Christmas and leaving us except for cards and wrapping paper.
I'd run out of £10's at one point and asked Mark to bring any up. He examined one of the £20's in the till and started holding it up to the light. He explained that he had a conversation with one of the tellers at the bank and he got a few tips on how to spot a fake. I compared the one he was looking at with another and they were almost identical, but there is a watermarked £20 which was slightly off in the "fake" note:


If it is a fake, it's a good one! It passed the marking test with our security pen.

I also got a Penguin Special from John, The Hidden Persuaders by Vance Packard:


It's about advertising, S185, published in 1960.

Saturday, 7 December 2013

Dragonmeet 2013

For a change of pace, I went to the games festival Dragonmeet at Kensington Town Hall. There were the usual stalls, including Chessex, the dice makers:


Yummy!

I indulged a little and bought a card game I've played before, Love Letter by Aldaric Entertainment:


It's a lovely little game, very easy to play.

I only managed to play one game while there, Camelot by Wotan Games. They were introducing the game and it was delightful to play. It's a tile laying game, interior designing for King Arthur.


The designer, Julian, is the chap in the middle.

All-in-all a nice day out.

Thursday, 5 December 2013

Parker

No, nothing to do with Thunderbirds.

After being double crossed and left for dead following a daring robbery, thief and robber Parker (Jason Statham) plots his revenge.


What could have been an ingenious crime and revenge thriller is let down by the meandering plot, mediocre direction and Statham's lack of enthusiasm, as well as being outclassed by supporting actors like Nick Nolte, Michael Chiklis and Wendel Pierce, who are woefully underused. I'd like to say it's better than nothing, but it isn't. Watch something else.