ObjectSharp Blogs

You are currently viewing

Dave Lloyd's 2 Cents

A .NET Developer's Perspective


Metro Toronto User Group February 2012

 

Come out to the Metro Toronto User Group on February 15th. Colin Bowern and I will be showing you how to customize your build process with TFS 2010 and use MS Deploy to automate your web app deployment.

Customizing the TFS Build process and automatically deploying your web app.

When: Wednesday February 15, 2012 at 6:00pm

Where: KPMG, 333 Bay Street, 46th Floor, Toronto

See you there.

Create a Master Build that calls other Builds

Have you ever wanted to have a build that kicks off a bunch of other builds. I recently had such a need, we wanted to have independent build definitions for a bunch of apps. However when you are responsible for deployment you just want to run a bunch of builds at once. If every app is a .net application it’s easy to create one build that builds all the apps.

However in this instance we have two different build process’s. One for .net apps and one for VB6 COM applications. So we created a master build that can kick off multiple build definitions each having a different build process.

First thing is to strip down the Default build Process to it’s bare minimum. Here is what the Build Process looks like.

If you are familiar with the default build process you will recognize the first few items.

The ForEach is the new part. I will explain that in a minute. First we need a new Argument to the build process that will hold the build definitions you want to queue.

Name – BuildDefinitions
Direction – In
Type – String[ ] (Array of Strings)

and a new Variable for the output.

Name – BuildRetVal
Type – IQueuedBuild
Scope– RunOnAgent

You will need to get the Community TFS Build Extensions from Codeplex. If you don’t know how to get started using these, there is plenty of help on that subject here.

To Queue up a bunch of builds drag in a ForEach and iterate over the BuildDefinitions parameter you added.

Inside the ForEach drop in a QueueBuild from the community TFS Build Extensions.

Here is how you fill in the paramaters of the QueueBuild Activity.

Build Controller - BuildDetail.BuildController
BuildDefinition - BuildDetail.BuildServer.GetBuildDefinition(BuildDetail.TeamProject, item)
BuildServer - BuildDetail.BuildServer
Priority - Microsoft.TeamFoundation.Build.Client.QueuePriority.Normal
Process Parameters - Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers.SerializeProcessParameters(New Dictionary(Of String, Object) From {{"AgentSettings", AgentSettings}, {"Verbosity", Verbosity}})
Result - BuildRetVal

In my example I pass the Agent settings and verbosity through to the called definition. That way I can control them from the master build. In our case we wanted each child build to run on the same agent as the master build so we can accomplish that by passing in the AgentSettings to override those defined in the build definition.

We also passed in the Drop Location and used it in the child so that the child builds each dropped their binaries under the master builds drop folder. Again a choice we made for our situation.

Once you have the process we can define a build definition for the master build. Add all the Build Definition Names you want and the Master build will kick them all off for you. It should look like this.

Set the AssemblyFileVersion to match the build number

If you are not sure why you need to set the AssemblyFileVersion and AssemblyVersion read this first.

First thing to do is to change the build number format to include the version number of a build Major.Minor.Build.Revision.

Something like this $(BuildDefinitionName_{Major}.{Minor}.$(DayOfYear)$(Rev:.r) will usually do the trick. The Build number could also be a date $(Date:MMdd)

The above build number format will will result in a build number similar to: Calculator.Main.QA_5.3.321.1

For the Major and Minor numbers create two string arguments in your Build process one for each.

Find the Invoke For Reason activity named “Update Build Number for Triggered Builds” in your build process and add an Assign activity right before the Update Build Number activity. This will include your Major and Minor build numbers in the Build Number Format.

Assign activity
To:
BuildNumberFormat
Value: String.Format(BuildNumberFormat, Major, Minor)

Now we want to put the version number from the build into the AssemblyInfo.cs file in our projects so the assemblies have the same version number as the build.

There are 3 build activities we can use to get the job done.

We will need the following variables defined:

  1. FileVersion as string
  2. FilesToVersion as IEnumerable<String>

Then add these four activities into a sequence right after initialize Workspace.

  1. 1. Extract the Version Number from the Build Number
  2. Assign activity (From the Primitives group in your Workflow tool box)
  3. To: FileVersion
  4. Value: BuildDetail.BuildNumber.Substring(BuildDetail.BuildNumber.IndexOf("_") + 1)

2. Get all the AssemblyInfo.cs files
FindMatchingFiles activity (from the Team Foundation Build Activities in your Workflow tool box)
Match Pattern: String.Format("{0}\**\Assemblyinfo.cs", SourcesDirectory)
Result: FilesToVersion

  1. 3. Change the AssemblyFileVersion
    File activity (from the TFS Build Extensions project)
  2. Action: Replace
  3. Fail Build on Error: True
  4. Files: FilesToVersion
  5. Regex Pattern: "AssemblyFileVersion\(""(.*)""\)"
  6. Replacement: String.Format("AssemblyFileVersion(""{0}"")", FileVersion)
4. Change the AssemblyVersion

File activity (from the TFS Build Extensions project)
Action: Replace
Fail Build on Error: True
Files: FilesToVersion
Regex Pattern: "AssemblyVersion\(""(.*)""\)"
Replacement: String.Format("AssemblyVersion(""{0}.{1}.0.0"")", Major,Minor)

When you queue a build set the Major and Minor numbers on the build definition and let the build process do the rest.

The result will be an AssemblyFileVersion that looks like 5.3.321.1 and an AssemblyVersion that looks like 5.3.0.0

The TFS Build Extensions has a TFSVersion Activity that is great and helps to simplify this. However it currently has a problem with a BuildNumberFormat that is different from the default. When that gets fixed i will repost how to do this using TFSVersion.

Test Case Customization

The Test Case Work item has a tab that lists Tested Requirements or User Stories (depending on the canned process template CMMI or Agile) that this Test Case tests.

When a bug is found you should write a test case so everyone knows how to validate that Bug once it’s fixed. Therefore why have a tab that just shows Tested Requirements/User Stories.

Lets use the Agile template as an example. The Tested User Stories tab will only allow you to add User Stories. Even though you could add a Bug with the tests relationship under All Links if you wanted.

It’s very easy to change this tabs behaviour to allow for Bugs also. Here’s how.

Open up the Test Case in the WIT editor that comes with the TFS 2010 Power Tools. Under the Layout tab find the TabGroup > TabPage – Tested User Stories > Control – User Stories tested by this Test Case and select it.

Select the Control Settings property and click on the ellipsis button. Leave Work Item Type Filters as Include. However in the drop down list to the right of that change it to also include Bug, then click OK,

Now change the Label from User Stories tested by this Test Case to something more appropriate like Tested by this Test Case.

Then switch focus to the Tab Page and change it’s label to something more appropriate  like Tested User Stories and Bugs or just Tests.

Save the work item type.

You should now be able to select Bug as a work item type tested by this test case.

Quality Assurance in Mixed Technology Environments

 

I am doing a webcast today on the subject Quality Assurance in Mixed Technology Environments.

This is one in a series of Web Casts MS and partners like us are doing leading up to the TesTrek conference in Toronto. Where Deb Forsyth and I will be leading a workshop on Experience and Overcome the Challenges of Exploratory Testing.

Test Configurations

 

I’m sure you have noticed that when you create a new TFS project in 2010 there are a couple of default Test Configurations created.

Operating System - Windows 7
Browser – Internet Explorer 8.0

Like most people you will go into Test Manager and add the configurations you really need. Then you create another project and those default configurations are back. Unfortunately there is no way in the UI to add the configurations you added in the first project to other projects. Not without writing some code.

However if you look at the process template those defaults are in there, however they are not made available for edit through the Process editor UI.

Of course you can edit the file, and add your Test Configurations manually. The file you are looking for is testconfiguration.xml and it can be found in the Test Management folder of the downloaded process template.

<?xml version="1.0" encoding="utf-8" ?>
<TestConfigurations>
    <TestConfiguration name="Windows 7 and IE 8"
                        description="Default operating system and browser for testing" state="active" isdefault="true">
        <TestVariable
                        name="Operating System" value="Windows 7" />
        <TestVariable
                        name="Browser" value="Internet Explorer 8.0" />
    </TestConfiguration>
</TestConfigurations>

If you want to add test configurations to a new project edit this file in your process template first. The defaults you put in here will be created in your new project.

Windows Explorer

This is a very interesting Blog post on the history and future of Windows Explorer.

Figure 1 - MS-DOS Executive in Windows 1.0

Figure 9 - Home tab

Filtering Assigned To

Team Foundation Server work items have an assigned to field that defaults to the Valid Users Group. The problem is this group includes service accounts also.

ValidUser

You can easily change the list to contain just the groups you want.

Open up the work item with the Process Editor you get when you install the TFS 2010 Power Tools.

Open the field definition for the Assigned To field in the work item and switch to the Rules Tab.

Remove any rules that are there now. and add Allowed Values and Default.

AssignedTo

Edit Allowed Value and set it to the following to get all the project administrators and Contributors along with an unassigned value. Make sure you exclude Groups.

AllowedValues

Under Default set the value to be Unassigned.

Default

Now you are all set all that will show up in the AssignedTo drop down is Unassigned along with Project Administrators and Contributors.

Requirements in TFS

Customers are often asking about storing requirement documents with their requirement work item. Specifically what is the best way to do this? I always tell them they have 3 options. Before we talk about that keep in mind there are third party requirement management tools out there that integrate with TFS. Therefore there is a 4th option. Which is to use that tool and have it push requirements into TFS as a work items but store the full fidelity of the requirement in the requirement management tool itself. If you don’t have such a tool here are 3 other options.

Attachments

The simplest is to just attach your requirement document to the Work item using the attachments tab on the work item. The document is stored in the Database with the requirement and is easily found by others. This is difficult to version though. If you changed the requirement in another release you would have to alter the document and attach it again to another Work item so you can maintain the previous requirement as it was in the previous version.

Versioned Items

If you want to keep versions of the Requirement document you could store it in source control and create a link to it from the work item using a Versioned Item. Then you can point the Work item to a particular version of the document in source control using the Link Type Versioned Items.

Hyperlink

The third solution is to store the document in SharePoint. Where you can easily apply workflow to it and version it. Then link it to the Work Item via a Hyperlink link type.

Along the same lines, I was recently asked what if I wanted to change my requirement work item so there was a tab on the Requirement just for Hyperlinks to SharePoint, and remove the Attachments tab so documents can’t be added to the work item.

I’m not sure I would remove the attachments tab it can be handy for many things. However it’s easily removed from the UI. Adding a Tab just for Hyperlinks is a little trickier.

I’ll explain how to do this using the process editor that comes with the TFS power tools. Then also include the XML for the control.

Open the work item type using the process editor, and go to the layout tab.

Add a new Tab under the Tab Group and name it SharePoint Documents or something appropriate.

Create a new control on that Tab and change the control type to a LinksControl

On the Control Settings property click the ellipses button to open the editor. 

In the filter section there are three fields set them like this:

  • Work Item Type Filters – Exclude - Select all Work Item Types
  • Work item Link Filters – Exclude - Select all Work Item Filter Types
  • External Link Filters – Include – Workitem Hyperlink

Might as well remove all the columns except for Title and System.Links.Comment

Once you apply this change to your Project you will have a new tab that only allows Hyperlinks to be added.

As promised here is the XML for the new Tab with Links Control

<Tab Label="SharePoint Documents">
            <Control Type="LinksControl" Label="" LabelPosition="Left">
              <LinksControlOptions>
                <LinkColumns>
                  <LinkColumn LinkAttribute="System.Links.Comment" />
                  <LinkColumn RefName="System.Title" />
                </LinkColumns>
                <WorkItemLinkFilters FilterType="exclude">
                  <Filter LinkType="Microsoft.VSTS.Common.Affects" />
                  <Filter LinkType="System.LinkTypes.Hierarchy" />
                  <Filter LinkType="System.LinkTypes.Dependency" />
                  <Filter LinkType="System.LinkTypes.Related" />
                  <Filter LinkType="Microsoft.VSTS.TestCase.SharedStepReferencedBy" />
                  <Filter LinkType="Microsoft.VSTS.Common.TestedBy" />
                </WorkItemLinkFilters>
                <ExternalLinkFilters FilterType="include">
                  <Filter LinkType="Workitem Hyperlink" />
                </ExternalLinkFilters>
                <WorkItemTypeFilters FilterType="exclude">
                  <Filter WorkItemType="Bug" />
                  <Filter WorkItemType="Issue" />
                  <Filter WorkItemType="Shared Steps" />
                  <Filter WorkItemType="Task" />
                  <Filter WorkItemType="Test Case" />
                  <Filter WorkItemType="User Story" />
                </WorkItemTypeFilters>
              </LinksControlOptions>
            </Control>
          </Tab>

The Layer Diagram

The layer Diagram in VS2010 Ultimate is a great tool for validating your applications architecture. If you already have an application and you would like to see how your team has done following your prescribed architecture. Check this out.

Open your application in Visual Studio.

Then create a new Layer Diagram using the Architecture – New Diagram menu in Visual Studio Ultimate.

By dragging over layers from the tool box create a Layer Diagram that represents the architecture of your application.

Then Drag the components from your application in the solution explorer to the appropriate layer in the diagram. You can then open the Layer Explorer to see what layer everything is assigned to. (You can drag anything from a project to a single file.) Notice the numbers in the Layer diagram representing the number of items in that layer.

 

You could have created dependencies in the diagram to show which layer can call which layer. Since we are pulling in an existing app we want to see if it was written following our architecture. Therefore Right click on the diagram and select Generate Dependencies.

So here is how our application came out.

Most of the dependencies are fine. However there seems to be a lot of calls directly to the Data Layer. That is not good, but happens when the architecture is not validated periodically. click on the dependencies that are incorrect and press delete to remove them. Here is the Layer diagram as we intended it.

Now right click on the diagram and select Validate Dependencies.

This will generate errors and warnings where the application does not follow the architecture. So the Dependencies generated in the previous step now generate errors in the application.

From the error list you can generate work items in TFS to get these discrepancies fixed.

The bug will contain layer diagram that generated this error and the details of the invalid dependency.

The Next Version of VS and TFS

While we have been enjoying the fantastic features made available in VS and TFS 2010, Microsoft has been busy working on the next version. The ALM story just keeps getting better and better.

Last week at Teched MS showed off a lot of the new features we can expect to see in the next release. Below is a SpeakFlow presentation with demos to help tell the story.

A SpeakFlow is a Silverlight-powered way of delivering rich, interactive content. This SpeakFlow allows you to follow the lifecycle – from development to operations and back again – and view short demonstrations of how Visual Studio vNext will help you embrace better application lifecycle management. start at the top with the  “STORYBOARDING” video and then following the circle counter-clockwise.
Tip: To go up a level after drilling in, use your mouse wheel or the UP key on your keyboard.

Click on the image below to take a look.

Support for Visual Source Safe Extended

 

Support for Visual Source safe 2005 was previously scheduled to end this year, however to allow customers more time to migrate away from it. Apparently MS has decided to extend mainstream support until July 10 2012 and Extended Support to July 11 2017.

How do I know this? There is a web site that tells you how long MS products are supported for.

So come on people lets get those VSS repositories converted over to TFS you will be much happier and your code will be much safer.

In case your reading this and don’t know that it’s available you have a tool right there on your machine to convert a VSS repository to TFS.

Register now for ObjectSharp @ the Movies

Join ObjectSharp and Microsoft on May 5th for a Half Day in the Cloud! Learn to provide stability and elasticity for your web based solutions as we leverage Windows Azure. Technologies including Silverlight, ASP.NET, Team Foundation Server, Visual Studio and Powershell will be in the Air as we rain data down from the Cloud. This is one summer blockbuster event that cannot be missed!

Thursday, May 5th, 2011

Registration: 8:00am - 9:00am
Presentation: 9:00am - 12:00pm

Scotiabank Theatre
259 Richmond Street West
Toronto, ON M5V 3M6
Directions

Build a Reporting Services Solution with MSBuild 4.0

I recently was tasked with setting up a build for a large solution of Reporting Services reports. The goal was to build and deploy them. The build was pretty easy although disappointing. Reporting Solution projects are not msbuild projects. You can however build the solution from the command line using devenv.exe. Which looks something like this:

devenv.exe /Build debug /out ".\Logs\SSRS.Log" ReportingServices.sln

So automating this on a build server was pretty simple. Install a copy of Visual Studio 2008 or 2005 depending on the version of your reports. (No 2010 can’t even open a reporting solution let along build it.)

In source control in the same folder as your Reporting Services Solution create a batch file with the above command. I would pass the drop location in to batch file and put the log there instead of in the source directories. So the batch file may look more like this.

mkdir %1\Logs
devenv.exe /Build debug /out "%1\Logs\SSRS.Log" reportingServices.sln

Now in your build process template drag in an invoke process activity, and populate 

ExitCode is a Variable of the type int32 that you would create in your build process.

BuildDetail.DropLocation and SourcesDirectory are variables already set up for you that hold the Drop Location you selected in your Build Definition and the Sources Directory defined by your Build Agent Working Directory.

TFS Build Invoke Process Activity

Likely the most useful tool in the list of Team Foundation Build Activities is InvokeProcess. This little Activity lets you call out to anything you want. I have found it very useful for executing a batch file that is stored with my source code to do a number of things. Invoke a PowerGen build for PowerBuilder Applications. Invoke Devenv.exe for building Reporting Services, or calling a deployment script you don’t want to rewrite at the moment.  

When I went to use this activity the first time there was not much out there as an example so I thought I would post a quick and dirty example of using the Invoke process.

Find the place in your process where you want to make the call and drag in an InvokeProcess Activity.

Next you want messages that come from the application you are calling to end up in your Build report. This is done via stdout and stderr. So drag over a WriteBuildMessage Activity and a WriteBuildError Activity into the Invoke process as seen below.

There are two variables defined stdOutput and errOutput they need to be placed in the message property of the Write Activities. I would set the Importance property on the WriteBuildMessage Activity to High. Like this:

Now for the properties of the Invoke process. It’s pretty simple really.

DisplayName: This will be exposed in the Workflow so it’s good to name it something that reads well and tells the reader what you are doing here. 

FileName: The file you want to call. For batch files I find it useful to put the file in source control with the app. Then use the SourcesDirectory variable to find it. See Below.

Arguments: What you want to pass to the called application or batch file.

Result: Your ExitCode variable. The last thing you call from the batch file or the app will generally return an exit code then you can use that to determine if you want to carry on in the build process.

EnvironmentVariables: This dictionary of <string, string> allows you to specify environment variables and their values.

OutputEncoding: You can specify the encoding that is used to read the output (StandardOutputEncoding) and error (RedirectStandardError) streams. I have only ever used the default value.

So if I wanted to call a batch file named MyBatchFile.bat and it was in source control at the root of my solution folder, and I want to pass in the Drop Location from my build definition. My InvokeProcess might look like this.

ObjectSharp At the Movies is in the Cloud

 
 

Join ObjectSharp and Microsoft on May 5th for a Half Day in the Cloud! Learn to provide stability and elasticity for your web based solutions as we leverage Windows Azure. Technologies including Silverlight, ASP.NET, Team Foundation Server, Visual Studio and Powershell will be in the Air as we rain data down from the Cloud. This is one summer blockbuster event that cannot be missed!


ATM 2011 Learn More!
FacebookTwitterFlickrRSS

2010 At The Movies

Thursday, May 5th, 2011
Registration: 8:00am - 9:00am
Presentation: 9:00am - 12:00pm

2010 At The Movies

Scotiabank Theatre
259 Richmond Street West
Toronto, ON M5V 3M6
Directions

2010 At The Movies
FREE admission

TFS Power Tools March Release

A new version of the TFS PowerTools were released recently.

This release includes changes to the following areas:

  • TFS Backup
  • TFS Best Practices Analyzer
  • TFPT.EXE Version control command line
  • Windows Shell Extensions

You can get more details and download from here.

March 8th MS Announcements

I’m a little slow getting to this. Just no time to Blog in the past coupe of weeks.

Last weeks big announcement and two service packs and a Feature Pack oh my!

1. Unlimited Load testing. Now you can load test your application without having to purchase Virtual User Packs. You use to have to purchase Load Test Packs to be able to simulate 100o users. Now this comes free with the Ultimate edition of MSDN.

2. VS/TFS 2010 SP1 and TFS-Project Server Integration Feature Pack is out in Beta. The Service Packs includes a bunch of fixes see links below, while the Feature Pack allows you to integrate your project Server with TFS.

MetaData Override

 

I learnt something I didn’t know, so I thought I would share it. I was creating a build for a client that builds several technologies. PowerBuilder, Java, .net 1.1, SQL Server 2008, Reporting Services and .net 3.5.

I altered the Default Template to perform the other technology builds. The problem was The Build Settings argument is required and in this case I didn’t want it to be. They may use the process to build something that is not a .net solution after all.

The trick I found: If you add the Buildsettings to the MetaData argument and don’t make it required it overrides the default.This way you can still use Buildsettings just like you would in the DefaultTemplate however if it’s not needed for the build definition you are creating it will not be required.

Visual Studio 2010 Feature Pack 2

Deb Forsyth posts lots of great information about TFS and it’s related tools for the Test community. She put up a post recently about the new Feature Pack for Visual Studio.

There is one feature in this Feature Pack that is particularly useful, the Coded UI Test Editor. If you have worked with Coded UI Tests you will know, although powerful the tooling around version 1 needs some maturing. We'll it’s already begun. When you create a Coded UI Test it generates a couple of files. The UIMap.uitest  which maps methods that manipulate the UI and assertions to the application under test, and  the Coded UI Test class which is really just a test class with test methods that call methods in this UIMap object.

Prior to Feature Pack 2, to make a change to the UIMap.uitest has not been easy you would have to have a good working knowledge of .net development. However, now we have the Coded UI Test editor. After you install the new Feature Pack open the UIMap file in your test project and an editor will open that allows you to see all the methods in your UIMap rename them split them out into other methods. It will also allow you to change an assertion as seen in the image below.

This is a welcome tool when writing automated tests using Visual Studio.

TF215097: An error occurred while initializing a build for build definition

If you ever get an error like this in the build. Think back, did you recently remove a build argument from the build process template?

Apparently when you modify the Build process template and therefore it’s no longer in sync with the build definition you can get this error.

To solve this problem you need to get them back in sync. Even though from the process tab of the build definition your arguments all seem to be ok.

To fix the problem open the Build definition and from the process tab refresh the build process.

That fixed the problem for me.

Thanks to Jakob Ehn for his post which explains this issue in more detail.

PowerBuilder and TFS Source Control

I have been helping customers who are implementing Team Foundation Server (TFS) and would like to put PowerBuilder Code into TFS source control. I’m not sure how different this would be in the newest versions of PowerBuilder that support xaml and where powerscript is a .net language. However for the older versions where the customer is still using native PB there are a couple of things you might want to do to make the experience better for all involved.

First let me explain one problem with PowerBuilder and TFS: If you just add the PBL’s in your target to TFS all the exported objects end up in one folder and it’s hard to tell where everything comes from. This may not be a big deal if you never look at the source explorer in Team Explorer, but why wouldn’t you?

So here are my suggestions:

1. First set up a folder structure that will become your local working copy of the PB code. I recommend putting each PBL into it’s own folder. This might seem odd at first but once TFS gets a hold of it and all your objects are in each folder along with the .PBG file it will be a lot easier to work with. So lets say your folder structure looks something like this:

MyPBApp  
Logistics
Order
Shipping
Warehouse

2. Now put your target file in the MyPBApp  folder. In .net speak the PBL is the project and the target is like the solution. There is one more level above that (the workspace) but I’m going to ignore that in source control and just keep it local. You will have to fix the target in PowerBuilder so that it can find the PBL’s in their new locations.

3. Make sure PowerBuilder is connected to TFS via the MSSCCI provider. You can set up the connection by right clicking on the PowerBuilder workspace, select properties and go to the Source Control tab. I would also install Team Explorer so you have access to the full feature set of TFS.

4. From PowerBuilder pick your target and select Add To Source Control. This will export all the objects out of their PBL’s and create a PBG file which is a manifest of the objects inside that PBL. Now anyone on the team can get latest and open the Target in their local workspace.

5. Make sure to tell everyone to make the local copies of their PBL’s writable. Or they will have to check them out when they check out an object. Trust me it’s easier to make them writable locally.

Code Metrics PowerTool

 

Would you like to be able to run code metrics for your application via the build process. As of two days ago you can. ON Jan 26th 2011 MS published the Visual Studio Code Metrics PowerTool 10.0.

With this power tool you can perform code metrics via the command line so it can be called from your build.

Just download and run metrics.exe /? for help.

Build Controller vs Build Agent

This is a great walkthrough that explains how to deploy a Database from a TFS 2010 Build WorkFlow.

It uses a command line tool called VSDBCMD.EXE, that is explained here.

I recently used this technique and it works great.

I actually created a pretty sophisticated build and deploy process using the build process templates from TFS 2010 to build a Database project and allow the user to decide via variables if they want to deploy to a Database or just create the script.

Something to watch out for though.

Take a look at the section titled “To define the Then Deploy block”

Then look at Step 3.d

Set the FileName property to the path of VSDBCMD.EXE on your build server. For example, you might specify C:\Program Files\Microsoft Visual Studio 10.0\VSTSDB\Deploy\VSDBCMD.EXE if you installed Visual Studio on your build computer or C:\Deploy\VSDBCMD.EXE if you just copied the Deploy folder to your build computer.

Notice the reference to “your build server”. This seems innocent enough of a statement. However if your Build controller is a different machine than your build agent it makes a difference as to where you can put your Invoke process to call VSDBCMD.

If you installed VSDBCMD on the build agent make sure the Invoke VSDBCMD is within the Run on Agent block in your Build process or it won’t work. If you follow the walkthrough and put your Invoke Process after the Check In Gated Changes block the process will not be able to find VSDBCMD.EXE because it’s installed on the Build Agent and at this point you are on the controller. If they are the same machine it won’t make a difference.

referring to the diagram below: If your controller and agent are different machines, everything in the Run On Agent block runs on the Agent and everything else runs on the Controller.

Build Agent Working Directory Tokens

Team Foundation Build variables: You can use the following variables in a build agent working directory:

  • $(BuildAgentId): An automatically generated integer that uniquely identifies a build agent within a team project collection.
  • $(BuildAgentName): The Display Name of the build agent.
  • $(BuildDefinitionId): An automatically generated integer that uniquely identifies a build definition within a team project collection.
  • $(BuildDefinitionPath): The team project name and the build definition name, separated by a backslash.

Baseless Merge with TFS

This Blog post contains material that is not suitable for the branching novice. Viewer discretion is advised.

First I would like to say this should be avoided if at all possible. Having a relationship between branches makes it much easier to deal with branching. So unless you absolutely have to  merge between unrelated related branches try not to.

Now that disclaimers are out of the way, what is a baseless merge?

Take the following branch hierarchy. Dev can be merged with QA, and QA can be merged with hotfix or Prod. If you tried to merge a change from hotfix directly to Dev the UI will not let you. There is no relationship between them therefore it would be a baseless merge.

If I were to make a change in the Hotfix branch and attempt to merge it with Dev that option would not be available. As you can see in the merge dialog below the only option available for merging is the QA branch.

If I was to merge changeset 108 from Hotfix to QA the visualizer would show something like this.

If I wanted to merge the latest version of HotFix into Dev skipping QA I would have to do a Baseless merge from the command line. Using the baseless switch on the tf merge command.

tf merge /recursive /baseless Hotfix Dev

If we then take a look at the visualizer we can see that we did a baseless merge denoted by the dotted line.

 

Shelve Sets

I think Shelve Sets are one of the nicest features of TFS source control.

They are great for:

  • Storing code safely on the server each night before you go home
  • Storing code you are working on to fix a bug in another branch or older code base
  • Sharing a code example
  • Code Reviews
  • Prototyping
  • Passing something incomplete off before a vacation or long weekend

That reminds me of the one thing I don’t like about Shelve Sets. When you want to unshelve something that belongs to another developer you have to know their user id. There is no  drop down with a distinct list of users that have something shelved. To get my code you would have to know dlloyd or lloyddave or lloydd or whatever my network id happenes to be.

All is not lost, if you install the TFS Power Tools  one of the tools it comes with is called Team Members which is an add-in to Team Explorer, that allows you to organize users into sub-teams and access a number of collaborative tools, such as IM and email, sharing of queries and links, and downloading and installation of custom Team Foundation components.

Check out the context menu when you right click on a team member in this tool you can show their check in history, pending changes, and of course shelvesets.

Sweet!

Microsoft 24 hour code-a-thon

24-Hours of pure, unadulterated coding madness!

The new Windows Phone 7 has recently launched in Canada and Microsoft is looking to YOU to develop apps! Join your friends and fellow student developers for a 24-hour Code-A-Thon hosted by Microsoft. There will be tons of amazing prizes for the best apps, and a brand new Windows Phone 7 for the student that can submit the most apps!

The Windows Phone 7 Code-A-Thon:

Start Date:

Friday, January 21st @ 6pm

End Date:

Saturday, January 22nd @ 6pm

Location:

University of Waterloo, VeloCity Residence 200 University Avenue West

Students to RSVP at: http://codeathon.wufoo.com/forms/microsoft-24-hour-codeathon/.

The Maritimes loves TFS

If you have been reading my Blog this week you will know I am in Halifax at Techdays. I did two sessions this week one on Branching and Merging and one on Build Automation both TFS topics. 

Being in the east coast for me feels less like travelling then talking in Ottawa does. You see I have maritime blood in me. My father was born in New Brunswick and I spent most of my childhood summers here. I love the Maritimes they are the nicest people I have ever met. The two ladies who worked the door of the room I talked in were so friendly and helpful I would like to say thank you, I don’t know your names and you will never read this, but to the ladies outside room 200C2 Thanks. :)

