The finale of what seemed to become my favourite sci-fi series ever (at its beginning) left me with a bitter taste in my mouth. Not only it makes no sense, but it is overall incredibly idiotic. If you haven't watched the end of the series, don't read further, because this is the mother of all ranty spoilers ever.

What makes it so emotional for me is not only that I really liked the show, but that this was not a show that was ended because of lack of planning or budget or the economical crisis, so nothing was rushed or changed. This was "meant to happen". And it sucked! Sucked worse that a vampire caught in the event horizon of a black hole that is falling into another black hole!

Not only did it not explain anything in a manner that would make sense to me, but instead it went completely overboard on all the things that I hated in the show. God exists, he somehow planned all this (oh, yeah, real modesty here, mr. Moore!), the model 6 in Gaiuses head was an angel, so was Kara Thrace, in the end they all reach Earth (this Earth) and decide to leave all technology behind (they throw the ships in the sun!!!) in the hope that starting anew would make them "break the cycle" and Hera became the chromosomal mother of all future humans. I guess leaving all that technology behind wasn't a good survival strategy for the rest of the 38000 people left alive, was it?!

If everything was God's plan, then there was no cycle except in its brain!! Forgetting mistakes is NOT a step towards not repeating them. Leaving behind technology is just as stupid! And ending the show with a couple of angels walking on Earth now and making bets on if we repeat the mistakes again or not, with background videos of the latest developments in robotics was.... there is no word in the English language for it. It is dumber than creationist! And the last half of the last episode was all about people saying goodbye to one another then going to live alone (read DIE!!) somewhere!

There is a glimmer of hope left though. The centurions were given their freedom and the last baseship. I will be looking at the sky hoping for them to return, nuke Moore and then air an all Cylon TV show about how they didn't repeat any mistake and just carried on!! Gods, this was frakking retarded!

And, of course, there is one more good thing in the series, and that is the Bear McCreary's remix of Bob Dylan's/Jimmi Hendrix's All Along the Watchtower. I am embedding the video with the cool transition from simple piano to all the instruments. Pretty cool!.

Guess what? F***ing YouTube removed the video because of a copyright infringement. What? One minute and a half of a movie scene? Geez! Couldn't find the same scene, so I am embedding All Along The Watchtower.

[youtube:qMo7WybtTWI]

The sound bit of the scene, sans the scene, can be found here. You can also see the live performance of the song here. You might also want to try Bob Dylan's original song.

Update: check out this Google event with McCreary playing the BSG theme with Raya Yarbrough as the vocalist.

and has 0 comments
This is how Dexter, the animated character in Dexter's Laboratory, begins his days. His enthusiasm for his work is amazing and inspirational, but real people rarely feel this way. Today is one of those great days for me! I woke up late, I took a long shower, I've eaten some good food, I've watched one of my favourite anime shows while getting dressed and I came to work in a beautiful sunny spring morning.

What amazing energy and how great a feeling! I feel I can do anything! Throw your legacy ASP applications at me, make me do stupid changes in even dumber web CRMs, give me the most menial degrading tasks you can think of, I will eat them whole and spit out gold! I am unstoppable!

and has 4 comments
Ok, you first must know that Microsoft added a specific namespace for working with ActiveDirectory in .NET 3.5. It is called System.DirectoryServices.AccountManagement. The principal objects in the Account Management API include computer, group and user objects and it provides a means for applications to extend the object model to include custom schema object types.

Now that this is out of the way, I want to take my simple Authenticate, ListUser and ReadUser methods (working fine with the old DirectoryEntry method) and translate them into this new way of doing things.

I did some code and I got this error message: "80075000". That is the actual error Message property! Even more remarkable, a google for 80075000 resulted in only 246 results!! none of them explaining what I did wrong. Apparently, I had sent a string in the format "LDAP://ComputerName" as the computer name. Maybe it helps someone.

But this didn't solve it. I changed it with just the computer name, with or without a "\\" prefix, and I got a more clear text, but just as vague UnauthorizedAccessException: "General access denied error".

I am still working on it, but damn, how can a programmer not think about the error message he passes to other programmers?!

Ok, made it work, here is the code for the user authentication in an Active Directory domain.
Classic DirectoryEntry:

