and has 0 comments
It's time for the list of TV series that are wasting my precious time. I only do this so you don't have to. I know, I know, you are so grateful, but that's me: a beacon of hope, goodness and humility.

Let me start with the shows that I've already talked about before:
  • Doctor Who has entered a darker era, with the arrival of The Silence, a race that has you forget about them the moment you don't see them anymore and that have lived on the Earth since forever and of The Flesh, a programmable biological material that can take any shape. Initially used as a way to build cheap avatars, it will become much more when infused with the memories and personalities of its users.
  • Torchwood has started again, season 4 now. The show was the more cliché of the Doctor Who spin-offs so it was bought by the American TV channel Starz. It now features big U.S. actors like Bill Pulman, Mekhi Phifer and Lauren Ambrose. It is still weird enough to enjoy, but the first two episodes were not very bright.
  • The Sarah Jane Adventures. It started for a while, time in which I noticed that the main character, played by Elisabeth Sladen, was a bit off, she was starting to look her age and a bit tired or confused. Later on I've learnt of her death to cancer. She was not in her fifties, I had guessed, but 65 years old. I do not know what the fate of the series is.
  • Eureka just started again, the second half of the fourth season. I haven't had the chance to watch any of the episodes, but it can't have changed much.
  • House MD got even stranger and harder to watch than before, but at least that annoying self righteous bitch was replaced by Thirteen again. As for the script, medically all characters are brain dead.
  • Criminal Minds has ended its sixth season and we're waiting for the seventh. It lost some of its oomf, but at least it still has potential. Suspect Behaviour, the spin-off, was rightfully cancelled.
  • Dexter hasn't started yet, but the hints and teasers are promising. Dex would return to his murderous roots and leave behind all that suburban emotional dad crap. Or will he?
  • Big Love has ended with its fifth season. While I did enjoy the first four, I still could not force myself to watch the fifth season, not one episode of it. I believe I will leave it to braver men than I to comment on its ending.
  • Fringe is undying. A lot of experimentation (pun not intended) with the show, including a partially animated episode. Still watchable at the end of a tiring day, but nothing else worth mentioning.
  • True Blood's fourth season has started in force, with panther people, witches, shapeshifters, an amnesic Eric, a Bill that is king of Louisiana and a Tara that is bisexual. It has lost a major part of its charm though and I am only watching it to see what else they invent.
  • Still waiting for Californication's sixth season. While it too lost a big chunk of its initial charm, it is still interesting in a lot of ways.
  • V was cancelled by ABC and fans are petitioning Warner Bros to continue it. I feel it was a failure and it needs no renewal. If you consider that it is I who is suggesting cancelling a sci-fi show, then you should know that there are serious reasons for it.
  • Men of a Certain Age second half of the second season has started and it's still great. Who would have thought that a lot of the police, fantasy and science fiction series would become family dramas while a show that has started as a drama would be interesting and educational, as well as fun?
  • Weeds' seventh season has started rather well. Hot Nancy is pardoned from jail because someone has killed Esteban and the state wants nothing to do with her, while her family returns from Denmark when they find out she is out. Transactions with grenades for Afghan kush and the usual craziness come next, but I think they dialed down a notch all the stupidity and the onslaught of pointless American culture. Just a notch.
  • The Good Wife is still a nice show, combining personal issues with court cases in a pleasant and intelligent way.
  • The Walking Dead has not had its second season start yet. I have high hopes, despite the rather boring first season.
  • Haven's second season has just started. I haven't seen any of it, though, which talks about my elevated interest about the show. It's a more localized and less sciency Fringe, so it falls into the same tired brain category.
  • Royal Pains has ended its second season and just started the third. I have no idea what is going on with it as I stopped watching it and not even the wife seems to want to.
  • Lost Girl, a sort of Canadian Sookie with more violent tendencies, has not started its second season yet.
  • Nikita latest season has not started either.
  • A Game of Thrones. Oh, this needed a section of its own. Short story: the first book of the series was turned into a 10 episode season. Why only ten? Make them at least 13, as it is customary. With only ten episodes a lot of the book was left out and when I say this, I don't mean the facts, but the interaction and relationships between characters. I know, you are thinking: Who is this guy? Where is Siderite? If he talks more about the relationships of characters in TV series I'm gonna switch blogs! The only comparison I can give that would give justice to the important part of the book that is missing from the series is Dune. There was a Lynch version of Dune, which had almost nothing to do with the book and there was a mini series version that followed the book line by line. I liked the Lynch version better. The feeling that you get reading the book you can't get from this series, which is, otherwise, very nice and well done.
  • Better With You was cancelled, thank you!
  • Falling Skies. I would call it a response to The Walking Dead. Earth has been attacked by aliens, defeated utterly, and the last remnants of humanity are fighting a resistance war. But practically there are a bunch of guys with a lot of attitude, trying to survive while being attacked by zombies aliens. I like it, but it is presenting the same idealistic people that fight "the good fight" while having ample opportunities to demonstrate how that is better than being evil and stupid. No real character development, no complex situations, only the good, the bad, and the stupid in between. Get it together, people!
  • Endgame was boring, stupid and had nothing to do with chess at all. It felt more like that ridiculous show about a guy that gets tomorrow's paper every day and then tries to change the headlines. I refuse to watch it when I have real chess videos around.
  • Southpark is going to a rough patch I think. The last episode ended in a very ambiguous way, with Stan's parents deciding to leave Southpark and Stan itself feeling distanced from his friends by the debilitating disease "being a cynical asshole". I still don't know what is going on.
  • Season four of Breaking Bad just started. Haven't started watching it, yet.