Both sessions had a great question and answer segment at the end. The poor next presenter has been setting up both times while I am trying to get out.

After my session today I hung around in the Ask the Experts area of the conference. Even though there are about 15% the attendance of Toronto. I had 4 times the number of people asking questions about TFS. Everyone was very excited at the possibility of using TFS for source control and Build automation. Wait until they learn all the other stuff it can do.

Halifax, thanks for another lovely trip. I’ll be back.

The Maxwell’s Plum in Halifax

I am in Halifax at the moment, speaking at TechDays. I am doing two sessions here Branching and Merging yesterday and Build Automation today.

Yesterday one of my partners Bruce Johnson surprised me by showing up to do a talk. Nice for me now I had someone to have dinner and a beer with.

So Bruce and I headed out looking for a pub. We got lucky first time finding The Maxwell’s Plum. I can’t recommend it enough the food was good and the beer even better. They have a huge selection of drafts on tap. Our server Amy was funny and friendly and knew her beer.

First we both tried a BlackBerry which was a variation on Black and Tan using Pumphouse Blueberry as the Tan. It was very nice.

So I thought I would see how well Amy knows her beer. I asked her to suggest some beers. She asked me what kinds of beers I like. I ended up having a Garrison Tall Ship Ale which is a local micro brewery and it was excellent. I also had a Propeller Pale another local brewery. Both were great beers, it’s nice when the server actually knows and understands the product they are selling.

Now if the Prince George Hotel where I stayed understood their rooms are not worth the price they are charging. :(

Windows Phone 7 Apps “Double Out”

The MVPs were challenged to write a Windows Phone 7 app and upload it to the marketplace. There are of course prizes involved. :)

So I wrote one. I’m no Silverlight expert, and I have never completed a mobile app I started before.

However, I must say this was easy, and the emulator worked flawlessly. In a couple of hours I wrote a simple application that gives you a dart finish if you enter what you have left to throw.

I play on a dart team you see. This application will help you with dart finishes. In Dart games like 301, 501 and 701 you must end on a double. There are three and two dart finishes starting at 170. Many pubs have posters up that show you the best finish given what you have left to shoot. This simple application brings that information to your Windows Phone 7. Just enter what you have left to throw and Double Out will tell you the best finish.

The interface is pretty simple but getting going was a snap. I downloaded the developer kit installed and built an app all within a couple of hours. There is plenty of help out there including articles and examples. I managed to build this without reading any of it.

Now that I have this starting point I want to play with the gestures. I have done some gesture programming before for windows 7 so I am interested in seeing how it works for the phone.

image

Microsoft Quality Assurance Breakfast

imageQuality Assurance
An effective software quality approach can dramatically improve effectiveness, automation and traceability throughout the development lifecycle. It may surprise you to learn that Microsoft employs as many software testers as developers. Less surprising is the emphasis the company places on the testing discipline—and its role in managing quality across a diverse product portfolio.

For insights into how Microsoft drives software development and tool efficiencies that can benefit your organization, we are extending this special invitation to join Microsoft’s own Alan Page for an executive breakfast on software quality assurance. This is a unique opportunity to share your challenges and learn more about real world solutions. Please register before limited spaces are filled. (Invite Code: 2B1C6C)

Alan Page began his career as a tester in 1993, and joined Microsoft in 1995. He is a Principal SDET on the Office Communicator team, where he coaches and mentors testers and test managers across the organization on testing approaches and techniques. Alan also leads Microsoft’s Test Architect Group and other Microsoft quality and testing focused communities. In his career at Microsoft, Alan has worked on various versions of Windows®, Internet Explorer®, and Windows CE, and has functioned as Microsoft’s

Director of Test Excellence.
Alan is also a frequent speaker at industry testing conferences, a board member of the Seattle Area Software Quality Assurance Group (SASQAG), and has published several articles on testing and quality in testing and software engineering magazines. Alan writes about testing on his blog (http://angryweasel.com/blog), was the lead author on How We Test Software at Microsoft (Microsoft Press, 2008, and contributed a chapter on large-scale test automation to Beautiful Testing (O’Reilly Press, 2009).

 

Topic: Software Quality Assurance

Date: Thursday October 21, 2010

Location: St. Andrew’s Club & Conference Center

Address: 150 King Street West at University, 27th floor

Breakfast: 8:00 AM

Session Start:  8:30 AM

Session Finish: 11:30 AM

Who Should Attend?

Senior leaders responsible for software Quality Assurance

Register Now

Invite Code: 2B1C6C

TesTrek Talk Next Week.

Deb Forsyth and I are speaking at TesTrek next week.

Our workshop is on Thursday Oct. 21st at 11:00 am

Effectively Managing the testing Process Through Collaboration
Debra Forysth and Dave Lloyd, ObjectSharp Consulting

Communications is the key to the success or failure of any team, whether it’s a sports team or a software development team creating the next app. Without communication, the team members have no idea how best to direct their efforts. With communication, the team can overcome almost any challenge.  Unfortunately, ensuring that the level of collaboration required in generating success can be a difficult goal to achieve. Solid development managers have a bag of tricks that they utilize to foster communications among the different roles. In this session, you will learn some of the tricks that can be used in your own environment to create better communications across all of the team roles.

  • How can the other team roles more effectively communicate with the testing team?
  • What does the test team need to know to complete the testing effort?

 

 

Hope to see you there.

Intellitrace: Debugging for the 21st Century

Come out to the next Metro Toronto User Group meeting and see my talk on Intellitrace.

Intellitrace is the new debugging feature in VS 2010 Ultimate. No longer will you have to set a breakpoint at just the right spot and carefully step to it hoping to catch the problem at the source. Instead you can debug backwards to see the prior states of the application without having to restart. Among other things, I will show you how to set up Intellitrace and navigate your application backward and forward so you can find problems faster and easier than ever before.

Date & Time:

6:30 pm on Tuesday October 19th 2010

Location:

KPMG

333 Bay Street
46th floor
Toronto, Ontario

You can Register here.

See you there.

Tech Days Toronto

Tech•Days—back and better than ever

Tech•Days 2010 is traveling across Canada and coming to Toronto on October 27th  and 28th. With 50 sessions across 5 technical tracks, Tech•Days 2010 is a must-attend for IT Professionals and Developers dreaming of the future—today. Immerse yourself in cutting edge technologies that will transform business. Take advantage of learning opportunities that will help you enhance your current skills and develop new ones. And hear from key speakers who will motivate you to explore new ideas, perspectives and knowledge. The track and session abstracts are final and have been designed to help you grow your technical skills and offer you the best learning experience on the latest technologies. Register Now

Tracks include:

  • Developing for Three Screens and the Cloud
  • Optimizing the Development Process
  • Collaboration: The Next Generation
  • All About Deployment
  • Managing and Helping to Secure your IT Infrastructure
  • Local Flavours

This year’s Tech·Days is gearing up to be the best yet. In addition to the great technical learning you will receive, we’ve finalized compelling offers that will be made available only to TechDays attendees, including:

If you are planning to attend any of the Azure sessions at Tech·Days, sign up for an Azure introductory offer to receive your free computer time, storage, and database in the cloud. To sign up, please visit the Azure offer site and select the Introductory offer.  You will require a credit card to sign up; however, you will not be charged unless you exceed the free allowance.

Be sure to take advantage of the Early Bird rate of $349.99 + applicable taxes (nearly 50% savings off the regular price of $699.99). Toronto Early Bird pricing ends on September 16th , 2010.

Register for TechDays Toronto Now

Tech Days 2010

Tech Days 2010 starts next month Vancouver then makes it’s way around Canada.

I’m a Session lead for a session on Build Automation.

Here are dates and locations for a Tech Day near you.

Vancouver   Sep 14-15

Edmonton   Oct 05-06

Toronto      Oct 27-28

Halifax        Nov 02-03

Ottawa       Nov 09-10

Montreal    Nov 23-24

Winnipeg   Dec 07-08

Calgary       Dec 14-15

How to Delete a TFS Project in 2010

In the past if you wanted to delete a TFS project it had to be done at the command line.

Now you can do it right from the Admin console on the Server. “I am loving the TFS Admin console.“

For those of us who create projects just to play with features and then don’t want them hanging around anymore this is much easier.

image

Building .net 4.0 with TFS 2008

Did you know the TFS 2008 build agent can use MSBuild 4.0 to build VS 2010 solutions

On the Team Foundation Build 2008 machine:

  • Install .NET 4.0
  • Install Visual Studio 2010 (if you are running tests)
  • Edit the TFSBuildService.exe.config file and set the MSBuildPath value to v4

image

The MetaData Build Process Argument

As you have read on this blog and others, the TFS 2010 build process’ now utilizes Windows WorkFlow to define it’s process. This means you can define Arguments to allow an option to be set in the Build definition instead of being hard coded in the process.

For example when you create a build definition the process tab allows you to set various options like Where to find unit tests, what is the build number format, should the build run Code Analysis? These are all defined as arguments in the build process so they can be changed when creating the build definition or even when you queue the build.

You can of course add your own arguments to a build process. Just to set the stage, lets say for example I wanted the build process to create a work item when the build completed. In the build toolbox there is an OpenWorkItem activity that I can use for this. We’ll have the build create a Task that has someone Validate the Build.

We can set the type and title of the work item we want created. However the AssignedTo might depend on the solution being built. We don’t want to hard code this in the build process but rather allow the author of the build definition the ability to set it for each type of build.

image 

Set the Type = “Task”

Set the Title = “Validate Build (“ + BuildDetail.BuildNumber + “)”

Next create an argument called BuildValidator to take the name of the person the author of the build would like the Task assigned to.

At the bottom of the process editor click on the arguments button to show arguments for the process you are editing. In the last entry where it says Create Argument enter the name of your argument. In our case we’ll call it BuildValidator

image

Now we can go back and add BuildValidator to the AssignedTo property of the OpenWorkItem Activity to complete our process.

However lets set up some Metadata for this property. This is done using the Metadata Argument. In the list of arguments you will see one called Metadata click on the ellipsis under the Default Value column.

In the dialog that opens you can Add MetaData for a process parameter. Click the Add button and enter BuildValidator into the Paramater Name.

From the screen shot below you can see that you are able to set a DisplayName, Category, Description. Set an editor, whether or not it’s required and where it should show up.

image

Once you have the metadata entered Click OK, save the process and check it in.

Go and edit or create a build definition using this process and you will see your process argument with all it’s Metadata in the process tab of the build definition.

image

Canada eh!

Tonight at the Microsoft World Partner Conference MS Canada had a party for all the Canadians. It was wonderful. Food and drinks at the Hard Rock Cafe in Washington.

They brought in Great Big Sea to play for us, and they were wonderful.

IMAGE_056

Thanks MS Canada you know how to treat your partners.

My first WPC

I arrived in Washington D.C. yesterday morning for the MS World Partner Conference. I have been to many PDC’s and TechEd type conferences but this is my first Partner Conference.

Registration was very well done. Attendees just scan the bar code on a piece of paper they printed at home when they registered. Take that to a desk show ID and they hand you a card. it’s was literally 2 minutes. Very impressive.

Went to a New Horizons/MS  party last night that was fun. I met a bunch of people including a nice couple from Redmond. He works for MS and knows a few people I know from MS Canada.

The last time I was in Washington it was a lot different then it is now. It’s very clean and there is lots of activity. I Found an Irish Pub on my way to the NH party yesterday, it was buzzing with people. Nice atmosphere.

I am going to pack up now and get over to the Verizon Centre for Breakfast and the first Keynotes.

Creating a Video Recording with MS Test Manager

When manual testing using MS Test Manager you may want to change the test settings to include Video Recording.

image

This will capture a video of the test session so the developer can’t say “Tell me exactly what you did to create this bug.”

To get video recording to work you may have to install the Windows Media Encoder and a support update.

You can find the details and download links here.

Hierarchical Work Items

TFS 2010 has hierarchical work items. This is something that we have been waiting for and are very happy about. Along with hierarchical work items you also get two new query types.

Work Items and Direct Links - Which allows you to query for a work items with specified relationships.

Tree of Work Items – Lets you query for a work item and child work items.

For example if I wanted to return a list of User Stories and all the Development and Design Tasks to implement them it would look something like this.

image

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The result from this query might look something like this.

image

Lets say you have created tasks but have not assigned them to Requirements yet. In other words they have no Parent Work Item. Create a query something like this, so it shows Tasks and User Stories in the Parent role. 

image

The Result will show Tasks that were not assigned to User Stories yet.

image

Here’s the cool trick I wanted to show you.

By dragging the Task titled “Implement Movie Query” onto the User Story titled “Select Movie Time” it will automatically create the Parent/Child relationship. You can also reassign incorrectly assigned children to another parent.

Nice eh?

2010 Launch

The 2010 Launch event was last night at Ultra on Queen West. Great event, thanks MS for putting it on. There were lots of folks out to help celebrate.

VS2010 Launch 020 by Jules in Toronto.

 

 

Now to get ready for the next launch event.

on April 22nd ObjectSharp and Microsoft co-present Visual Studio 2010 At the Movies.

This is a free full day event from the best instructors in the business.

ironman spaceballs torontosfinest wizards

Microsoft Sync &amp; MyKey

I recently purchased a new car. I had been thinking about it and a deal came up that was too good to pass up. 0% financing, free MS Sync were just two of the carrots I followed into the dealership.

I bought a 2010 Ford Focus. If you are like me you might have thought the focus was a low end, small car like the chevette back in the day. :) Well I’m hear to tell you that is not the case. For a very reasonable price (I am very cheap when it comes to cars) I bumped up to the SES model. It has loads of great options. I wanted to Blog about two of them.

Cool Option Number 1: Mykey

Mykey allows me to program driving instructions based on the key that is used in the car. I can program the car so that when the spare key is used:

  • The seat belt reminder can not be turned off
  • Audio is muted until the seat belt is buckled
  • Audio volume can be limited
  • Vehicle Speed can be limited
  • There are audible and visible warnings for both low fuel and speed thresholds

Teenagers everywhere are cringing at the thought of this feature. :)

Cool Option Number 2: Microsoft Sync

I had heard a lot about MS Sync but never really knew what features it had. I have just started playing with it, but so far it’s very nice. Let me begin by saying the controls are all on the steering wheel which is a great feature. What can MS Sync do?

  • Hands Free Calling
  • You can search through Contact List, missed calls, incoming calls outgoing calls.
  • Have it read you text messages to you
  • Automatic Text message responses like
    • Can’t talk right now
    • Call you later
    • I’m stuck in traffic
    • CU in 20 minutes
    • CU in 10 minutes
    • Where R you?
    • Call me
  • Verbally search for and select music to play on your IPod plugged into the USB port
  • Charge your phone via the USB port
  • 911 Assist (I haven’t used this yet, hopefully I never have to)

I really like my MS Sync.

Branching &amp;amp; Merging in 2010

Branching & Merging has always been difficult. I have worked with teams who go out of their way not to branch the code. However sometimes it’s just necessary. Thanks to the Software Engineers at Microsoft it’s much easier now in TFS 2010 Source Control. I don’t mean easier (less key strokes) I mean easier because a Branch is now a first class citizen and there are ways to visualize what change sets have made it into which branches.

Let me show you what I mean.

Lets take a simple application like my calculator and create two branches of the code for the purpose of code promotion. Some source control tools have the concept of a promotion model. Which works kind of like static labels. Code can be promoted from development to QA and Production branches. Dev QA and Production act like labels but there is only ever one Dev, QA and Production promotion level at a time. We can use branching to achieve this. I’m not promoting this method as the way you should promote code, I’m just using it as an example for branching because I think it’s pretty easy to get your head around.

To start I’ll take my Calculator solution and create two branches in source control called QA and Prod. Right click on the project folder in Source control and select Branching and Merging | Branch…

image

On the branch dialog enter the name of the target branch.

image

Create two, one named QA and one named Prod. You will also be asked to create a local folder if you leave the option checked to store it on your local workspace. Don’t forget this operation is a local change and you will have to check in your changes to make it permanent.

Once all is complete you should have the following in Source control.

image

So here we have the Calculator main branch and of course the two promotion branches Prod and QA. Right click on Calculator and select Branching and Merging | View Hierarchy from the popup menu. This will give you a view of the relationships between branches.

image

Right click on the main branch and select Properties from the popup menu. The properties dialog contains information about the branch including relationships to other branches and permissions. This is where you can denote who has the rights to promote to a particular branch.

image

We can use the History View to visualize which branches a changeset has been promoted to. Here are the changesets checked into the my calculator.

image

If you right click on one of the changesets we can see how it has been promoted through the branches. Lets take this bug fix for example. I’ll write click on it and select Track Changeset from the popup menu.

Next we select which branches we want to look at.

image

Click on Visualize to see which branches this Changeset is in. From the Visualizer switch to Timeline Tracking to get this view.

image 

We can see that the changeset has been promoted to both branches. Therefore Changeset 13, 15 and 16 are the same.  Select a changeset and you will see the date and time the changeset was merged into the branch at the top highlights in yellow.

Now try this. Make a change in the base branch then open the visualizer and drag the base branch to one of the other branches this will merge the changeset into the branch you drop it on. Then check in your merge and refresh your visualizer.

Happy Branching and Merging.

Generate a Data Driven Coded UI Test from an Action Recording

One of the very cool new features of VS 2010 and TFS is the ability to turn a manual test into an Automated UI test. As if that wasn’t cool enough how about making it Data Driven and bind it to the original Test Case created by QA.

Using the new Test Manager that comes with VS Ultimate 2010 your test team can create Test Cases using parameters instead of hard coded data values. This allows the manual test to be executed over multiple iterations and validate several scenarios using just one Test Case.

If you have such a Test Case stored in TFS it will look something like this.

image

Notice the @Value1, @Value2 and @Result under the Action and Expected Result. They represent parameters whose values that are listed below, the steps.

Assuming the test team executed this Test Case and created an Action Recording. Which means they let Test Manager record their actions while they ran through a manual test of the application. During the manual test and subsequent recording they will have easily, and possibly without even knowing it bound the Parameters to controls in the application.

From this you can create a Coded UI Test that you can use in part of your arsenal of automated tests against the User Interface.

Here is what you need to do.

Open the Test Project where you want to store the Coded  UI Test. And select Test | New Test… from the Visual Studio menu. On the New Test dialog select Coded UI Test, name it and select the test project to add it to.

image

As the test is being added to the project you will be prompted with a choice to either Record this test yourself of use an existing action recording. Select Use an existing action recording.

image

Next you will be prompted to select a test case. Find and select the test case created by your QA team that contains Parameters and an action recording discussed earlier.

The Coded UI test will be generated for you. Minus the Assertions, we’ll add those ourselves.

You should end up with a Multiplytests class that contains a CodedUITestMethod1(). Rename the method to something more appropriate. In my case I will name it MultiplyTestMethodUI().

The method will look something like this.

image

Notice the reference to Value1 and Value2.

We need to add the assertion to this test.

Place the cursor on a blank line just before the CloseCalc() method call, right click and select Generate Code for Coded UI Test | Use Coded UI Test Builder… from the popup menu.

Visual Studio will minimize and you will see the Coded UI Test Builder.

image

Open the Application and drag the cross hair to the control you want to use to validate the result. In my case it’s the Answer Text Box. You will be presented with a property grid for this control. Select the Text property.

image

Click the Add Assertion button on the property grid toolbar and select AreEqual as the comparator and some value. Then click OK.

image

Click Alt+ G to generate the code for the assertion, when prompted enter a name for the method and click Add and Generate. Stop your recording by clicking on the X in the Coded UI Test Builder. We could have done this all manually. I’m all for letting the tool do it for me. :)

You will notice back in your test method a call will be added to the assertion method you generated.

At this point we want to set the expected value for the assertion to the result from the test case.

Insert a line just before the AssertMultiplicationTest method call and insert the following code.

this.UIMap.AssertMultiplicationTestExpectedValues.UIAnswerTextBoxEditText – TestContext.DataRow[“result”].ToString();

Save and build your solution. Open the Test View window and execute the new Coded UI Test you just created.

Check the test results to see a pass for each Data Row.

image

Take a look at the DataSource Attribute on your test method. It’s pointing back to Test Case 11. Therefore if the test team adds scenarios to their test case your Coded UI Test will run those scenarios also.

Happy New Year

It’s been over a month since I wrote an blog entry. I have reasons, Christmas, time off, New Years. I paved my main machine too, it was time. Put a fresh install of Windows 7 on a brand new Solid State Drive. It’s crazy fast. Of course that means fresh installs of everything. Everyday software gets installed first and then I move on to secondary stuff that I don’t use everyday, like Live writer. 

