Friday, April 30, 2010

Safely transfering files from a Linux computer to another

I wanted to build a script to copy some files from a computer to another. This can be done using a few utilities like:
  • nc - for stream network transfer
  • tar - for clumping all files together
  • gpg - for encryption


Here is the quick and dirty version.
On the receiving computer:
nc -dl _MyPort_ | gpg -d -q --no-mdc-warning --passphrase _MyPassword_ | tar -xjC _DownloadFolder_

On the sending computer:
tar -cj -C _Folder1_ _File1_ -C _Folder2_ _File2_ -C _Folder3_ _File3_ _File4_ _File5_ | gpg --passphrase _MyPassword_ -c | nc _MyIP_ _MyPort_

In other words:
On the receiving side nc is listening on a specific port for a stream that will be passed through gpg and decrypted, then passed to tar which will decompress it and split it into different files in a specified download folder.
On the sending site the files to be transferred are clumped and compressed into a stream by tar passed through gpg and encrypted, then sent to a specified IP and port via nc.

nc and tar are standard Linux utilities. gpg must be downloaded and installed.

The scripts themselves are more complicated, but the gist of it is in here.

Monday, April 26, 2010

Pro JavaScript Design Patterns by Ross Harmes

The book started really nice, at a beginner to medium level with which I could not feel neither embarrassed nor overwhelmed. The first chapter was about the expressiveness of Javascript and how different styles of programming could be employed to achieve the same goals. This part of it I would have liked to see expanded in a book of its own, with code examples and everything.

The second chapter was also interesting, comparing the interface style of programming with the options available inside Javascript as well as giving some real life solutions. Personally, I didn't think the solutions were valid, as writing the interface as comments and trying to enforce the interface inside methods and getters/setters feels cumbersome and "unJavascriptish" to me.

The third chapter, Encapsulation and Information Hiding, described object creation, private, privileged (not protected!) and public members, while the fourth was dedicated to inheritance. All these are great reading for a Javascript programmer, as they might teach one or two new things.

From then on, 13 chapters described various software patterns and their application in Javascript. Alas, since this was the explicit purpose of the book, I can't say I enjoyed that part of the book. It felt like any other rehashing of the original GoF book, only with the syntax changed. Well, maybe not quite so bad, but it lacked a consistency and a touch of the writer's personality that makes books easy to read and to remember.

That being said, the technical part was top notch and the structure of each chapter made it easy to understand everything in them. The software patterns described were: Singleton, Chaining, Factory, Bridge, Composite, Facade, Adapter, Decorator, Flyweight, Proxy, Observer, Command and Chain of Responsibility.

Overall, a nice book for reference, but not one that I would call memorable. An easy read and also an easy browse, since one can pass quickly through the book and still understand what it is all about.

Saturday, April 17, 2010

TV series I have been watching - part 6

