Monday 27 February 2012

"Object moved to here" message in an empty page

I had to investigate a situation where a message of "Object moved to here", where "here" was a link, appeared in our ASP.Net application. First of all, we don't have that message in the app, it appears it is an internal message in ASP.Net, more exactly in HttpResponse.Redirect. It is a hardcoded HTML that is displayed as the response status code is set to 302 and the redirect location is set to the given URL. The browser is expected to move to the redirect location anyway, and the displayed message should be only a temporary thing. However, if the URL is empty, the browser does not go anywhere.

In conclusion, if you get to a webpage that has the following content:
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="[url]">here</a>.</h2>
</body></html>
then you are probably trying to Response.Redirect to an empty URL.

Tuesday 21 February 2012

Winter's Heart (Wheel of Time 9) by Robert Jordan

My blog becomes boring as I fly through the Wheel of Time series and it seems this is all I write about. The truth is that the feeling that started creeping in from books four or five, the "let's get it over with" feeling, has become stronger and undeniable. I don't want to stop reading the series, but I want to finish it soon, so I get to something that is truly interesting.

Book cover Winter's Heart is somewhat fractured. It continues where Path of Daggers left it and again it ends without a definite book boundary, just like a simple episode from a series. There is a rather important situation right at the end of the book, but it is underwritten, leaking important knowledge matter-of-factly and barely describing what should have been glorious fights with the One Power.

My impressions: Mat's storyline becomes intriguing, after a bit of utter boredom. Perin's story becomes ridiculous, with choices no sane man would make, not to mention women, and the obnoxious Aiel again getting a foothold in the plot. It has reached a point for me where any mention of Aiel just rubs me the wrong way. Rand is trying to make his enemies unsure of his plans, therefore he acts erratically, but that means he doesn't really do anything, until the end of the book. The girls are all doing whatever they feel like it, without coordinating with the boys, but still assuming they don't need to. The worst are the "evil ones" which seem to have fallen asleep. Fain tries to kill Rand, but not when he has him alone somewhere, only when he can "lure" him into a trap, together with all his friends.

Some ideas do come up. One is that Shai'tan is nothing more than a force of evil, not unlike Sauron, nothing corporeal or even conscious. All the evil in the book is done by people "doing the Great Lord's work" and their minions. The idea that the Dark One is imprisoned and that is why his actions make no sense is moot. Also, it seems that the Chosen are being reincarnated almost as soon as they die, only in other bodies. They call themselves differently, for some reason, but they possess the power and knowledge they had before death. They fear death, also, which make no sense at all. Robert Jordan's talent here is to make the evil side act stupidly, but without letting the reader feel so, and he manages it pretty well. Too bad I am more of a rational person.

I really like the idea that the One Power (which was always two, one male, one female) has an evil equivalent (the True Power - who comes up with these names?). Being of a Western origin, it is likely Robert Jordan will feel the need to unite all of these powers under "one God", so interesting interactions and hybrids might appear later. A tantalizing hint that Moiraine might be alive is also presented, when a reincarnation of Lanfear appears. Now that more annoying characters have popped up, I almost miss her, not to mention Lanfear herself, which is my favourite evil insane female character in the book :)

Wednesday 15 February 2012

The Path of Daggers (Wheel of Time 8) by Robert Jordan

Book coverThe one word that comes into mind when I think of the book is "frustrating". Having abandoned any semblance of independence between the books, Robert Jordan continues in The Path of Daggers many of the story arches began in A Crown of Swords and I don't know if he ends any. All the characters are acting like proud chickens, lacking any thought. They are emotional, weak, playing games when important issues are at stakes, taking serious offence from irrelevant words. I am sick of people "educating" others via beating, switching, shaming, pompous posturing, power plays and torture. The fate of the world is at stake and each and every one of the heroes of the story act like they still have other options. And while they are disgusted by people doing that very thing, but not seeing it in themselves.

At this point I am left with no other choice than to "watch" the story unfolding like on TV, because I feel no connection with it whatsoever. My wife asked me which of the characters in the book I most identify with. And I couldn't think of any. Even Shai'Tan doesn't make any sense at all. I've already started Winter's Heart and it continues in the same way.