Still here? Hellllooo... lloooo... looooo... looooo? Time for the new TV shows:
  • King - Canadian show about a gloriously sexy woman that... solves police cases. She is actually a cop. Her name is King. The action was mellow enough, the episodes plot boring, even a tall red-head with beautiful legs could not make me watch it. It is the average cop TV show with a lead character, only slightly shifted towards women.
  • The Killing has received great reviews, but unfortunately I could not find the time to watch it.
  • Mortal Kombat Legacy. Remember about a year ago there was a trailer for a new Mortal Kombat movie, when Sub Zero was used by a cop to find Scorpion? It all looked realistic and reinvented and modern. That didn't go well. Instead they changed the theme a little and brought it as a web series. Is there any word that sounds more stupid than webisode? Well, they used those to present the characters. Some were good, some were bad, but overall I think it deserves a shot. Nothing fancy, mind you.
  • The Nine Lives of Chloe King and Teen Wolf are two idiotically tweeny series that try to capitalize on Twilight and the such. I've watched the pilot episodes groaning at each good looking gelled hair idiot teen that turns into a cat/wolf while bad people are after them. Vomit inducing.
  • Alphas is the new X-men series. Different powers, less cool, different professor, no X-es in his name, different bad guys. The pilot was not especially bad, considering you have Mutant-X as a reference, but nothing special either.
  • Switched at Birth had an intriguing synopsis: two baby girls are mixed up at birth and they find out about it only 16 years later. The interaction between the two families should have presented an interesting experiment of nature vs. nurture. The pilot was not bad, but it was too family oriented for me to enjoy. Also, I think I am becoming slightly allergic to bouts of teenage angst. I understand most teenagers are dumb and selfserving, but they are not all clichés!
  • Suits is the male equivalent of courtroom series. If The Good Wife is trying to attract more female audience by using a woman as the lead and presenting her in the midst of family issues, Suits shows cool bachelors finding all kinds of technical solutions to problems. I mean the boys are studs, one of them is a rookie that can remember anything he reads or sees, while the other is a cocky flashy lawyer that takes the noob under his wing. There are even technical discussions about race cars! It is not without flaw, but it produces an easy going feeling that I enjoy in my series.
  • Camelot. This was recommended by a friend, one that usually has good tastes in TV and movie matters. Well, he was wrong. This is the King Arthur version of Hercules. The only people that die are those who make it harder for the screenwriters to continue the story, Merlin is the guy from Flashforward, with magic issues instead of alcohol, the same irritating frown and self righteousness and with no hair. Arthur is an infant that played in Harry Potter and Twilight. The only good parts here are the women: Eva Green as Morgan, Tamsin Egerton as Guinevere (after a lot of rumours she was going to play in Game of Thrones) and Claire Forlani as queen Igraine. Claire, could you play some sexy and open minded person next role? Your beauty is wasted on stuck up obnoxious do gooders!
  • Wilfred is a new show stolen by the Americans from Australia. The story is that one guy sees the neighbour dog as a human being dressed in a dog suit, talking with Aussie accent and smoking bong all day. The dog teaches the wimpy human how to live. The show is both intriguing and annoying. I did watch it until now, but I am having conflicting feelings about it. I am curious about what will happen next and have no problem starting to watch an episode, but I always regret it afterwards. It's a kind of guilty pleasure, I suppose.


There is something to say about future projects, like Once Upon a Time which sounds promising, but I haven't really researched the future plans of TV networks yet.

Until the next time, have fun!

What a beautiful anime film this was. I rated Summer Wars a full 10 on Imdb and I just felt the need to also post my opinion on the blog. Imagine Myiakazi combined with Denou Coil and you will get a glimpse of what Summer Wars is. Brilliant!

The Sword of Uruk is the continuation of The Tower of Druaga - The Aegis of Uruk, itself a spawn of the The Tower of Druaga arcade game by Namco. I must confess I have not watched the first part before venturing to see the second, but as the story unfolded, it was pretty clear what had transpired before. The problem, thus, was not that I didn't "get it".

The animation itself is typically Japanese, but one of the styles that is found usually in children animations. I didn't really mind that so much either, except the lazy 3D CGI bits that seems to be the creation of some 90's computer. The script, though, was a combination of ridicule, then ridiculous. I liked some of the jaunts directed to some movies or other anime, but in the end, it was just a really childish story. Also, it seemed to go towards an RPG style feel, one of those weird Asian dress-up MMO games. I didn't like that at all.

The world in which the story unfolds is a combination of modern, old and RPG, something that continuously switches from serious to not. Or better said, from ridiculous to ludicrous.

Long story short, I couldn't finish watching it. It is at best a children animation, with nothing to be learned or admired, really.

The only thing I did notice and is worth mentioning is that it featured two audio tracks, one in Japanese and one in English. The English one had the text completely changed, the attitude of the voice actors was completely different and it made me realize how much people who only watch the dubbed versions miss out on Japanese animation. It was really fun to watch an episode with English dubbing and English subtitles, both very different from each other, as the subtitles were direct translations from Japanese.


As I was noting a few posts earlier, I recently watched the entire Star Trek Deep Space 9 series. This part of the franchise showed a lot of the Klingons as well as their choice of beverages: Bloodwine and Raktajino. The former is a strong alcoholic beverage which I will not get into, and the latter is a strong and spicy coffee that grew on the crew of the space station. As I knew that the Klingon culture spawned an entire real life current, including a complete language, I was curious if they also replicated (pun not intended :) ) their recipes. And I found that, indeed, there was at least one Raktajino recipe on the net: Klingon Raktajino Klah Version.