bool authentic = false;
try
{
var entry = new DirectoryEntry("LDAP://ComputerName",
"Domain\\username", "password");
object nativeObject = entry.NativeObject;
authentic = true;
}
catch (DirectoryServicesCOMException ex){}
return authentic;
As you can see, not the most elegant approach.

The .NET 3.5 way:

using (var context = new PrincipalContext(ContextType.Domain,"ComputerName"))
{
return context.ValidateCredentials("username","password");
}
Much better, isn't it? Pay attention that in the first case you need the domain in the username and in the second you need it not to be part of the username!

There is a third way (System.DirectoryServices.Protocols.LdapConnection), but seems too complicated to address right now.

and has 0 comments
The new spring heat seems to have brought not only flies out of hibernation, but also some cats! Their behaviour is strangely similar to that of the flies, though, hmm :)

Recently I have been working on this Sharepoint project. I took it more out of curiosity as I didn't know anything about this piece of software. Now I know a lot more, like how hellish it is to code against it :) But it is also not a bad idea.

In case you don't know (as I didn't) Sharepoint is something like an ASP.Net site designed to work within a company, as an internal tool, allowing a lot of customizations and security from the web interface, with no code required. The desired end result is something looking like the IGoogle or Yahoo home pages, with web parts that can be configured, moved around, minimized, closed, made to interact one with another. Sharepoint Services is in itself a free software, but it only works on a Windows 2003 server or higher, so it sucks that way. Also, there is no real Sharepoint support for Visual Studio and most of the tutorials you find online are either too specific (blogs and such) or too vague (Microsoft style).

Also, there is a lot of confusion regarding the use of the interfaces in the Sharepoint dll, most of which have been obsoleted when the web part engine from .Net 2.0 was introduced.

Ok, short list of steps on how to start making a Sharepoint project in Visual Studio, assuming you code in Windows XP:
  1. Install Windows Server 2003 on another machine (virtual or not)
  2. Download and install Sharepoint Services 3.0 SP1 on it
  3. Get the Microsoft.Sharepoint.dll file and copy it on your XP machine somewhere
  4. Download and install the Sharepoint SmartTemplates for Visual Studio
  5. Update the WSPBuilder application and some batch files in the template files
  6. Start Visual Studio and create new project from installed templates
  7. Add a reference to the Microsoft.Sharepoint.dll library
  8. Code!
.

Now for the long list.
In order to install Sharepoint Services 3.0 SP1 you need to also install .Net 3.5 SP1. Actually it is a good idea to install this as well as the Visual Studio 2008 SP1 before you do anything (Sharepointy or not). Here is a link.

The Sharepoint SmartTemplates actually create a folder structure that is then used by the WSPBuilder utility to create the WSP file that installs a web part in Sharepoint. You can either import it in the site (upload) or use the setup that is provided with the templates. The problems I met when using it are linked primarily with the version of WSPBuilder that is included in the templates I've downloaded (version 0.2).
So first locate the installed template files: you can usually find them in My Documents/Visual Studio 2008/Templates/Project Templates/ as two zip files. First step is to download the latest WSPBuilder and replace it in the archives. The next step is to change the WSP/createwsp.bat file like this:
@ECHO OFF
DEL .\$safeprojectname$.wsp
ECHO Copying DLL ...
XCOPY /Y ..\BIN\$safeprojectname$.dll .\80\BIN\
ECHO Copying ASCX files ...
XCOPY /Y ..\*.ascx .\12\TEMPLATE\CONTROLTEMPLATES\$safeprojectname$\
ECHO Building WSP ...
..\WSPBuilder\WSPBuilder.exe -WSPName $safeprojectname$.wsp -BuildCAS false -SolutionID $guid2$ -DLLReferencePath "[the folder path where you copied Microsoft.Sharepoint.dll]" -TraceLevel Verbose
ECHO Copying WSP file ...
XCOPY /Y .\$safeprojectname$.wsp ..\SETUP\

The bold parts you must add to the file. The delete because otherwise you might be able to compile the project using the old WSP file if the WSPBuilder run fails. The others is in order to be able to compile the WSP using the sharepoint library and see any errors that might occur.
Alternatively, you can change the WSPBuilder/WSPBuilder.exe.config file with the DLLReferencePath and TraceLevel options.
Ok, now repack the folders into the archives and copy them back.