Monday 6 February 2012

A Crown of Swords (Wheel of Time 7) by Robert Jordan

Book coverThe seventh book of the Wheel of Time series is a direct continuation of the sixth. I was saying in a previous post that book six, Lord of Chaos, was long and it doesn't even have a complete ending; A Crown of Swords overlaps Lord of Chaos a little, then opens up some other doors and doesn't close them either. Either this is the pattern (pun not intended) of the next books, or this is actually a weave (ok, now I was doing it on purpose :) ) of at least three books that are strongly coupled to each other.

A Crown of Swords is back to a size closer to the average of the other books, but since it is so connected to the books before and after, it doesn't really matter. There is a lot happening and some of it is captivating. I can't really empathize with most of the characters, though, except maybe Mat, and he is very present in this book. A new evil type of darkspawn appears, along with an advanced type of Myrddraal. The girls are hunting ter'angreal, the Seanchan are stirring again and a new battle against Forsaken is close. Also an Aes Sedai hero is approaching Rand and completely dissing him. Fun stuff!

Thursday 2 February 2012

Scrum, a personal view

If I would have written an article two years ago (wait a minute, I did!) it would have been a cold enumeration of rules and my outsider opinion about it.

If I would have written an article about Scrum two months ago, it would have probably been an insider rant, explaining how just following the rules of Scrum leads to blind bureaucracy and to a lot of waste of time.

Well, now I am writing about Scrum as I understood it from a personal viewpoint, because I've had this epiphany: Scrum (or any other development process) is a personal process first and foremost. To use a metaphor, so that I can move it out of the way and talk shop, it is like driving a car on a straight road. You are the engine (strong and reliable, hopefully), the road is the development process and your speed is your development speed. It is so easy to do everything fast and furious, it's a straight road after all, but what if there is a fog? Then you would have to slow down, for danger that you wouldn't see a sudden obstacle.

To get real now, the fog is the lack of foreknowledge about what you are going to do. And I don't mean project vision, or strategic planning, I am talking about your personal schedule, of how well you know what you are going to do. Scrum is trying to achieve this by enforcing a time table (the sprints) and a schedule (the sprint planning) and a recurrent update mechanism (the daily meetings), but it is only the beginning. If you plan your sprint superficially, it is like adding fog to the road in front of you. If you (and I mean YOU!) do not update your schedule as you go, including documentation, estimated time, time spent and all useful metrics, you add fog to the road behind you. If you are surrounded by uncertainty, you cannot plan anything. You don't know where you are, where you are going and how fast you are going to get there.

After 6 months of badly implemented Scrum, I've experimented with using a simple text file to mark when I start a job and when I finish it and any breaks in between, updating the actual work time and estimated time in the Scrum tool. We are using a clearly defined specification document for each feature, including requirements, acceptance tests, implementation details, code reviews, definition of done, test plan, updated as we go. I've discovered that all this huge amount of information, instead of slowing me down, lifts the fog and allows me to push the pedal to the metal and go as fast as I can. I know when I am doing something, why, and who is doing everything else and why. At the end of the day I don't have to rack my brains to remember what I did, I just cut and paste the task names and times from my text file to an email and the Scrum master just goes over the list and we are free to talk about what really mattered in those tasks: new issues, dependencies, implementation details. The result is visibility of what we are doing and not less important, I get to go home early.

Of course, I am writing this enthusiastic post after a single day of well done and 6 months of poorly done, but I have a great feeling about this, something akin to fog being lifted from my eyes.

InvalidOperationException in System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded

A Microsoft patch for ASP.Net released on the 29th of December 2011 adds a new functionality that rejects POST http requests with more than 1000 keys and any JSON http request with more than 1000 members. That is pretty huge, and if you have encountered this exception:
Operation is not valid due to the current state of the object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Operation is not valid due to the current state of the object.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:
[InvalidOperationException: Operation is not valid due to the current state of the object.]
System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() +2692302
System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +61
System.Web.HttpRequest.FillInFormCollection() +148