I was not satisfied, though. You see, Klingons are supposed to be mighty warriors. Why would they throw a bit of sweet chocolate, some cocoa and a bit of cinnamon and nutmeg into their drinks if it's not going to be effective in battle? So I started researching the different active ingredients in the recipe, as well as other possible sources for a stronger effect. Here is my research on it, the result and the effects on myself (as any mad scientist knows, you first experiment on helpless victims or yourself. I was fresh out of victims that day).

Let's first examine the main stuff: coffee. There are other energizing beverages in the world, like tea, or mate tea, or even stuff like Burn or Red Bull. I will not touch the chemical energizer drinks in this post because I couldn't possibly replicate one out of simple ingredients (or could I? Note to self: make a one hundred times stronger energizer drink than Red Bull. Get more helpless victims.). Something I've recently (to my shame) found out is that when people researched coffee, tea and mate they called the main active ingredient for each by the substance they started with: caffeine, theine and mateine. Later on, it was proven to be the exact same substance. So there would be no point of mixing these together, since they have the same effect.

However, there are other ingredients in the beverages described above, like catechins, which are found in white and green tea, mostly. Also, found in cocoa, so there might be something there for the Raktajino, after all. The effect of flavanols on health is mixed, but it is clear that it has a health benefit for heart conditions as well as an apparent anti-aging effect when combined with regular exercise. Nothing Klingons like more, by the way.

Ok, which of these contains the biggest concentration of flavanols: cocoa or white tea? It is irrelevant, as this is actually a class of substances and the flavanols in each (and in wine, btw) are different. So, let's mix them up for starters.

What other active ingredients does cocoa have, except the flavanols? Well, it seems it contains something called Theobromine. It can appear naturally in the body as a result of metabolising caffeine, btw, so it seems like a good choice for the acceleration or augmentation of the effect of coffee. Also, it has a slight aphrodisiac effect :)

So, we got a mix of cocoa and white tea, something that is good for the heart, slows ageing and also should accelerate the absorption of coffee. But the recipe also had Cinnamon in it. So let's see what it contains. Well, it is called Cinnamaldehyde which sports effects like antimicrobial and anticancer. But what cinnamon does most is increase the blood flow, so also the metabolism, so the absorption of all the substances in our magic mix.

Of, if we have already a substance that increases blood flow and metabolism, why not use one that is really hot: Capsaicin? Yes, you read that right, it's the active ingredient in chilli peppers and the thing that tricks the heat sensors in our body to react to lower temperatures, giving us the sensation of heat. It also increases blood circulation and regulates sugar levels.

The net recipe also showed a use of nutmeg. I suspect that is mostly for the aroma, as large quantities of nutmeg are toxic, even if it also has a deliriant effect. Also, the "recreational" properties of nutmeg can take about four hours to take effect, so we don't actually need the stuff.

Ok. We have the ingredients we need to add to our coffee: cinnamon, cocoa, white or green tea and chilly powder. I used 2 spoon of cinnamon, 2 of cocoa, enough green tea for 2 litres of strong tea and one tablespoon of chilly powder. Then I've added it in my coffee. I also drank it with hot water only. The best results were with coffee, some sugar to add to the burn, and a bit of milk to take the edge off the tongue.

The effects: I am not a big drinker of coffee, but ever since I've moved to this job where they had a coffee machine, I would drink one cup a day. Sometimes four. Anyway, after a while it didn't seem to have any effect, other than a deficiency of calcium (that's another story, just remember to add calcium and vitamin D to your diet if you are a coffee drinker). So, the day I used a small portion of my spice in my coffee, not only did it taste great! but it also gave me a jittery active state that I hadn't felt since the first days of drinking coffee, a state that lasted for... 6 hours straight!

So, to wrap it up, I can't give you a recipe for my version of Raktajino, as I am experimenting with various quantities, but mix a lot of cocoa and cinnamon with your coffee, then add some concentrated green tea and as much chilly powder as your stomach can stand: Raktajino, Siderite version!. (I used strong text there because it is so strong of a coffee, see?)

Do let me know if you drink it and tell me what effect it had on you. The excitement of the research may be responsible for the jittery effect, after all, although I doubt it.

I've met a very interesting WPF bug today, something that is hard to explain or reproduce, but might give terrible headaches if you don't know its source.

I had a WPF UserControl, with its xaml and cs files. Now, I know that in MVVM I shouldn't really use those much, but it was out of my control. The control had a section of resources (UserControl.Resources) in which there was a ResourceDictionary with some stuff in it. Considering that I'd removed all the merged dictionaries from this, I thought that I had no need of the dictionary tags, after all the Resources property of an element is already a ResourceDictionary. So it was something like this:

<UserControl ... >
<UserControl.Resources>
<!-- <ResourceDictionary> with these tags commented the error occurs -->
... stuff ...
<!-- </ResourceDictionary> -->
</UserControl.Resources>
</UserControl>

The error itself is that, during compilation, the partial user control class defines in the code behind doesn't seem to find things from the xaml. Probably, the compiler fails building the xaml into a class, but fails silently, while the codebehind is completely disconnected from the xaml because it is the only partial file for that class name.

By selectively removing items in the resources I've narrowed it down to one of the converters. It was creating using the MarkupExtension trick, but it was also declared as a resource for some reason. I do not see why that should matter, but still.

Bottom line: when the partial codebehind class for a WPF user control (or maybe for windows as well) fails to connect to the xaml, it means it silently fails the compilation of the XAML and you should try checking the resources of the elements therein.

and has 0 comments
I've just finished watching the seven seasons of Star Trek DS9. I've decided to do it since I've only seen it on TV when I was younger and never from start to finish. Frankly, when I think about it, watching anything on TV, waiting for it to start at specific hours and then having no possibility to pause, stop or fast forward (not to mention the idiotic commercials), seems insane. But I digress.

What I found most interesting in this Star Trek series is that it showed so many pieces of technology that are now available. However, they were doing it wrong :) Let's take the "pad". They were using something looking like IPads. However, they were using multiple pads, one for each of the things they were reading or working on! Or they had these very complex communication systems: a badge that acted as a communicator, holographic video calls, screens everywhere. Yet whenever something was happening, they were calling the other person to come to them: "Captain, I think you'll want to see this". You can't really expect technical perspective from TV designer people, but they were so bloody close!

