Showing posts with label review. Show all posts
Showing posts with label review. Show all posts

Monday, June 3, 2013

The Sarah Connor Chronicles

This is a TV series based on the Terminator films. It is set after Terminator 2 and focuses on Sarah’s struggle to bring John up to be the future leader of humanity and to keep him safe from SkyNet’s continuing efforts to kill him, while also attempting to prevent SkyNet’s invention by changing key events in the present. They are joined by a reprogrammed Terminator, called Cameron, played by Summer Glau.

They made two series, with a total of 31 40-minute episodes so there is plenty to watch. On the down side it doesn’t look like they will make any more, so the story just runs out without conclusion. On the up side, Summer Glau makes a fantastic Terminator. Throughout the series there are constant minor things that she does that indicate that her character is more than just a robot killing machine, such as taking up dancing and helping a cancer patient. It seems likely to me that the plot would develop until they came to the realisation that preventing SkyNet from being built isn’t going to work – the time travel thing makes it too simple to sidestep and even if you succeed, humanity would just redevelop something similar a little later. The real solution is to convince SkyNet (or some similar AI faction) that humanity can be co-existed with and doesn’t need to be exterminated. I think that this is where John & Cameron’s relationship would have gone if the series had continued.

The rest of the cast are also excellent and there are many mini-plots with flashbacks to the future war providing additional depth to the main story. Religion gets the usual free ride, as ex-FBI agent Ellison “teaches” a young AI, called John Henry, about the value of human life, although there were hints that this wasn’t necessarily being accepted uncritically and this could have developed had the show continued. There was also a tendency to present Cameron as sexy-Terminator, which was disappointing. As an AI combat chassis specialising in infiltration there was plenty of scope for playing down the sexy and many fashion-is-bullshit-anyway gags.

Friday, August 13, 2010

ASP.Net MVC

Here is a brief summary of the first chapter of Professional ASP.NET MVC 1.0, which is freely available to download from http://tinyurl.com/aspnetmvc. Even though it’s only the first chapter, it’s a walkthrough of a worked example and, at ~180 pages, covers a lot of ground. It’s also available for Kindle and an updated version for MVC 2.

The core of it is the model, view & controller pattern. While this isn’t a new idea, it’s still an improvement on the traditional Forms approach. The Model represents the data objects. Views are screens/pages, etc. Controllers process user requests (via URLs for example) by performing actions in the model and responding with an updated view, for example.

Applying the MVC pattern means the framework can provide built-in support for additional features, such as:

  • Routing – controls how URLs map to controllers. This makes it easy to create and maintain Search Engine Optimised (SEO or ‘Google friendly’) URLs.
  • ActionLink & RouteLink helper methods – creates URLs appropriate for the controllers. Avoids manually generating anchor tags. Can also do redirects.
  • Authentication & Authorisation – can decorate the Controllers’ action methods with role names and have the framework enforce security.

Perhaps the biggest benefit is that it’s simpler to unit test due to the greater separation of concerns – the model abstracts the database access and, if mocked, the views and controllers can be tested without a database actually being present. The final part of the chapter provides a walk through of this using dependency injection and Moq.

Early in the chapter we get an introduction to Linq To Sql, an Object Relational Mapping (ORM) tool. This can be used to quickly create an object model from SQL tables.

Some other things demonstrated include:

  • Scaffolding – quickly create basic default views (CRUD pages, etc) from templates (.aspx files).
  • Extension methods – add a method to a class without actually altering the class.
  • ViewModel classes – helper classes that expose the parts of the model needed by a specific view. Prevents exposing the entire model to every view. The ViewModel is constructed by the controller from the model.
  • Master pages & partial views – master pages allow the site’s shell to be specified once, rather than repeated on each page. Partial views are for sharing bits of views and for breaking UI things up into simpler parts.
  • Pagination – how to retrieve subsets of large result sets.
  • AJAXjQuery & JSON – demonstrates how to make a lightweight call to the website using AJAX; uses a simple jQuery text-animation effect; and sends data to a page in JSON format.

Overall, I recommend it. While many of the subjects covered will each take a further book to cover in any depth, the chapter does provide an excellent overview.

Thursday, July 29, 2010

Dia - free diagram drawing utility (like Visio)

Dia is a diagramming tool, a bit like Microsoft Visio, but free. You create a diagram out of shapes and lines and if you move shapes around it automatically keeps all the lines pointing to the right shapes.

In the following diagram I've just used the basic box shape, basic line connector and some text objects (I'm using version 0.97.1). Dia comes with a bunch of other pre-created shapes for drawing UML diagrams, network diagrams, etc.


The text objects are also connected to the shapes and also move around automatically. It took me a while to figure this out as dragging a text object onto a shape's connection point didn't appear to 'latch-on' as I expected it to, but this is just a wrinkle of the UI - let go and the point should change from green to red to show it's bound to a shape. The text objects will also bind to connection points on lines and you can bind both a text object and a line-end to the same connection point if you want.

A little time-saver: if you click on a connection point when adding a line or text object, then the line or text object will be created and bound to that point.

I've bound the line-ends to the connection points in the centre of the boxes (not shown). The lines automatically move around the box edges so you don't have to alter the connection point bindings if you move shapes around.

I tried putting the boxes and lines on different layers. While this worked, I got errors when I reloaded the diagram and all the objects were all disconnected. I've moved them all back to a single layer for now. Hopefully this will be addressed in a future release.

Dia can also auto-scale the diagram to fit a page. Use File > Page Setup and use Fit To 1 by 1, for example. Check the paper size and orientation too. Note that if you want to export the diagram to an image format later you might need to swap back to specifying a scaling otherwise the image can come out a little 'blocky'.