June 2006 Entries

Microsoft WPF Issues...

As my .Net Framework 3.0 exploration continues more questions are being razed:
Does rotation means also skew?
I've drawn a Rectangle and filled it with a DrawingBrush, then tried to transform the brush and rotate it by 45 degrees [see
the source code]. The resulting transformation as you can see in the image is also skewed. The same applies for all brushes as well as the opacity mask ones. Does anyone have any idea why this is happening?
Why RelativeTransform is the default transformation?
When using
Microsoft Expression Interactive designer and try to transform a brush as previously mentioned [using the tool] It creates a RelativeTransformation xaml Node [as seen in the previous source code] and in it describes the transformation. If you change from RelativeTransform to Transform using the xaml editor then you can no longer modify the transformation using the designer. Why is that?

Greek Innovation

It hasn't been that long since I blogged about innovation in Greece...
Well it seems that someone else beside me cares and decided to do something about it. OTENET (the Government’s internet provider) is hosting a 50000€ competition for the most innovating idea. I just wish that this will be a fair competition and that this will lead into things getting better for IT in Greece.

Things are only getting better...

I've been playing around with WinFx... sorry .Net Framework 3.0 for quite some time now and faced a number of issues with those early releases with the most irritating one being the crashing of Visual Studio 2005 when, while debugging an application, an unhandled exception occurred. It's comforting to see though that most of the things that annoyed my in those early releases have already been resolved by the VS Team in .Net Framework 3.0 beta 2.

Personal Web Starter Kit Bug

Microsoft's personal web starter kit, included in Visual Studio 2005, contains two small bugs.
Issue 1: In the photos administration page the ObjectDataSource used for the CRUD (CreateRemoveUpdateDelete) operations does not provide any parameter declarations for the update and delete functions. Thus when trying to update or delete a photo you get an exception saying that the method call requires a parameter that's not provided.

<asp:ObjectDataSource ID="ObjectDataSource1" Runat="server" TypeName="PhotoManager" SelectMethod="GetPhotos" InsertMethod="AddPhoto" DeleteMethod="RemovePhoto" UpdateMethod="EditPhoto" >
  <
SelectParameters>
    <
asp:QueryStringParameter Name="AlbumID" Type="Int32" QueryStringField="AlbumID" />
  SelectParameters>
  <
InsertParameters>
    <
asp:QueryStringParameter Name="AlbumID" Type="Int32" QueryStringField="AlbumID" />
  InsertParameters>
asp:ObjectDataSource>