Another interesting thing, and that goes for the entire Star Trek franchise, is how they split the human mentality into clichés, made entire races out of them, then explored each one in particular. That is different from making the heroes be envomittingly good and the bad people nauseatingly evil. They took the mercantile personality, pushed it to an extreme, then built the Ferengi species around it. I still don't get how they did it without the Hollywood higherups shouting racism, since the race was clearly modelled after Jews. The Klingons were fierce warriors, honourable and brave. The Romulans were sneaky. The Kardasians were imperial invaders. And so on and so on.

But then, they explored each of these human traits and readded depth from the places where they took it. What happens with Ferengis when their lives are at stake or when their friends are in peril? What do Klingons do when imperial leaders become more and more political and corrupt? What do the worst enemies when they are forced to fight or work together and find themselves in the very situations they has previously forced the other to be? As far as I know, this is the only show that did this. The few other multispecies sci fi series, like Babylon 5, centered on the story more than on the characters.

As for what differentiates DS9 from the other Star Trek series, it's the grit. I suppose that is why it didn't have that much success with the audience, as it was a decent show with some deep (pardon the pun) ideas. It did had its sillyness: the entire Bajoran faith thing, with the alien Prophets intervening whenever the script went nowhere, the episodes about the crew getting to the past or locked in some holodeck fantasy or being mentally manipulated, all so that they get to act in present day situations that had nothing to do with the show. The silliest thing yet, I believe, are the fights. The ridiculous fighting style of the Federation "elites" and the ships that either resist dozens of hits or die from a single one.

I believe that there is much to be learned from Star Trek, from a television and scifi perspective, and DS9 specifically. We lack a space opera with real war scenes and actual grit.

I've finally finished reading Pro ASP.Net MVC Framework by Steven Sanderson. The book is slightly dated, since it discusses the technology used in Visual Studio 2008 and without any mention of the new Razor engine, but these are details that are not important to the content of the book anyway. I can say that it is a very nice book and it was worth reading, especially the first part.

There are two parts to this, the first being a TDD ASP.Net MVC web shop application built step by step and explained line by line. It goes through some Domain Driven Design concepts as well, it does unit testing and mocking, even shows off a little dependency injection via Castle Windsor. What I liked most, though, is how painstakingly thorough Sanderson was explaining every single detail. He didn't assume anything as he documented every step of the way, down to what lambda expressions are and what .Net features he was using.

The second part of the book is a little less readable, as it goes through the classes and features of ASP.Net MVC, complete with methods, properties and small samples. I highly recommend reading this part while actually experimenting with the framework on the computer. Even if you do not, this part of the book remains a very valuable reference for when you do. In this section of the book you can learn about data entry, Ajax and partial updates, application security and deployment, even how to mix classic ASP.Net with MVC, though not really recommended.

The bottom line is that Pro ASP.Net MVC Framework is a must read for a developer learning ASP.Net MVC. There is an updated version of the book for VS2010 and .Net 4 that I think that I will also read (the book was so good). Here is the link for Pro ASP.NET MVC 2 Framework.

A quick post here about using a ContentPresenter (or a ContentControl which uses a ContentPresenter in its template) with its Content property. The intended usage of ContentPresenter is to set the Content to some binding to a data object, then control the element tree via the ContentTemplate property. That may lead to a counterintuitive situation when you want to specify some UI element content and then use bindings in that content. Let's take an example:

<!--
This ContentControl has a MainViewModel class as a DataContext.
The MainViewModel class exposes a MyButtonCommand property.
-->
<ContentControl>
<ContentControl.Content>
<Button Command="{Binding MyButtonCommand}">Press me!</Button>
</ContentControl.Content>
</ContentControl>
You may expect to press the button and execute the command, but it doesn't work. In fact, the binding on the Command property will fail.

Here is a working example:

<!--
This ContentControl has a MainViewModel class as a DataContext.
The MainViewModel class exposes a MyButtonCommand property.
-->
<ContentControl Content="{Binding MyButtonCommand}">
<ContentControl.ContentTemplate>
<DataTemplate>
<Button Command="{Binding}">Press me!</Button>
</DataTemplate>
</ContentControl.ContentTemplate>
</ContentControl>


I realize this is not what most of you have in mind when using a ContentControl. Another solution is to use the Content as in the first example, but add an explicit DataContext property to it before using any binding, something like this:

<!--
This ContentControl has a MainViewModel class as a DataContext.
The MainViewModel class exposes a MyButtonCommand property.
-->
<ContentControl>
<ContentControl.Content>
<DataTemplate>
<Button
DataContext="{Binding DataContext,RelativeSource={RelativeSource AncestorType={x:Type ContentControl}}}"
Command="{Binding MyButtonCommand}">Press me!</Button>
</DataTemplate>
</ContentControl.Content>
</ContentControl>
In this case, though, you specify the DataContext as an ugly binding and, worst of all, you cannot set it via the ContentControl, but you need to access the actual content.

Perhaps another solution, one that would involve a custom DataTemplateSelector on the ContentControl would work, but right now I have no perfectly satisfactory solution.

A colleague of mine started using a control I made in which there was a Hyperlink. Well, the purpose of it was not complex, I just needed a text that can be clicked. A Hyperlink sounded like the only solution out of the box, since there is no LinkButton control in the standard WPF controls. That aside, after I finish writing this blog post, I will write myself a LinkButton control to use in these situations instead, since Hyperlink seems to have several design flaws. It's not even a control, but a flow element.

What my colleague reported is that the Hyperlink would not get enabled in certain situations and we've come to the conclusion that after the initialization of the control, the IsEnabled property on the Hyperlink does not change when an ancestor control changes its enabledness. The only way to force it is to actually bind it to an ancestor IsEnabled.

Here is the scenario: You place several items in a XAML file. They are a text in a Hyperlink, in a TextBlock (since Hyperlinks cannot be directly part of a Panel, first design flaw), in a StackPanel. The text in the text block will appear as a clickable link. Set the StackPanel to IsEnabled="False" and the text will appear as disabled. Now, add a ToggleButton and bind its IsChecked property to the StackPanel IsEnabled property. Click the button and the StackPanel will get disabled, but not the hyperlink. Start with a disabled StackPanel, the link will be disabled, click the button and the hyperlink will stay disabled. The solution: set on the Hyperlink, inline or via a style, IsEnabled="{Binding IsEnabled,RelativeSource={RelativeSource AncestorType={x:FrameworkElement}}}". Now that is ugly.

As a sideline, whenever you see a WPF element inexplicably disabled and you use Snoop on it and try to set IsEnabled to true and you can't, there is probably one of two situations:
  1. A parent of the control is disabled
  2. The control is implementing ICommandSource and its Command property is set on an ICommand that returns false on its CanExecute method

Well, I have been kind of absent from the blog lately and that is for several reasons. One is that I have been waiting for some news that would determine my direction as a professional developer. The other is that I have re-acquired a passion for chess. So, between work at the office, watching chess videos, playing chess with my PDA and watching all seven seasons of Star Trek Deep Space 9, I haven't had much time for blogging.

Also, when you think about it, the last period of my programming life has been in some sort of a limbo: switched from ASP.Net to WPF, then to ASP.Net again (while being promised it would be temporary), then back to WPF (but in a mere executive position). Meanwhile, Microsoft didn't do much to help me, and thus saw their profits plummet. Well, maybe it was a coincidence, but what if it wasn't?

I am complaining about Microsoft because I was so sold into the whole WPF/Silverlight concept, while I was totally getting fed up with web work. Yet WPF is slow, with no clear development pathway when using it, while Silverlight is essentially something else, supported by only a few platforms, and I haven't even gotten around to use it yet. And now the Internet Explorer 9/Windows 8 duo come in force placing Javascript and HTML5 in the forefront again. Check out this cool ArsTechnica blog post about Microsoft's (re)new(ed) direction.

All of this, plus the mysterious news I have been waiting for that I won't detail (don't want to jinx it :-S), but which could throw me back into the web world, plus the insanity with the mobile everything that has only one common point: web. Add to it the not too enthusiastic reaction of my blog readers when starting talking about WPF. So the world either wants web or I just have been spouting one stupid thing after another and blew my readers away.

All these shining signs pointing me towards web development also say that I should be relearning web dev with ASP.Net MVC, getting serious about Javascript, relearning HTML in its 5th incarnation and finally making some sense of CSS. Exciting and crazy at the same time. Am I getting too old for this shit or am I ready for the challenge? We'll just have to see, won't we?

and has 0 comments
This is a case of a bug fix that I made work, but I can't understand why the solution works. Basically, the story was that some internal component of a third part control forced WPF to throw an exception on the UI thread. As it was impossible to plug the hole in the third party library, and since its next version is supposed to solve the issue, I've opted for a somewhat ugly hack: I've handled the DispatcherUnhandledException event of the Application class and I've basically said to it to ignore that specific UI error.

I will get into details of what the error and where it came from was and how to handle it, but I want to focus on the fact that, since this was a fix for a specific class, I've inherited from that class and used a static method in it to do the above handling of the event. Well, it worked most of the cases, but not all. Some code that involved moving the focus of WPF elements programmatically would cause the bug to reappear.

At first I thought it was a matter of a change in the policy of exception handling from .Net 1.0 to 2.0 and above. So I've set the <legacyUnhandledExceptionPolicy enabled="1"/> option in the app.config runtime section, but it didn't help.

I've tried everything, from using the control instance Dispatcher in the constructor or in the Loaded event, to moving the code directly to the point after the application was instantiated and before the application was run. Bingo, it worked! I thought that was it. I've again encapsulated the entire behavior in the inherited control and ... watched it fail.

Let me simplify the situation: static code that doesn't work when encapsulated in a static class works perfectly when the same code is inlined in the calling code. Can you explain that? I cannot!