Anyone visiting my imDb comments page would notice that I haven't been writing much there and that is because I have been watching a lot of TV series and those I do not comment on imDb. But I do occasionally list the series I have been watching and a small synopsis on the blog. Here is the latest "TV series I have been watching" entry.
  • Virtuality - a show about a state of the art spaceship exploring the Solar System, where the crew is being entertained by a complex virtual reality machine. Which then starts having thoughts of its own. The idea was pretty promising, reminding me of movies like Space Odyssey and books like Frank Herbert's Pandora. Alas, it quickly turned into a jumbled, psychotic, pseudo spiritual mess. No wonder the show was cancelled after the pilot
  • Defying Gravity - the sister show for Virtuality, in the Hollywood tradition of trying two obnoxiously similar ideas at the same time so that people focus on similarities and not on how much better they could have been. Same spaceship exploring the Solar System, but this time they are actually on a secret mission as well to collect pieces of an alien that are spread on each of the major teluric planets. The alien is like a small god and soon enough the entire show is about the faith of people and how they feel, etc. It still could have been saved, but in this Lost day and age, people must be vaguely religious, things must never make any sense and the sheer volume of melodrama must suffocate. It survived a first season, but it was cancelled before a second one
  • Caprica - spin-off series from Battlestar Galactica 2003. It explains how the twisted AI of the Cylons appeared, in a world divided by religious fervour, terrorism and virtual reality. I kind of like it, although it is clear that the ending can't possibly be good. And since the start is not brilliant as BSG's was, I feel conflicted about recommending it. It is is clearly sci-fi, though.
  • Doctor Who 2005 - Season 4 ended with the Doctor, played by David Tennant, dying and regenerating. Season 5 has begun with a new Doctor and a new companion. It is consistently weird, low budget and innovative. The new girl companion is a fiery Scottish redhead who is ocasionally almost as hot as Billie Piper, so I can't complain :)
  • Eureka - a show about a secret US town that hosts the most brilliant (and wacky) minds of the country. The series is a light sci-fi comedy so I guess it takes a little from both crowds and survives. The fourth season is supposed to start airing on the 9th of July, with 22 episodes, two of them... musicals. And I am serious here.
  • Numb3rs - a series about a brilliant mathematician applying science to help his FBI brother. The show has been consistently nice, even if the math involved has dwindled to the point of exctinction in favor of the procedural police work Americans love so much. It is very likely that the sixth season will also be the last one. Too bad.
  • House MD - don't ask me why I watch it. It started as an interesting medical drama only to turn into a farce. I really wish for a show that actually shows good, real work, not the feelings of the people involved. The small amount of medicine shown is beginning to sound more and more surreal
  • Criminal Minds - about an FBI unit that catches serial killers by profiling their behaviour and catching them based on that. I like the show, but not too much. Besides, it can't last, the same thing is done by Google, and they just do it better ;-)
  • South Park - this animated series has reached the 200th episode (the fifth in the fourteenth season), a two parter, set on making fun of everybody they ever made fun of in the show, which is not an easy task. The episodes usually concern a current issue, mixed up with a famous movie and parodied to the extreme. The jokes are smart, even if sometimes a bit crass, and I enjoy it immensly
  • Dexter - yay! A really cool HBO show about a serial killer working for the police and killing other serial killers. The characters and scope of the show have evolved in unexpected directions, digressing from the books, which, in this case, is a good thing, since the script is smart and catchy, while the books mostly sucked. I can hardly wait for season 5, after a great season 4 finale. I am pretty curious to see how the script writers will go on, since the next book in the Dexter series is not even out yet.
  • Big Love - I love Bill Paxton. He can play just about anything, including a mormon guy with three wives, practicing "the Principle" and also trying to deal with the society disaproval of it. Unfortunately it turned too much into a "Desperate Housewives" type of show, with useless drama and artificial problems. I am waiting for season 5
  • Fringe - getting worse and worse by the episode, this is the new X-Files and it is created by the antichrist, J.J. Abrams, himself. Even my wife stopped watching it.
  • Heroes - watching heroes is like playing tower defense games. It makes no sense, but you do it anyway. Waiting for season 5
  • Legend of the Seeker - this fantasy series is turning, alas, more and more into Hercule+Xena=Love. Based on the Sword of Truth series, which I have no read, it has some very cool episodes drowning amongst many mediocre or completely bad ones. It's fun, but degrading quickly
  • True Blood - another cool HBO show, again based on some books and diverting from the story there, again coming up on top from the original work. HBO series are really worth watching. Waiting for season 3
  • Californication - a show about a grumpy and sexy writer, humping everything with breasts and also trying to keep alive the relation with his former wife and daughter which he loves. A really good show in the first season, the quality of the show is diminishing by the season. I still have high hopes for season 4, planned to start airing in August
  • Breaking Bad - a show that is at the same time harsh, funny, horrible and good, a dark comedy about a chemistry professor that enters the crystal meth manufacturing business because he has cancer and wants to leave his family something. Season 3 just began and I am always sad when an episode ends
  • Secret Diary of a Call Girl - sexy Billie Piper in the role of prostitute/writer/blogger Belle de Jour. Yummy!
  • Entourage - another great show! Following a group of friends trying to make it in Hollywood, with ups and downs, but always a feeling of healthy optimism, even at the worst of times. It really feels good watching the series. Series 7 is supposed to start in June
  • Stargate Universe - this show is to SG1 what Deep Space Nine was for Next Generation: a dark, politically and humanly charged adventure. I really hope the ratings will be high, because it started as a pretty smart sci-fi series and I would really hate to see it cancelled or mauled by the marketing
  • Flash Forward - again weird and unexplainable shit that makes people start thinking of god and everything revolves around the same people and some of them are FBI. A mash-up of all the shows of the genre, it is a confused mess that I hope will get ended soon
  • Eastwick - Rebecca Romjin and Jaime Ray Newman and some other chick star as the witches of Eastwick, with great Paul Gross as the devil. Unfortunately, even bountifull sexiness and Canadian charm could not save this show from becoming "Desperated" and becoming so stupid it had to be cancelled
  • Torchwood - spin-off from Doctor Who, it's still weird, but a little more action packed. Not much, though. Season 3 was in fact a 5 part miniseries, used to champion the unveiling of BBC America. Season 4 is supposed to air in 2011
  • The Sarah Jane Adventures - another Doctor Who spinoff, it is oriented towards children and, even if it is fun, it is really more like a fairy tail
  • 10 things I hate about you - a show about a single father raising two daughters, one being the gloomy smart one, while the other the popular air head. The pilot was so bad that I decided not to watch it.
  • Bored to Death - another "personally cancelled" series about a guy who pretends to be a private eye out of boredom. I just stopped watching.
  • The Guild - this is not a TV show, but a web show. It is partially sponsored by Microsoft and it is about a group of MMO players and their weird group dynamic. The lead character is a really sexy chick, which makes about 60% of the reasons I am watching this. There are episodes that are hilarious, though.
  • The Forgotten - I like Christian Slater, but this show just didn't feel right. A group of do-gooders volunteer to help the police solve old cases where the victim's identity could not be determined. I don't think there will be a second season
  • V 2009 - aliens come to Earth, all filled with good intentions... or are they? Silly script, but then again, the original wasn't a gem either. Sexy actresses in it, though, so who knows? :)
  • Paradox - the Welsh version of Flash Forward, it kind of made more sense, if one ignores the premise of the show completely :) It only had 5 episodes and it wasn't received very well. Doubtful that it will see a second season, but still better than Flash Forward
  • Men Of A Certain AgeScott Bakula, Ray Romano and Andre Braugher as midlife crisis best friends. It is a smart and funny show, I hope it continues to be so in season 2
  • Weeds - another show about a drug manufacturer, this time it involves marijuana and the person in question is a woman, played by the so very hot Mary-Louise Parker. The first seasons were really cool, but in seasons 4 and 5, it became sick with "Desperitits" and so it started getting worse. I am waiting for season 6, maybe they can came back to the surface with it. More light than Breaking Bad, but still pretty cool
  • The Good Wife - it's a lawyer show. Not much to say about it, the main character is a wife getting a job as an attorney when her husband is (more or less wrongly) imprisoned. I like the show and the main actress (Julianna Margulies)
  • Damages - another lawyer show, this time a bit tougher, with a touch of "The Devil Wears Prada". We watched the first episode and we've decided to not watch it. My work colleagues like it, though