I am going to try and get out more Blog entries on what's new in 2010. At the moment I am pretty busy. Besides helping with day to day business. I have several presentations coming up.

  1. Today Adam Gallant and I are doing a Web Cast titled Quality Assurance in VSTS 2010.
  2. On January 21st Jeff Zado  and I will be in Waterloo to discuss Better Application Lifecycle Management with VS 2010
  3. On January 27th Deb Forsyth and I will be at the CTTDNUG in Kitchener presenting What’s new in TFS 2010

I also have Several ALM Assessments to do, plus Deb and I are writing some new courses. TFS 2010 for QA and TFS 2010 for Developers.

I’ll get back into the swing of a regular Blog entry sometime this week.

Build Process Templates

Making a build script do exactly what you want is easier with 2010?

When setting up a build there has always been a separation of concerns.

  • The Build Definition
  • The Build Process

Creating the build definition is much like you are use to in 2008. Right click on the builds node in the Team Explorer and select New Build Definition. It’s no longer a modal wizard, however it’s the same of information.

  • Name and Description

  • How you want the build to be triggered

  • Working folders

  • Build Server and Drop Location

  • Retention Policy

However there is a big difference, and it relates to the separation of concerns I mentioned above. In 2008 you could create a project file, that you would later have to edit to get the build to do anything extra ordinary. When you hit create on the project file tab you would be launched into another wizard that allowed you to select the solution to build, the type of configuration you wanted to build, weather or not you wanted tests executed against the build and or static code analysis performed.

In 2010 the Process tab contains a type of property grid which allows you to change the configuration of the build. This grid is organized into 3 sections Required, Basic and Advanced, allowing you to specify the solutions to build, define the build number, how to deal with tests and code analysis, weather or not to perform test impact analysis or label the source at this build to name just a few.

Where is all this defined? How would I add extra functionality to my build? What if I wanted to replace a dev.config with a test.config or deploy extra files to the drop location?

At the top of this tab is a show details expander.

image 

After expanding this area you will  be able to select from a list of Build Process Templates.

image

Each template can contain different build processes. Beta2 comes with three templates to get you going. Click New to create your own by selecting a XAML file you have already created a placed in source control, or copy one of the existing templates as a starting point. You will notice also that you can store your Build Template anywhere in source control. In previous versions they only ever existed in one place under source control.

With 2010 you can create a build using the default template, which will likely do most, and more likely all of what you need it to do. In my experience most teams do not customize their project build files so for them the default template will suffice.

If you do want to make changes to your Build process you no longer have to edit a confusing poorly documented XML file. Instead when you open the build template in VS you will be presented with a Windows Workflow editor that allows you to edit your build process template.

image

So why did I start this Blog post with a question? Although it does appear to be easier to add functionality to your build process, For those of us who are Windows Workflow challenged there is some learning to do. The good news is it will be better documented and ultimately easier to find solutions.

Conflict Resolution in TFS 2010

The conflict resolution in previous versions of VSTS/TFS worked ok, but did not have the best user experience for the developer. When a conflict was detected on check in a modal dialogue was dispatched and the developer could resolve the conflicts from there. However getting to all the information you required to resolve the conflict was not at hand.  

In TFS 2010 when you attempt to check in a conflict VS behaves the way it does when you have violated a Check in Policy. One mark for consistency. You will get a warning message as seen below.

image

Then you will be redirected to the Pending Changes - Conflicts Tab

From the conflicts tab you can get at the information you need to help you resolve the conflict.

image

Compare – Compare the local file with the latest version in source control.

History – See the complete history of all changes to this file.

Annotate – Shows you the source file with change set information in the margin. Including who made the change and when.

image

Once you know what you need to do, click on the expander for a file and select how you want to resolve this conflict. You can AutoMerge, use the Merge Tool to edit the source, or simply select the server version or the local version.

image

Happy Merging!

Test Driven Development with VS 2010

Test Driven Development proposes you should: write the test, watch it fail, write the code, run the test to see it pass, refactor your code.

This is difficult when your code won’t compile because you haven’t created the method or even the class you are writing a test for. When you are in the middle of writing unit tests you don’t want to have to switch over to create a class with an empty method, it breaks your train of thought.

In VS 2008 MS introduced the Generate Method Stub  on the CTRL+. smart tag.

image

In 2010 they have taken this a step further. There are two new features I want to talk about here IntelliSense Suggestion Mode and Generate From Usage.

IntelliSense has two modes now Completion Mode and Suggestion Mode. You can toggle between these modes with the key sequence CTRL+ALT+SPACEBAR.

In completion mode if you entered the name of a type that does not exist, IntelliSense will make suggestions that match what you typed. I’m sure you have noticed that this can be annoying, with the wrong key stroke you end up with code you didn’t want.

image

By switching to Suggestion mode IntelliSense will display an edit control allowing you to continue typing even though there are no matches.

image

IntelliSense will even suggest this new class before it’s actually created.

image

Once you have completed your statement you can use the CTRL+. smart tag to generate this class.

image

Or generate a new type altogether, allowing you to select the project it should go in.

image

You can use this new feature to generate a method or property stub also a class, interface, struct or enum.

Reference Highlighting

I’m going to like the new Reference Highlighting in the 2010 code editor. This is like an in place version of the find all references feature.

To enable/disable this feature:

For C# Go to  Tools > Options >Text Editor > C# > Advanced
                        Check “Highlight references to symbol under cursor”

For VB Go to Tools > Options >Text Editor > Basic > VB Specific
                         Check “Enable highlighting of references and keywords”

Once enabled (which is the default in Beta 2) place your cursor on almost any symbol and all other references to that symbol will become highlighted.

image

You can navigate between the highlighted text using CRTL+SHIFT+UP ARROW or CRTL+SHIFT+DOWN ARROW

Symbols can include declarations, references, and pretty much anything else that Find All References would return. Including classes, objects, variables, methods, and properties.

In Visual Basic, this also includes: Select Case, Case, End Select, If, Then, ElseIf, and End If.

For C# code, reference highlighting is not provided for the switch and if constructions, but is provided for other symbols.

Gated Check-in Build Trigger

VS 2010 has a new feature that allows a developer to validate that their code change will merge and successfully build with the current code base on the server before ever checking it in. It’s called the gated Check-in.

How it works

Create a build type that uses Gated Check-in as it’s trigger for starting the build.

image

Take the code you want to check in and shelve it.

Then when you queue the build you can specify the Shelve set to be merged with the source from the server. You can also have the build complete your check in if the build is successful.

image

This should help to diminish the number of broken builds on the server.

Extending VS 2010

In VS 2010 MS has made adding extensions very very easy using the Extension Manager.

First you may want to change one option under Environment > Extension Manager.

You want to Load Per User Extensions when running as administrator.

image

Once you do that, from the Tools menu open the Extension Manager. The Extension manager shows you what extensions you already have installed, and gives you the ability to uninstall or disable them.

image

So where do I get extensions from? The extension manager helps here too. Select the Online Gallery and you will be able to pick from a list of published VS extensions. You can filter to just see Controls, Templates or Tools. Sorting is a handy way to see what is popular by rating or most downloaded.

image

Select the extension you want and click Download. You will be prompted to install the package. Now just restart Visual Studio and enjoy your new VS extension. :)

Code Coverage in VS2010

VThis took me a few minutes to find. Perhaps I can save someone else those few minutes.

To turn on Code Coverage locally you need to edit what used to be the <Local>.TestRunConfig , which is now called the <Local>.TestSettings.

The section is not called Code Coverage anymore it’s under Data and Diagnostics. There are a bunch of  tools you can turn on from here including:

image

Select Code Coverage, and the configure button at the top will become enabled.

image

To select the DLL’s for code coverage click the Configure button. You will get this window, I think you know what to do from here.

image

Access 2007 & SharePoint

If you are responsible for content in SharePoint in any way you should take a look at Access. Weather you are just updating information ongoing, or migrating information from an old site, or from other sources Access is the way to go.

I recently had several hundred items that needed to go into a list. The data was sent to me in an Excel spread sheet. So I thought I would look into the Excel Add-ins for SharePoint.  image

I knew Open with Access was an option in the list Actions menu but always dismissed it. I didn’t want to open up Access, I haven’t used that old tool in years. However with a need to insert hundreds of list items and a faint hope that using a client application to edit those lists would be a much nicer experience then  using SharePoint itself I clicked on the menu item.

You can completely manage your list with Access.

You don’t even have to log in to the SharePoint site via your browser. Open Access, then from the External Data tab on the ribbon select SharePoint Lists then Existing SharePoint List. Enter the URL of the SharePoint site, log in and select the option Link to the Data source by creating a linked table.

At this point select the lists you would like to work with and they will be added as tables in Access linked directly to SharePoint. Now that you have your list as an Access table the options for managing that data is endless.

You can update, insert and Delete using SQL Statements.

You can import data from multiple sources including Excel, Another SharePoint List, Text, XML, Word Mail merge, HTML, ODBC and more.

image

Trust me this is an option you will be happy you explored.

Google vs Bing Maps

I have been a fan of Google for a long time. I tried Live Search but ended up going back to Google.

The other day I was looking for an address in rural Hamilton, Flamborough actually. The address was 359 Concession 10 East Hamilton. I knew the general location I just wanted to know some street names around it to figure out the best route.

When I entered the address into Google Maps it took me to 359 Concession St in Hamilton which is on the mountain not in Flamborough. I tried various incarnations of the address but Google could not seem to find it. 

Therefore I switched over to Bing maps, entered the address the same as I had for Google and Bing found the exact location.

Bing, you have my attention!

Windows 7 Programming

Windows 7 is coming and there is plenty for .net developers to be happy about.

First of all there are the managed Code API’s written by the Windows SDK team. This is a set of libraries that take care of all the interop necessary for communicating between .NET and the native windows API.

What’s included in this API you ask?

Support for Windows Shell namespace objects, including:
   Windows 7 libraries
   Known Folders
   Non-file system containers
Windows Vista and Windows 7 Task Dialogs
Support for Windows 7 Explorer Browser Control
Support for Shell property system
Windows 7 Taskbar
Support for Windows Vista and Windows 7 common file dialogs, including custom file dialog controls
Support for Direct3D 11.0 and DXGI 1.0/1.1 APIs
Sensor Platform APIs
Extended Linguistic Services APIs

Download here, Read more here.

Windows 7 Gestures.

The next version of WPF will include .NET support for Windows 7 MultiTouch.

Until then Windows 7 MultiTouch API’s are native Win32 based only. However you can download the MultiTouch Sample .Net Interop Library. This Library is full of samples to help you understand this managed API.

Download here.

Silverlight on the Silver Screen

You don’t want to miss this. It’s going to be great.

July 9th 2009 at the Scotia Bank Theatre

star_wars_smsilver_thunder_sm

No CI Build on Check-in

Found this out just this past week. What a great tip. Thanks Colin Bowern by way of Buck Hodges

Have you ever wanted to check something in without kicking off the CI build?

All you have to do is put ***NO_CI*** in the check in comment.

Now I will never forget.

Business Intelligence Smart Breakfast

If you want to learn what your data can do for you. You should attend The next ObjectSharp Smart breakfast with David Chennells.

Click on the image below for more information and to register.

Twitter

Although I have been twittering, I have also been struggling with its usefulness. Frankly I don’t care what you had for dinner, or how you golfed yesterday.

There is certainly good info on the web that people broadcast that I may not have come across on my own. To date that was the driving force to Tweet and follow, for me.

However, I attended a MS event yesterday and the first speaker talked about a bakery in London that tweets when a batch of bread is coming out of the oven. Using a Baker Tweet device. The bakeries followers can then follow a link to a picture of the product and a map to the location.

I have to admit this put a new light on Twitter for me. Knowing what someone is doing right now seems pointless to me, but finding out a batch of rye just came out of the oven is useful.

Twitter is like an event broker. If I want to execute my buy fresh bread event when the bread is at it’s freshest. I just subscribe to the service and twitter sends the event publication. Twitter makes it possible for the execution of that event to be in sync with the bread coming out fresh from the oven. In the past it fired when I wanted fresh bread but that did not mean the bread was fresh.

Now that I am seeing twitter for what it really is, the possibilities are endless.

Using the WPF DockPanel

For those WinForm developers that are familiar with the Dock Property of Win32 controls, you may be looking for Fill as a DockPanel.Dock value in WPF. There isn’t one. Not to worry docking is easier with the DockPanel then it was in WinForms.

In WinForms, when using the Dock property didn’t result in the look you expected, The way to fix it up was to open the Document Outline window and reorder the controls you were docking. The order along with the Dock property value dictated how the controls would be laid out.

This is also true in WPF. When using the DockPanel you will notice there are four Dock options to select from Bottom, Top, Right and left. There is no fill. However the order of the controls will determine which one fills the panel.

When laying out a DockPanel think of it this way. Your controls will be placed in the panel in the order you have them listed in the XAML. The examples below show how changing the order of the controls changes how the controls are docked. 

When the first control is docked Left it is occupying the whole left side of the DockPanel. While the last control will fill the remaining space in this case the control docked to the Bottom.

 

<DockPanel>
        <Button DockPanel.Dock="Left">Left</Button>
        <Button DockPanel.Dock="Top">Top</Button>
        <Button DockPanel.Dock="Right">Right</Button>
        <Button DockPanel.Dock="Bottom">Bottom</Button>
    </DockPanel>

image
Putting Top first, makes it occupy the whole top, then with bottom second it occupies the whole bottom. Left goes in between, and Right fills the remainder of the DockPanel.  

<DockPanel>
    <Button DockPanel.Dock="Top">Top</Button>
    <Button DockPanel.Dock="Bottom">Bottom</Button>
    <Button DockPanel.Dock="Left">Left</Button>
    <Button DockPanel.Dock="Right">Right</Button>
</DockPanel>

image
This example shows how this rule holds true even when more then one control has the same docking.  

<DockPanel>
    <Button DockPanel.Dock="Left">Left 1</Button>
    <Button DockPanel.Dock="Top">Top</Button>
    <Button DockPanel.Dock="Bottom">Bottom</Button>
    <Button DockPanel.Dock="Left">Left 2</Button>
    <Button DockPanel.Dock="Right">Right</Button>
</DockPanel>

image

Happy Docking!

Google Alerts made me laugh :)

I subscribe to Google Alerts. I have an alert set up to look for the word ObjectSharp. This has worked great over the years, pointing out blogs and articles where people have made reference to ObjectSharp.

This morning I received an Alert that made me laugh.  I started reading a news article titled: Here's how and where 'cutters' can get help

Perhaps its someone talking about our training, I thought to myself. As I began to read the article it made no sense. Then I found the source of the Alert. :)

image

You understand, it made me laugh because of the mix up , not that the article is funny. The Article is very serious and I hope these people get some help.

Dundas Charts in the .Net Framework 3.5 SP1?

It's true. We were looking at using Dundas charts for a client project. One of our associates mentioned that Dundas sold the rights to their Data Visualization packages to Microsoft last year and have added them as a separate installation for .Net framework 3.5 SP1. Read more about it here.

What do I need and where do I get it?

For some help using them check out Chart Forums and Chart Samples

DevTeach Montreal

Have you heard the news?

Every attendee to DevTeach Montreal will get Visual Studio 2008 Pro, Expression Web 2 and Tech-Ed DEV set in their bag!

DevTeach believes that all developers need the right tool to be productive. Therefore you will get,  free software, when you register to DevTeach or SQLTeach. Yes that right! They are giving over a $1000 worth of software when you register to DevTeach. You will find in your conference bag a version of Visual Studio 2008 Professional, ExpressionTM Web 2 and the Tech-Ed Conference DVD Set. Now that is a good deal? DevTeach and SQLTeach are really the training you can’t get any other way.

Register now.

 

clip_image001clip_image002clip_image003

Windows 7

At PDC everyone got a Windows 7 DVD. I used it at the conference on machines that were set up for people to use and it seemed pretty good. I have an older laptop I was going to get paved to use as a back up when this one has trouble. So I thought I would try it out on that machine, nothing to lose.

I was very impressed with the easy install. I have installed pretty much every version of windows since version 3 at one time or another. I would have to say this was the quickest and most pain free ever.

After playing around with it a little (keep in mind there is very little software on it to play with so far) it's snappy. I mean really responsive.

It seems like a much better Vista rather then a new operating system.

So far I give it a big thumbs up. :)

Microsoft Research Part II

On the plane going to PDC Bruce mentioned a new product from MSR that he had downloaded called Pex. Then when the Expo hall opened at PDC we eventually made our way to the MSR section of the hall. There was Pex. We watched an excellent and very enthusiastic demo, at the end we were told there would be a session first thing Thursday morning. That would be the last thing we do before heading for home.

Thursday morning we arrive at the Convention centre for Breakfast, randomly select a table and settle in for breakfast with four other PDCer's. Turns out two of them work for MSR and are giving the talk on Pex this morning. :) It was meant to be, how many signs does one need.

As it turned out Bruce decided to find out how MS uses VSTS internally instead of both of us attending the Pex talk. so we split up.

The Pex talk turned out to be two talks.

Code Contracts

Code contracts will be coming in 4.0 and will allow you to add contracts to your classes and methods to express assumptions about the code. These contracts can be used to:

    1. Improve testing via runtime checking
    2. Static contract verification
    3. Documentation generation

    public virtual int Add(object value)
    {
            Contract.Requires( value != null );
            Contract.Ensures( Count == Contract.OldValue(Count) + 1 );
            Contract.Ensures( Contract.Result<int>() == Contract.OldValue(Count) );
            if (count == items.Length) EnsureCapacity(count + 1); 
            items[count] = value; 
            return count++;
    }

Pex

Pex is an automated white box testing tool, that will interrogate your code and build a table of possible inputs to your code that would execute all code paths. From this table of possible test cases you can generate unit tests. If an unhandled exception is found it will show up in bold, once you create the unit test you can then run the test and debug directly into the code path that causes the exception. All from the Pex UI. Very nice demo.

This is definitely worth a look. There are two versions you can download today. One works with the 2010 CTP and an academic release that works with VS 2008.

Microsoft Research Part I

This year at PDC Microsoft Research was here in force. I have seen them at PDC before, I'm sure of it, Although they tell me it was just a smattering. This year they had a section of the Expo Hall, The Wednesday Morning key note was done completely by MSR. Here are some of the highlights for me.

SecondLight

This is a very cool surface project. The demonstration showed images being projected onto a surface. Where the presenter could rearrange, and resize them, using multiple touch technologies. Then it got cool. Holding a piece of tracing paper above the surface showed a second projection coming through. This image was text that explained the first image. The whole thing is done by alternating between two separate projections onto a surface that can alternate at the same time between transparent and opaque.When the surface is opaque the first image is projected onto it. When it's transparent the second image passes through and can be seen only when a second surface is introduced.

AutoCollage

At the Expo hall there was a booth where a chap showed me some software that was available from MSR right now called AutoCollage. This software will take a folder of images and meld them together as a collage for you, taking the attributes of the image into account. This is one I made after downloading a trial version.

AutoCollage_Images

Deep Intellisense:

Deep intelisense is a tool that helps you find information about a piece of code. It's a quick reverse chronological reference of everything and everyone that have touched this code. Including work items, change sets, Share Point documents. It's used internally at MS but is not ready for external release.

image

Blogging and Beer!

I have not blogged anything for the past two days. I've had very little time between key notes breakout sessions and visiting the Microsoft Booths in the Expo Hall, I could Blog and do all that but then add client work to the mix and there goes the extra time. I sat through a session yesterday and know nothing that happened I ended up catching up on email and having several conversations with people back at home via MSN.

Enough excuses, Bruce and I have split up this morning. He went to a session titled TFS: How we use it at MS and I have gone to a session put on by MS Research on PEX (More Later).

Last night was the only night this week we actually went out for dinner. Attached to our hotel is a Micro Brewery  Bonaventure Brewery  So we went and had the sampler. 5 different beers served on  tray with the type of the beer written on the matt under the glass. (Nice Touch)

IMAG0011 IMAG0012

The Stout was good no Guiness but good. The Pale Ale was as expected from a Micro Brewery. That is what I ended up selecting as a pint after the tasting. The Blond and Strawberry Blonde  were very good also light and lots of flavour. The beer of the day was good also, although my least favourite. I can't recall the name of it. :(

PDC Show Off

Last night we went to a PDC event called Show off. Where people submitted videos of cool stuff they had written using Microsoft Technologies.

The best was Brian The Build Bunny I may just have to buy one of these wireless build notification appliances.

More VSTS 2010

The new VSTS 2010 has me so excited that I sat in on another session. Now I am sad because I have to go back to work and use VSTS 2008. :(

In 2010 you can:

  • Have multiple Build Agents on one Build server
  • Use a Workflow designer to completely Customize you build type
  • Each build can have a server and private or gated build drop location
    • In a previous post I mentioned no more broken builds. That is by using a Gated build to verify what you are about to check in will not break the latest build.
  • Another thing that helps with this is branching.
    • Branches are first class citizens now.
    • You can visualize your branches
    • Conflict Resolution is in the pending changes not a modal dialog.
    • You can now Rollback without a command line powertool
    • Because Branching is a real player History and Annotate know about it.
  • You can create hierarchical workitems.
    • User Story
      • Task...
      • Test Case...
  • Better workitem queries
    • Query across workitem hierarchy relationships
    • Query by TFS Group (Bugs assigned to everyone in UI Dev Group)
    • Compare two fields (Remaining work = estimated work)

C#

After lunch there was only one session that interested me. C# IDE Tips and Tricks.It seems everyone else wanted to see this one also. I went a few minutes late and was sent to an overflow room. From there I was sent to another overflow room, which was full. At this point I gave up and decided to call home. :)

Since I didn't get my C# fix there I next attended The Future of C# with Anders Helsberg. There were two things I found interesting.

  • According to Anders the C# and VB teams are going to work together to keep the two languages in line and up to date together.
  • The other part of the talk I found interesting was around the Dynamic Language Runtime.. C# and VB will have support for the DLR soon. Essentially there will be a new type called Dynamic. :)

VSTS 2010

I attended my first session on VSTS 2010. WOW! This team has been very busy. This session was geared to developers, however it was about testing and architecture features. Here are some highlights I thought were pretty cool:

  • Testing

The Tester executes a Manual Test Case (More to learn here) finds a problem and raises a bug.

Some of what is Automatically attached to the bug is

      1. A video of what the tester did.
    1. A debug Trace file (Developers can load and use to debug through the stack trace)
    2. Information on the state of the test machine.

There will be a lot less returned bugs with the reason "can not reproduce"

Another helpful view is the Test Impact View. This is a filtered list of unit tests that might be affected by your code change.

And then there was the Coded UI Test. This is a recorded test against a web, windows or WPF application. This test is built just like a unit test. However there are extra files that contain the calls that manipulate the UI being tested. You can of course insert Validations/Asserts easily using the recorder. If you are so inclined you could tweak the test because it is written in your favourite .net language. The Coded UI Test looks very good I'm looking forward to seeing more.

  • Build Server

When you check in your code it will actually shelve it with a separate version of the latest code and attempt a build. If it build ok you can check in for real. If not you can't.

No more broken builds?

  • Architect

For the architect there is a new Layer Diagram which will validate against your code to ensure developers are following the architecture as it was intended. This validation is done during the build process. There is a nice Namespace view that is appealing and lets you see how objects interact within and across Namespaces.

PDC KeyNote

This is my 4th PDC. I have to be honest this is the dullest Key Note yet. To be fair Cloud computing is a tough thing to show. Everyone is doing a good job of getting across Windows Azure. So far two partners have come up to talk about how they are using it for their applications. One partner created service called BlueHoo This is a cool app that runs on your phone using Bluetooth it looks for people around you that have BlueHoo accounts and can show you people with similar interests. For now it seems like a toy, however these types of applications have incredible capabilities.

I'm a developer and I want to see code and cool tool features that makes my job easier and more fun. The problem is to utilize cloud computing using Windows Azure, I don't need new tools. It's the same old tools I have been using all along. Hey wait that's a good thing. :)

PDC here we come...

Later today I will be heading for the airport to fly to L.A. for my fourth PDC. This year I am going with another ObjectSharp partner Bruce Johnson.

From everything I have been reading it looks like we are going to learn a lot about Cloud Computing. I'm also looking forward to seeing what is coming in TFS and VSTS.

We get in late tonight so first thing in the morning we'll be heading in to register and find our way to the keynote, which is always a treat.

See you at PDC.

Guaranteed Laugh

Want a good chuckle?

  1. Goto Google Maps
  2. Get Directions from Sydney Australia to Los Angeles CA (For those with little or no time)
  3. Read number 6 on the directions.

Big Smile

It’s cool to be a geek…

 

Do you remember when it was not cool to be a geek?

 

Not that I ever let it bother me. I have attended every PDC since 2001. It’s tough to be the coolest guy out of 8000.

 

Now a days it's cool to be a geek , people are coming out of the wood work to proclaim their geekyness with pride. Below are three examples I came across in the past few weeks.

1. A developer who changed his girlfriend’s favorite game (bejeweled) so when she achieved a certain score it displayed a proposal of marriage.

2. I remember when that one kid in a class with a laptop was the geek. Who’s the outcast now?  

3. Cat 5 Wedding rings, need I say more.

 

 

 

ObjectSharp @ the Movies

