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

Monday, September 28, 2009

Creating a Web Service around an Excel File

Need to create a Web Service around an Excel File ??

Here is a simple way to do so, without using .Net interop to Excel (that could raise issues in memory usage, even if COM objects are properly cleaned up).

As far as I am concerned, I used Aspose.Cells for .NET, which is a simple, but powerfull library to :
1/ Send values to my Excel WCF service,
2/ Let Excel perform all the complexe sums (most importantly, let a non technical users to update the Excel files),
3/ Gets the data and convert them into ADO.Net, so that it could be DataBound easily,
4/ Get all the returned values back to my orginal application,


A stress/load test on the solution proves that it can handle a great amount of calls.


PS: Other possibilities could be EXCEL Services from MOSS Enterprise, Office 2010 (EXCEL Web Access), ...

Sunday, June 14, 2009

Checklist before starting an IT project

Hi, here is an excellent post from http://ianfnelson.com/software-development-process-questions/
in order to ask yourself relevant questions before starting up an IT project.

Thank you Ian Nelson,

Project Management

  • What project management approach is used (e.g. PRINCE2)?
  • Are any formal development processes used (e.g. Agile, Cleanroom, Iterative, RAD, RUP, Spiral, Waterfall, XP, Scrum)?
  • How are projects separated and organised? (Identify potential mapping to TFS Team Projects).
  • Where are documents related to the project stored?
  • Identify the structure of a typical project development team. Does the team include Project Manager, Business Analysts, Developers, Testers, Customer Representative?
  • Team Continuity?

Requirements Gathering

  • Identify how the requirements gathering process works. Who gathers the requirements, from whom, what do they do with these requirements?
  • Are user stories captured?
  • How are requirements prioritised into iterations? By who?
  • How long is a typical iteration?
  • How is feedback solicited and gathered from users of an existing release?

Analysis & Design

  • How are requirements turned into a technical solution design? By whom?
  • Are functional and/or technical specifications written? What format do these take?
  • Are UML or other formal methods used?
  • What techniques do the technical team members use to produce estimates and schedules?

Work Item Tracking

  • What system is used to track work items?
  • What types of work item are tracked? (Bug, Task, Change Request, Quality of Service, etc)
  • How are work items triaged, prioritised and assigned to an iteration?
  • Who assigns work items to individuals?
  • Which stakeholders have the ability to create, update, resolve and close work items?
  • What techniques are used to break down large tasks to fit into an iteration?
  • Are work items pertaining to refactoring and non-functional improvements created?
  • Are user stories broken down into work items?

Source Control

  • Which source control system is used (VSS, TFS, Vault, SVN, CVS, etc)?
  • Is the source control repository backed up appropriately?
  • Is exclusive checkout used?
  • What branching and merging model is used?
  • Do developers check-in frequently?
  • Are database schema objects stored in source control? How?
  • What artifacts other than source are stored in source control? (Build scripts, documentation, etc)
  • What check-in policies exist?
  • Is it possible to identify relationships between changesets and work items?

Development

  • · How is Documentation produced for the solution?
  • How do the development team share information? (Wiki, email, shared folders, Sharepoint?)
  • How many developers work on a typical project simultaneously?
  • Is Pair Programming practiced?
  • Do the team practice Collective Code Ownership?
  • Is time set aside for Refactoring?
  • Which IDEs are used? (VS2005, 2008, Expression Studio?) Which SKUs? Which licenses are held, or could be purchased?
  • Is VS DB Edition (Data Dude) used? Or other tools which perform a similar function?
  • Which databases are used? SQL 2000/5/8, Oracle?
  • What are the core outputs of the development process? (Windows apps, web apps, web services, WCF, SharePoint sites, BizTalk solutions, InfoPath documents, etc)
  • Do the developers integrate their work with that of Designers? How? (Expression?)
  • Do any coding standards or guidelines exist?
  • Do the team use any static code analysis software (FxCop, StyleCop, NDepend)?
  • What code metrics are gathered? To what use are these put?
  • Do the team regularly make use of any internally-developed shared resources?
  • Do the team regularly make use of any third-party components (Telerik controls, Enterprise Library, etc)?
  • What is the physical setup of the project office? Are developers working in a bull pen? Is a customer representative close at hand?

Builds and Integration

  • How are builds performed? MSBuild, NANT, etc?
  • Are build scripts source controlled?
  • How often are builds performed? (CI, Rolling, Daily, Ad-hoc?)
  • Does the build process increment the version number? Of which components?
  • Are database upgraded / recreated as part of the build process?
  • What “optional” steps are performed as part o f the build process (e.g. static analysis, unit testing, labelling?)