That is it, folks! The bottom line is that while more and more shows get infected by the pandemic of Lost and Desperate Housewives, there are still others that fight the illness and fight for quality, a major player in this direction being HBO, which started sucking as a television broadcaster, but makes consistently good TV shows.

Thursday, April 15, 2010

Personal experience with Javascript and jQuery

I have been working on a jQuery based control library for a few months and today I replaced the embedded 1.3.2 version with the 1.4.2 version. I immediately noticed an increase in performance. Before, the profilers were screaming at the CLASS function, immediately followed by css. Now, the CLASS function seems to work 10 times faster. Some resizing script that I was using and was kind of sluggish now behaved all perky. I personally believe John Resig did some good things in the new 1.4 jQuery release.

Also, trying to optimize javascript code and having attended a Javascript training recently, I reached some conclusions that I want to formalize and place in a blog post, but just in case I don't find the resources, here are some quick pointers:
  • Javascript has function scope and closure support, which means that a variable defined in a function will be accessed faster than one that is outside or global, also that any function you create inside another function remembers all the variables declared in that scope. You should declare local variables in init functions and also declare local functions that use those variables, essentially guaranteeing faster access and that no one will overwrite them accidentally. Also, cache in this way the global variables and functions that are commonly used, like document
  • Cache the jQuery objects, not the elements. Not only it reduces the overhead of recreating them, but they "track" the underlying elements even if one removes/adds/modifies them.
  • Use the context format find method of the jQuery selector to get to child controls.
  • There are a lot of free profiling tools for javascript: dynaTrace Ajax is pretty cool, but also tools like the IE8 developer toolbar profiler or the famous Firebug and its many addons. You should use a profiler to understand where your bottlenecks are, they might not be where you expect them to be.
  • Redrawing the DOM elements is an expensive operation and changing the style of an element has many side effects. You should check if the value you wish to change in the style of an element is not already set. For example jQuery has the outerWidth and outerHeight functions that should return the same sizes as the value you pass to width and height (at least for divs with overflow not 'visible')