Issue 2: If you install the database backend by running the script provided (personal-add.sql) in the PWS folder (usefull when you're usind a shared hosting service) the EditAlbum and EditPhoto stored procedures have different parameter names than the ones provided in the Photos.aspx administration page (original_AlbumId and original_PhotoId is needed) causing a parameter exception when trying to update either an album or a photo.
CREATE PROCEDURE EditAlbum
@Caption nvarchar(50),
@IsPublic bit,
@AlbumID int
AS ...
CREATE PROCEDURE
EditPhoto
@Caption nvarchar(50),
@PhotoID int
AS ...

I'm sure that the people behind the SK have already noticed the problem and published or going to publish a fix for it. I just thought that I should let everyone know since I've already stumbled on them.

Vista Visual Studio and SQLExpress Intergration

It seems that the way visual studio understands the SQLExpress server name has changed or that security settings have disabled the .\SQLExpress syntax (which obviously meant local computer SQLExpress instance) on Vista. So if you try to create a new database from the AddItem menu item of visual studio 2005 or connect to an existing one that uses the above syntax in the connection string you will most probably get an error saying that “failed to generate a user instance of sql server”.
What you'll have to do (this took me a while to figure out, so you should thank me :-) ) is modify the server name/instance to the fully qualified one. If you want to create a new database you should first create it from the management studio, then add it to your project and modify the connection string.

MSI installation under Vista

Continuing my Vista setup and exploration, I begun installing all the software and components I used in order to develop software. Most of the MSI installation packages (including Microsoft's CAB) though failed to complete under Vista.
It seems that some kind of privileged action needed in order to complete the installation, which is probably write access to the program files directory in order to write an InstallerState file is not allowed not even when the executable is running under an administrative account. The error message says that “Access to the path c:\program files\program\programInstall.InstallState is denied (P.S not event the administrator can change the access rights). The installation completes successfully though when a different installation path is specified (e.g. C:\Program\).
Ok it's nice to protect the OS from various things that could damage it but from the experienced user's perspective it gets really frustrating having to confirm every administrative action through a dialog or not allowing write access to the Program Files folder.

Intuitive Microsoft Exception Messages...

I’m developing a web application which takes advantage of Microsoft Enterprise Library’s Logging block to log Errors in a custom sink I’ve developed. Now in order to log unhandled exceptions I’ve hooked on the Application_Error event of the HttpApplication object, the code looks something like that:

void application_Error(object sender, EventArgs e)

{

  HttpApplication app = (HttpApplication)sender;

  Exception error = app.Server.GetLastError();

  if (error != null)

  {

    LogEntry errorEntry = new LogEntry();

    errorEntry.Title = error.Message;

    errorEntry.Categories.Add("General");

    errorEntry.EventId = (int)(LoggingErrorCodes.Unhandled_Error);

    errorEntry.Severity = System.Diagnostics.TraceEventType.Error;

    errorEntry.ExtendedProperties.Add("CallStack", error.StackTrace);

    Logger.Write(errorEntry);

    app.Server.ClearError();

  }

}

So far so good, when I run the application though, I was getting an exception for almost every request made, which resulted of course in a log entry beeing written on the log. The exception had the intuitive message “File does not exist.” , the exception type was HttpException and the call stack indicated that the exception was originating from the ProcessRequestInternal method of HttpStaticHandler class. Finally the page was loading up fine (no obvious errors).
Ok here is the trivia question (don’t read bellow before answering that ;-)) can you imagine why this was happening?

After spending a couple of hours on that and doing a little disassembling on the HttpStaticHandler class (sorry MS had no other way) I’ve discovered that a file was actually missing and that’s why I was getting the exception,

internal static void ProcessRequestInternal(HttpContext context)

{

  HttpRequest request1 = context.Request;

  HttpResponse response1 = context.Response;

  string text1 = request1.PhysicalPath;

  if (!HostingEnvironment.UsingMapPathBasedVirtualPathProvider)

  {

    StaticFileHandler.RespondUsingVirtualFile(request1.FilePath, response1);

  }

  else

  {

    FileInfo info1;

    if (!FileUtil.FileExists(text1))

    {

      throw new HttpException(0x194, SR.GetString("File_does_not_exist"));

    }


But which file? Once more the page I was requesting was loading up fine. Can you, after these clues, imagine what was going on?

If you still don’t know, here is the solution to the trivia. I’ve put a watch on the ((HttpApplication)sender).context.Request object and set a breakpoint in the application error event handler. From the Request object I found out that the blank.gif (from the name you can see why I was seeing no difference on the page) was missing from a javascript component that was trying to load it at runtime.

If only the guy who wrote the ProcessRequestInternal method of the HttpStaticHandler class had added the text1 local variable in the exception information it would have saved me a lot of time and efford from trying to find out the error. So the lesson learned here is “Always include helpful information to your exceptions” it will make the life of other developers a lot easier…

Comments are welcomed...

I've just noticed that I didn’t have comments enabled for my posts, sorry guys that wasn't intentional but a configuration error.
What troubles me is that nobody contact me, to let me know of this error. This could either mean that nobody reads my blog or that no one had anything to say on my posts.
In any case I won't be discouraged I will keep blogging regularly and hope that someone is or will be reading me ...

Not because I'm Greek...

The world's oldest computer, seems to be Greek as joint British-Greek research seems to suggest.…
What's strange though, is how from a culture that could innovate by creating such computing devices we reached the point of being almost last (40th among other European countries) according to the
ICTDI (Information Communication Technology Diffusion Index) of Europe's Information Society (i2010).

Stumbled on Source Control

Installing all the software I need in my new Operating System, I’ve stumbled across my first real problem, (had various other small ones, which didn’t worth mentioning) Source Control. VSS 2005 does not install on Vista. I get a software requirement error, stating that Windows XP SP2 is needed in order to complete the installation. So if someone plans on checking out code from office and work at home with it in his Vista enabled laptop, he better forget about it, or use another source control system L. I wonder if there is any work around I could use…
I’m curious what source control Microsoft’s engineers/developers use for their code if  VSS does not work with vista?

Graph me up...

The latest hype on the net, everyone is doing, is graphing your site, so I though I give it a try too. Here are my results:
My Site

and my Blog

Legend:
blue: for links (the A tag)
red: for tables (TABLE, TR and TD tags)
green: for the DIV tag
violet: for images (the IMG tag)
yellow: for forms (FORM, INPUT, TEXTAREA, SELECT and OPTION tags)
orange: for linebreaks and blockquotes (BR, P, and BLOCKQUOTE tags)
black: the HTML tag, the root node
gray: all other tags

First Vista blog post...

This is my first post from vista.
I've installed over the weekend windows Vista and I'm glad to say that everything went smoothly.
After completing the installation most of my hardware was automatically identified and installed, except from the sound card, modem and camera, which was also installed though after my first OS update.
The new OS looks great and it's quite fast (despite everything said on the internet about Vista so far). I'm running vista on a 1.8GHz Centrino Laptop with 2GB of memory, 80MB HD and a 256MB ATI X700 graphics card and the OS is as fast as my old XP used to be.
So everything pitchy so far... I still have to install all the software I used :-(
I'll keep you posted on my vista experience...

Collection Library

From Sotiris Filippidis' Weblog a great collection library (C5) everyone should check out...

WPF Tools...

If you don't already have them and want to start codding on WinFX (more likely on WPF) you should start downloading them now...

Code Visualization aka Class Diagrams...

I'm a huge fan of software modeling, I guess my studies both as a Naval Architect and Software Engineer is to be blamed for this. Both disciplines require a lot of designing, modeling and planning in order to build a good product.
So I was very happy when I found out that visual studio included a Class Diagram designer (it’s not a UML tool but it’s a start), and especially one that allows real-time synchronization with the code.
Although I'm a huge fun of this new feature, I find the fact that I cannot set the accessibility of a property (by default a property when created, creates both get and set accessors and there is no obvious way of deleting just one of them) from the designer extremely frustrating.
Hope that the next Visual Studio patch will fix this...