Testing

  • Do the developers write unit tests? Which framework is used? (NUnit, XUnit.NET, etc).
  • Is Test-Driven Development practiced?
  • Are mocking frameworks used (e.g Rhino Mocks, MOQ)?
  • Are database objects unit tested? How?
  • Are build verification tests run?
  • Are dedicated testers employed?
  • How is system testing performed? By who?
  • Is UAT performed? By who?
  • Is the FIT framework or similar used to define customer tests?
  • Is Load/Performance testing performed? Using which tools?
  • Are test scripts used to plan manual testing? Where are they located?
  • Are automated web tests used?
  • Are tests performed on a range of browsers / hardware?
  • Are Code Coverage metrics obtained? Use of NCover? Integration with NDepend?

Release Management

  • What environments exist (Dev, Stage, Test, Train, Live, etc)?
  • How are promotions authorised?
  • How are users notified of the release?
  • Who performs the promotions? Involvement from Systems team, DBAs?
  • How are web app promotions performed? Use of app_offline? Replacement of web.config?
  • How are database promotions performed? Data Dude? Scripts?
  • When are releases deployed? Out of hours?
  • Are release notes produced? How, and with what content?

Reporting

  • How are reports and metrics on the development team’s progress created?
  • Are reports created to detail the work items included in each build?
  • Reports on code-churn, bug clearance rates?
  • Reports on estimated vs actual schedules?

Friday, March 13, 2009

Destroy ALL tables, views or stored procedures

If you want to destroy ALL tables, views or stored procedures, here are some T-SQL commands.
By the way, in order to find out more about deadlocks : http://www.sql-server-performance.com/tips/deadlocks_p1.aspx

* To DROP all tables (run it many times so that tables with constraints are progressively destroyed)



EXEC sp_MSforeachtable "DROP TABLE ? PRINT '? to be dropped' "


* Here is to DROP ALL SP and VIEWS



CREATE PROCEDURE Usp_DropAllSPViews
AS
DECLARE @name  varchar(100)
DECLARE @xtype char(1)
DECLARE @sqlstring nvarchar(1000)
DECLARE AllSPViews_cursor CURSOR FOR

SELECT sysobjects.name, sysobjects.xtype
FROM sysobjects
  JOIN sysusers ON sysobjects.uid = sysusers.uid
WHERE OBJECTPROPERTY(sysobjects.id, N'IsProcedure') = 1
  OR OBJECTPROPERTY(sysobjects.id, N'IsView') = 1 and sysusers.name = 'USERNAME'
OPEN AllSPViews_cursor
      FETCH NEXT FROM SPViews_cursor INTO @name, @xtype
      WHILE @@fetch_status = 0
        BEGIN
         -- obtain object type IF it is a stored procedure or view
         IF @xtype = 'P'
              BEGIN
                  SET @sqlstring = 'drop procedure ' + @name
                  EXEC sp_executesql @sqlstring
                  SET @sqlstring = ' '
              END
         -- obtain object type IF it is a view or stored procedure
         IF @xtype = 'V'
              BEGIN
                   SET @sqlstring = 'drop view ' + @name
                   EXEC sp_executesql @sqlstring
                   SET @sqlstring = ' '
              END
            FETCH NEXT FROM AllSPViews_cursor INTO @name, @xtype
        END
CLOSE AllSPViews_cursor
DEALLOCATE AllSPViews_cursor

Sunday, February 15, 2009

my return of experience on AGILE projects

The thoughts below are based on the syntheses of my own experience of 3 years project management, many books and blogs, and finally on the Tech-Ed 2008.

Having being interested in AGILE for a few years by now, and since I had the chance to compare a 1.5 year non-Agile project management and 1.5 year AGILE -one, I wanted to share some experience.

How to ensure an AGILE project to go bad ? It's simple : if you apply the Agile techniques dogmatically, without thinking by yourself !

In the past, I only picked up few elements from the AGILE methodology in my projects, and never claimed to use The AGILE methodology. However, as soon as I tried to make it more Agile on a 6 people team, I was facing some of the problems presented below.

1. Enforce a daily Scrum meeting “by the book” where each person speaks in turn to answer the 3 questions. For our team, tt appeared that only few and minor problems came out of during those meetings. Crutial problems suddenly appear after few iterations (e.g people hating each other, ...). Why? the team was asked to speak in turn, that’s what they did, without really admitting in front of others their problems. Solution: I could probably come out with better solutions, but those two below worked. On top of daily scrum, I added

- non official ones (pubs, coffee, ..) where real problems could be raised unofficially. It enabled to reveal fundamental problems (addressing those problems is another story!).

- a one-to-one interview

2. Deeply involving the client in the iteration process : The good side of it is that we are sure that the application’s fundamentals are implemented. The dark side is that, since we are using “software factory” with 3 platforms (development, integration and production) each delivery has to go thought many phases and tests, which is good … until the customer wants more frequent delivery for good reasons. As a result, instead of a 2 weeks' iteration, I had to deliver every second day, if not every day. Problem? This is leads to unhappy customers facing a bad quality and unstable version to meet the schedule. Moreover, the whole team was spending time in testing and releasing instead of developping new features. Solution: easy! Since it was agreed to perform a fortnight release, I should have refused from the very beginning to deliver within a shorter period of time.