Here is some code that demonstrates the above rules:

/* set an element to be of the same size as another element */
function sameSize(base,target) {
// jQuery and cache
base=$(base);
target=$(target);
// local variable will be remembered
// and accessed faster
var lastSize={
width:-1,
height:-1
};
// local function will be private and also accessed faster
function checkSize() {
// get the outer size of the base element
var baseSize={
width:base.outerWidth(),
height:base.outerHeight()
};
// compare it with lastSize
// do nothing if this size was handled before
// use the !== inequality for extra speed (no type conversion)
if (baseSize.width!==lastSize.width
||baseSize.height!==lastSize.height) {
// get both the declared and real size of the target element
var targetSize={
declaredWidth:target.css('width'),
declaredHeight:target.css('height'),
width:target.outerWidth(),
height:target.outerHeight()
};
// only change the size (and thus fire all sorts of events
// and layout refreshes) only if the size is not already
// declared as such or simply the same for other reasons
// like 100% layout in a common container
if ((targetSize.width!==baseSize.width
&&targetSize.declaredWidth!=baseSize.width+'px')
||(targetSize.height!==baseSize.height
&&targetSize.declaredHeight!=baseSize.height+'px') {
// Javascript object notation comes in handy
// when using the css jQuery function
target.css(baseSize);
}
// cache the handled size
lastSize=baseSize;
}
}
// bind the function to any event you want to
// since it will only do anything if the size actually
// needs changing
base.bind('resize',checkSize);
$(window).bind('resize',checkSize);
setInterval(checkSize,1000);
}

/* faster getElementById */
// use a local anonymous function as a closure
(function(){
// cache the document in a private local variable
var d=document;
byId=function(id) {
return d.getElementById(id);
};
// a lot more code might come here, all using byId and accessing
// it faster since it is local to the closure
})();
/* you might think that this doesn't do much if no other code
in the closure, since byId would be a global function and just as
slow to be accessed, but remember that you only need to find the
function once, while document.getElementById needs to find document,
and then getElementById. And document is a large object. */

/* find the tables inside a div using the context syntax */
var div=$('#myDiv');
var childTables=$('table',div);

Weekend in Berlin

This blog post was a long time coming, but I was pretty busy and didn't have the time its writing deserved. My company was invited to a team building weekend in Berlin by our Dutch partner and so I went there last Thursday for about four days. Here are my impressions.

The first feeling that I got coming from the airport by bus was that Berlin is a real city. Not some bullshit tourist attraction, but a place where people live, work and have fun. The combination of factories in the periphery and the new and old styles of the buildings was very pleasing to my eyes. I was, however, convinced that we are at the very edge of the German capital city and so that explained both the "realness" and the small number of people and cars that I was seeing. I was quite a bit shocked to reach the hotel and having the feeling still firmly rooted in my psyche. The hotel, Berlin, Berlin, was somewhere in the southwest of the city, but as close to the center as to the outskirts. Where were the people, the cars, the chaos, the multitudes of banks and pharmacies, the angry honking, the infernal traffic and the tall buildings one comes to expect in a modern city?

Well, it appears that is something rare in Berlin, be it the East or the West side of it. A lot of people use bikes, on lanes that are both on the sidewalk and the car side, there are amazingly few cars and people don't seem to get angry very often. I heard only three honks my entire stay there. The streets are also pretty empty, be it weekend or work day, however the restaurants and public transportation stay active even beyond midnight. It is more of a cultural city, than an industrial one, but I still liked it :)

The buildings are rarely very tall, if one excludes the TV tower, the 200 meter construction that was supposed to show to the West the great technical skill of Eastern engineers. Since Berlin is built on a former marsh (hence the name, which comes from a Slavic word for swamp, not from the bear mascot of the city, which itself comes from Albert the Bear, member of House of Ascania) it might be the reason why Berlin has expanded more horizontally than vertically. It might explain also why the great communist engineers needed to secretly employ Swedish techs to help them out with the TV tower.

As I said, the bars and restaurants (of all nationalities and flavours) are open till very late. Some are a bit expensive (like 4 euro the cheapest beer and 8 euros for a cocktail in a bar we went to in the first evening) some are too cheap, like the Japanese sushi which is more expensive in Bucharest or a Turkish kebab that I took for 3 euros when exiting the above bar. When we left the bar they didn't have beer on tap anymore, we drank it all, and not because of huge excesses. So I asked the owner: "Are you kidding me? A bar in Germany without beer?". The poor guy glared at me for a second they retorted "We are not in Munich, we are in Berlin". It seems the capital of the country is not really characteristic for the whole of Germany. It makes me cringe in horror to wonder if people outside Romania judge the country based on anecdotal stories of provincial attitudes. Ouch!

You have to understand, there are a lot of Romanians who like to bash their own country, to dream of greener pastures right beyond the border or consider everything in Romania shit. I am not one of those people, I like being Romanian and I enjoy living in Bucharest, but frankly, after going to Berlin, I think I would enjoy living there more!

Also, it was a bit shocking for us to see that, after a certain hour, every street became adorned with young women dressed provocatively. Most of them were really hot, although the quality fluctuated wildly. It was amazing to see police cars passing by and ignoring the working girls. We noticed three especially beautiful girls and one of our group went to say hello, so they answered... in Romanian. Is it any wonder that I like living in Bucharest? :)

