Friday, December 25, 2009

Extend Windows 7 's activation period using "Windows Software Licensing Management Tool"

Hi, having not yet the time to go and meet my dear Admins with my legal copy of Windows 7, I had to extend the activation's period. Here's the well known trick that also worked on Windows VISTA :

Click on “Start” > “All Programs” > “Accessories” and then right click on “Command Prompt” and select “Run as Administrator”

slmgr -rearm

It stands for "Software License ManaGeR" and is a VBS Script that adds an extra 30 days (you can do this 3 times).

Once you run that command, wait for a few seconds then you will have a popup "La commande a été exécutée. Redérarez le système pour que les modifications soient prises en compte." (something like "The command has been executed. Restart your system so that the modifications can be taken into account")

After the maximum allowed, you'll have the message :
"Error: 0xC004D307 The maximum allowed number of re-arms has been exceeded. You must re-install the OS before trying to re-arm again"

You have the same thing for Office 2010 :
http://keznews.com/6174_How_to_Rearm_and_Extend_Office_2010_Activation_Grace_Period_for_Free_180_Days_Usage

Silverlight 4 / Flash : Creating a generic business application

When creating a generic business applications with dynamic business rules stored in a Web Service (eg. IBM ILOG JRules, Excel, C# code, MS Workflow Foundation, or even Microsoft "M" language, ...) we have to find an easy and friendly way of choosing the required rules.

Here is an example of how Silverlight or Flash could allow that. Then, a clic or a Drag & Drop will allow attaching the selected Rules to the elements / pages.

The example below is made with a Flash library (http://www.flshow.net/), but it is easy to get the corresponding Silverlight gallery.

Sunday, December 6, 2009

A business oriented drawing application made easy with Entity Framework 4

Hi, here is a basic example of how to design a generic business oriented drawing application using Entity Framework 4. The Client of the Entity model could be a Silverlight or WPF application, using RIA Services for instance (although so far RIA Services has some limitations).

(On this example, my project uses an ASP.Net front office, just to validate that it also works easily)

Consider the following edmx model :


After connecting to a Database and generating all tables from the model ("Generate Database Script from Model..."), the EF also magically generates all the C# classes for you. It's a nice and clean code that you can directly use :


protected void Page_Load(object sender, EventArgs e)
{

    EFModelContainer BusinessContainer = new EFModelContainer();

    Screen screen = new Screen() { Guid = Guid.NewGuid(), Name = "My Screen" };
    Tab tab = new Tab() { Guid = Guid.NewGuid(), Name = "My Tab" };


    BlockElementary elementaryBlock1 = new BlockElementary() { Guid = Guid.NewGuid(), Name = "My elementaryBlock1" };
    BlockElementary elementaryBlock2 = new BlockElementary() { Guid = Guid.NewGuid(), Name = "My elementaryBlock2" };
    BlockElementary elementaryBlock3 = new BlockElementary() { Guid = Guid.NewGuid(), Name = "My elementaryBlock3" };

    BlockContainer blockContainer1 = new BlockContainer() { Guid = Guid.NewGuid(), Name = "My BlockContainer1" };
    BlockContainer blockContainer2 = new BlockContainer() { Guid = Guid.NewGuid(), Name = "My BlockContainer2" };

    // Adds the elementary blocs to the container
    // NOTE : I know this is not proper English,
    // but I prefer this way for intellisens purposes
    blockContainer1.BlockElementaries.Add(elementaryBlock1);
    blockContainer1.BlockElementaries.Add(elementaryBlock3);

    blockContainer2.BlockElementaries.Add(elementaryBlock1);
    blockContainer2.BlockElementaries.Add(elementaryBlock2);
    blockContainer2.BlockElementaries.Add(elementaryBlock3);

    atmTextBlock atomTB = new atmTextBlock()
{ Guid = Guid.NewGuid(), Name = "My atmTextBlock" };
    atomTB.Label = "Label of my atome of type TextBlock atomTB";

    atmTextBlock atomTB2 = new atmTextBlock()
{ Guid = Guid.NewGuid(), Name = "My atmTextBlock" };
    atomTB2.Label = "Label of my atome of type TextBlock atomTB2";


    elementaryBlock1.Atoms.Add(atomTB);
    elementaryBlock2.Atoms.Add(atomTB2);

    // NOTE : I should be renaming tab.BlockContainer into tab.BlockContainers
    tab.BlockContainer.Add(blockContainer1);
    tab.BlockContainer.Add(blockContainer2);
    screen.Tabs.Add(tab);

    BusinessContainer.AddToEltOfScreens(screen);
    int countUpdates = BusinessContainer.SaveChanges();

    Response.Write("Number of updates = " + countUpdates);

}

Everything saves properly into the database :

Mnemonic post

Hi, this one will be in French, since it uses French mnemonic to remember stuff :

Mnemonic 1 :"Notre Bar Reste Ouvert Jeudi Vendredi Bonne Veillée Gros Buveur"
          Variant : "Ne manger rien ou jeûner, voila bien votre grande bêtise"
 Aim : Remember the Color code of resistors
 Usage :
  •  0 Noir
  • 1 Marron
  • 2 Rouge
  • 3 Orange 
  • 4 Jaune 
  • 5 Vert 
  • 6 Bleu 
  • 7 Violet 
  • 8 Gris 
  • 9 Blanc


Mnemonic 2 :"Me voici toute mouillée, je suis une nouvelle planète"

 Aim : Remember all 9 planets of our solar system and how they appear
 Usage : Mercure, Vénus, Terre, Mars, Jupiter, Saturne, Uranus, Neptune, Pluton
 

Thursday, December 3, 2009

Entity Framework combined with Class Diagrams

You liked the Class Diagrams in Visual Studio ? Use them with Entity Framework !!

Here is how :

1/ Use your favorite Developper's environment to create your Entity models (and the dependencies and inheritance as required). Let us assume that your file is called BusinessModel.edmx :



2/ Save the model. This will generate automatically the classes associated with the entities,

3/ Create a Class Diagram, call it for instance ClassDiagram.cd

4/ Open the Class View panel and drill down to find your classes, then Drag and Drop your classes either one by one or by selecting many of them onto the ClassDiagram.cd diagram.




5/ By default, the diagram is read only, and all properties / items are grayed out.



This is because it was generated by EF4;
Create a new file, called for instance 'BusinessModelParialClasses.cs'
that is going to extend the partial EF generated classes stored in the BusinessModel.Designer.cs

6/ You can extend the classes within the 'BusinessModelParialClasses.cs' file, for example, add the two following methods :
public bool TurnPages(int NumberOfPagesToTurn) ...
public bool TurnChapter(int NumberOfChapterToTurn) ...

on the Book class.

7/ You can notice that now the Class Diagram of the Book Class is not fully read only anymore (the elements generated by EF4 are still read only), and offers the 'Add' option like you are used to:


8/ Obviously, you can access all the Class Details pan properties, like you normally would.


9/ That's it ! let's go back to your Edmx file, where you can "Generate Database Script from Model". And here you go, nearly zero line of code !!!

How lazy I am, more over, a snap shoot of the display and copy/paste will create a nice documentation.
Well ideally, the best would be to generate a dynamic Silverlight 3.0 image within a web document hosted on a Web server ;-) Sounds like SharePoint 2010 ??




Note: This was used with Visual Studio 2010 Beta + EntityFramework 4

Tuesday, December 1, 2009

Silverlight and Microsoft Test and Lab Manager (Visual Studio 2010 Beta 2)

Hi, I am currently using "Test Runner" from "Test and Lab Manager" (Visual Studio 2010 Beta 2) for a Silverlight 4.0 project. As soon as I start recording, I have a spendid error message :

"Microsoft Silverlight is not supported.. Test paused."

Any one knows if it's going to be supported on Visual Studio 2010 RTM ??

[updates: Dec 2009] :
I tried a very powerfull and impressive UI Automation that works on a Silverlight 4.0 projects.
It is the WebUI Test Studio 2 application from Telerik / ArtOfTest.
 They claim to be this first "Record and Play" for Silverlight (even Microsoft hasn't supported it ... yet ! == It'll come soon after the release of VS2010 RTM).
Here is the article : Telerik and ArtOfTest Launch Industry’s First Record & Play Silverlight UI Testing Automation Solution.

Even more impressive, I installed it on my VS2008 (even if the SL4 project was developped in VS2010b2), and it worked straight after, and is very intuitive (but a bit slow since I was in a VPC).

Another UI test for SL (but I haven't tried yet): Hewlett Packard has launched a plugin to HP QTP (QuickTest Pro).

[updates: Dec 2010] : Our Quality Team tried HP QTP to create the automated UI testing on our complex SL4 LOB application. This tool is really expensive, but it works perfectly within half a day, and no need to reference within our project any additional DLLs (which is the case for WebUI Tests Studio from Telerik or the Microsoft Coded UI).



Vincent THAVONEKHAM