On Feb 7th ObjectSharp hosted a free event at the Paramount Scotia Bank Theatre downtown. The morning after one of this winters largest snowfalls 160 people showed up for a morning of what's new in Visual Studio 2008. I did a piece on VSTS and TFS 2008. My slides are attached.

Even with the snow the event turnout was great, thanks to everyone who ventured out. I hope you enjoyed it as much as we did.

A few pictures were taken at the event you can view them here.

Laboratory Automation Robots

Living in Canada I don't get to the Desert very often. I have always been under the impression it doesn't rain there very often. So on my first trip to the desert what does it do? Rain, the whole weekend. I was in Palm Springs attending a conference, which was a bit different for me. I have been to many conferences in my time; however I normally attend developer conferences like Microsoft's PDC and Tech Ed, DevTeach and in the past Client Server World. This time it was Lab Automation 2008.

I was there to help one of our clients, Thermo Fisher Scientific. Thermo is showing off some new software that allows its users to define and execute an automated Laboratory. Thermo is a leader in this space, and this is the next generation of their Lab Automation Systems named Momentum. I have wanted to Blog about this project for some time now but couldn't say anything until the show made it public. Now that the show has taken place, and the world knows how cool Momentum is, I can talk about it. J

I have worked on some cool projects in my 25 years of software development; this is definitely in the top 5. Thermo has built a Software Factory that allows their clients to create laboratory automation systems that can be configured to execute experiments using any vendor's instrument. In the world of Lab Automation there are hundreds of instruments that perform various tasks, from changing a plate's orientation to filling it with a compound. For the Lab Automation conference we created a demo that helps illustrate what Momentum can do. I took a short video before I left for home. In the video below you see three robots that are executing a process which is moving a plate from one location to another. Then when an conference attendee drops their plate into the shoot a bar code reader detects the plate and instructs momentum to add another process to the run which returns the attendees plate along with a plate containing a prize. How cool are Robots!

[youtube]http://www.youtube.com/watch?v=rMpwqRjSSkE[/youtube]

 

 

Visual Studio 2008

In case you haven't heard ObjectSharp is hosting a free VS2008 What's hot and what's not event at the Paramount Theatre downttown on Feb 7th 2008.

It's going to be a lot of fun. Our graphics guy has been busy making movie posters for the event. They are wonderful not to mention very funny.

Check out Rob Windsors Blog he explains wonderfully.

Cleaning up your TFS Build Server

The Team Foundation Build Server at one of our clients was getting out of hand. We set up continuous integration so we are getting a lot of builds per day. The server had hundreds of builds that we just didn't need hanging around anymore. We asked our IT guy extraordinaire, Max if he could write us a script to automate the cleanup of TFS Builds. He rose to the challenge and now we have one.

He wrote the VB Script attached to this post. I tried it out on the server last Friday and it worked great. Here is the command to call it.

cscript TFSBuildCleanup.vbs http://<Server>:<port> <Project> <Build Location> <BuildType> <Days>

  • Server = Team Foundation Server
  • Port = TFS port
  • Build Location = Folder that contains the builds on the server (ie: c:\Builds)
  • BuildType = Name of the build Type to remove
  • Number of days of build to keep. If you put seven it will remove all the build 8 days and older.

I set it up as a task on the build server to run each night.

I hope it's useful to someone out there.

GoDiagram by NorthWoods

I have been using a tool that is new to me. I am very impressed and would like to share my experience.

The product I am talking about is GoDiagram from Northwoods. I of course am using the .net version there is also a Java and MFC version of the product.

The tool is used for creating diagrams and also includes a library of Instruments, if you buy the right license.

The object model is a little complicated at first but there is a good document that comes with the product that explains the architecture, I recommend reading it before you begin it really helps to set the stage.

The documentation is OK, but could be better. However Northwoods makes up for that via support. Their online forum is watched very closely and responses are very quick and helpful. I called and left a message the other day and someone called me back. We chatted for ages, he gave me his email and personal number. They are so eager to help its very refreshing. The other wonderful support tool they have is their samples. When you install you get a bunch of samples, with source code. They have been a great help in learning the tool.

It's amazing how powerful and flexible this product is. If you have a need to create any kind of diagram or free form drawing tool I highly recommend it.

Some of my favorite features include:

  • Overview: A control that duplicates your diagram in a smaller window with zooming and scale changes of the main diagram.
  • UndoManager: Automatic undo and redo capabilities.
  • AutoLayout: Costs extra but it's worth it. AutoLayout does just what its name implys. It will automatically organize your diagram for you.
  • Images: With the GoImage object you can easily add graphics to your diagram.
  • Flexability: You can create your own Node and Link classes and they can look and behave any way you want them to.

If you have a need for such a product, do yourself a favour and make sure this product is on your list to evaluate.

Autumn Background taken in Burlignton, Ontario

I recently found out that my favourite XP Background was a photograph taken in Burlingto ON, Canada, my home town. A friend of mine pointed out this article in the Toronto Star.

 Imagine that!?

DeploymentItem Attribute on a VSTS TestMethod

Did you know there are two ways to Deploy files to be used when executing unit tests in VSTS.

 

You can added them to the .Testrunconfig:

 

 

Or using the DeploymentItem attribute on the TestMethod:

 

 

[TestMethod,DeploymentItem(@"Bin\fr-CA\Thermo.Automation.Foundation.Tests.resources.dll","fr-CA")]

public void Multilanguage()

{

    Message msg = Message.Retrieve(Messages.Multilanguage);

    msgServ.Post(msg);

    Assert.IsTrue(msgServ.ValidateMessageReceived("English message"));

 

    Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-CA");

 

    Message msgFr = Message.Retrieve(Messages.Multilanguage);

    msgServ.Post(msgFr);

    Assert.IsTrue(msgServ.ValidateMessageReceived("French message"));

}    

 

Snagit and TFS

Two great tools come together to make our lives easier.

 I have been a fan of Snagit for many many years, and more recently Camtasia, both from Techsmith. Now snagit has a hook into Team Foundation Server, allowing you to create a Work Item from a Snapshot of a screen. Using the tried and true features of snagit to capture a portion of your screen you can now use the newly added Team System tool bar item to create a Workitem and automatically attach the screen shot to it.

TechSmith has a Camtasia demo here so you can see it in action.

Thanks Andre

VSTS unit testing and the .VSMDI

If you have done any serious unit testing with Visual Studio Team System and tried to include these tests in your Team Build you will have come across issues with the .VSMDI. It might drive you crazy until you completeley understand what is going on. Lets see if I can explain the situation with a series of truths.

  1. The .VSMDI file is Test Meta Data
  2. Each Solution can have only one .VSMDI
  3. The .VSMDI stores, amoung other things, test lists created using Test Manager
  4. Test lists are required to execute tests in a Team Build
  5. The .VSMDI must be checked into source control for this to work
  6. VS for Developers does not come with Test Manager
  7. A solution can have multiple .testrunconfig files
  8. The active .testrunconfig is stored in the .VSMDI
  9. When a developers switches to another .testrunconfig it will change the .VSMDI

All these truths together mean that everyone on a team including the Build server sharing one solution (which I see happen a lot) is a pain in the ass.  

So how do you each have your own .testrunconfig without messing up the build server. There are plenty of blogs and forum entries out there complaining of this in one way or another.

From what I can tell there are a couple of things you can do.

  1. Download and use the TFS PowerToys TestToolsTask so you can run tests in a build without test meta data files and test lists. The problem with this is it's more difficult to include only the tests you want executed on the build server. Not impossible but not as easy as using test lists.
  2. Create a solution for the Build Server to use. It can have it's own test run config and test lists .VSMDI ( You still need team suite or VS for testers to create them) of course all the developers should have their own Solutions also. This can have it's own headaches on a large project when many VS Projects make up the solution. As developers add projects to their solution they have to make sure everyone else knows as well as the build server solution.

I hope they address this in a coming release, I'd like it to be more transparent to the developer.

Do you buy Dell?

If you do, you might find this article useful 22 Confessions Of A Former Dell Sales Manager.

 

EnergizeIT

I am speaking today at EnergizeIT. I'm doing a talk on unit testing with VSTS at 3:30. I'll be talking to the kids about some of the things to watch out for when doing unit testing in VSTS, as well as some of the really nice features.

I attached my demo apps to this Blog entry if you are interested.

WMI (What Magnificent Information)

Yesterday I blogged about a class I came across in the SystemInformation namespace called PowerStatus. It was working great for me until I tested it on a machine with three UPS's plugged into it. The three UPS's were not for that machine of course :) they were in a rack with a bunch of controllers etc. We wanted to monitor all three UPS's and find out how much life was left in the weakest, so we can shut down the system and save all data before any of them go.

The problem with Power Status was it seemed to give me an average of all three batteries and on my laptop it got nothing. So I asked my network of developers and Andrew pointed me to WMI (Windows Management Instrumentation). Well there is a wealth of information in there. And it can all be called nativley from .Net. I thought I would post some sample code. Gives me a place to come look for it next time I need something similar.

 This code gets a collection of Batteries from the current machine and fills a listbox with their Names and remaining life.

ConnectionOptions options = new ConnectionOptions();

options.Impersonation = ImpersonationLevel.Impersonate;

options.Authentication = AuthenticationLevel.Default;

options.EnablePrivileges = true;

 

ManagementScope connectScope = new ManagementScope();

connectScope.Path = new ManagementPath(@"\\" + Environment.MachineName + @"\root\CIMV2");

connectScope.Options = options;

connectScope.Connect();

 

SelectQuery msQuery = new SelectQuery("Select * from WIN32_Battery");

ManagementObjectSearcher searchProcedure = new ManagementObjectSearcher(connectScope, msQuery);

 

this.listBox1.Items.Clear();

foreach (ManagementObject item in searchProcedure.Get())

{

    this.listBox1.Items.Add(item["DeviceID"].ToString() + " - " + item["EstimatedRunTime"].ToString());

}

Notice the query in the middle of this code that is looking in Win32_Battery click here to see what else you can query out there.

PowerStatus

The project I am working on right now is a software factory that will eventually allow it's users to build software that controls robots and other devices in a laboratory.

Today I wrote a service that monitors the power on the machine it's running. The idea is the service will raise an event if the machine loses power, and will then monitor the remaining life of the UPS. This will allow the system to save any data to disk before the UPS gives up the ghost.

To write this I used a class that is new to .NET 2.0 called PowerStatus. This is a very useful little class.

First of all you can check various useful properties relating to your machines power supply.

Also you can handle the PowerLineStatusChanged event which will fire when the Power State changes.  In this event you can tell if the Power is connected or not and if the computer is about to resume or suspend.

There is a great code example and sample application here

 

VSTS ClassCleanup Method

A colleague and friend of mine Andre who in my opinion is a guru of Test Driven Development discivered this issue.

If you're used to Nunit and how it fires methods in your test Fixture you may assume VSTS fires the equivalent methods in a similar way. Well think again. I am specifically talking about the method you decorate with the ClassCleanup attribute.

Lets assume you have some code in your ClassSetup and ClassCleanup methods you would expect it to setup and cleanup for all the tests in that class. According to the comments generated by MS when a test class is created automatically, you would assume these methods execute before the first test runs and after the last test in that class runs.

Here is the comment you see in the Additional Test Attributes Region of a auto generated Unit Test.

//Use ClassInitialize to run code before running the first test in the class
//Use ClassCleanup to run code after all tests in a class have run
 

The Comments seem clear enough, or do they?

The Nunit equivalents would fire in the order you would expect from the above comments:

Class1.ClassInitialize
 Class1.TestInitialize
  Class1.Test
 Class1.TestCleaup
Class1.ClassCleanup

Class2.ClassInitialize
 Class2.TestInitialize
  Class2.Test
 Class2.TestCleaup
Class2.ClassCleanup

In VSTS they fire in this order:

Class1.ClassInitialize
 Class1.TestInitialize
  Class1.Test
 Class1.TestCleaup
Class2.ClassInitialize
 Class2.TestInitialize
  Class2.Test
 Class2.TestCleaup
Class1.ClassCleanup
Class2.ClassCleanup

Do you see the difference? The cleanup from class1 is not done until after class2 tests have been executed. All the class cleanups are done at once.

What if I wanted to set something up and tear it down for each class? Do I have to keep track of what order people will be running the tests and make sure I perform the setup only once in the first class to execute a test. What if I only want to run the tests in Class 2.

To me this is a design error, intentional or not.

Documentation

Have you been looking for Ndoc or the cool document generator that was available for C# in VS 2003. They no longer seem to exist, I'm not sure what the whole story is behind the scenes, but I have come across a nice tool that works in their place.  

It's called SandCastle. I checked it out and it worked very well, creating some really nice MSDN stlye documentation complete with C#, VB.net and Managed C++ samples. I tried out Eric Woodruffs GUI which was easy to use especially if you've ever used Ndoc.

Give it a try I think you will be impressed with the outcome.

TFS Time Entry Utility

Many clients ask me if there is a tool that will help you keep track of time spent on different tasks in a TFS Project. The answer has always been, "Not that I have seen, but it wouldn't be hard to write one".  

Well I put my code where my mouth was and I wrote this little utility, of which I am happily sharing with anyone who would like it. It's a windows application that sits in your system tray when minimized and allows you to select a project, query and workitem, hit start and work away on that work item. When you hit stop it will add the amount of time you spent to the Completed work field and subtract that same amount of time from the Remaining work field of the same work item.

I want to change the UI but have not had a chance yet. I would also like to split the code up and get it out of the window. I would also like to get the old water heater out of my basement and to the dump but there is always something more important to do.

I have added a project to CodePlex so if anyone wants to work on it please let me know and I will add you as a developer.

Meanwhile your feedback is very welcome.

Some enhancement ideas I have:

  1. Set the Project and Query off the right click on the system tray (similar to the Server)
  2. Make the list of work items a long list so you can just click on the item to start timing. (Or perhaps a clock next to it)
  3. Make the fields it updates configurable in case you have customized the WorkItem.
  4. Configiure the Work Item types that should show in the list. For now the Query can do that.
  5. Make it an add in for VS
  6. Add it as a control to the Work item field it self.

Enjoy!

 

Junk Mail

I have posted before about Junk Mail and how I am inundated with it in so many forms, one of which is in the mail box at our house. Some days you get the mail out of the mailbox and find nothing but a bill and 7 flyers for windows, pizza and credit cards.

While chatting with a friend of mine about this he gave me this great idea. I have done it about 5 times now. I'm not sure what effect it will have on the companies who send out this crap but it makes me feel better.

More then once a week I receive a letter from some credit card company with an application form for their credit card. Included in the main envelope is postage paid envelope that I am supposed to use to send back my application form. Instead, I take all the junk mail I received that day and stuff it into this envelope seal it up and mail it back to them.

 I hope they are enjoying the Pizza coupons and window adds.

 

MS Project and Work Items

If you are a project manager or know a project manager who is using Microsoft Project with Team Foundation Server to manage Work items you may have noticed that Start and Finish Dates only update in one direction. It seems that by default PublishOnly is set to True in the Field Mapping for MS Project for these fields, therefore if you have a schedule in Project and you publish it to the Team Foundation Server the work items will have the start and finish dates from project. However if you load up a project from the work items in your Team project the dates will not be reflected.

You can change this by downloading a mapping file, changing it and uploading it again. Use the command line utility TFSFieldMapping.exe to accompish this. Read this article to understand how to download and upload mapping information. 

The command is as simple as:
TFSFieldMapping download TeamFoundationServer TeamProject MappingFile.xml
TFSFieldMapping upload TeamFoundationServer TeamProject MappingFile.xml

After you have downloaded the Project Field Mapping information you can change the PublishOnly attribute to False and upload the file again.

 

Calling a Custom External Assembly from a Report

One of the most powerful features of Reporting Services is the ability to call code from within a report. Before we get to that, you may or may not know you can call the .net Framework from within the expression of an objects property on a report. However, there is one rule you must follow, the code must be written in VB.Net.

  • For example: 
    =iif( me.Value < 0, “Red“, “Black“) placed in the color property of a textbox this expression will change the text colour based on the value returned.
    =Format(Fields!BirthDate.Value, "MMM dd,yyyy") placed in the value property this expression will format a date value, (ie Dec 10, 2006)=System.Web.HttpContext.GetGlobalResourceObject("AppResources", "ID14831").ToString() placed in the value property uses your existing resource file to translate a label

Although this is all great and very useful, if you need to do something a bit more complicated you can write your own code and call that from an expression in a report also. This can be done in two ways.

1. You can write code directly in the report using the report properties Code tab. The code tab contains a multi-line textbox where you can write code that can be called from the expressions of the report. From the menu select Report - Report Properties... on the Report properties dialog select the Code Tab. Here you can write code like in the example below. Once again it must be VB.Net.

To use this code in your report place the following into the Value proprty of the textbox where you want to display the Pay Frequency.  

=code.GetPayFrequencyString(Fields!PayFrequency.Value)

2. You may want to reuse the code you write, across many reports. if that is the case, first write your assembly in the .net language of your choice. Then make sure the assembly is in the correct folder so it can be found by the Report Server and the Report Designer. I have a Blog entry here to help you with that.

Now you need to create a reference to the Assembly from the report. There is a reference tab on the Report properties dialog. Make sure you put the namespace in front of the class name or it won't work.

Now you can call your Assembly from any expression by referencing the class and method in the expression. Like this:

=code.empReport.GetSickLeave(Fields!SickLeaveHours.Value)

 

 

 

SRS Filters

I have found a lot of students and clients are not getting the most out of filters in there reports. So I thought I would explain a bit about how useful they can be. There are two places you can put a filter in a report.

  • Data Region (Table, Matrix, List, Graph, Grouping Level)

Applying a filter to a DataRegion means I can show different views of the same data. In other words I can create one Dataset and let it feed multiple regions in my report. Say for example I need a report for management that shows the breakdown of Salaried employees vs hourly. They want to see two pie charts one will show the number of salaried employees by department the other Hourly. Instead of creating two queries one that selects salaried employees and one that selects hourly. I can just select all the data into one Dataset and filter the separate Graphs.

 

When you set the filter don't forget you are applying an expression so the value must begin with an equal sign. This is a common source of frustration the first time people use filters.

I can reuse this data in different ways throughout the report. In a matrix to show the number of employees by region, in a table sorted by Hire Date. All from one dataset.

  • DataSet

You can apply a filter to a Dataset, which at first seems odd. Doesn't the Dataset already have its parameters. Why would I filter the report again? When you create a Cached Instance or a Snapshot the report is stored with its data and the parameters cannot be changed. However filters can still be applied to the report. Filters will use the current report parameter values to filter the report instead of creating a new cached instance or snapshot. This can be useful to avoid creating multiple versions of the same report in the cache.

Go Ahead Run your Tests in the Build

Do you want to be able to run tests in Team Build without having to use a .vsmdi file.

Well now you can. Buck Hodges  has a post with a download which includes a task for running tests in your build by simply specifying the .dll's.

Buck also says this new task will be included in the next release of  Team Foundation Power Toys.

Perhaps someone is listening!

San Francisco