Anyway, speaking of girls, there were the rare cases of tall blue eyed blond German girls in the city (although one wonders if not every one of them was actually Polish or something), but the vast majority of women there are either immigrants or plain (to use a polite euphemism). What I found especially weird is that younger girls seemed to be fatter than the older ones. If my eyes got drawn by an attractive figure, it was immediately revealed that the person in question was above forty... or Asian.

People in Berlin understood English mostly, although there was a large portion of the serving staff that struggled with it. TV was voice dubbed in German on every channel, so I didn't find it surprising. Amazingly, I understood quite a lot of the language; I was afraid that my TV knowledge of German had vanished from my brain just as Bulgarian did, so I was pleasantly surprised by this.

There was a lot of sight seeing and history lessons from our guides. We went on a bicycle ride with an American woman with Asian roots in her genealogy and it was a bit ironic to get the explanations about Berlin's history from her. But she was cool. If you want history, just go on Wikipedia, though. Enough said, during war or occupation, Germans, English, French, Russians or Americans behaved in the same way: ugly, petty, disregarding the qualities we call "humanity" completely, ridiculously accusing each other of evil while perpetrating the exact same acts on all sides.

No pictures, as I did not bring my photo camera with me. I might use some from my colleagues, but I don't think pictures could do justice to the feeling of peace I got in the city of Berlin. I really liked it.

Wednesday, April 14, 2010

Controls collection cannot be modified revisited

A while ago I was writing about the annoying The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). error and how to fix it by using a PlaceHolder or another container to hold your code blocks you can resolve this.