The code is simple:

application.DispatcherUnhandledException +=
application_DispatcherUnhandledException;

static void application_DispatcherUnhandledException
(object sender, DispatcherUnhandledExceptionEventArgs e)
{
if (e.Exception.Message.Contains("Hover")
&& e.Exception.Message
.Contains("System.Windows.Controls.ControlTemplate"))
{
e.Handled = true;
}
}


Move that in a static class and execute it as MyClass.RegisterFix(application); and it doesn't catch all the exceptions thrown, although it works in most cases.

Can anyone explain this to me? Why does it matter where the code is?

and has 0 comments
Today is the Rapture, at least according to a doomsayer Christian evangelist in the US (where else?). Anyway, today is my name saint day, so it makes a weird kind of sense, although I would have preferred it to be on my birthday, so I would feel even more special. Something is certain though, if it happens during my lifetime, the Rapture will probably happen on my death day.

But what is this Rapture? According to Wikipedia, God bless her, it seems there is a moment in time when the big guy gets fed up with all the bullshit and just packs all his believers and goes home. A small script bottom line also mentions throwing away everything else. But theeen, he gets his people back on Earth. Ha! I know that concept! It's a Genetic Algorithm Reaper! It takes the fit to another generation, it gets rid of the unfit, in order to evolve the perfect believer in Christ. So appropriate when you think about it: the Rapture happens when Christianity and Evolution finally converge.

As I was blogging before, RedGate are assholes. They bought Reflector, promised to keep it free, then asked money for it. But every crisis can be turned into an opportunity. JetBrains promised a free decompiler tool and they have kept their word as they have released an early build. A total news to me, but not really a surprise, other software companies decided to build their own version in order to boost their visibility in the developer world. Telerik, for example, has just released JustDecompile, beta version.

It is no secret that JetBrains is a company that I respect a lot, as they made ReSharper, the coolest tool I've ever had the pleasure to work with, but I will try to be as unbiased as possible in comparing the options. I have tried dotPeek on WPF's PresentationFramework.dll from the .NET framework 4.0, as I often need to check the sources in order to understand functionality or bugs.

As a footnote, Reflector, just before it went commercial, could not decompile some of the code there. Not only it did not decompile it, but it presented empty methods like that was all there was in the code, with no warnings or errors or explicative comments. So, even if free, I bet Reflector would have sucked in the end, after getting into the money grabbing hands of RedGate.

dotPeek has seen and decompiled the code that Reflector did not. Also, I have to say that similar functionality like in ReSharper, finding usages, going to declaration, etc are making dotPeek a very nice tool to work with. What I did not quite like is that it doesn't have yet the functionality to save the sources to text files. But I am sure this is just a detail that was not implemented yet. Hopefully, they will provide a rich plugin model like old Reflector did.

Unfortunately, to download JustDecompile, they need you to have a Telerik login in order to download, which, as everyone knows, simply sucks. No one likes a registration form, folks! Especially one that presents you with wonderful prechecked checkboxes for permission for Telerik to send you all kind of stupid promotions and newsletters. Also, the download is of a .msi file. Most developers like to see what they are installing and preferably just copy it from a file archive. Running the .msi took forever, including the mandatory 100% CPU utilization bit that I will never understand in installation products. (coming from the .NET runtime optimization service, mscorsvw, called by ngen) But that's just the delivery system. Let's check out the actual thing.

JustDecompile starts reasonably fast and it also has a nice look, being build with Telerik controls and what not. The decompilation is a bit weird at first, since it shows only the method names and for a second there I thought it was as bad as Reflector was, but then I noticed the Expand All Members button. The context menu is not nearly as useful as dotPeek's, but there are a lot of options in the top toolbar and the navigation via links is fast and intuitive. It also has no text saving options yet.

As the decompiled sources were, I noticed these differences:
  • JustDecompiler places inline member declarations in constructors, dotPeek shows it inline. It might not seem an important thing, but an internal class gains a weird public constructor in order to place the declaration there, instead of using the only internal constructor that the class had. It looks strange too as its last line is base(); which is not even legal.
  • dotPeek seems to want to cast everything in the source code. For example List list = (List) null;
  • JustDecompiler shows a Dictionary TryGetValue method with a ref parameter, dotPeek shows the correct out.
  • dotPeek creates really simple names for local scope variables like listand list1, JustDecompiler seems to create more meaningful names like attachedAnnotations
  • JustDecompiler shows a class internal as dotPeek shows it as internal abstract.
  • JustDecompiler seems to fail to decompile correctly indexer access.
  • JustDecompiler doesn't seem to handle explicit interface implementations.
  • JustDecompiler doesn't seem to decompile readonly fields.
  • JustDecompiler transforms a piece of code into an if with a return in it and then some other code, dotPeek decompiles it into an if/else.
  • JustDecompiler doesn't seem to handle Unicode characters. dotPeek correctly encodes them in source like "\x001B".
  • dotPeek seems to join nested ifs in a single one, as opposed to JustDecompiler.
  • JustDecompiler uses base. in order to access members coming from base classes, while dotPeek uses this.


I will stop here. I am sure there are many other differences. My conclusion is that dotPeek could do with the naming algorithm JustDecompiler seems to use for local scope variables, but in most other ways is superior to JustDecompiler for now. As both programs are in beta, this could quickly change. I do hope that healthy competition between these two products (and, why not, shady developer meetings in bars over tons of beer and pizza, in order to compare ideas intercompanies) will result in great products. My only wish is that one of these products would become open source, but as both use proprietary bits from commercial products, I doubt it will happen.