Now, after you build the project, you will have a Setup folder in the bin folder. That you must copy to the Windows 2003 computer and run. It will install the web part(s) in the project. In order to add more webparts to the project and make them compile in the setup project you need to alter the WSP\12\TEMPLATE\FEATURES\SmartPartTemplate\manifest.xml file and describe the files you add to the project.

After you run the setup project, you have to open the Sharepoint site and go to Site Settings -> Site collection features and activate the web part. Only then you can actually add it to a page.

Sounds complicated? Well, read more :)

Make sure that when you have finished with a web part you DO NOT DELETE THE SETUP PROJECT, but run it to remove the web part first! In order to remove an install web part from a Sharepoint site you must delve into the hell of command line utilities! Well, it's natural to me, but I am an old guy! ;)

Just supposing that you have done the undoable and you managed to delete a setup project with the part still installed, you must use the stsadm tool.
First find it on the Windows 2003 computer (with Find Files) then add the containing folder to the path. Then run cmd in the Start/Run menu and use the following commands:
stsadm -o enumsolutions
will enumerate the installed solutions. Remember the name of the solutions you want to remove.
stsadm -o retractsolution -name "[name of solution]" -immediate
will retract the web part project and allow you to delete it.
stsadm -o deletesolution -name "[name of solution]" -override
retracting doesn't always work, so the override option will force a delete.

Sometimes you manage to change the GUID of the project and you get an error like A solution with the same name "SomeName.wsp" or id "Some GUID" already exists in the solution store.. You delete it, but you still have this error. Try to install the solution with the setup project. Wait for the error, exit the setup project. Use stsadm -enumsolutions to see what the GUID of the project is, copy it, replace the SolutionId GUID in the setup.exe.config file with this one. The setup should then work.

This is about it. I've wasted a few hours to learn all of this. I know it's not terribly organized, but writing something is better than sharing nothing.

and has 0 comments

I haven't been writing for a while, but that is because I was working! Amazingly so, as I am not known for my willingness to work. But that also has its boons, you know, as I will not only gain material wealth for my wife's shoes, but also material for the blog! :) You will have to wait a bit for that, though.

Instead, I will talk about three little gems I found while browsing ShellCity. In case you don't know, ShellCity is a blog dedicated to the tools, not the result. Every day four free utilities are being presented in this retro looking site. Anyway, without further ado:

Fences. This allows you to organize your many desktop icons by grouping them into labeled transparent folder like structures. Not only does it make your desktop look better and feel better, but when you change your desktop resolution, it also remembers the location of these groups so that when you revert, you get them in the same position! Great thing to have and my favourite in this post.

MSVDM, or the Microsoft Virtual Desktop Manager. This is pretty old stuff, but I've only recently discovered it. It is NOT an exe file and it will not be installed in the Start menu! Instead it is a taskbar toolbar. It shows four buttons which allow you to switch between four different desktops. The desktop icons remain on all of the desktops, but you can define a different background for each and the opened windows are different from desktop to desktop. So, what you use it for is to open a group of utilities based on context. As an example, open a Visual Studio and some browser windows regarding a certain project, then open another Visual Studio and some other browser windows for another project that you work on simultaneously.

WizMouse. This one is not something you immediately go Wow! about. It sits in the traybar and does only one thing: it scrolls windows when you move the scrollwheel. But it doesn't scroll the active window, but the window directly under the mouse pointer! A lot of annoyance is saved by this.

Hope it helps you all. Till next time!

This is a message I got from the UpdatePanel Shrinker in a site we built:
Shrinkage: from 70000 to 10 = 0.014%.


Almost a year ago I thought of a way of compressing the UpdatePanel asynchronous output based on the previously sent information and created the UpdatePanel Shrinker. I waited all this time to test it and also I've used it in some small projects.

From today, the project is on Github, with an MIT licence, that means do whatever you want with it, but I would appreciate some words from you.

As for the details: it uses a sort of fast and dirty home made diff algorithm to compare the previously sent output for an UpdatePanel with the current one. The problem is that the effect can only be seen from the second async postback on, but when used, it yields fantastic compression rates.

You can use it for sites that are accessed from Internet challenged locations, for sites that have complex Ajax interactions and for sites that you "Ajaxify". And before I get angry comments from purists, yes, I know it is more efficient to use Ajax in a smart way to solve each problem in the best possible way, but if you just want the quick and dirty solution, like a MasterPage with a ScriptManager, an UpdatePanel and the page content in it, the Shrinker is the thing for you.