Why those problems ? One of the reasons was that, at that time, I knew too little about SCRUM !, and second, because Agile methodology is like a recipe, with 3 phases:
1. Simply apply exactly what is written (however, you don’t exactly have the same oven, you don’t have exactly have the same ingredients, …)
2. Based on the recipe, you could customise it to have something suitable to your customers
3. Once you have a lot of experience, don’t follow any recipe : follow your own way
To me, in order to achieve a successful “AGILE project”, is to do “agile project” where sentences like “in Agile you must / have to do this and that” should be avoided. According to one of the “creator” of agile methodology, the second and third case should be reached, i.e. have some experience/maturity and be flexible to adapt to the customer’s environment changes (e.g. changes in law regulation since the beginning of the project, new innovative ideas were found after the few first iterations, …). If you simply apply AGILE methodology exactly according to the book without analysing what is written “between the lines”, the project will probably lead to a failure.

Tech-Days 2009 in Paris



Hello, a quick feed back on the Tech-Days 2009 in Paris. Excellent Keynote : the demos are dynamics and funny you could find the video here.

Although, I attended only one day out of the 3, I was really looking forward to find out what other new technologies Microsoft is preparing for us : Surface, Windows 7, Visual Studio 2010, Microsoft Solver Foundation ...

It's also a great opportunity :
. to meet previous colleagues and keep in touch;
. to encourage Winwise speakers that are presenting more than 20 sessions in only 3 days !

Great stuff... except at some point, where I must admit, I was unlucky enough to attend an awful session that I left 10 min after it has started. To be polite, I will not mention the session that would have been good for beginners ... 2 years ago ; moreover, since it was classified as "expert" either many people left the session too or sarcastic comments were made.

Among the top quality sessions, I wanted to mention a great one : it's "Coding for fun", with WPF, XNA, Wiimote. The name of the session speaks by it-self : totally unusefull code, but so much fun in designing and coding them, it's real a challenge for the brain to develop such applications. I loved it !!

I wish I could have attended more sessions... nevermind : I'll do it better next year.

October 2008 : Tech-Ed EMEA 2008 in Barcelona

Here we are in Barcelona !! October 2008 : Tech-Ed EMEA 2008 in Barcelona (Europe Middle-East and Africa).

I know, it is really sunny, however, we (as Winwise) are here to work hard on the latest Microsoft technologies during these 4 days conference.



After the usual Keynote, I started directly with one of my favorit topic :
"Best Practices for Managing Projects with Microsoft Visual Studio Team System", where I found my God : Joel Semeniuk, a MVP - Regional Director, very funny that presents us real user cases, not the ones that comes out of the book. That was great !!

So many interresting sessions given by visionnary speakers (The Future of Unit Testing by Roy Osherove, AGILE, ...), but I think it would be boring to mention them all.


For the non interresting ones, with my average of 5 hours-sleep, I just escaped to have a 30 min rest on the beach.

Here is the team sent by Winwise (many many thanks Olivier Bourdin !!) :
Picture on the left Daniel Tizon (Regional Director), Audrey Petit, Julien Tournadre, Davy Frontigny, and my-self on the left hand of the second picture.

Team Tests : Load tests with VSTS 2008 Trial

A little story about some Load Test with VSTS 2008 :

I already had Visual Studio 2008 developer SP1 installed and I desperately needed to install Visual Studio 2008 Team System Team Suite Trial (on the Load / Web tests aspects). Here are the steps required.

1) First :

. Spend a lot of time installing VS 2008 dev + SP1 (and SQL server 2008, etc)
. upgrade it to the Visual Studio 2008 Team System Team Suite Trial

At this step, the "Load Tests" will not work, and you will have the following problem : the new templates (Load Tests, Web Tests, …) will not appear automatically. You will have to execute the command line :

devenv /installvstemplates

2) Second : At this stage, the "Web Tests" will work but not the "Load Tests", as the following bug will appear :

Could not run load test 'LoadTest1' on agent 'NameOfYourComputer': Method not found: 'Void Microsoft.VisualStudio.TestTools.LoadTesting.LoadTestScenario..ctor(System.String, System.Collections.Generic.IEnumerable`1)'

Luckily my colleague Etienne Margraff (a Visual Studio and TFS guru) suggested me to simply run again the VS SP1 (it just take ages to reinstall it !!).

3) Finally, I did re-install VS SP1
Then, I launched again the Load Tests, and .... here you go, it WORKS !!


Hope this post will prevent someone from being stuck for days trying to solve the problem.

PS :
I mentioned "stuck for days" on purpose and not "stuck for hours" because you will spend hours in re-installing SP1 ;-) !!!