But what if the ASPX code is not yours and you are only building the control? How can you get around the dreaded code blocks? First, let's try to understand the mechanism that renders the code blocks. When the markup code is read, a CodeDomTreeGenerator class is used to parse it. All DOM tree generators inherit from BaseTemplateCodeDomTreeGenerator which does the following: if the block read is a control, create the control and add it to the control collection, if it is a code block, generate a dynamic render method and use that. From that moment on, you can't change the control collection because (stupid, if you ask me) the render method has already been generated and it only knows about the controls it had then.

You can test if the ControlCollection object cannot be changed via the IsReadOnly property. If it is read only, code blocks have been added. Indeed, in the ControlCollection class, a private field is used to hold an error message and, if not null, it will be used as the exception message when trying to add or remove controls from the collection.

Are you in the mood for some insanity? Ok, let's unset the string via reflection, see what happens! Well, first of all, no error! You can manipulate the control collection at your leisure. The problem is that the render method is still the generated one. If you change the control collection weird stuff will happen, like not getting your control rendered or, if inserted or deleted, seeing controls rendered instead of others or being pushed out of the "rendering queue". So, what is we remove the render method as well? Then the normal Render mechanism will be used. That means that the code blocks will be completely ignored!

So, if you are a mean son of a bitch like myself, instead of begging junior programmers to never use code blocks or to encapsulate them at least, screw the controls so that they ignore that bad code. Not very smart, but oh, so mean :)

Here is a bit of code to remove the "readonlyness" of control collections:


public static class MSOAB
{
private static readonly FieldInfo _readOnlyErrorMsgFieldInfo =
typeof(ControlCollection).GetField("_readOnlyErrorMsg",
BindingFlags.Instance | BindingFlags.NonPublic);
private static readonly PropertyInfo _rareFieldsEnsuredPropertyInfo =
typeof(Control).GetProperty("RareFieldsEnsured",
BindingFlags.Instance | BindingFlags.NonPublic);

private static FieldInfo _renderMethodFieldInfo;

public static void FixReadOnlyControlCollection(Control control)
{
if (control.Controls.IsReadOnly)
{

_readOnlyErrorMsgFieldInfo.SetValue(control.Controls, null);
var rareFieldsEnsured = _rareFieldsEnsuredPropertyInfo.GetValue(control, new object[] { });
if (_renderMethodFieldInfo == null)
{
_renderMethodFieldInfo = rareFieldsEnsured.GetType().GetField("RenderMethod");
}
_renderMethodFieldInfo.SetValue(rareFieldsEnsured, null);
}
}
}

This isn't really tested except the basic functionality and I haven't used it in a production environment, but it was fun as it was. I hope you enjoyed it as well.

Tuesday, April 13, 2010

ASP.Net track focus during postback

Coincidence made it that this week people have asked me twice about how to preserve focus during postbacks, especially during auto postbacks. I didn't really know much about how ASP.Net does this other than building your own script, so I started investigating.

When you post back, there is a postback event reference that is used. The Page.ClientScript property, of the type ClientScriptManager, has a bunch of methods called GetPostBackEventReference which return different script strings for different options. The options are encapsulated into a PostBackOptions object which has, interestingly enough, a property called TrackFocus. Wow! Exactly what I wanted.

The problem comes when digging in the System.Web sources and seeing that no one actually sets this property. I did a bunch of code to add the script with the TrackFocus property and it seems it works. Not only does it preserve the focus before the postback, but also the scroll bars position. I tested in Internet Explorer, FireFox and Chrome and it worked on all.

So what is going on? Why does this feature, which I imagine is quite useful, seem only half done? And that since the era of .Net 2.0? I have no idea. I will post this method, applicable on TextBox controls, although I guess it could be applied on most if not all AutoPostback controls, that replaces the script for a normal AutoPostback with one that also preserves focus:

private void fixAutoPostBack(TextBox tb)
{
if (!tb.AutoPostBack)
return;
tb.AutoPostBack = false;
PostBackOptions options
= new PostBackOptions(tb, string.Empty)
{
TrackFocus = true,
AutoPostBack = true
};
if (tb.CausesValidation)
{
options.PerformValidation = true;
options.ValidationGroup = tb.ValidationGroup;
}
string onchange = string.Empty;
if (tb.HasAttributes)
{
onchange = tb.Attributes["onchange"];
if (!string.IsNullOrEmpty(onchange))
{
onchange = onchange.TrimEnd(';') + ";";
}
}
onchange += ClientScript
.GetPostBackEventReference(options, true);
tb.Attributes["onchange"] = onchange;
}

As you can see, the only thing I do differently from the normal AutoPostback code is to set TrackFocus to true.

Solution for _WidgetManager undefined error

I started using a script that shows me what javascript errors occur in my blog. I soon found out that there were about 10-20 errors each day, intermittently, the vast majority of them being '_WidgetManager is undefined'. I googled it, of course, only to discover that a lot of people had it, some fix was applied by Google and thus most of the articles on the web were completely unuseful.

Well, what seemed to happen is that some code was added at the end of the blog page, loading a js file, and if the js file was (for some weird reason) not loaded, the script following would throw an error. So I added my own script to create a fake _WidgetManager class just in case the script did not load.

Hoping it might help others, here is the script:
_WidgetInfo=function(){};
_WidgetManager={
_Init:function() {},
_SetPageActionUrl:function() {},
_SetDataContext:function() {},
_SetSystemMarkup:function() {},
_RegisterWidget:function() {}
};

Wednesday, April 07, 2010

Toll the Hounds, by Steven Erikson

Book coverThe eighth book in the Malazan Book of the Fallen series, Toll the Hounds was the worst, I think. First, Steven Erikson experimented with a narrator of sorts, all philosophical and moving the "frame" of the story with wise sounding words that actually sounded fake and convoluted like Kruppe's. Second of all, most of the characters started thinking deeply about all kinds of things that had no real relation to the story, all metaphorical and stuff. Third, the stories themselves were vague, disconnected or filled with "his words brought tears into his eyes" scenes. I swear, even Kallor sheds tears at one moment. The ending was a disappointment too, where the convergence of forces that we got used to in the series seems random and pointless. To top it all off, Fisher Kel Tath made his appearance, thus filling the book with bard poems.

As for the story itself... if you wanted closure on something previous, tough luck. Some new characters, some old ones die (including Hood, how cool is that?) most of the action happens in Darujhistan, while the rest is in Black Coral. No Crippled God at all! Also you may find Wiskeyjack fighting in Hood's army. Didn't they ascend? What is he doing there? Pointless battles abound (and I mean pointless, they are not even strategic, just an enumeration of people starting the fight and then, later on, finishing it. Most of the time the result is pretty much known beforehand, but the battle is honorable or something like that.

Mixed news about the ninth and tenth books in the series. First of all, the series ends! Yes, a huge book, with so many open ends and a great mythos, just ends, because the contract was for ten books. That is both brave and insane in the same time, although I suspect that future books will be scoped in the same universe, just not as part of the Malazan Book of the Fallen series. The books nine and ten will actually be a single two part story, with the ninth ending in a cliffhanger. Erikson apologized for this:

While I am, of course, not known for writing door-stopper tomes, the conclusion of The Malazan Book of the Fallen was, to my mind, always going to demand something more than modern bookbinding technology could accommodate. To date, I have avoided writing cliff-hangers, principally because as a reader I always hated having to wait to find out what happens. Alas, Dust of Dreams is the first half of a two-volume novel, to be concluded with The Crippled God. Accordingly, if you’re looking for resolutions to various story-threads, you won’t find them. Also, do note that there is no epilogue and, structurally, Dust of Dreams does not follow the traditional arc for a novel. To this, all I can ask of you is, please be patient. I know you can do it: after all, you have waited this long, haven't you?

The ninth book, Dust of Dreams, started cool, though, in a KChain Che'Malle city with a Matron giving a Destriant the task of finding a Mortal Sword and a Shield Anvil. The Destriant is human and the Matron is insane. Promising, huh? I was considering waiting for a year and reading both ending books, but how can I now?