Take care to look in the Debug Output window. The shrinker will output the compression rate and any warnings it might have.

I have this cool thing I made that needs a HttpHandler to process some commands. Therefore, in the code, I am trying to change the web.config whenever possible. I do it in the usual way:
WebConfigurationManager.OpenWebConfiguration("~");
... .Save();
. That should work fine, unless you don't have writing rights on the web.config file. But you don't need only that! I gave rights to the web.config file, but I got this silly error: "changing web.config An error occurred loading a configuration file: Access to the path 'bla...bla...bla...bla.tmp' is denied.".

In other words, in order to write to the web.config you also need rights to add files to the web folder in order to create temporary files. Hmm, I thought the temporary files folder was used for that... :-|

and has 2 comments
No, I didn't leave my current job. This is more or less a quote from some blog I read. Probably Jean Paul S. Boodhoo, but I couldn't find the reference when I looked for it.

Anyway, the gist of the article was that, even if he did enjoy his position, the guy chose to look further and expand his horizons and that, in the end, made him a better developer and a better person. Is that a general idea? Of course not. I am willing to bet that changing one's job more often leads to bad things than good, but in the end you try a few options and you get to some place you can live with.

And, well, I can't stop thinking about the beginning of my career when, even if I wasn't really doing a lot of programming, I was learning a lot by the simple fact of changing jobs. Usually, the first month is extraordinary as you learn new skills, you get to know new people and new methods of doing new things. After that you "get used" to the job, like a shoe on someone's foot. It can also get smelly pretty fast, as well.

Sure, having a new job every 8 months doesn't sound so good now, but the memory of that "living on the edge" feeling still lingers. And who knows? I may find something worthwhile just by looking over the fence. What do you guys think?

and has 1 comment
As you have probably noticed, I've decided to replace Talkinator with Jabbify. Hopefully this will solve the problems with IE6 as well as the hour issues (never knowing when people left the last message). Also, this particular type of chat lets me know when people leave messages, so I can actually reply and join blog conversations.

Don't hesitate to leave me messages, although I would prefer them to be smarter than "fgfghhfgf". Thank you!

You are using a PopupControlExtender from the AjaxControlToolkit and you added a Button or an ImageButton in it and every time you click on it this ugly js error appears: this._postBackSettings.async is null or not an object. You Google and you see that the solution is to use a LinkButton instead of a Button or an ImageButton.

Well, I want my ImageButton! Therefore I added to the Page_Load method of my page or control this little piece of code to fix the bug:

private void FixPopupFormSubmit()
{
  var script =
    @"if( window.Sys && Sys.WebForms 
    && Sys.WebForms.PageRequestManager 
	&& Sys.WebForms.PageRequestManager.getInstance) {
  var prm = Sys.WebForms.PageRequestManager.getInstance();
  if (prm && !prm._postBackSettings) {
    prm._postBackSettings = prm._createPostBackSettings(false, null, null);
  }
}";
  ScriptManager.RegisterOnSubmitStatement(
    Page, 
    Page.GetType(), 
    "FixPopupFormSubmit", 
    script);
}



Hope it helps you all.

I wanted to use this Accordion control on a page and so I specified the ContentTemplate and HeaderTemplate and gave it a DataTable as a DataSource and DataBound it. Nothing! No errors, no warnings, no display of any kind. After a few frustrating minutes of trying to solve it I asked buddy Google about it and it turned out that the Accordion control MUST receive a DataView as a DataSource and nothing else. Using datatable.DefaultView solved it.

I've been listening to my favourite podcasts, HanselMinutes and .NetRocks, as usual and I've stumbled upon another gem of a show. It was about Test Driven Development. Why am I talking so much about this, although I don't practice it? Because I am sure I will get around and do practice it. It is not just a hype, it is the only way to do software. And I will explain why. But before that, let's talk about a confusion that has been cleared by the show I have been talking about.

The name Test Driven Development is usually associated with Automated Unit Testing. While this is mostly used only in TDD, it is not required by TDD at all. The badly chosen word Test actually means "meaningful, measurable, goals", in other words, the specifications! If you have those, you can test your application against the requirements and determine what is wrong, if anything. Without a clear view of the specs, you cannot tell if the project is performing as needed.