[HttpException (0x80004005): The URL-encoded form data is not valid.]
System.Web.HttpRequest.FillInFormCollection() +206
System.Web.HttpRequest.get_Form() +68
System.Web.HttpRequest.get_HasForm() +8735447
System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +97
System.Web.UI.Page.DeterminePostBackMode() +63
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +133


then your site has been affected by this patch.

Well, you probably know that something is wrong with the design of a page that sends 1000 POST values, but still, let's assume you are in a situation where you cannot change the design of the application and you just want the site to work. Never fear, use this:

<configuration xmlns=”http://schemas.microsoft.com/.NetConfiguration/v2.0>
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="5000" />
<add key="aspnet:MaxJsonDeserializerMembers" value="5000" />
</appSettings>
</configuration>


More details:
Knowledge base article about it
The security advisor for the vulnerability fixed
The entire MS11-100 security update bulletin

CSS selectors for two or more classes

Update 3rd of March 2016: I've opened this blog post on the latest versions of Internet Explorer, Firefox and Chrome and the bug is not present anymore. You should consider this blog post obsolete

The CSS standard allows selecting an element with a certain CSS class, using the dot notation (.myClass), but it also allows an element to have more than one CSS class, separated by space (class="myClass anotherClass"). Now, sometimes we would like to select an element that has two simultaneous classes and the CSS syntax for this is to put two class selectors one after the other, with nothing to separate them (.myClass.anotherClass). This blog entry is about how you should avoid using this, at least for now, as it seems to be one of the buggiest parts of the CSS implementation in the current browsers.

First of all, Internet Explorer just fails with this. Up to version 8 simultaneous class selectors just failed in a random way. I was surprised a few days ago to see that Chrome and Firefox also have issues with this. Even if the selector did appear to work, it did not register in the css rule lists for either Firebug or the Chrome developer tools, when used with CSS3 content selectors. Remove the double class selector and they would magically appear.

The bug can be reproduced in this code:
<style type="text/css">
.a.b span:before {
content:"before ";
}

.b span:after {
content:" after";
}
</style>
<div class="a b">
<span>Test</span>
</div>

and here is the result:
Test


In Chrome and Firefox the span element will appear with an after rule, but not a before rule, even if they are both applied.

Lord of Chaos (Wheel of Time 6) by Robert Jordan

book cover
Lord of Chaos was a long book to read. In size, it was as long as Shadow Rising, the longest book in the series so far, but it felt more packed. After all, Rand and Egwene can use portals and they go where the action goes, the Tower is divided, the Aiel are divided, a force of channelling men is created, Cairhien and Tear soldiers fight along Rand, there is action in Ebou Dar, Tear, Cairhien, Salidar, Andor, Two Rivers, Amadicia, The Forsaken are executing a plan of the Dark Lord and so on and so on.

There is a problem with consistency again, at least as I see it. If this was a strategy game, imagine more players playing in the same team, but each of them doing whatever they feel like. They are all friends, they even have one central character they can rally with, but they continue to do things their way. If the other team would have even a modicum of coordination, they would easily win. Also, the series has succumbed to levelitis, the disease that causes all main characters in a story to level up continuously, until it becomes unmaintainable. Rand and Eqwene can Travel or enter Tel'aran'rhiod in the flesh, Elayne can make ter'angreal, Nynaeve can heal stilling and gentling, Mat has the memories of countless heroes and has a talisman against saidar, Perrin is a lord, Loial can fight, Min can read auras and fight with knives, etc. It is getting so grand, that I fear for the books to come.

Even so, I've enjoyed the book and at the end I could barely stop reading to see where all the tension accumulated in the last hundred pages would explode, and how. The grandness and action packing of the book also led to a kind of split, where the stories started now have not ended yet and I must continue to read the series to see what is going to happen. The name of the book is also strange, as the Lord of Chaos is somehow related to the Dark One, but we don't really learn who he is; only hints are left here and there. Finally, Shai'tan seems to be more than just the cardboard evil destroyer of life and gains some complexity.

Sigh! There are 14 books in the series, I have just started the 7th and they seem to be growing in size as I go along... this is going to take a while.