This week I am in San Francisco (Actually I'm south of SF) but I landed there and drove down Hwy 101 to Morgan Hill just south of San Jose.

I passed some things that make every geek stop to look. Like when I saw Microsoft Campus for the first.

Today I saw the Google Campus and ebay and I drove past Palo Alto and Silicon Valley. This is my first time to San Francisco so it was very exciting for me.

Tomorrow I will be helping some nice people get the most out of Reporting Services. I'm looking forward to it.

Team Foundation Server Users and Microsoft Project Resources

After some investigation this seems to be a pretty well known issue. However I had not come across this issue so I thought I would Blog it so I can easily find the solution again.

Although there are work arounds for this issue, you will be happy to know this will be fixed and is addressed in KB #919232

When the TFS Client is installed, Microsoft Project like Excell becomes connected to the Team Foundation Server via a new tool bar in Project. Using this a Manager can read or publish work items from the TFS Project. The problem, is when the users on TFS are defined in Active Directory the AD friendly name is Lloyd, David. In MS Project multiple resources can be assigned to a task using a separator. Which by default is a comma.

Here in lies the problem. When you take a project and try to publish tasks with multiple users to TFS you will get an error, telling you the user is not defined. When you read tasks from a TFS Project it will work but you will end up with multiple users. (Lloyd and David)

There may be more than one solution to this, however I found a simple solution on the MS Forums which is to simply change the separator Character in your Regional Settings so Project does not use a Comma as the separator.

If you're not sure where this is follow these directions:

From Control Panel open Regional and Language Options
On the Regional Options tab click the Customize Button
On the Numbers tab change the List Separator

There are other work arounds but they are not even worth mentioning.

Summer

I haven't blogged anything this summer. I plan on getting back into it soon. It's been a crazy summer, nice but crazy.

I just took a week off to go to a family reunion in N.B. The reunion was on my Dad's side of the family. Everyone from my Dad's parents down. It was great to see everyone and the location was beautiful. We met at the Bay of Fundy. I had never been there, if you get a chance go, it's wonderful. After the reunion my son Gareth and I spent the week driving back. It was a nice road trip. Starting at the bay of Fundy we drove to Moncton and spent the night at my cousins. Where we had a wonderful time. The next day we put my wife Tracy on a plane home and drove to PEI. Where we stayed at a Bed and Breakfast near Summerside. The bridge to PEI is huge. Had a great scallop and shrimp meal in New London and did some touring around. From PEI we drove to Portland Maine, where we stayed at another lovely B&B. From there we drove to Salem MA. That was the most fun, we did lots there, including a ghost walk and watched a reenactment of a witch trial from 1692. We went into a replica of the witches dungeon. It's a lovely city with nice pubs, good food and lots of stores full of spell books and potion ingredients. After Salem we drove to Wolfe Island in the 1000 Islands. We were going to stay over night there but decided to head home. So we got a Tim's and hit the 401. Nice trip glad to be done driving.

I'll get Blogging again soon.I just have to get these kids back to school first. :)

Fenway Park

Last night it was the attendees party. I have been to many of these, and this was one of the better ones.

We got the run of Fenway park, one of the oldest Ball parks in the games history (According to Bruce). It's quite amazing.

We sat at the top of the Green Giant. Walked around the field. Bruce wanted to throw a ball from the mound but the actual field was roped off. We kept daring him. I even offered hm 100 to do it, but he didn't want to be on the news today I guess.

They had a couple of bands play. I saw one of them Train. Very good band, they put on a good show.

Last Day of the conference. At this point you just want to go home. Barry was one of the Judges for the Iron Architect Competition on the last day. Bruce and I headed to the airport. I took the Subway which was a nice way to get to the airport cheaply. Not that a cab from downtown costs all that much but the boston subway is pretty cool so I thought I would take it.

 

Boston Culture and Interesting People

The Boston Culture was Durgin Park. We went tonight for dinner. You have to do it. It's a 180 year old Boston landmark. Like they say “Your great grandfather likely had dinner there.”

Interesting People: I went to a session today by Jesper Johansson called Is that application really safe? I went on John Lam's recommendation. I'm glad I did. It was an excellent presentation. Security can be interesting. That was the first interesting person I saw today.

Tonight we went to the influencer's party at Ned Divines Bruce and I were walking around seeing who was there. We asked to borrow a chair from a table where two ladies were sitting and got chatting with them. They were both British and their job was to organize and execute Tech Ed Europe. I have mentioned before in my blog how amazed I am how something this huge comes together, and here I was with the chance to chat with the people who do it. They were very interesting to talk to, they mostly wanted our opinion on various matters. Which of course we gave them, however not without asking a bunch of questions about organizing something like Tech ed or PDC.

Interesting day all around.

More on Visual Studio Team Edition for Database Professionals

Was looking at sessions for the afternoon. And came across one that I had missed before on this topic. The book didn't actually say it was about this but I recognized the name Mairread O'Donovan from the VSTS influencer's the night before. She was the one telling me about this new product.

I have been skipping VSTS sessions so far since I have been working with it for so long I thought they might be too light, but this is new and I wanted to see the product in action.

Some of the features I didn't find out about last night.

  • Reverse engineer your SQL Server Database
  • Version Control
  • Schema Build and Deploy
  • Unit Testing
  • Schema Compare
  • Data Compare
  • Data Generator (This is a nice tool for creating sample test Data, FOR DEVELOPERS NOT TESTERS we'll talk later)
  • Schema refactoring
  • TSQL editor
  • Query Execution
  • Plus the normal Team Foundation Server stuff (Work items and Process Integration)

It would be nice if they would also include in this tool the following. If the Team is reading this feel free to use this as high level requirements.

  • Integrate Profiler
  • Debugging from code straight into SQL easily with no extra work
  • Modeling (for Barry)

VS for DBA's

I attended a little party on Monday night for VSTS influencer's.

I met some very nice people, who are very excited about their work. I had a short discussion about the new Visual Studio for DBA's. This sounds like a nice tool. One of the features I liked from a testing/deployment/promotion model point of view is being able to compare Data between versions of the Database.

When you are testing an application you must have control variables. So often this is not the case. Other industries are laughing at us over this. I remember reading an article in American Scientific written by an engineer who was slamming the software industry because we do not have standard process and controls in place like the engineering community. Anyway One of the most important parts of testing is to have a Database that you know the state of when executing tests. If you don't know what data is in your Database how can you be sure the test results are accurate.

It sounds to me like there will be tools to help in the coming version or Visual Studio for DBA's

Tech Ed Transportation

I really can't go the week without saying something about the people in charge of getting us from our hotels to the conference centre and back again.

The Buses run often and everyone is bending over backwards to help you get from A to B.

Two examples.

  1. I left the conference today to go to a Staples and stop in at the hotel for something. I got on a bus that was going to a hotel that was near the Staples.  I was the only one on the bus. The driver asked me which hotel, to which I replied I'm actually going to the Staples so I'll get off at which ever hotel is closest. He dropped me off right in front of the Staples.
  2. I was talking to the guy who handles the bus outside our hotel. I asked him when the next bus would go. If it was more then 20 min I was going to walk. He tells me it's going to be 10 minutes. So I said I was going to walk around Quincy Market for a few minutes and I would come right back. On my way back I see him running across the street to find me in the market to tell me the bus was here and ready to take me back.

That is good service. To all those in charge of transportation at Tech-Ed 2006. Thank you!

Tech Ed Key Note

It's Monday morning now. Last night we found Bruce and went to the Key Note. It's was interesting at times, mostly when Mary Lynn Rajskub from 24 came on stage. Barry of course claims that was his idea. ;) We left part way through the Key Note. Hit a pub downtown and played a couple of games of pool accompanied by a few beers.

So far my impression of Tech-ed is not wonderful. I have attended PDC 3 times, but this is my first tech-ed. I'll be honest it's not developer centric enough. I have never cared about supporting servers, Share point, operations or anything even remotely related to these subjects. It's just not my thing. I am very happy there are people out there who do this. Had I known finding a session on development would be like finding an Irish man in the coffee shop next door to the pub. I might have given it a miss. It's only Monday and we are in Boston (my favorite US city) so it will be a good week. I'm sure there will be plenty of sessions where I will learn something.

At the moment I am sitting in a session on Reporting Services Report Builder. It's good. I have been meaning to play with this new part of the product in a while. Today I got a push in the right direction.

 

Tech Ed

I'm in Boston attending Tech Ed 2006. I flew down with fellow ObjectSharpees Barry Gervin and Rob Windsor. We flew at a ridiculous time. (6:30 am) The Taxi woke me up at 4:30 with a phone call and I was out the door in about 2 minutes.

Flight was OK but the cab driver from the airport to the conference centre. Was an ass. He didn't take Visa. No cab driver should be allowed to work the airport if they don't take Visa. I thought we were going to fight right there on the steps of the Conference centre. I paid him his precious cash while he ranted and raved like an idiot. “Welcome to America”

I'm going for a nap. Tonight at 7 PM is the Keynote. We should hook up with Bruce, John and Jen-Luc then.

The Never Ending Load Test

Ways to mess up your Team System Tests...

In Visual Studio Team System you can create a Manual Test, which is a great tool I know many people will ignore but that is for another Blog entry.  You can also create a Load Test and the developers were smart enough to filter out Manual Tests. This was clever because a manual test, while processing stops to ask you to perform the test and record the result. This would stop the load test and completly mess up any data you are trying to gather.

However you can still add a Manual Test to your Load Test by putting it in an Ordered Test first. So if your Load test seems to have stopped check to see if someone added a manual test to one of your ordered tests.

 

Developer Night in Canada

One of my Partners in Objectsharp John Lam was interviewed on Developer Night in Canada. It's a good interview.

If you have heard about Ruby and your curious about it you should listen to it.

Tech Support

If you are a mechanic people ask you about their car, if you are a lawyer they ask you legal advise, if you are a doctor they have a pain. I remember a day when being a programmer meant no one talked to you about your work. This is because they didn't understand it. If you said you were a programmer the standard reply was. “Good for you that sure is the up and coming business to be in.”

I remember complaining that I couldn't go to a party and talk about what I did, unless I met another programmer. No one wanted to hear it. Then along came the Personal Computer. Suddenly everyone knows what Ram is.  Now when someone finds out you are a developer they all want to talk to you about pop-ups, viruses, networks you name it. Perhaps the old days were not so bad. :)

The reality is, I don't mind helping out my friends and family at all. I'm happy to be able to talk to people about what I do. This way I can trade computer help with some skills I need help with.

As a matter of fact I recently helped my wifes boss out. He sent me this and this, I got a chuckle out of them. I thought I would pass them along to anyone else who has helped someone they know with their computer.

The Movie Business

This past weekend I spent 5 days on a movie set. This was not in Hollywood, but rather on a farm north of Harriston, ON. Its a production being created by York University students called “The Great Fear“. Why was I there you ask? Well, my son was one of the actors in the movie. Less then a year ago he told me he wanted to be an actor. Well this 11 year old made his dream come true in less then a year. I'm so proud of him, but that is another story.

Like most people I have watched the Oscars waiting like most people for the Best Actress and Best Actor categories to be presented. Scoffing at the set design, lighting, sound, costume, makeup, and camera people. Just to mention a few. Not to mention all the people who setup, tear down, move, get, send, lift, cook, run the list goes on and on.

I always knew it took a lot of people to make a movie and I think, I thought, I appreciated them. Until you actually see it in action you have no idea.

The people working on creating “The Great Fear” worked their butts off. They take their craft very seriously and it was great to see young people so passionate about something.  I cant wait to see the final product.

To everyone I met last weekend. You have enhanced Gareth and my lives in more ways then you will ever know. Thank you!

I took some pictures, if you like you can see them here.

The DataSource Attribute

You can use the DataSource attribute to call your TestMethod multiple times with different data each time.

Lets say for example I have an order details table like the one in Northwind.

  • OrderId
  • ProductId
  • UnitPrice
  • Quantity
  • Discount

In your application somewhere you have a method that calculates the cost of an item. Given the OrderId and ProductId it will return the Price for that line item. You want to write a test for this method, easy enough.

<TestMethod()> _
Public Sub TotalPriceTest()
Dim price As
Decimal
Dim MyDac As New
MyWindowsApplication.MyDac

    MyDac.Load()
    price = MyDac.getTotalPrice(10329, 38)

    Assert.AreEqual(price, CDec(4005.2))

End Sub

The problem is this test only tests one particular row. What about the case where there is no discount. I guess we have to write another unit test with a different orderId and productId. Hey we could create a file that contains a bunch of variations and then write a loop in the unit test to go through each one.

Or...

We could use a DataSource Attribute along with the TestContext Class.

When you add the DataSource Attribute to a TestMethod it will retrieve all the rows from the table identified for that connection and call your testmethod for each row. Inside your TestMethod you can use the TestContext Object to get information about the current test run. ie: the DataRow. Take a look at the example below.

<TestClass()> Public Class DataTests

  Private testContextInstance As TestContext

  '''<summary>
  '''Gets or sets the test context which provides
  '''information about and functionality for the current test run.
  '''</summary>
  Public Property TestContext() As TestContext
   Get
      Return testContextInstance
   End Get
   Set(ByVal value As TestContext)
     testContextInstance = Value
   End Set
  End Property

  <TestMethod()> _
  'DataSource Attribute to get the Data from Northwind -> OrderDetailTestData
  <DataSource(
"Data Source=localhost;Initial Catalog=Northwind;Provider=SQLOLEDB;Integrated Security=SSPI;", "OrderDetailTestData")> _
  Public Sub OrderDataTest()
    Dim price As Decimal
    Dim expectedPrice As Decimal
    Dim MyDac As New MyWindowsApplication.MyDac

      MyDac.Load()
      'Use the TestContext Object to get the current DataRow for the current test run
      price = MyDac.getTotalPrice(
CInt(Me.TestContext.DataRow("OrderId")), CInt(Me.TestContext.DataRow("ProductId")))
      expectedPrice =
CDec(Me.TestContext.DataRow("Price"))

      Assert.AreEqual(price, expectedPrice)

  End Sub

End Class

Now just populate the OrderDetailTestData table with all the different data you want to pass through your method.

Delegates Delegates

Here is something you may not have noticed before.

I'm sure you have utilized the following code to create an event handler in your code.

VB.NET  AddHandler MsgArrivedEvent, AddressOf My_MsgArrivedCallback
C#      MsgArrivedEvent += new MsgArrivedEventHandler(My_MsgArrivedEventCallback);

I have found it quite useful to create a method called AddHandlers and one called RemoveHandlers. This way I can easily turn on and off event handling. It's very nice when handling events like ColumnChanged in a Dataset. When I want to push data into the Dataset without the events firing I can just call RemoveHandlers. Then when I'm done call AddHandlers. It's analogous to enforceconstraints.

Here is an example in VB.

Public Sub AddHandlers()
   With Me
.OrderEntity.OrderData
      AddHandler .Order.ColumnChanged, AddressOf Me.onOrderColumnChanged
   End
With
End Sub

Public Sub RemoveHandlers()
  
With Me.OrderEntity.OrderData
      RemoveHandler .Order.ColumnChanged, AddressOf Me.onOrderColumnChanged
   End With
End Sub

If you use something like this be careful. Why you ask? You could turn Handlers on twice in a row inadvertently.

For example:
From the columnchanged event handler you call CalculateTotal which will RemoveHandlers, total the items, recalculate the tax, and then call AddHandlers.
Also from the columnchanged event handler you call CalculateTax which needs to RemoveHandlers, total the taxes for all items, and then call AddHandlers.
How clever of you to reuse the code in CalculateTax. pseudo code sample below.

CalculateTotal( amount )
  RemoveHandlers()
  'Total values
  if taxable
    CalculateTax(amount)
  AddHandlers()

CalculateTax( amount )
  RemoveHandlers()
  'Calculate tax
  AddHandlers()

The problem with this scenario is it will call RemoveHandlers twice then AddHandlers twice. The side effects are:

  1. Two handlers get added to the event, therefore the handler will be fired twice each time the event fires. 
  2. You may not have noticed to double event firring. If may call Removehandlers in another method and assume the handlers are turned off, but there is still one handler so RemoveHandler fixed problem one :) but your handler is not disabled like you thought.

There is one simple solution so you don't have to worry about it. Call RemoveHandlers at the beginning of AddHandlers.

Or be more careful.

VS 2005 Start Page

Did you know that the Start page in VS 2005 will display RSS Feeds? 

Try this in VS 2005:

  • Select Tools - Options on the menu.
  • Navigate to Environment - Startup.
  • In the Start Page News Channel textbox paste the following:  http://www.objectsharp.com/blogs/MainFeed.aspx

Now your start page will be all the ObjectSharp Consultants most recent Blogs. Lucky you!

Deleting a Project from Team Foundation Server Update...

Thanks to Blair Leduc for pointing out that my Blog entry on Deleting a Project from team Foundation Server is already out of date. The blog entry shows you how to use the command line utility DeleteTeamProject.exe to remove projects from TFS.

This command line utility was renamed to TFSDeleteProject in Beta 3.

Hopefully that is the last time I have to update this post. :)

A Lap around VSTS

On November 24th I will be presenting A lap around Visual Studio Team System at the Metro Toronto User Group meeting.

I did this for the CTTDNUG in September, and it was well received. This presentation is light on slides and heavy on Demo's.

I'll try to walk through as much of VSTS as I can without getting to deep into any one topic. If you have never seen VSTS or would like to know what it's all about come on out.

You can register here -> Metro Toronto User Group “A Lap around VSTS” 

Deleting a Project from Team Foundation Server

Have you wondered how to delete a project from Team Foundation Server? There is no way to do it from the Team explorer in Visual Studio. I think this is a good idea. There is however a command line utility called DeleteTeamProject.

DeleteTeamProject [/q] [/domain:] [/force]

    [/q]  - Quiet mode.  Do not prompt the user for confirmation.
    [/domain:] - The name of the domain.  Necessary in multi-domain environments.
    [/force]  - Indicates the program should continue even if some parts cannot be deleted.
    - The name of the project.  Use quotation marks if there are spaces in the name.

You of course require DELETE permission on the project.

Snippets

Well Snippets are so easy it doesn't make sense not to create them.

I am working on a VB.net 2005 windows application. This client has a very well defined framework. So implementing some feature of the framework is often a matter of finding an example of it in another part of the code then copy and paste. This application was started in VS 2003 and this is primarily what we did. In the beginning we had templates but no one ever wants to keep them up to date as the framework evolves.

Now we have migrated to VS 2005, it's time to take advantage of snippets. So I thought I should try making some, see if it's worth the effort. I was shocked at how easy it is. Let me give you an example: We have a common IU for all forms that display what we define as a document (Order, Product, Customer)

 If you have a piece of code to write that is common in your application. You find a sample of the code in another object. You copy it and paste it into your own object then change the names to suite your object. If you take a few minutes and create a code snippet from this the next time it will be that much faster. The time it takes to create the snippet, you will get back the next time you use it.

  • There will be no looking for it in another object.
  • There will be no removing of the extra stuff from the other example.
  • It will be easier to change the names in the new code.

So here is what I did.

First of all to organize your snippets just create a directory structure to store them in. For example in this application there are 4 distinct object types. Representing different layers. This is a windows application therefore we have Windows Forms, Business Objects, Business Entities and Data Access. Therefore I divided the snippets into this directory structure.

YourName
    Windows Form
    Business Object
    Business Entity
    Data Access

Now that we have the directory structure all you have to do is open Visual Studio 2005 and select the menu item Tools |Code Snippet Manager... This dialog is a bit confusing at first there is an add and an import button. Import is for importing a single snippet into an existing Folder. Add allows you to add a directory of snippets all at once. So We'll use the add button to add your folder to snippets. The folder names show up in VS when you select the Snippets so choose them carefully. Even if you don't have snippets for each object type yet add the folder anyway. They won't show up until you put snippets in them.

Creating a Snippet

Now lets create a snippet to add to our folders. Snippets are just an XML file. If you like writing XML as much as I do then you will want to find a snippet editor :) . I downloaded a couple but only installed one. I had every intension of trying out a few of them but this one was so easy to use that I had created about 10 snippets before I realized I was still using the first snippet editor. The one I am using is called snippy it's one of the Power toys for Visual Studio 8.

 

How to use Snippy

First you enter some basic information like the name of the snippet a description of it and your name. The shortcut can be used by the developer to jump straight to this snippet instead of going through the snippet selector.

Then you select the type of snippet. Expansion, Surrounds With, or Refactoring. I have only tried Expansion so far. So that is what we will continue on with. :)

 

Enter any name spaces you need to include for the code being added.

 

Now for the code. You have to select the language (C#, VB, J# or XML ) and kind of code you are entering. Then paste the code in. Anything that you want the user to replace at run time just enter a keyword with dollar signs around it. In my example above the object we are creating will have a name (ie: Customer, Order, Product) so I used the keyword object with dollar signs around it where ever I want to replace the ObjectName in the code. When the snippet is inserted into the code the user will be able to tab through the code changing any of the items you have identified as $object$.

 

Now for the Literals and Objects this is where you create those place holders mentioned in the code section. Click the add button and you can add a literal for anything you put in the code that the user should replace. The ID must be the same as the name you surrounded with dollar signs.

How simple is that?

Productivity tip of the day

If you have ever read my blog you know I love IDE tips that make me more productive. I learned a cool new productivity tip for Visual Studio 2005 today. This is just another great benefit to paired programming. Thanks for the tip Eugene.

Tip of the day:  If you have a file open in VS 2005 you can quickly close it by simply clicking on it with the wheel of your mouse. That's right a wheel click. Just put your mouse over the tab of the file you want to close and click the wheel on your mouse.

You will also notice some new menu items on the context menu if you right click on the file tab. Check these out.

  • Close All But This - Close all open files but this one.
  • Copy Full Path - Copies the location path of this file to the clipboard.
  • Open Containing Folder - Opens file explorer to the folder containing this file.

.Net DataWindow 2.0

Doug Porter was good enough to let me know about a .Net Datawindow 2.0 Web Cast

This is interesting to me for a couple of reasons. As you know I am a fan of the DataWindow. I however have some issues with it in the .net world, because the SQL and UI layers are so tightly coupled.  I have been in touch with Sybase over the past year and they have been very responsive to the input of outsiders. One thing I have been asking for is DataSet support. Being able to use a DataSet or DataTable as the Datasource for a .Net Datawindow. Well it's coming, and version 2.0 has it. Dave Fish gave me a demonstration at PDC 05. With this feature you will be able to create a Data Access Layer and still utilize the power of the Datawindow. Once I get my hands on the Beta I will try it out report back here.

This Web Cast will cover the following new features:

  • Using .NET Datasets and Datatables as DataWindow datasources
  • Visual Studio 2005 Support
  • Dot Notation (Indexer) access to DataWindow Data
  • Hierarchical (Treeview) Style DataWindow
  • Enhanced Drop Down DataWindows for Web Apps

PDC Day 4 the last day

The last day is always quiet. Many have left. Went to a session this morning. Then went to the hands on lab, they were great this year, Blair and I did a Sparkle lab. That was very very cool. Too bad I couldn't capture a video of it. My windows application had a glowing ellipse circling the application and when you changed products the right detail panel flew in like a flip card along with it's reflection. The people working in the labs were developers of the products. I hit a bug in the lab and called someone over they smiled and said I know what's happened that's my bug. :) It was great to get a chance to try it out with the developer right there and be able to talk to them about it. Windows development is going to be very cool in the future.

My first Windows Presentation Foundation Application

So how was my third PDC? I found the organization and logistics excellent. The busses were always there when you walked out. The Attendee party was great and well organized. We had more time at the park then last year. The meals were mostly good. I enjoyed the exhibition hall, lots of vendors. I got to chat with some guys from Sybase that I have talked to on the phone and via email about the .Net Datawindow. The Hands on labs were fantastic.

The content and sessions however were not as good as past years. Some of them I really enjoyed but on a whole I was not as impressed. Mind you there was a lot more new at the last two I attended. The exciting stuff we saw in 2003 had new names but it was still the same stuff. ( WPF - Avalon, WCF - Indigo) A lot of session titles were misleading I thought. I would go to and it would be something different then I was expecting. Maybe I need to read the outline more carefully, but I was not the only one saying this.

What was cool? LINQ is cool. WWF is cool even though it has an unfortunate acronym. VSTS is cool and Whidbey is cool, but they are not new, I have been playing with and demoing them for almost 2 years now. Anders session on C# was great. He told the audience "Please give feedback on these 3.0 features because they are not carved in stone, we haven't even released whidbey yet". That kind of summed it up for me. Maybe next spring would have been a better time for this PDC.

It was so quiet at the conference centre that I headed to the airport and got an earlier flight so I wouldn't have to take the red eye. I'm to old for red eyes. Found Rob Windsor there is noon flight was apparently at 3:10. :)

Now I'm waiting for my DVD of everything so I can watch some of the sessions I didn't make it to.

PDC Day 2 - Part II

I attended a great session on C#. Talking about Lambda Expressions, Extension Methods, Object Initializers, Anonymous Types, and Query Expressions. Here are a couple things explained, the others would be way more work then I can handle. We went to Universal Studios last night you know. It was a long and busy day. Which is why I am posting this today.

var

You can use var so you don't have to keep telling the compiler what type the object is.

Instead of...                     You can do...
int i = 5;                        var i = 5;
float j = 1.0;                    var j = 1.0;
string name = “Dave”;             var name = “Dave”;
Customer cust = new Customer();   var cust = new Customer();

Object Initializers

You can initialize the properties of a class when you instantiate it.

Customer cust = new Customer { Fname = “Dave“, Lname = “Lloyd“} ;

The compiler turns it into this.

Customer cust = new Customer();
cust.Fname = “Dave“;
cust.Lname = “Lloyd“;

You can nest this to initialize the properties of a class inside another class. So if Customer instantiated two PhoneNumber classes you could do this.

Customer cust = new Customer { 
    OfficePhone = { Area = “905“, Number = “555-1234” }, 
    MobilePhone = { Area = “905“, Number = “555-4321” }};

You can initialize a collection also this way.

 List primes = new List { 2, 3, 5, 7, 11 };

Extension Methods

An extension method is cool, potentially dangerous, but cool. Think of it kind of like an Extender provider for properties. You can create a static method whose first argument must be this. When the compiler sees one of these it brings it into scope for your class. Intellisense will even add it to the list of methods for your class. 

Take these Extension methods Where and Select if I just add a using to my code for this Namespace these methods will be extended onto my class.

namespace System.Query

    public static class Sequence 
   
        public static IEnumerable<T> Where<T>(this IEnumerable<T> source, Func<T, bool> predicate) { … } 
        public static IEnumerable<S> Select<T, S>(this IEnumerable<T> source,Func<T, S> selector) { … } 
        … 
    }
}

using System.Query;

var contacts = customers.Where(c => c.State == "WA").Select(c => c.Name);

That is enough for now. I'm going to see up and coming features of VB now.

PDC Day 3 - Part I keynote

Went to the keynote this morning. It was all about servers. Some cool demo's but nothing too exciting. I guess if you get all excited about servers it must have been good.

There was an excellent video before the session started though. Microsoft people talking about a new (GPF) error message box. The error message has two buttons instead of share information and don't share information the buttons on this new dialog read Share Pain and Don't Share Pain. When you click Share pain it shows you video of the developer that wrote the code that caused the crash you just experienced. Then you have three options. Stick them with a pin, electrocute them, flip the back of their seat down and up again to hit them in the back and force their face into their desk. Then when you push the button of choice so you can share your pain with the developer that caused it. :) They even went to the trouble of showing the technology behind the developers chair.

It was very funny.

PDC Day 2 - Part I

This morning at the keynote we were shown some new products that Microsoft is coming out with and a new designer for Visual Studio.

The products are touted by Microsoft as their Expression Family of Products they include:

  1. Acrylic Graphics Designer
    This is an editor for manipulating and creating graphics both Vector based and bitmap graphics. The demo was impressive. We'll see.
  2. Quarts Web Designer
    This is a design tool for Web page designers, incorporating CSS, XSLT, Master Pages, ASP.Net.
  3. Sparkle Interactive Designer
    This tool will allow a graphic designer the ability to create a Windows Form (generates XAML) . The demo was a designer and a developer working together on a windows form. One designing a cool interface and the other writing the code.

Visual Studio Tools for Applications
This is the new VBA. Cool demo of extending Auto Cad to include purchase and pricing information for a component right from a Cad drawing.

Windows Workflow Foundation
This is very cool. It's a work flow designer for Visual Studio. You can create your own workflow activities and reuse them from the toolbox. Check out Barry's Blog for more information and linkns to other resources.

 

Are you Canadian?

 

If you are at PDC and you are Canadian there are two informal get togethers going on.

Excuse: Breakfast
Date: Thursday Sept. 15th
Time: 7:45 am - 8:30 am
Location: Under the Canadian Flag in the dinning area

Excuse: Beer
Date: Thursday Sept. 15th
Time: 6:30 pm - 7:30 pm
Location: Millennium Biltmore Bar

Pass it on!

C# Query Syntax

Barry Gervin has a post with some LINQ links that is very useful.

Just to show you how easy it is. Here is the Query Don Box wrote during the key note today. I haven't seen it yet but I am told it's even easier to read in the VB syntax.

This is only the query itself so assume that p is a collection of processes and d is a class associated with a table and columns in the Database.

var query =
   from p in Process.GetProcesses()
   where p.WorkingSet > 4194304
   orderby p.WorkingSet
descending
   Select new 
   
{
      p.ProcessName,
      p.WorkingSet,
      Description = ( from d in db.ProcessDescriptions
                      where d.processName == p.Processname
                      Select d.Description
                    
).FirstOrDefault()
   };

PDC Day 1 - Part II

This afternoon I attended three session and they were all good. I already mentioned the VSTS session in my last post. After that I went to a session on SQL Server 2005: Building Distributed, Asynchronous Database Applications with the Service Broker.  The demos went a little fast to follow. I have heard and read about Service Broker before so I knew what was going on, if I hadn't I would have left thinking, “What is Service Broker anyway”. I think it's going to be an unbelievably useful tool for developers. I hope everyone goes to see it and understand how they can use it in their architecture. Service Broker Rocks.

After that I attended Windows Forms: Harnessing the Power and Flexibility of Windows Forms 2.0. This is a popular subject. The room was overflowing. It wasn't a huge room mind you. But it was the second time it ran today, the first time they added satellite rooms, the presenter told us 2 or 3 extra rooms. Plus they have added another session later in the week. We got to see some real stuff that will be available soon including ToolStrips, DataGridView, BackGroundWorker, and TableLayoutPanel. The presenter Erick Ellis did an excellent job. TableLayoutPanel is a very cool tool. If you create localized applications you need to look at this.

Dropped in to PDC underground over at the Weston Bonaventure. The RD's were all doing short presentations on various subjects. Very entertaining as usual, although Billy Hollis had trouble with his machine and could not do his presentation. :(

Someone named Holly won an i-mate JASJAR tonight for getting spotted in her hat. She was no more then 2 feet from me in my hat. <|:) Maybe tomorrow.

PDC 2005 Day 1 - Part 1