Have fun, devs!

Update 23 Feb 2012:
Spurred by a comment from Telerik, I again tried a (quick and dirty, mind you) comparison of the two .Net decompilation tools: JetBrains dotPeek and Telerik JustDecompile. Here are my impressions:

First of all, the Telerik tool has a really cute installer. I am certainly annoyed with the default Windows one and its weird error codes and inexplicable crashes. Now, that doesn't mean the Telerik installer does better in the error section, since I had none, but how could it not? The problem with the installation of JustDecompile is that it also tried to install (option checkboxes set by default) JustCode and JustTrace. The checkboxes themselves were something really custom, graphically, so I almost let them checked, since they looked as part of the background picture. If it weren't for my brain spam detector which went all red lights and alarm bells when seeing a really beautiful installer for a free tool, I might have installed the two applications.

Now for the decompilation itself. I was trying to see what the VisualBasic Strings.FormatNumber method contained. The results:
  • dotPeek showed xml documentation comments, JustDecompile did not
  • dotPeek showed default values for method parameters, JustDecompile did not
  • JustDecompile could decompile the source in C#, VB and IL, dotPeek did only C#
  • JustDecompile showed the source closer to the original source (I can say this because it also shows VB, which is probably the language in which Microsoft.VisualBasic was written), dotPeek shows an equivalent source, but heavily optimized, with things like ternary operators, inversions of if blocks and even removals of else sections if the if block can directly return from the method
  • There are some decorative attributes that dotPeek shows, while JustDecompile does not (like MethodImplAttribute)
  • dotPeek has a tabbed interface that allows the opening of more than a single file, JustDecompile has only a code view window
  • dotPeek shows the code of a class in a window, in order to see a method, it scrolls to where the method is; JustDecompile shows a class as a stub, one needs to click on a method to see the implementation of only that method in the code window


My conclusion remains that dotPeek is a lot more usable than JustDecompile. As a Resharper user, I can accept that I am biased, but one of the major functionalities of a .Net decompiler is to show you usable code. While I can take individual methods or properties with JustDecompile and paste them in my code, I can take entire classes with dotPeek, which makes me choose dotPeek for the moment, no matter all the other points above. Of course, if any of the two tools would give me a button that would allow me to take a dll and see it as a Visual Studio project, it would quickly rise to the top of my choices.