So if you think about TDD as Specifications Driven Development, you realize that you have been doing it all along! Admittedly, now it sounds even more like STD, but hey, sacrifices must be done in the name of improving code blog readability.

Now, I was saying that this is the only way to do software. Actually, I have explained why just above, but I will get into some personal details. I have been "blessed" with a project where the deadline was set before the specifications were drawn. Worse even, the specs did not come from people that really understand the business process, but from people using another piece of software that they want replaced. In other words, we're pretty much inventing ways of porting a badly designed Windows desktop app into ASP.Net. As this wasn't enough, we are also inventing features that were badly described by the client and starting from a partially functional ASP.Net project written by junior programmers.

What a drag! But that was actually not so bad as realizing that my developer output was slow, bad, and overall smelly and ugly. Why was that? Why couldn't I just stop whining and do what I know had to be done? Because there were no specs!. Without clearly drawn specs of not only what I had to do, but also what the initial project was supposed to do, my hands were tied. I could not refactor the code, because I had no way of telling if I broke anything. Has it ever happened to you to take a piece of code, make it better, then realize it is not working and you don't know why? The fear of that happening is the most important reason why people don't refactor. The next important factor being a manager that thinks refactoring is just a waste of time and has no vision of the future of the project.

But also, having no vision of what is to be done is the reason why developers are not motivated to do their job. Even the lowliest code monkey has to have a glimpse of the future of what they are doing, otherwise they are literally flying blind. Software development is just as much of an art as web design. It is actually strange that people don't understand there are many types of art just as there are many types of scientific thought. Even if we don't actually care how the app is gonna look as long as it does the job, we do feel pride in its functionality and it is nothing that hurts more as not knowing what that software is supposed to do and a clear way of measuring our own performance.

OK, enough of this. The bottom line is that a project needs to have clear specifications. The first test for a software is the compiler! You can even call it an automated test! ...but the last test is running through the spec list and determining if it does the job as required. Another podcast said that the process of creating automated tests has as a side effect the significant improvement of software quality, but not because of the tests themselves, but of the process of designing the tests. If your tests are meaningful, then you know what the app is to do and you have a clear vision of what failure and success mean and in the process of test design, you get to ask yourself the questions that lead to understanding the project. THAT is Test Driven Development!

and has 1 comment
Update: the manga is now completed, after 65 chapters. The ending was a bit disappointing, but at least it didn't drag on for ages like in other situations.

You can read Pluto, by Naoki Urasawa, up to chapter 62 on onemanga.com. It is updated often and I found it impossible to stop reading. The entire story is placed in a possible future where people and high intelligence robots coexist. There are only a few robots that have human like appearance and intelligence, and they are just beginning to understand feelings. A terrible killer is destroying them one by one, though. Who is he and what does he want?

I can hardly talk about the plot without spoiling it for you, but I can speak about my own impressions. Even if the logic/science in the series is not very consistent, the overall feeling is of great attention to detail, especially since the science is not as important as the philosophical perspective on consciousness and the soul. The drawing is also very carefully done and many of the slides are in color, as well. The plot is fascinating and it belongs to the group of stories the Japanese are so good at: the perils of too much power and the discovery of one's own limits.

I highly recommend this to lovers of manga and scifi alike. I will try to get the anime for Monster and I will probably get into reading the manga as well.

and has 0 comments
Update: There are some major issues with this addon, because on some sites (like YouTube, but not only) Internet Explorer simply closes with an error. It has become more and more annoying until I've decided to uninstall it.

What a nice little gem this is. I've just installed it, so I can't really say it is all good, but from what I've seen so far it is a wonderful addition to Internet Explorer (7 or 8!).

A few of the features that I've already observed:
  • It automatically recovers the pages and tabs opened when an computer or INTERNET explorer crash occurred.
  • Small download manager, FireFox style
  • Ad blocker - although it doesn't protect you from the javascript errors that occur when blocking ads
  • Mouse gestures
  • Background preloading of links when computer is idle enough and DNS prefetching
  • User scripts that can do all kinds of stuff, from moving YouTube windows where there is space and then showing them bigger to showing frames next to Google search results so you can open and preview the sites directly.
  • Tab history manager
.

But it does so much more. I am quite amazed by it. So get it, it's free: IE7Pro