So the first keynote was very long. It was good though. They told us we could buy an i-mate JASJAR at mobile planet for $149. But when the session got out they were sold out. Apparently they had 1000 for nearly 10,000 people. I went to mobile Planet the day before to buy a bluetooth head set which was $45 which I thought was a good deal, the guy at the store said to wait until after the key note, apparently there was a deal. At the key note Jim Allchin said we could buy one for $9.95 but they are sold out also. :(

Now I am wearing a hat around in the hopes that I get spotted and win one.

The coolest thing I saw in the Key note was LINQ. This is a feature of the .net framework that lets you write queries against any collection. In Anders Hejlsberg words, “If you can for each it you can query it” He and Don Box proceeded to query a collection of processes running on that machine. Then they added a text box to a web page and allowed the user to query for processes using a where clause. That is cool in it self but wait there is more, then they accessed a Database table which contained a process name and description. They Joined the collection of processes to the table in the Database and also displayed the description in the result set. :) Very Very Cool. All of this was done in C#.

We were also given a preview of Office 12. The new interface is really nice. I think my grandmother could have used Excel if it looked like this.  

Apparently I can go and pick up “The Goods“ anytime also. This will contain 6 DVD's full of Beta's and CTP's.

I sat in on a VSTS session a lot of it was nothing new. But these was a demo at the end that was good. Doug Neumann created a C# application that made calls using the TFS object model. Using a utility he turned it into a TFS Web service to notify a developer when they break the build. The extensibility of this product is amazing.

I have to get out there now so someone sees me in my hat. <|:) 

Bill Gates Key Note

It's day 1 of PDC. Well not counting the precon. I Caught the first bus from my hotel to the conference. Mostly because I'm still on Toronto time.

I got my name tag changed this morning. I of course filled out the form wrong and was walking around as Dave Lloyd Lloyd.

I'm looking forward to this morning it's the first Key note. I have yet to be dissapointed by Bill Gates telling us where MS is going. It's always full of the best demo's and is usually very entertaining.

If you want to watch it too you can, it's being broadcast live, check out Bill Gates KeyNote.

I wonder how Rob Windsor slept after stealing winning that phone last.

It's nice to be Rob Windsor

Rob Windsor steps off the plane checks into his hotel and heads down to The 64-Bit Question, a .NET Rocks! Quiz Show. They ask a multiple choice (with three choices) question about Garbage Collection and the contestant on stage gets it wrong so they ask someone from the audience and he gets it wrong. So they ask Rob.

So of course Rob wins an i-mate Jam. I got a t-shirt but then again so did 8000 other geeks at this conference.

All I can say is it's nice to be Rob. I'm not jealous, I'm very happy for Rob who was sitting right next to me, really I am. :)

The power was out in LA

After registering for PDC. I hopped on the bus back to the hotel the driver pointed out that one of the traffic lights was out. Then another and another. All of LA was out. When I got to the hotel the manager was in the lobby explaining that the power was out.

Without a computer and the internet what can you do? So I went for a walk, left my tooth brush at home so I had to get one. I passed by a wrap place and they were serving as long as you had cash. The lady in there told me it might be terrorists. She has worked in down town LA for many years the power has never gone out. :)

After I ate I noticed the lights on in the hotel lobby so I went up to my room and turned on the TV. Pretty much every channel had the LA Power Outage running across the banner at the bottom with Ariel shots of suburban LA.

Turns out someone at hydro cut the wrong cable. Accidents happen.

By the way if anyone from LA is reading this. When the traffic lights are out treat the intersection like a four way stop.

Tonight I'm heading back the the convention centre for the The 64-Bit Question, a .NET Rocks! Quiz Show

It's PDC time again

So here I am in a massive hall at the Los Angeles Convention Centre posting my first PDC Blog. The flight was long and cramped. But I am here all checked in and have my PDC05 bag full of goodies. The conference starts for me tomorrow. But I have avoided the rush of registration in the morning which will be crazy tomorrow morning.

There should be some good stuff at this PDC. Lets face it there always is. This is my third and I'm still waiting to see some of the stuff shown at the first one I went to 4 years ago. :)

At the moment I'm standing in Internet Alley. Behind me is the marketplace (a Microsoft store). In front thousands of people eating lunch. I'm going to wonder over to the exhibitors hall to see what is going on.

I'm going to be tired on Friday.

Static Code Analysis made easier in VS 2005

The built in Static Code analysis in Visual Studio 2005 is pretty cool, and quit intuitive to use.

There are a couple of nice features worth mentioning that are accessible right from the Error List.

If you come across warnings in your error list put there by the Static Code Analyzer. There are a couple of quick ways to deal with them.

Create a Work Item:
This is a nice way to remind yourself to deal with the issue later. You could even assign the Work Item to someone else so they can deal with it later. :)

I wish you could add a Todo: to the code from here. Sometimes I don't want a Work Item I just want a reminder in my code to fix it up. Maybe next version.

Suppress Message:
If this is not an issue for this particular project or class you can suppress the warning by selecting Suppress Message.

For example if you create an Enum and its members have values 1 - 4 you will get the warning CA1008 Enums should have zero value. For this instance you are knowingly breaking the rule, although you would like to continue to be warned when this happens. When you select Suppress Message from the context menu it will add an attribute to the enum telling the Static Code Analyzer to ignore the rule. If it's a project level rule a new file is created in the project called ModuleSuppressions.cs and attributes will be added to it.

VB vs C#

This blog entry is not a battle or comparison of the two languages. I love both of them the same.

What I did want to pass along is this great page I found. Actually I think someone may have told me about it but I can't remember who, if someone did point me to this I would like to publicly thank you.

If you, like me switch between these languages often you find your self sometimes trying to use the wrong keyword or needing to look up the equivalent. “I know it's internal in C# but what is it in VB again?” I could ask my friend :) but they forget too.

This page is a very useful resource for just such an occasion. VB.net and C# Comparison. If you use both languages often you will want to make this a favorite.

Document Outline for Windows forms

Many of you may be familiar with the Document Outline feature in word. Did you know Visual Studio also has a Document Outline. It's there in VS 2003 for Web Forms, in 2005 MS has made it useful to windows developers also.

To open the Document Outline window goto View | Other Windows | Document Outline or Ctrl-Alt-T.

Some things you can do with the Document Outline Window.

  • See a list of all your controls
    • This is not just a list though, it's a nested view of your form via treeview. Showing what container each control is in. This is a useful way to view a complex form. Any windows developer will tell you sometimes a form gets complicated and it's difficult to get a good picture of what is going on with splitters, panels, tabs etc.

  • Select controls to change their properties
    • We have all done it; clicked on a control on a form and inadvertantly moved it. With the Document Outline you can select a control so that you can use the property explorer without actually touching the form. You can also do this in the property browser itself using the list box at the top but it's easier to select the control from the Document Outline Window, because you can see all of them at once. If anyone from MS is reading this I would like to be able to multi select controls from this window.
  • Move controls from one container to another
    • One very cool feature is being able to move control from one container to another using the Document Outline. for example; you can drag a control from one side of your Split Container to the other or from a panel to the form, right in the Document Outline window. This can be very useful on a complicated form with many controls.

I'm not sure how much I will use this window once developing on a regular basis with it. But I can think of a few projects it would have come in handy.

Snap Lines

I know snap lines are not a big deal especially when you look at all the other new features of Visual Studio 2005. But for a windows developer they are a welcome productivity tool.

I'm not blogging to tell you 2005 will have snap lines. I'm blogging to show you this cool feature of snap lines.

Lets take a label and a textbox for example, this is likely where they will come in the most useful. Being able to visually line these two controls up is a real time saver.

Did you know you can also line up the text in the label with the text in the textbox.

Now that is nice.

Removing unwanted space in a report

There is a little trick in Reporting services that is not easy to find.

I created a report for a client that included an external class which parsed a stream of XML and returned various data from the XML for display in the report. The nature of the data was that not everything is required for each row. For example, each XML document would contain a question and answer given by the end user. Some questions would contain a tip to help the user and others did not.

To make the report generic, I used a table with multiple details bands for each question. Each textbox in the table would go after a different piece on data in the XML. The output of the report looks something like this:

Q: Should golf be 18 holes?
A: No.

Q: How many holes should a round of golf be?
A: 12.
Tip: The answer is 12.

Q: Why 12?
A: It just makes sense.

As you can see, some rows contain a tip and some do not. When the report calls the parser it gets back a “NoData” message indicating that there is no tip for this question. The problem you will find is there will be a space where the empty tip textbox is. (see example)

----------------------------------------------------------------------------------------

Q: Should golf be 18 holes?
A: No.
   [extra space not required]

Q: How many holes should a round of golf be?
A: 12.
Tip: The answer is 12.

Q: Why 12?
A: It just makes sense.
   [extra space not required]

----------------------------------------------------------------------------------------

You might have tried the following.
Put an expression on the textbox's hidden property so that if the NoData message is returned the textbox is made invisible like this:

=iif(Me.Value = "NoData", true, false)

You will find the extra space is still there.

You may have tried to set the text box property CanShrink to True, but the space will still be there.

Here is the trick. Make the height of the textbox zero. Reporting Services will change that to some default like .03 but this is the only way to remove the space. Make sure you set Can Shrink and Can Grow to True.

Duplicated Parameters in SRS Dataset

It's time I logged this hear so I can remember what the problem is when I get it. :)

When using a Stored Procedure in a Dataset in Reporting Services, Have you ever seen double the parameters on the refresh dialog in the Data Tab? They are actually listed twice in the dialog like this.

OrderId
OrderItemId
ProductID
OrderId
OrderItemId
ProductID

This is caused by duplicate versions of the Stored Procedure. For example

dlloyd.apGetOrder
dbo.apGetOrder

If you remove one of the Stored Procedures the parameters will return to normal.

GEOCaching

Now this is fun for the whole family.

I bought a GPS mostly because it came with Streets and Trips for $140 at Costco. Seemed like a good deal. We used it on a drive to Pittsburg to a friends 40th.

Then Barry tells be about GeoCaching. So I check out GeoCaching.com . We went yesterday.

It was so much fun. If you have a GPS and you havn't tried this I urge you to give it a go.

 

ObjectSharp Sponsors BitNet

ObjectSharp recently became a proud sponsor of BitNet.

BitNet is an association of individuals, businesses and organizations with a common interest in the practical and innovative use and development of technology, to the benefit and prosperity of the Golden Horseshoe community.

We look forward to a rewarding relationship with BitNet and it's members.

Reporting Services Special Directories

Where to put a report so that it shows up in the New Item Dialog as a template:

  •   C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer\ProjectItems\ReportProject

Where to put a custom class so it can be found by Report Server

  • C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin

Where to put a custom class so that it can be found by the designer

  • C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer

Google Intellisense

I'm looking for a practical application for this.

Barry pointed out to me that Google has a beta site with Intellisense. Now I appreciate google and it's research as much as the next guy. And I love that they create these things. But I am curious what practicle applications people can think of for this.

So please tell me how Intellisense is useful on a Web Search engine. I'll start things off.

Perhaps I don't know what I'm looking for. Maybe I want to know what pubs are in Boston, will I be able to enter “Boston pubs” and it will fill in the rest like they were memebers in a class.

Other ideas welcome.

Parameter Collection MultiValue not implemented yet

The Parameter collection in Reporting Sevrices has a boolean property called MultiValue. I wanted to use this so we could tell the front end that the user should be able to return multiple values for this parameter. There is no where to set this value in the Report designer. So I added it to the RDL manually. But it always comes back false.

After searching the MS Reporting Service News Group  I found out this is not implemented yet. It is defined in the parameter class but not used. Even the help references it. MultiValue - Indicates whether the parameter can be a multi-value parameter. Boolean

Here is the response from MS in the news group:

The MultiValue element is part of the RDL specification published in 2003/10. It was not implemented in V1 of Reporting Services. It will be available in the next version. The MultiValue boolean flag determines if a report parameter is a multi value parameter.

Reporting Services - Report Parameter - Available Values

I would like to interrupt my discussion of how to create an inbox at this time to point out a potentially annoying feature/defect in the ValidValues collection in Reporting Services.

When you add parameters to the report you can add a list of Valid Values. I think it's called Available Values in the UI. This would typically be a list of codes and display values used in a drop down list. The entries can be queried or hard coded right in the report.

Since we are building a front end to RS and passing the parameters to JSP for rendering on a web page we have to try a few different things, to make sure we can generically render the controls for gathering parameters on the web site.

So I created a test report which retrieved the customers from Northwind. The customer code is a string. So to keep it simple I made that a parameter and I put three of the customer codes into the Valid Values section of the report Parameter. Both the Label and Value were the same. I know this seems a bit odd, but I have seen real applications where this is the case. In some industries the code is known by the end user. For example they don't care that YYZ is the code for Toronto airport. They know YYZ is and that is what they want to see in a selection list. (calm down it's just an example)

Anyway back to the problem. If you create a parameter of the type string and fill in the Valid Value list with the same data in the label and the value, you will notice that when you call GetReportparameters to populate the parameter collection the valid value labels will be null. Perhaps someone thought if the value and label are the same they don't need the label. Although this might be true why make us write special code to know that and ignore the label. Just pass through the label as is even if it is the same as the value.

I hope it's just a bug and not a design decision. By the way I installed Service Pack 1 and it's still the same.

Creating an inbox

I have spent a fair bit of time on Reporting Services news groups lately. I have seen several people asking how to generate reports and go back and render them later. I'll do this via multiple blog entries mostly because I'm too tired to write the whole solution out now. :)

This is not a trivial problem, to figure out. Yet it's quit easy to do. So lets first define the requirements. I want to select a report and generate it, then be able to go off and do something else. Then come back to an inbox of reports later and render the report I generated earlier. The solution utilizes several areas of reporting services.

First you can use the ListChildren( ) method to get a list of reports available to be rendered. Tip: ListChildren returns all items so you should loop through and check which one's are reports so you don't end up displaying a list of DataSources and Folders.

MyLocalReportService.ReportingService rep = new MyLocalReportService.ReportingService();
   rep.Credentials = System.Net.CredentialCache.DefaultCredentials;
   MyLocalReportService.CatalogItem[] cat;

   cat = rep.ListChildren("/",true);

   foreach (MyLocalReportService.CatalogItem item in cat)
   {
    if (item.Type == MyLocalReportService.ItemTypeEnum.Report)
    {
     this.ReportslistBox.Items.Add(item.Name);
    }
   }

Next time I'll show you how to create a linked report that can be used to generate snapshot history items.

The Da Vinci Code

A friend of mine told me I should read The Da Vinci Code by Dan Brown. I would like to publicly thank him for that. Terry, thanks.

I couldn't put it down. Dan Brown is a great story teller. This Book is intelligent, suspenseful and fun. Full of codes to solve and rich thought provoking European history. I loved it. Do yourself a favour read it. You will not be disappointed.

Splitting Logs

Over the Thanksgiving weekend I rented a log splitter. Now I love everything electronic, I am a fairly typical developer. But I also love a good power tool and this was a beauty.

I had two trees in my yard that had been taken down for one reason of another and left for me to one day split into fire wood. The people who took them down were good enough to cut them into 16 inch (40 cm) pieces. Which was great but some of them were over 2 ft (61 cm) in diameter. I actually spent $15 at Canadian Tire and bought a wedge that you hammer into the log to split it. I tried that for about an hour one day. looked up at all the wood to be done and gave up.

This is when I decided to rent a Log Splitter. This thing was great. Although this is not a picture of the one I used. It gives you an idea of what one looks like.

It's hard to describe how much fun this was. Not to mention how much easier it makes splitting two trees worth of wood. Just put a log of apparently any size into it and pull the leaver. It splits the log like slicing cold cuts. :)

P & P Summit Day 3 (Enterprise Library)

In an earlier blog entry I mentioned Enterprise Library. At day three of the Summit we spent the morning talking about Enterprise Library.

The Enterprise Library has an amazing resemblance to the PFC (PowerBuilder Foundation Class). Not that it's similar code or anything, but here we have a vendor with a development platform, and that vendor has written the starting of a framework we as developers can use to make it easier for us to get started building applications. If you use the application blocks this is going to be a good thing. Seven of the eleven available Application Blocks have been wrapped up and cleaned up and documented, and will be released around January 2005 to the general public.

What comes with the Application Library?

  • Data Access Application Block
  • Exception Handling Application Block
  • Configuration Application Block
  • Caching Application Block
  • Logging & Instrumentation Application Block
  • Security Application Block
  • Cryptography Application Block

The Enterprise library should make it easier to install and use the application blocks. They come with documentation including templates and samples. The Blocks are designed to work together, but they can still be used individually. The configuration tool that comes with Enterprise Library makes it look pretty easy to start using any part of Enterprise library.

Some promises from Microsoft.

  1. We will continue to enhance Enterprise Library, providing new Application Blocks to assist with additional scenarios
  2. We are planning a Microsoft® .NET 2.0 “Whidbey” compliant release around the time that .NET 2.0 and Microsoft® Visual Studio® 2005 are released

P & P Summit Day 2

Today was not as good as yesterday. Don't get me wrong the speakers where great. I mean really great. But the topics were not new to me. DataAccess Layers, Middle Tier, Smart Client, Configuration. All topics I have a great deal of familiarity with.So my opinion of the day is slanted by the fact that I wasn't really learning anything new.

Actually I'm lying I did learn a few things. Mostly from the key note speaker. Johnathan Zuck was a developer and is now a lobbyist. I found him very interesting. He told stories of Lawyers in Europe wearing wigs arguing over interoperability of servers in a cluster. :) We had a very interesting discussion during his presentation. I enjoyed it thouroughly.

Fernando Guerrero did a presentation on DataAccess Layers. good speaker and very nice man. He actually said he prefers to call ExecuteNonQuery with output parameters then to fill a Dataset or to execute a SqlCommand. He claims this is how you get the best performance. That maybe true but what a pain.

Rocky Lhotka did a presentation on Middle Tier. He mentioned SOA once in his presentation. I think he said. "SOA is going somewhere, either up or down" :)

After Rocky told us all about making sure you have all your business code and validation in a business layer. Billy Hollis said who are you writing this application for yourself or the user. He sees no problem is putting simple validation in the UI. He even Demoed his Windows Forms ValidationControls. Similar to the ASP.NET .Net version.

There was a reception last night hosted by Logic Library, at a place called the Drainsville Tavern. They had busses going there but I thought I would drive so I was not on anyone Else's schedule. Also I am staying at a hotel about 2 miles away as are others. So I offered to drive anyone there who wanted to get their rental cars back to the hotel before going out. No one took me up on my offer which was a good thing. I got lost trying to find the place. By the time I got their I had missed dinner and found only about 6 people left. It was a really hard to find. No lights no signs. People working in gas stations less than 1/2 km away had never heard of it. Others just told me completely wrong directions. :(

P & P Summit Day 1

Today was long but good. They kept getting behind so we had lunches and breaks in the room while someone spoke. The speakers were good thank god.

The key note was Tommy Morris who talked about an army field medical application that was pretty cool. They use IPAQ's and specially made sandisk SD cards with reinforced cases so they can't be bent and special connections so salt water does not affect them. When someone is hurt in the field a medic comes along with his IPAQ, gets the SD Card that is around the soldiers neck like a dog tag and puts it in the IPAQ. Immediately the application opens with that soldier and all their medical information. The Medic can add information about what happened to him or her and it's saved on the IPAQ and written to the card to it goes with the Soldier. Also apparently they used to carry 20 lbs of field manuals with them. Now all that information is on the IPAQ, and accessible via context sensitive help. There was lots more to this presentation but that was the cool part for me. :)

I particularly liked Jim Newkirk's presentation on Test Driven Development. Nothing new here but a good presentation all the same.

Ron Jacobs spoke for the next two sessions. I could listen to him speak all day. He filled in all the SOA holes for me. I've heard the presentations before but he has done the best job of making it clear to date. EDRA is the new name for ShadowFax. Enterprise Development Reference Architecture contains a framework, four quick starts, an application template, documentation and a sample application The Global Bank. If you are about to build a distributed application in .Net this is likely worth looking at.

Chris Kinsman did a presentation on security. Not one of my favorite subjects, not unlike most developers. But he did a good job and made it less frightening. There were some good practical ideas that have come out of MS that help you design a secure application. Too much to blog here tonight.

Tomorrow is another day.

Patterns & Practices Summit

This week I am in Reston Virginia at the Patterns & Practices Summit. I'm hoping this is a good week and I learn lots. So far I learned the hotel bar has Bass on tap. :)

I'll keep you posted of the goings on here at the summit.

Patterns & Practices Application Blocks

If you use the Application Blocks from the Patterns and Practices group. You might be interested to know that next year they will be releasing their Enterprise Library.

For those that don't know what they are: Application blocks are reusable software components designed to assist developers with common development challenges.

To date they have been available for download separately. The Enterprise Library will combine the most commonly used application blocks and try to make them more consistent, extensible,  and easier to use. You can read all about it on the Patterns & Practices site or gotdotnet.

Connecting a .NET Datawindow to SQLServer

You may have noticed during the install of .NET DataWindow that there are no native drivers for SQL server. Sybase expects you to use OleDB to make the connection.

In case anyone is having trouble here is how to do it.

First you create the OleDBConnection object and pass that to an AdoTransaction Object. The AdoTransaction Object wraps up an ADO.Net users connection and Transaction objects so they can be used by the Datawindow.

Your code would look like this:

'Create a new OleDB Connection Object, Populate the ConnectionString Property and open the connection
Dim theConnection As New System.Data.OleDb.OleDbConnection
theConnection.ConnectionString = "Server=localhost;Provider=SQLOLEDB;Initial Catalog=Northwind;User ID=sa;Password=sa;"
theConnection.Open()

'Create a new AdoTransaction Object the constructor takes the connection object you created
Dim ADOTrans = New Sybase.DataWindow.AdoTransaction(theConnection)
'Binds the ADO.NET connection to the database interaction layer so that the AdoTransaction object can be used by a DataWindow
ADOTrans.BindConnection()

'Tell the DataWindow what Transaction Object to use
Me.DataWindowControl.SetTransaction(ADOTrans)

 

The Smart Client Architects Breakfast

If you are a Manager or Architect thinking of starting a Smart Client project using .NET. You should come to this Architects Breakfast. The ObjectSharp Architects Breakfast happens every two months. The topics are current and relevant to what our clients are doing today.

To Find out more about what the Architects Breakfast series is all about.

To register for the Smart Client Architects Breakfast.

Hope to see you there. :)

email notification from NANT

Setting up a NANT build script to send an email when the script completes is something I have done for several clients. When I search the web I find people are talking about it but there are not a lot of complete examples. So here is my version of how to do it. I hope it saves someone out there some time.

First these were the requirements I set out to achieve.

  • Generate a log file
  • The log file must have the date and time of the build in it's name
  • Send email notification of success or failure.
  • Attach the log file to the email

There were several NANT tasks and properties I used to accomplish this.

  • record  (You will need NAntContrib to use the record task)
    • A task that records the builds output to a file
  • mail
    • Sends an SMTP message
  • nant.onsuccess property
    • The name of a target to be executed when the build succeeds.
  • nant.onfailure property
    • The name of a target to be executed when the build fails.
  • tstamp
    • Sets properties with the current date and time.

The link below contains an example, with comments explaining what each section is doing. Keep in mind the rest of the script has been removed for clarity, therefore all you see is the entries that do what I explained above. See attachment for sample NANT Script.

As an aside you don't have to use the record task from NAntContrib you can just pipe the output from NANT to a file using the logfile command line argument. [nant.exe -l:c:\logfiles\Build.log] This output is perfectly acceptable, the problem is you can't attach it to an email and send it because it's still open and being written to. But it actually contains more information than the log file in my example. You see once you close the log files you stop writing to them. Therefore on a script failure the reason for the error does not get written to the log. I'm still looking for a way to get a complete log file that I can attach to an email and send from within a script. If you know how to do it please let me know.

The Best of both worlds

So how is this for getting the best of both worlds.

Below you see a VB.net application using .Net Datawindows. This application took less than an hour to write. I'd like to see you write this app with PowerBuilder or VB.NET in the same time. Since all you see here on my BLOG is a screen shot, let me tell you about some of the features available in this little application.

  • There are four DataWindows. A Freeform, a Graph, labels and a Group By. They are all sharing the same disconnected record set. using a DataWindowControl method called share( ). This means if you change data in the top DW it is immediately reflected in the other Datawindows. Imagine how long creating these different views would take.
  • Thanks to VB.Net I was able to use panels, splitterbars and docking which allowed me to place these on the form and be able to shrink and grow the region they take up on the form. This was never easy in PowerBuilder.
  • Total lines of code: 5

I think the two tools together make great development partners. (I know the app is ugly that is not the point.)

Then if I change some data in the main DW and move the splitter bar over. You see the graph and Nancy's address label is different.

>

What is a DataWindow?

Since I started Blogging about the .NET DataWindow. I have had some developers ask the following questions:

  • What is so great about a DataWindow?
  • Why do you care if you can use one in your .NET application?
  • Why not just use a DataGrid?

I thought I would try and answer some of these questions for those that have never used Powerbuilder.

First you must realize there are two different objects that both get called a DataWindow. A PowerBuilder developer knows which you are talking about by the context it's used in. They are

  • DataWindow Object - Class which contains the Presentation and SQL to retrieve Data and display it to the user.
  • DataWindow Control - A Control you place on your window that takes a DataWindow Object as one of it's parameters. This object presents the DataWindow Object to the user on your form.
    • Inheritable
    • Sample Methods
      • Retrieve
      • Update
    • Sample Events
      • RowFocusChanged
      • ItemChanged