Update 26 Apr 2013:
I've again compared the two .Net decompilers. JustDecompile 1.404.2 versus dotPeek EAP 1.1.1.511. You might ask why I am comparing with the Early Access Program version. It is because JustDecompile now has the option to export the assembly to a Visual Studio project (yay!), but dotPeek only has this in the EAP version so far.
I have this to report:
Telerik's JustDecompile:
  • the installer is just as cute as before, only it is for a suite called DevCraft, of which one of the products is JustDecompile
  • something that seemed a bit careless is the "trial" keyword appearing in both download page and installer. If installing just JD, it is not trial
  • again the checkboxes for JustCode and JustTrace are checked by default, but at least they are more visible in the list of products in the suite
  • a Help Improve the Telerik Installer Privacy Policy checkbox checked by default appeared and it is not that visible
  • the same need to have an account to Telerik in order to download JD
  • when installing JD, it also installs the Telerik Control Panel a single place to download and manage Telerik products, which is not obvious from the installer
  • the install takes about two minutes on my computer to a total size of 31MB, including the control panel
  • if a class is in a multipart namespace like Net.Dns, it uses folders named Net.Dns if there is no class in the Net namespace
  • not everything goes smoothly, sometimes the decompiler throws exceptions that are then logged in the code as comments, with the request to mail to JustDecompilePublicFeedback@telerik.com
  • it creates the AssemblyInfo.cs file in a Properties folder, just like when creating a project
  • resolves string concatenation with string.Concat, rather than using the '+' operator as in the original code
  • resolves foreach loops into while(true) loops with breaks when a condition is met
  • uses private static methods in a class with the qualified class name
  • resolves inline variables, leaving the code readable
  • overall it has a nicer decompiled code structure than dotPeek
  • adds explicit default constructors to classes
  • places generic class constraint at the end of constraints list, generating an exception
  • it doesn't catch all reference assemblies, sometimes you have to manually add them to the list
  • decompiles enum values to integer in method optional parameters default values, generating compilation errors
  • decompiles default(T) to null in method optional parameters default values, generating compilation errors
  • decompiles class destructors to Finalize methods which are not valid, generating compilation errors
  • types of parameters in calls to base constructors are sometimes wrong
  • places calls to base/this constructors at the end of constructor code blocks, which of course does not work, when you place more complex code in the calls
  • doesn't understand cast to ValueType (which is somewhat obscure, I agree)
  • really fucks up expressions trees like FluentNHibernate mapping classes, but I hate NHibernate anyway
  • resolves if blocks with return in them to goto/label sometimes
  • resolves readonly fields instantiated from a constructor to a mess that uses a local variable to set the field (which is not valid)
  • doesn't resolve corectly a class name if it conflicts with the name of a local method or field
  • inlines constants (although I don't think they can solve this)
  • switch/case statements on Enum values sometimes gain weird extra case blocks
  • sometimes it uses safe casting with value types (x as bool)

JetBrain's dotPeek:
  • the EAP version has a standalone executable version which doesn't need installation
  • the whole install is really fast and installs around 46MB
  • as I said above, it does not have the Export to Project option until version 1.1
  • the decompilation process is slower than JustDecompile's
  • if a class is in a multipart namespace like Net.Dns, it uses a folder structure like Net/Dns
  • sometimes things don't go well and it marks this with // ISSUE: comments, describing the problem. Note: these are not code exceptions, but issues with the decompiled code
  • it inlines a lot of local variables, making the code more compact and less readable
  • weird casting of items in string concatenations
  • a tendency to strong typed casting, making the code less readable and generating compilation errors at times
  • the AssemblyInfo.cs file is not created in a Properties folder
  • when there are more classes in a single file, it creates a file for each, named as the original file, but prefixed with a number, instead of using the name of the class
  • it has an option to create the solution for the project as well
  • it creates types for anonymous types, and creates files with weird names for them, which are not really valid, screwing the project.
  • it has problems with base constructor calls and constructor inheritance
  • it has problems with out parameters, it makes a complete mess of them
  • tries to create a type for Linq IQueryable results, badly
  • it has problems with class names that are the same as names of namespaces (this is an issue of ReSharper as well, when it doesn't present the option to choose between a class name and a namespace name)
  • resolves while(method) to invalid for loops
  • it doesn't resolve corectly a class name if it conflicts with the name of a local method or field
  • problems with explicit interface implementations: ISomething a=new Something(); a.Method(); (it declares a as Something, not ISomething)
  • problems with decompiling linq method chains
  • I found a situation where it resolved Decimal.op_Increment(d) for 1+d
  • indirectly used assemblies are not added to the reference list
  • it sometimes creates weird local variables like local_0, which are not declared, so not valid
  • adds a weird [assembly: Extension] in the AssemblyInfo file, which is not valid
  • a lot of messed up bool values resolved as (object) (bool) (value ? 1 : 0), which doesn't even work
  • inlines constants (although I don't think they can solve this)
  • __Null local1 = null; - really?

After decompiling, solving the issues and compiling again an assembly in the project I am working on I got these sizes:
JustDecompile: 409088
dotPeek: 395776
The original: 396288

Of course, this is not really a scientific comparison between the two. I was excited by the implementation of Export to Project in both products and I focused mainly on that. The navigation between types and methods is vastly improved in JustDecompile and, to my chagrin, I have to admit that it may be easier and safer to use than dotPeek at this time. Good job, Telerik! Oh, and no, they have NOT paid me to do this research :-)

and has 0 comments
A user has noticed that in Google Chrome changing the hash of the url adds the address in the browser history. So no more cool ASCII eyes watching you from the address bar.

Also, I was greeted today by a warning (also from Google Chrome) that my blog contains content from www.hillarymason.com and that it is unsafe to open. I've removed that blog from the blog roll list, even if, for what is worth, I don't think that was an "evil blog".

People who know me also know about the Law of Siderite: never use any Microsoft product until it has reached a second service pack or release. That has been true for me, like a skewed Moore law, since Windows 95 OSR2 (also known as Windows 96). But I had to break my own legal advice and try to install Visual Studio 2010 Service Pack 1.

There are several reasons for this, one of them being that VS2010 had a few relatively important bugs and I am using the tool at work every day and at home when I get the time. So not only did I not wait for a Service Pack 2, I've gone and installed the beta version! And guess what? It installed without any problems and fixed most of the bugs that annoyed me, if not all. Yay, for Microsoft! But then I had to install ASP.Net MVC, which needed as a prerequisite VS2010 SP1 and so I went and installed the Release Candidate. That is, the version that should be like the beta, only better. This is the story of that fateful decision:
  • Step 1: Start ASP.Net MVC3 installer. Result: Fail!
  • Step 2: Start Visual Studio 2010 Service Pack 1 installer, the small 500kb version. Result: fail.
  • Step 3: Download the .iso version and run. Result: fail.
  • Step 4: Reinstall Visual Studio 2010 Ultimate
    a) Uninstall Visual Studio 2010. Result: fail.
    b) Use Microsoft Installer Cleanup Utility on Visual Studio. Install VS2010 (without VB or VC++). Result: Success!
  • Step 5: Install VS2010 SP1
    a) .iso version. Result: fail!
    b) Web Platform Installer version (new fancy Microsoft tech). Result: fail!
  • Step 6: Install Web Developer Express (free) + VS2010 SP1 from Web Platform Installer. Result: SP1 core fail! SP1 Asp.net success!?!


Bottom line: Now ASP.Net MVC seems to be working, with Razor syntax highlighting and intellisense, but the SP1 core is not installed. Visual Studio help window shows me that I have the Rel(ease) version, not SP1. I don't know what will blow up when I try it. Luckily, all this happened at home, not at work, therefore I haven't broken my main working tool.

My conclusion is that somehow you need to install the (useless, if you have Visual Studio) Visual Web Developer Express in order for the ASP.Net SP1 to work. This allows for different web engines, like Razor. SP1 doesn't work though. If you have the beta installed, try to use the Web Platform Installer to install Web Developer Express as well as the Visual Studio SP1. If it fails, look at the last section and see what got installed. Maybe you get the best of both worlds. I will be trying another Visual Studio version, but as the whole process takes ages, be warned.

Let me say that again, so it's perfectly clear: the install process of Visual Studio 2010 Service Pack 1 plus Visual Web Developer Express via the Web Platform Installer tool took me 12 hours! I did not have to press anything, it wasn't a case of trial and error, I just ran it, it said "installing 2 out of 12" for 12 hours in a row, then it partially failed. And the Web Platform Installer seems the best solution so far!