In the DataWindow editor you define a DataSource, the problem is that DataSource is part of the Datawindow Object. Sybase has to change the .NET Datawindow to take an external DataSource, like a DataSet or Business Object that implements IListSource. I may write something that hooks a DataSet to a DataWindow if I get time. Perhaps Sybase will fly me down to meet with the.NET DataWindow Architects and give them some suggestions. Hint Hint

Back to how it works. Once you have your Data Source defined you move to the presentation side of the DataWindow. Here is the good thing about having the data and presentation together in one object. There is no binding issues. You get a column for each column in the result set. So you paint your Datawindow and please realize this is not just a grid. This can be a graph, labels, grid, tabular or you can make it look just like a for with buttons, group boxes, textboxes and labels.

Once you have a completed DataWindow. You drop a DataWindow Control on your form set the DataObject Property to the name of your DataWindow Object. Then just tell the DataWindow Control what Transaction you are using and call the retrieve method.

So that is a really simple example of how it works. In my next Blog entry I'll tell you why I think they are so good. 

My .NET Datawindow works

I got some help from two very nice gentleman at Sybase who read my Blog and offered to help me get my sample application with the .NET DataWindow working. As it turned out I abandoned the project I made and created a new one and it worked. I have no answer as to why at this point.

So I made a C# windows application and a VB.NET windows application. Each with a Datawindow that gathers data from the employee table of the Northwind Database. The DataWindow I created contains a computed field, and expressions to colour certain rows and columns based on the data retrieved.

I also added a sybase transaction object and three lines of code that I have written in powerscript many many many times.

  1. this.transaction.Connect();
  2. this.dataWindowControl1.SetTransaction(this.transaction);
  3. this.dataWindowControl1.Retrieve();

So check it out. Below you see a Datawindow. With the following expressions. If the country is UK make the whole row grey. If the employee was born before 1960 show their name in red. Autosize the height of the address column. :)

DataWindow .Net

Tonight I installed DataWindow.Net, which is shipping with PowerBuilder 10. It's a set of libraries that let you use PowerBuilder DataWindows in your .Net applications.

I downloaded an evaluation version of DataWindow.Net and the Datawindow Designer. I had to see what it was like. So I installed it, the install said it couldn't find a copy of Visual Studio 2003. So I had to add the Datawindow objects to the VS toolbox myself.

It added a DatawindowControl and DataStore and a Transaction Object.

So I opened the datawindow Designer and created a datawindow. Didn't have much trouble with that, it looked pretty much like PowerBuilder. Then I created a windows application in .Net and dropped a DataWindowControl on the form set the LibraryList property and DataObject property and there was my Datawindow in my .NET form.

I added a button and coded a setTransaction and Retrieve. (DataWindowControl methods to tell the datawindow what Database to connect to and execute the Select command of the Datawindow.)

My application built without error. And the bin directory contained a PBD (PowerBuilders version of a DLL) containing my Datawindow Object, along with some other Sybase DLL's. Unfortunately when I run my little application I get a TypeLoadException “Could not load type Sybase.DataWindow.DatawindowControl“. But I'm tired anyway so I'll try again tomorrow.

I'm going to try and do some more investigation. Mostly just for my own curiosity. There are a lot of things I don't miss about the Datawindow but there are a lot of things I miss a lot.

If anyone else out there is evaluating this new Sybase effort to save the DataWindow I'd be very interested in your findings also.

 

 

Is IntelliSense showing you everything?

Well I learned something new today. I can't believe I have been developing in Visual Studio .Net for so long without knowing this one. I'm sure someone showed me at one time or another. If they did I forgot.

A colleague of mine mentioned I should use a particular property on a particular class. When I went to use it, it did not show up in IntelliSense. I mentioned this to my very clever friend, who pointed out the following option to me. Apparently the property I was trying to access via IntelliSense was flagged by the developer as an advanced member.

If you have members in a class that you want to be treated as advanced, use the following attribute;

EditorBrowsable(EditorBrowsableState.Advanced)

 

Productivity tips for the Immediate window

Here is a nice little Immediate window trick I just came across. It's not going to change your life but it might make using the immediate window a little easier.

Have you ever wanted to change the last thing you looked at slightly, perhaps you were looking at the number of rows in the order Table.

?OrderData.Orders.count

and now you want to see the number of rows in the OrderDetail Table. Just highlight the command you just entered, and start changing it, a new command is created automatically.

This this nice when you are checking all the items in a collection by just editing the index.

  • ?OrderData.OrderDetails(0).itemarray
  • ?OrderData.OrderDetails(1).itemarray

I know, your thinking you can just hit the up arrow and the last command is yours for the changing. This is just another little trick for duplicating and altering the last command at the same time.

The Imagine Cup Kids

At VSLive ObjectSharp hosted a Limo Bus for speakers and special guests. Our special guests included the Canadian Imagine Cup winners, who just recently went to Brazil for the big competition.

Sadly they did not win, but what a ride they had. If you want to read about their travels here are their Blogs. these are also under links on by Blog page.

Dear Imagine Cup Kids,

What a wonderful accomplishment to get as far as you did. We at Objectsharp are very proud of you all. You're a great group and worked very hard to get where you did.  You will all go far in this industry, of that I'm sure.

Sounds like you are having a blast in Brazil. Now it's time to relax and have fun. You have earned it.

Spam Spam Spam Spam Spam Spam...

I am sick and tired of Spam and I know I'm not alone on this. I don't just mean the email kind of spam. Spam comes in many forms. It's far from new, all that's happened is the spammer has new tools.

These are the Spams I hate (in order):

  1. email Spam
  2. Phone calls at dinner
  3. The crap you get inside every statement you receive
  4. Junk mail
  5. The stuff that falls out of magazines

Although 1 and 2 don't kill tress, I find them the most intrusive. I hate the others but not because of the intrusion, I just toss them aside without even looking at them. Which means valuable resources have been wasted. If anyone reading this sends me junk mail. STOP IT. You are wasting your time, money and our planets resources. I will never buy anything from you because of this, so just stop.

At least with the phone calls there is someone to take it out on. You can yell at the poor telemarketer and feel a bit better. Also there are two ways to get ride of the dinner time callers. Call privacy is one, unfortunately this costs money. You can also combat this yourself, by asking to be taken off their list. By law if you ask the telemarketer to remove you from their list they must comply. And it always stops their spiel when I say it.

So what about the worst kind of Spam. The tons of email we get in our email box each day. You can't even reply to these bastards to yell at them. The current thinking in the industry is, creating filters is just not worth it. There is just no way to weed it all out. The best defense would be to make it not worth while doing. If it's not cost effective the spammers will stop. One way to do this is to charge postage on email. If we each had to pay a penny to send an email. It wouldn't cost much and if it meant that the spammer sending millions would stop because it cost to much, I think it would be worth it.

Cynthia Dwork of Microsoft has another idea. Charge for sending email but not with money with Processing power.

What Dwork proposes is to slow down the process by having the sending computer solve a mathematical puzzle created from the details of the message itself. Messages sent at different times and to different recipients would generate a different puzzle. This way a message sent to many different people would have to solve a different puzzle for each one. Thereby slowing down the machine sending emails. She also tosses in a way to combat the fact that processing power doubles every 18 months, by tossing in a variable that ensures each message takes 10 seconds to send. And will increase this value as machines get faster. So for you and I to send a few messages, our machine works away on a problem as it sends each message, so what. For a spammer they would require more hardware and processing power to send out the same volume of emails they send now. Therefore it might not be worth the effort anymore.

I'm behind you on this one Cynthia. If there is anything I can do to help get this through you can count on my support.


 

Getting the DataRow that is bound to an Infragistics UltraGridRow

Here is one of those posts I make because I keep forgetting how to do it. Now that I have posted it I won't forget. Perhaps someone else will be searching for this little code snipit and I will have helped them out. :)

If you have an Infragistics Grid bound to a Dataset, and you want to get the DataRow that the UltraGridRow references. Here is what you do.

Cast the UltraGridRow's ListObject property to a DataRowView and get the DataRow from that.

I'll do the code sample in VB this time.

Dim GridRow As UltraGridRow  'Let's assume you have the GridRow perhaps passed in an event argument
Dim OrderRow As
Myapp.Orders.OrderData.OrderRow

OrderRow = CTypeCType
GridRow.ListObject, DataRowView  ).row , Myapp.Orders.OrderData.OrderRow  )

This will return Null if it's an UltraGridGroupByRow.

Oh Canada, our home and....

You tell 'em Danny!

Google is king

If you open a browser on any of the 6 computers (including an IPAQ)  in my house, you will see www.Google.ca. It's safe to say Google is the official search engine of the Lloyd household. One of them actually defaults to French.

The other day my 10 year old son asked me if I knew that Google could help you shop on the internet.

I said “Yeah it's called Froogle.” "That's it", he said "Can you show me?" So I did.

While we were there I showed him a bunch of other cool features. He was amazed. So I thought maybe I should Blog some of my favorite Google Features.

If you know of others I don't mentioned please tell me. I love a good Google feature.

  1. Spelling: I'm sure people know about this feature. Those of us who can't spell sure do. If you type in something Google doesn't recognize Google will suggest a spelling correction to you. I get a lot of use out of this feature.
  2. Calculator: Did you know you can type a calculation into Google and it will give you an answer. Try typing this into Google: 5 * 5 and hit search. 
  3. More Google Calculator: The coolest thing the calculator does is conversions. If you want to know how many kilometers are in a mile just type into Google km in a mile and hit search, try ounces in a cup or cubits in a meter. Is that cool or what?      More about the Google Calculator.
  4. Define: Google is a dictionary. You can type define: someword and Google will return all the definitions it can find for that word. For fun type in define: Google
  5. Google Sets: I love this, but have not thought of a really useful application for it. Go to Google Sets  and type in a different related word in each textbox then click one of the set buttons below. Google goes out and finds other related items. Try this, enter Ross, Phoebe, Monica and see what you get. Now try DataSet and DataTable. This is really part of Google labs, see below.

There are others I would like to take advantage of but only seem to work in the US like Local search, phone book, maps.  Here is a complete list of Google search features .

Google Labs:

If you go to labs.Google.com you will find other google ideas that are not quite ready for main stream yet. They are ideas in progress.

  1. Personalized Web Search - Get personalized search results based on your interests
  2. Web Alerts - Find out about new web pages on a topic of interest  ( I subscribe to this. Any time ObjectSharp is mentioned on the web I get an email)
  3. Web Quotes - View search results with quotes about them from other sites
  4. Voice Search -Search on Google by voice with a simple telephone call
  5. Google Compute - Donate your computer's idle time to help scientific research
  6. Froogle Wireless - Search for products from your cell phone using Froogle
  7. Google Groups - Create and join searchable discussion groups and mailing lists

Did you notice not an add anywhere. :)

Happy Goggling

Open With... the editor of your choice.

I'm on an VS IDE high lately. So to continue in this arena. Here is another tip my students and audiences seem to like.

I'm sure there is someone out there who has an XML file with a non standard extension, and they want to be able to use the XML editor in Visual Studio. But when you open the file there is no colour coding or any of the other XML editor features. This is because you are not in the XML editor. This is a nice little trick, I hope someone finds it useful.

I found this the first time I set up a Visual Studio project to hold all my NANT Scripts. NANT creates XML files with a .build extension. When you edit these XML files in Visual Studio they are not colour coded by default, because Visual Studio does not know it's an XML file.

Here is how to rectify the situation. When you open the file in Visual Studio (File->Open->File...). You will notice a drop down arrow on the open button.


Click the drop down arrow and select Open With... You should get this dialog.


Select the type of editor you want to open the file with. While you are here click on the Set as Default button. From now on whenever you open a file with that extension it will be opened in the editor you selected. In my example files with a .build selection always open in the XML editor now.

 

FTP Software

For years I have been trying to find FTP software that was good. I mean easy to use, reliable with a nice GUI. I have used all kinds over the years. I won't mention all the bad ones I used, so as not to offend anyone. None of them were very nice to use.

I asked Dan what he used for FTP. He told me the kids today use FileZilla. You have to listen to the kids, they know.

So I went to SourceForge and downloaded FileZilla. this is the best FTP software I have ever used.

It's intuitive and friendly, and so far completely reliable.

I love it, and I don't care who knows it.

Incremental Search

Barry found this and showed me some time ago. I had forgot about it and stumbled across it today. I keep forgetting it's there. I'm hoping by Blogging it I will remember.

When you are editing code in Visual Studio hit CTRL-I. You will see this little icon appear,  this is Incremental Search.

Once in this mode you can just start typing and it will find text that matches what you are typing as you type.

If you have typed the whole word but search has not found the one you want, hit F3 to jump to the next occurrence.

 

How does dynamic help work?

Did you ever wonder how dynamic help works? The Visual Studio IDE continuously emits keywords and attributes depending on what you are doing in the IDE. Lets start by turning on debugging in Visual Studio. I don't mean the kind of debugging you do to your code. It's easier if I just show you. Follow these steps. Don't worry it's harmless.

  1. Close Visual Studio .NET if it is not already closed.
  2. Open the Windows Registry Editor (RegEdit).
  3. Go to the following key:
    HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.0\Dynamic Help
  4. Add a new string value of "Display Debug Output in Retail" with a value of "YES."
  5. Start Visual Studio .NET.
  6. Open the Dynamic Help

Now open a solution and start working, watch the dynamic help window you will see the keywords displayed in the Dynamic help window as you manipulate your code in Visual Studio.

For example if I were to click on a windows form in VB.NET I would see the following in my Dynamic help window.

--- Keywords - priority: 500 ---
(F1 Kwd) Keyword=Designer_System.Windows.Forms.Design.FormDocumentDesigner
(Kwd) Keyword=System.Windows.Forms.Form
--- Keywords - priority: 100 ---
(Kwd) KEYWORD=VS.Ambient
--- Attributes ---
Devlang=VB
Item=Project
Item=vb
Product=VB
Product=VS
Project=Exe
ProjType=LocalProj
Selection=None
ShellMode=Design
Solution=Any
Solution=Multiple
SourceControl=FALSE
SubType=Form
UniqueFiles=resx
UniqueFiles=vb

What you are seeing are the keywords and attributes emitted by Visual Studio. This is how Dynamic help works. You can add your own custom help that displays different help links based on keywords emitted from the IDE.

Ok, so now that I know how to get the keywords, how do I add my own custom help? This is a Blog not an article so I'll give you the abridged version, you can look up the rest yourself.

Create a file called CustomHelp.xml and place it in C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\HTML\XMLLinks\1033

Here is what a sample CustomHelp.xml file could look like. Some nodes to take note of:

  • LinkGroup defines a heading in the help to group the links
  • Keywords/Kitem define which keywords trigger this help to display
  • Links/Litem the URL for the help file, the link group it belongs under, and the text to display

The above CustomHelp.xml file will generate dynamic help that looks like this. Well the last group called ObjectSharp Coding Standards

The keyword I used in the sample above (Ambient) is a special keyword. It is always present. Therefore if you want a help file to always be accessible use the keyword ambient in your CustomHelp.xml.

As I'm sure you can tell I have only scratched the surface on this subject. There is plenty more information in the MSDN library.

Tech Ed Bloggers

There are a bunch of ObjectSharp people and Friends of ObjectSharp at Tech Ed this week. Their Blogs are making good reading. I feel like I'm there. If you wish you had gone to Tech Ed or wonder what you are missing. Check out the Blogs below.

ObjectSharp People

Friends of ObjectSharp

Everyone else

The Immediate Window

I notice a lot of developers do not use the Immediate window. If you are one of those users,  do yourself a favour and check it out. It's terribly useful. For those of you who are not familiar with it here are some highlights to get you started.

The window I'm talking about in VS 2003 is the Command Window. This window can be used to either issue commands or to debug and evaluate expressions in Visual Studio .net. To open this window, press CTRL+ALT+A, or click on the menu View->OtherWindows->Command Window

For the record I believe I heard these two windows will be seperated in Whidbey.

Below is a quick description of the two modes.

Mode

Title Bar Displays Description
Command Mode Command Window Allows the developer to perform any command available in Visual Studio via a command line interface.
Immediate Mode Command Window - Immediate Used when debugging an application for evaluating expressions, print variable values, or execute statements. It can also be used to change the value of a variable during debug or even to execute a function or statement.

How to switch between the two modes?

  • When you are in command mode you can enter the command >immed to switch to immediate mode.
  • When you are in Immediate mode you can switch to command mode by typing >cmd
  • If you wanted to execute one command in immediate mode prefix it with a > ie: >alias

Immediate Window:

This is the mode I use most. It's like a command line quickwatch, but it has intellisense. To evaluate an expression you must prefix it with a ?

  • ?this.Order.OrderTable(0).itemarray
  • ?this.Order.OrderTable(0).CustomerId
  • ?this.Order.OrderTable.count

In previous versions of the Immediate window the UP and DOWN ARROW keys move the cursor to previous commands. In VS .Net they allow you to scroll through previously issued commands. If you scroll to a command highlight it and hit enter it will be copied as the next command to be executed.
Once in a project, the Command window can be opened in Immediate mode by pressing CTRL+ALT+I, or click on the menu Debug->Windows->Immediate.

One more quick tip. You can copy your command from the immediate window into the watch window. So in other words get it right with the help of intellisence then paste it into the watch window so you can see it permanently.

The Command Window:

Just to give fair time to both modes. The Command Window makes full use of intellisense to help you find and execute a command within VS.

You can also create your own alias for any command for example: You can type the following to save all the files in your solution.

 

However, if you used this command a lot you could create a shorter alias of this command like fs.
To create an alias enter the following into the command window.

>

From now on you can just type fs to perform a file.Saveall

To see a complete list of aliased commands just type alias in the Command Window and it will list all the aliased commands.

 

Golf should be 12 holes.

I'm looking for investors!

This idea will change golf forever. I think I can at least double this industry's revenue with one small inexpensive change.

I want to open a golf course where a round of golf is 12 holes. Don't go, hear me out.

I golf occasionally. I would golf more but it takes too damn long. I don't have 4-5 hours in a day to spend golfing. Not to mention the time spent at the 19th hole.

Inevitably every time I golf I get to about the 14th hole and I spend the rest of the game wishing it was over.

12 holes just makes sense. Here are some reasons why.

  1. You could play 6 holes in the morning before work without having to go to an executive course.
  2. However over lunch you could easily play a 6 hole executive course.
  3. All the courses out there now don't have to change anything but the numbers at each hole. Every 18 hole golf course just has 3 6's.
  4. They can get more people golfing starting 3 at a time like they do on 27 hole courses now.
  5. If a round is just over 2 hours instead of 4. More people can golf in a day.
  6. It will be easier to get a tee off time.
  7. More people would golf because they wouldn't be saying “I wish this was over” on the 14th hole.
  8. More people would golf because it would be less expensive.
  9. Yet the courses would make more due to the increase in volume and staggered tee offs.
  10. For the avid golfer who wants to spend more time on the course. They can still do 18 by golfing 12 and then the  front 6 again.
  11. Some people even say they want to golf two full rounds or 36 holes. No problem, for 36 holes you would get in 3 rounds that day.

Now there are people who don't like change. These people will say golf has always been 18 holes and that it's a tradition. This is not true. Please read the article below. ( I could have just typed this in but it's much more effective this way, don't you think)

OK, so who wants to be in on the ground floor of this.

Maybe you don't want in? But if you have more reasons why golf should be 12 holes please share them with me.

So you think you know Pointers?

This might be a bit of fun for the old C programmers out there like me.

A long time ago I used to teach C programming. This was before C++ and Windows. When we used to have to write whole applications that fit into 250K of Ram because the rest of the 640K was used up by various hardware drivers, and DOS, and you had to use tools like Quarterdeck QEMM to move drivers into memory locations above 640K. These were the days when hardware was expensive and developers had to really worry about memory usage and pointers and stacks..... Oh sorry I got a little carried away there, that is not what this Blog is about.

Where was I? Oh yeah I used to teach C, at the end of every test I used to have bonus questions for my students. I found one the other day and thought I would put it on my Blog for fun. This particular bonus question was meant to test their understanding of the pointer operators ( * & ), amoung other things.

Now to use pointers in C#, I had to make the code unsafe.  With todays compilers and editors, it would be easy to see what this little method does. So see if you can figure it out just by looking at the code right here in my Blog.

Can you tell me what i will equal, and therefore what will be written to the console.

unsafe static void Foo()
{
      int i, k=5;     /* Declare some Integers */
      int *j;           /* Declare a pointer */

      j = &k;        /* Assign a Value */
      i = 10/*j;     /* Do the Math */;

      Console.WriteLine( i.ToString() );
}

If you are thinking this is too easy, and the answer is 2. Try again.

Regular Expressions

Regular expressions are a very powerful tool for validating or parsing a string. I don't claim to be an expert in the use of Regular expressions by any means. But I have used them with great success on a number of occasions. They are very useful. I have used them to validate a special URL that is used to create hyperlinks to forms within a smart client application, or to parse the syntax of a Powerbuilder DataWindow to name just two.

In ASP.NET there is a Regular Expression validator control. This control lets you validate input based on Regular Expressions. The nice thing about this control is the hard work is done for you for a variety of different strings. For example there is a sample expression for internet email addresses. \w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* and one for an Internet URL http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?

If you want to use Regex in .NET (C# or VB.NET) getting the expression right is the tough part, as you can see from the expressions above. The rest is pretty easy. To help you out there is a tool written by Eric Gunnerson called Regular Expression Workbench that I have found very useful on many occasions. You can down load it from gotdotnet. This wonderful tool will help you format your expression, interpret or execute your expression on a sample string, even tell you how efficient the operation is.

For those of you who don't really know how to use Regular Expressions here is a simple example to get you started. Using this example you can test a string for swear words.

First: to use Regular Expressions you must use the System.Text.RegularExpressions namespace.

Then create a regular expression and call the match method to search your string.

 using System.Text.RegularExpressions;
 Regex r;                                                     //Declare Regular expression
 r = new Regex("hell");                                //Create expression
 Match m = r.Match(this.textBox1.Text);    //Call match method

 if (m.Success)                                           //Check to see if a match was made
   {
      MessageBox.Show("You can't say that.");
   }
 else
   {
      MessageBox.Show("nothing found.");
   }

The above example works to find the word hell but it will also find it inside the word hello. You can add the escape character /b to denote word boundaries. For example if your expression is /bhell/b it will only match on the word hell. /b has two uses in a regular expression it's a word boundary. When used within a [ ] character class it refers to the backspace character.

Fine so you can now validate a string to keep users from entering a swear word. "But Dave there are many words I need to check for.", you say. Not to worry this can be done in the same expression using a pipe. If you separate each word you want to find with a pipe Match( ) will look for all the words listed. See the example below.

using System.Text.RegularExpressions;
Regex r;                                                    //Declare Regular expression
   
 r = new Regex("
\\bhell\\b|\\bfrig\\b");        //Create expression
 Match m = r.Match(this.textBox1.Text);  //Call match

 if (m.Success)                                         //Check to see if a match was made
 {
  MessageBox.Show("You can't say that.");
 }
 else
 {
  MessageBox.Show("nothing found.");
 }

SQLDependancy Caching

One of the new features in version 2.0 of ASP.NET is a new form of cCaching. This is a cool feature but not as easy to get working as it would seem.

In case you haven't heard about it, using SQL Dependency you can tell the Web Page not to refresh until the DB notifies it that the data has changed.

There are three steps you have to do to get this feature to work.

1. Add this section to your Web.Config file:

<connectionStrings>

<add name="pubs" connectionString="Integrated Security=SSPI;User ID=sa;Password=sa;Data Source=LONDON;Initial Catalog=pubs;Persist Security Info=False;Workstation ID=DLLOYD" />

connectionStrings>

<system.web>

<caching>

<sqlCacheDependency enabled="true" pollTime="500">

<databases>

<add name="pubs" connectionStringName="pubs" />

databases>

sqlCacheDependency>

caching>

system.web>

Watch out because there are articles out there that say the tag should be CACHE not CACHING

2. You have to run an administrative utility (aspnet_regsqlcache) that enables a Database and Table for SQL cache dependency.

aspnet_regsqlcache -S (local) -U "sa" -P "sa" -d pubs -t authors -ed (Enable the DataBase)

aspnet_regsqlcache -S (local) -U "sa" -P "sa" -d pubs -t authors -et (Enable the Table)

aspnet_regsqlcache /? (Too see all the commandline switches)

3. On the page itself, in the Page Directive add the following line.

<%@ OutPutCache Duration=6000 SQLDependency=“pubs:authors“ VaryByParams=“*“%>

Uninstalling Whidbey PDC Preview

For anyone else who received the recent Whidbey 2005 preview. And thought they would uninstall an older version of Whidbey. Here is what happened when I did it.

  1. I un-installed Whidbey.
  2. Then I had to separately un-install:
    • Microsoft .NET Framework 1.2
    • Microsoft Visual J# redistributable Package 1.1
  3. Then to get Visual Studio 2003 working properly again, I had to reinstall:
    1. Visual Source Safe
    2. MSDN Library

And everything seems OK so far.

Closing a form before it shows

I'm working on a smart client application at the moment. One of the forms, under certain conditions, launches a wizard to gather information from the user.

From the users perspective they open the form and the wizard displays. If the user hits cancel, I want the wizard to close and the form not to show.

So what is the best way to do this. There is no cancel in the FormLoad event. If you try to close in formload an exception is raised:

Cannot call Close() while doing CreateHandle().

I asked Google and found one solution. Controls have a Public Event, VisibleChanged that fires when the visible property is changed. In this event you can call the forms Close method.

This works fine with one side effect, the form shows for a split second then closes.

This will suffice, but if anyone knows a better way to do this please let me know.

 

 

It's a right handed world

Left handed people always say it's a right handed world. Its true. Those of us who are right handed don't think much about this because everything is geared toward righties by default, like scissors and mice.

My son is left handed as well and my sister and mother, so although I am right handed I have an appreciation for the plight of the left handed.

My family and I spent march break in Panama. I wanted to really get away and not think about anything but relaxing. So I left my laptop at home. Yeah I know! I took my IPAQ though, I mean come on be reasonable. I needed somewhere to transfer my pictures when the flash card was full right?

So on the plane I was teaching my 9 year old son how to play solitaire. Something I had never done on my hand held. As I was playing it on my IPAQ I realized the game is not conducive to right handed players. As you click on the pile of cards to turn the next card your hand is in the way of the screen. While my son could play very easily without ever moving his hand out of the way to see.

So although it is a right handed world, there are some things in this world for lefties and not righties. If you want to feel good about being a south paw play solitaire on a hand held computer.

If anyone comes across a right handed version of solitaire for windows CE, I'm interested.

Visual Studio Command Prompt

This is a trick I got from Paul Murphy at the Toronto Security Briefing. Which was very good by the way, I thought Paul did a great job. If you missed it and would like to see the slides and demos. Visit Paul's Blog he posted them last night. http://www.paul.bz/blog.aspx.

Back to the tip. You would think after a Security briefing my tip would be about security. But to be honest I need time to digest some of the tons of information presented.

This is a really simple little thing I knew how to do but never thought to do it.

As a .NET developer it is inevitable that you will be opening the Visual Studio Command prompt to run some command line utility. Weather it's Sn.exe or GacUtil.exe or one of the many other utilities you can run from the command line. It is suggested (with good reason) that you develop logged in as a regular user, not administrator. If you are developing as administrator there is a good chance when the application is run by a non administrator there will be code that will not run due to the difference in permissions between the two accounts.

Wouldn't it be nice if the Command prompt looked different when you opened it as administrator. So you know visually right away that you are in that session as an administrator.

Here is how to do it:

  • Open the Visual Studio Command Prompt
  • Click on the Command Prompt icon (Control Box) and select properties
  • Click the advanced button
  • Select Run with different credentials (When opening a command prompt you will no be prompted to log in as another user)
  • Click OK and then switch to the colors tabs.
  • Select another background colour for the command prompt. (You can change what ever you want about the command prompt as you visual cue)
  • When you click OK on the properties dialog you will be asked if you want to Apply changes to just this window or Modify the shortcut that started this window. Select the second option.

From now on when you open the Visual Studio Command Prompt as Administrator it will look different than the normal Command Prompt.

Thanks for the tip Paul.

Whidbey

So far so good.

When we last met I had installed Whidbey and the .net framework 2.0 on my production machine along with VS 2003 and 2002.

I haven't found a problem yet. I gave a demo at the CTTDNUG last Wednesday and it went OK. Well nothing went wrong that I didn't expect to using alpha software.

Also since then I have been developing an windows application in 2003 with no problems.

Not sure what will happen when I try to upgrade to Beta.

 

Whidbey and VS .Net 2003

Well I've done it. They warned me not to but I did it anyway.

I installed Whidbey on my machine along side 2002 and 2003.

I'll post any trouble I have right here.

Dave

DataTable.Rows

I have an issue with the DataTable object. Although I think it's a cultural thing. Some people I talk to don't seem to bothered by it. I find it very annoying, mostly because it would have been so easily avoided.

So whats the problem? When a DataRow is flagged for deletion it's still part of the row collection in the DataTable. So you may now be wondering what the big deal is.

You see I spent 10 years in the PowerBuilder world. In a PowerBuilder DataWindow (Similar to the objects in ADO.NET) when a row is flagged for deletion it's stored in a separate collection. Therefore when you are processing the rows The Deleted rows are not in the collection of current rows. If you want to access the deleted rows you can do that also. Also when you get a count of rows it's the count of rows not including the deleted rows.

In a DataTable when you delete a row it remains in the rows Collection and you have to deal with them. This also means that DataTable.Rows.Count or DataTable.Count is a count of all the rows including deleted rows.

Why do I say it's cultural? My esteemed colleague Bruce Johnson and I had a brief discussion and he almost convinced me this is how it should be. Bruce said "It's only flagged as deleted why shouldn't it be in the Rows collection?"  I have to say this is a fair statement. However it would make life easier for the developer if there was a DeletedRows collection. Therefore a corresponding DeletedRows.Count. This feels more natural to me.

When do you ever want to iterate through all the rows in a DataTable both deleted and not and preform the same action on them? I could make something up but it would be bogus. I have never wanted to do this. Even if you can come up with a good reason it's not going the be the common scenario. When you write a framework you should take into account the 80/20 rule. Make it easier for 80 percent of the cases and let the 20 percent do extra work.

This means that when you iterate through a collection of rows in a table you have to be sensitive to the fact that some of them may have been deleted.

There are ways to make life easier, and when .net 2.0 (Whidbey) comes along there will be even more.

What can you do about it?

You could check the row state inside your iterator like this.

For each row as dataRow in DataTable
          if Datarow.RowState <> dataRowState.Delete then
                ...
          end if
Next

Or you could get a subset of the collection like this.

For each row as dataRow in dataTable.Select("", "", DataViewRowState.CurrentRows)
               ...
next

Keep in mind with this solution if you are using a typed DataSet you will have to cast the select for the typed row.

For each row as OrderRow in Ctype(OrderTable.Select("","",DataViewRowState.CurrentRows), OrderRow())
             ...
next

I recommend wrapping up the select in a DataSetHelper method, so it looks like this.

For each row as OrderRow in Ctype(DataSetHelper.GetCurrentRows( OrderTable ), OrderRow())
              ...
next

What about getting the count of Current rows in the DataTable. You could wrap this little code segment up in a method in your DataSetHelper also. Just pass in a DataTable.

Public Function GetRowCount( dt as DataTable ) as integer
              Dim dataView As New dataView

             dataView.Table = dt
             dataView.RowStateFilter = DataViewRowState.CurrentRows
             return = dataView.Count
End Function

I mentioned above .net 2.0 (Whidbey) will help. How is that you ask.
There are a couple of solutions.

  1. Using Partial types you could extend the DataSet Class to include a method that returns a collection of Current Rows. This way it's more natural to the developer.             OrderTable.CurrentOrderRows
  2. Using Iterators you could write your own iterator that only iterates thought the current rows.

 

 

 

 

Merry Christmas

I would like to wish everyone a happy holiday season.

 

Rename a XSD

Yesterday I tried to rename a DataSet. To lazy to recreate it. Have you ever tried to rename a DataSet?

It seems easy enough. Press F2 in the Solution explorer and type in a new name. Open the XSD and do a find and replace of the old name with the new name, there done right?

Not exactly when you try to generate the class it may get generated with the old name. Your solution ends up looking like this:

  • MyNewDataSetName.xsd
    • MyOldDataSetName.vb
    • MyNewDataSetName.xsx

So what is the solution? The problem is in the Project File. There's an attribute on the file node called LastGenOutput it is holding the old DataSetName. See below.

Delete this attribute and you will be fine.


 
          RelPath = "MyNewDataSet.xsd"
      BuildAction = "Content"
      Generator = "MSDataSetGenerator"
      LastGenOutput = "MyOldDataSet.cs"
    />
 


           

Visual Studio Command Prompt

Here is another useful tip from Mark Comeau, this guy needs his own Blog. Then again I'm glad he hasn't got one. What would I write about. :)

Do you find yourself in the Visual Studio Command Prompt from time to time? Of course you do. Do you get to it via:

Start->Programs->Visual Studio .Net 2003->Visual Studio .Net Tools->Visual Studio .NET 2003 Command Prompt

Hopefully you have a shortcut that is closer to your desktop or start menu.

When you open it what directory are you in? Do you have to then use your vast knowledge of command line directory traversal to get to your source code or whatever it is your looking for?

Would you like to right click on a directory in windows explorer and open a Visual Studio Command Prompt already set to that directory?

Just add these entries to your registry:

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_vs]
@="Open VS Command Prompt Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_vs\command]
@="cmd.exe /k \"C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Common7\\Tools\\vsvars32.bat\""

If you would like the same functionality from a Drive also add this to your registry.

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd_vs]
@="Open VS Command Prompt Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd_vs\command]
@="cmd.exe /k \"C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Common7\\Tools\\vsvars32.bat\""


Thanks Mark thats a good one.


 

Partial Classes

I'm really liking this idea of Partial Classes that is coming in .Net 2.0.

When I first heard about it, I thought “now that is going to be confusing“. But I've been playing with it in Whidbey and I think it's going to be cool. Both VB.NET (When do we get to stop calling it VB.NET and just call it VB again)  and C# allow you to split your class across two files. Although the syntax is slightly different.

C# - Each part of the class has the same definition as seen below

  • public partial class MyClass
  • public partial class MyClass

VB.NET - There is a main class and all others expand on that like this

  • Public Class MyClass
  • Expands Class MyClass

For those who are wondering, The two files must reside in the same assembly. They are actually combined at compile time.

I have been thinking about how useful this will be. Here are some of the uses I can see for Partial Classes.

  1. That section of code generated by the designer that you shouldn't touch, can go in another file (And in Whidbey it will)
  2. Extending a Typed Dataset or any other auto generated class (This is the same basic reason as number 1)
  3. Code Behind, I assume the ASP.NET team will use partial classes to implement code behind
  4. Multiple developers, two developers can work on different areas of a class at the same time without worrying about merging changes. Therefore it could be used to logically divide a class, think of it like regions on steroids.

What else? I'm curious to hear about others peoples ideas for Partial Classes.

 

Source Safe Performance

Here are a couple of good tips for making source safe run a little better over the network.

I have seen these before but a client (Mark Comeau) recently reminded me of them.

  1. Change your VSS Folder for temporary files to be local. It will default to where the VSS Database is installed. Tools->Options...-> General Tab
  2. Put your ss.ini on your local machine. This file normally is in the \users\ You can move it locally and change the \users.txt file to tell Source Safe where you put it.

Less network chatter means a better response time when using Source Safe over the network.

 

 

Whidbey

Next Tuesday (Dec 9th) Object Sharp is hosting a free half day seminar on VS.NET 2.0 (Code Named Whidbey).  We'll show a lot of the new features in the IDE like snipits, expansions, snap lines and smart tags. We'll show you new features in C# and VB.NET, also ADO.NET and ASP.NET.

I think you will really enjoy this informal look at the next wave from a developers perspective.

Come on out. It's free and you just might learn something. You can register here.

 

VB who knew?

I haven't written anything in my Blog for quit some time. Mostly because I have been preparing for presentations. We helped Microsoft with their Bigger Better Basic cross Canada tour last month. I spoke in Toronto, Ottawa and Vancouver. It was great. We met lots of wonderful people who were all very excited about Web Services and Client Applications. I'm sure you can tell by the name that the show was for VB developers. My colleagues will tell you it's pretty humorous to say the least that I would wind up speaking to VB developers about how great VB.NET is to develop in.

At one time I would have nothing to do with VB. It was not Object Oriented, that was enough right there. ADO was not great, ASP was not great. It was just too hard to do anything. Well I'm hear to tell you, “VB has come a long way baby“. I was speaking with someone at the show on this very subject. They said “If you told me 1 year ago VB would one day have Generics I wouldn't have believed it”

I still prefer the syntax of C#. In a paste life I was a C developer so I am used the the sparse syntax and I like curly brackets. However, although I still find VB a bit verbose for my taste. I have been developing an application with it and it's a good language, VB.NET has a lot going for it.

EnforceConstraints

Have you ever tried to update a Dataset and received this message?

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Not a problem in a small DataSet. But if your Dataset is more complex sometimes it's not easy to see the problem right away.

There is a property on the DataSet called EnforceConstraints. When you set this to true the DataSet will try to enforce all the constraints in the DataSet (Not null columns, Foreign keys, unique keys) The problem with this exception is, it tells you very little. You know you have violated a constraint, but which one? The way to find out is to look at the row and column errors.

Below is a method that will attempt to apply contraints and write the errors out to the output window. I hope someone out there finds it useful.

Public Sub GetDataSetErrors(ByVal ds As System.Data.DataSet)

 

Public Shared Sub GetDataSetErrors(ByVal ds As System.Data.DataSet)

 

Try

ds.EnforceConstraints =

True

Catch ex As Exception

Debug.WriteLine("DataSet errors: " & ds.DataSetName)

 

For Each table As DataTable In ds.Tables

 

Dim ErrorRows As DataRow()

ErrorRows = table.GetErrors()

 

For Each row As DataRow In ErrorRows

Debug.WriteLine("Table: " & table.TableName)

Debug.WriteLine(" Row Error: " & row.RowError)

 

Dim ErrorColumns As DataColumn()

ErrorColumns = row.GetColumnsInError()

 

For Each column As DataColumn In ErrorColumns

Debug.WriteLine("Column: " & column.ColumnName)

Debug.WriteLine(" Error: " & row.GetColumnError(column))

 

Next

 

Next

 

Next

 

End Try

 

End Sub

PDC Aftermath

It's now the Monday after PDC. I just woke up.

What a week! I didn't get a blog entry in on Tursday it was a very busy day. Talked to some ADO Microsofties about DataSets and Object Spaces. Sat in one a few last sessions. Did some shopping. Headed for the airport. For the next 12 hours we travelled.

Now I have to sit down and watch all the presentations I wanted to go to but couldn't get into, or picked something else.

I hope the DVD comes soon.

 

Bigger Better Basic

Over the next month we are co-presenting with Microsoft at their cross Canada tour called Bigger Better Basic . ObjectSharp will be in 5 cities Calgary, Vancouver, Toronto, Montreal and Ottawa.

Come on out.

Food at PDC

I can't go all week without mentioning the food, here. I took a couple of pictures to get the point across. Check out my pictures. it will help you visualize.

I took a picture of the lunch and breakfast hall. I got as much in as I could with my camera. Imagine seating 8000 for lunch. It's quit amazing to watch, the staff here at the conference centre are great.

All around the conference centre there are tables full of food. There are two pictures of these also. They are always full of muffins, bagels, chips, chocolate bars, granola bars and fruit. There must be 10 of them set up. Next to these are giant coffee urns and barrels full of pop juice and water.

No one is going hungry here!

C# now there's a language

Did I mention msbuild? Microsoft is writing their own NANT. It's XML and everything.

Yesterday was a C# day for me.

I tried to get into Anders Hejlsberg's session on the new features in C#.

  • Generics
  • Iterators
  • Anonymous methods
  • Partial types
  • Property accessors with different accessibility

But it was full. Even the TV outside the room had no space around it. They sometimes re-run popular sessions. Fingers Crossed.

I did however get into a good session called Visual C# "Whidbey" IDE enhancements for the C# developer

Found some things in there to look forward to.

Debugging is easier with regard to DataSets. In Whidbey you can adjust what you want to see in the debugger. You can tell VS what you consider your code and therefore want exposed in the debugger. You can also click on a drop down and see a DataSet Visualizer, which is essentially a list box of DataTables and a grid for the DataRows and DataColumns. It's like a trimmed down version of Barry's DataSet Debugger. In the build I saw, it’s not as good as Barry’s but maybe it will get better.

Here's one Andre will like. They have included IDE support for refactoring code.

Rename - You can rename a method and have it change solution wide.
Extract Method - If you wrote a large method and later decide it would be better split into multiple methods. You can highlight a section of code and select [extract method]. Whidbey will prompt you for a method name. It will figure out what arguments you need the scope and what it returns.
Some others include:

  • Extract Interface
  • Encapsulate Field
  • Reorder parameters
  • Remove Parameters
  • Add Parameters

Expansions are cool too:
You know in VB .net how you type in a property and it fills in the get and set etc. VB had to do this because it's so verbose no one would use it otherwise. :)

Whidbey has something else cool called expansions (C# has it for sure. I have not confirmed VB). Using XML you can define an expansion, which shows up in IntelliSense. Lets say you wanted to create a property expansion. You could type in prop and it could fill in the following. the cursor would be placed on string ready for you to change. You can just tab through the fields (in yellow) to change the names.

private string name;

public string Name {

get { return name;}

set { name = value;} }

That's enough for now. I have to get to another session.

We are going to Universal Studios today whoohoo!

Tonight is universal studios night. Microsoft rented the park for us for a few hours. I can't wait. Shrek 4D here I come.

The network at the hotel sucks. Couldn't get on last night for any longer than a minute or two. We were supposed to be in a web cast with Microsoft today but couldn't get a spot quiet enough with a stable network to do it.

Got an email from Roman this morning. Thanks Roman. Seems the dart team lost last night. Hard luck guys. I was thinking about you.

Right now I'm in a session for the tester in me. “Avalon” UI Automation to improve application testing. It's just starting so I'll be right back.

 

Tuesday Morning at PDC

Good Morning...

Barry said it best, “I woke up this morning needing a nap”.

Had trouble installing Longhorn last night, couldn't get the key from the web site. Barry got his so I can install it later on.

Just had breakfast with Joe Futty, Yeah he's here, he's doing well. It’s good to see him.

Waiting for the general session to start, I forgot my camera this morning. I have to remember to take a picture of the never ending dinning hall. Who is cooking all this food?

I want to try and talk to Paul from the Whidbey presentation yesterday. I'd like to get on the Whidbey Alpha. We need a newer build than the one they gave us. We want to hold a session in December to show clients some of the stuff we've seen this week. I think I'll go to ask the experts tonight. He should be there.

Barry was schmoozing with the infragistics guys last night at the trade show. They don't have anyone who does training for them. Matt? Barry said maybe we could do that for them. ComponentOne was four booths over. :)

For other attendees: Have you been to PDCVIBE and downloaded the PDC Vibe tool. It's pretty nice. Shows all the sessions, lets you filter them. Give feedback on PDC. Download slides. It's very nice.

Almost time for the general session, I better run.

Whidbey is looking good

Yet another long day, I feel like I have been at this conference for a week already, I'm exhausted.

At this moment I am installing Longhorn on one of the extra laptops we brought for just such an occasion. I hope they don't monitor hydro usage per room because between the wireless router, 2 phones, 3 IPAQ's, and 4 laptops plugged in we must be over our quota.

After I install Longhorn, I'll be installing Whidbey. For those who don't know, Whidbey is the code name for the next release of Visual Studio. I'm a software developer and have been for 20 years. So when presenters are on stage using old editors and compiling on the command line. I'm with them and sometimes feel a little nostalgic. As much as I once loved K-edit I wouldn't trade Visual Studio .net for it now. Like any software VS.net has it's problems. But the development teams at Microsoft have done a wonderful job addressing a lot of the issues. Assuming they deliver what I saw today.

So what did I see today?

  • I saw tools to make interactive development easier. Like smart tags. You can drop a control on a form then right click and make it something else. Maybe it was a textbox at first but them you decide to make it a date time picker. Just right click select DateTimePicker and you’re done.
  • Ever want to try something by coding it? As a result you end up with WindowsApplication1, WindowsApplication2, WindowsApplication3 ... on your machine. Whidbey works like word, your project is not saved until you save it. So you could create a project write some code compile it and run. Then exit without saving and discard the whole thing. (Honest that's what he said.)
  • I saw Paul Yuknewicz create an employee.user.vb. What's that you say? Well it's what Microsoft refers to as a partial class. You can have a class split across multiple files and they will be compiled into one. So the file employee.user.vb goes with employee.vb which goes with employee.xsd. You guessed it. It's an extension of a Typed DataSet. :)
  • The new snap lines for aligning controls are wonderful. If you are adding multiple labels and controls just drag one near another and it shows you lines to tell when it's lined up with the other controls and the labels. It's hard to explain how nice it looks. I'll be happy to demo it when I get back.
  • There is this thing called a DataSource Picker. To bind a control you can simply drag from you DataSource to the control and it binds it.
  • There is this new control called a DataContainer, all I can say is PowerSoft DataWindow. (I'll save the comparison for another Blog)
  • There are some enhancements to the XML editor. Nothing else to see here move along.
  • Actually one really note worthy XML addition. You can set breakpoints in an XSLT file and debug it.
  • Oh yeah I remember this is nice. When you add a datasource to DataBinding in the property window. You can grab the editor and stretch it out to see everything. It's really nice

Enough about Whidbey for now.

The exhibition hall was cooking tonight, must have been the free drinks. We stopped into a few booths, chatted with some folks, did a little shopping in the Microsoft Store. Can't tell you what I bought. My Daughters have been reading along, and it's for them.

It's time to unwind and relax, another long day tomorrow at PDC.

General Session at PDC

So I sit here eating my Chinese food for lunch. Barry went to a session. He's a trooper. I'm thinking about the cool things I saw in the general session. I'm new to blogging and I am not going to try and dump everything I saw here in one entry. I'll leave that to the more serious bloggers and writers out there.

However I will tell you a little about the general session.

  • No bathroom breaks
  • 8000 or so people, watching at least 16 giant screens.
  • Check out the pictures. It was pretty cool just from a logistics point of view.

Some demo highlights while I sip the last of my ice tea here:

  1. XAML (pronounced Zamil) is a new buzz word. From what I can gather it's code behind for windows and web. If you have been trying to peg yourself as a windows or web developer stop, it won't matter soon. XAML is an XML language that lets you write your user interface.
  2. Doing cool graphics is easy. Or at least Don Box and Chris Anderson made it look easy.
  3. Very cool demo by Amazon.com. If you get a chance check out the carousel control, Very cool. If anyone knows where you can see a sample of it let me know.
  4. Another cool demo was paging up and down in a document. If you click on the scroll bar a thumbnail appears that shows you where that is in the document. In the demo that particular section of the document had a video playing. It played in the thumbnail too. :)

There was a lot more and a lot more important that these for example the new file system is very exciting. But I have session in a few minutes and I have to find it. I'll try and get on again later today.

Thanks Paolo

Someone who attended the Tips and Tricks BOF session took notes. We tried but it was going pretty fast.

Thanks Paolo for posting these tips in your blog.

Tips and Tricks Birds of a Feather @ PDC

Tonight at 8pm we hosted a “Birds of a Feather” session. These are meant to be round table discussions for people with common interests. This one was a little large to be an effective round table. But it turned out good.

We took our projector to setup, because we thought we might have to show a few to get the group warmed up. As it turned out there were between 100 and 200 people at the session. So we showed a few tips each, all the while prompting the floor to submit some.

And they did! It was great, the session attendees got right into it. With that big a crowd is was a challenge to stay organized. Barry Gervin did a great job of facilitating.

People always think their tip will be silly and everyone will know it, but the truth is we can all learn from each other. Every time someone gave a tip someone else in the audience gave the “oh good one” response.

I thought I would share a couple of my favorites here on the Blog.

  1. To select a vertical block of text you can alt-drag. I knew word had this feature but I didn't know VS did. The last editor I used with this was K-edit back in my C programming days.
  2. Ctrl-Pgup or Ctrl-Pgdn to flip between editor views. (i.e. Design/Html or DataSet/XML)

There were plenty more. I'll add some more in as the week goes on.

Tomorrow the sessions start. I'm really looking forward to a lot of them. I want to be well rested and ready, so I'll say good night now.

Registration

We are now at the conference centre. We registered and got our free gifts. Yet another laptop nap sac, a t-shirt and a coupon that is good for a bunch of CD's we can't get until tomorrow. Now we'll have to put the coupon in the room safe so all the other attendees don't try steeling it from us before we can redeem it tomorrow. :)

We got a copy of Office 2003, which is very nice.

The wireless access is excellent in the conference hall. I'm on it now. You can see how good it is eh?P>

Tonight We are hosting a Birds of a Feather (BOF) Session at 8:00 in room 402AB entitled VS.NET Secret Tips & Tricks
I may attend this BOF session  Web Services Orchestration: More Than Just Getting the Weather and Checking Your Stocks at 7:00 pm

I'll let you know how they turn out.>

Time Change

I left home at 4:45 am so I would have time to pick up Barry Gervin and get to the airport for our 7:20 flight. I stopped for coffee knowing it would be the last time for a week that I would enjoy the sweet aroma and flavour of a Tim Horton's large black 2 sugars. I was hungry so I pick up a couple of blueberry muffins for breakfast.

Our flight left on time, and the first leg was quick. Between Toronto and Cleveland we got coffee and a blueberry muffin. It was OK.

Between Cleveland and LA we had in flight entertainment. The movie Legally Blonde II and episodes of the TV shows Sabrina the Teenage Witch and Wings.

Next thing you know they start serving breakfast. I sat eagerly awaiting some eggs and of course one of the standard breakfast meats. The flight attendant pulled her cart up to our aisle and set down a lovely healthy breakfast. Cereal, milk a banana and a blueberry muffin. It's a good thing I really like blue berry muffins.

That was a long day. I was in bed by 9 pm and them up at 6 which of course I thought was 7. Now I am going to get that breakfast I have been waiting for, then off the convention centre to register for PDC 2003.