Powerd by dasBlog RSS 2.0
 Sunday, August 17, 2008

With the release of all Visual Studio 2008, TFS 2008, and SQL 2008, I set about upgrading I set about upgrading my main development laptop. Currently I have VS 2008, Team Explorer 2008 and SQL 2005 client tools installed. I opted to download the full installer for the SP1 updates as opposed to the bootstrapper options.

I knew I needed to install VS 2008 SP1 prior to TFS 2008 SP1, but for some reason decided to go with the SQL upgrade first. As I mentioned before, I currently only have the client tools installed, as I like to keep my SQL servers on virtualized development servers.

The SQL 2008 installer starts off by checking for .Net 3.5 SP1, and if it does not exist, it will install it on your machine, along with a hotfix for windows installer. After this is complete, you are required to reboot your machine. I opted for the upgrade option, hoping that everything just works. I’m not sure if you can do a side by side install with SQL 2005 client tools and 2008.

After selecting my options, an upgrade check is preformed, and it failed because I have not installed VS 2008 SP1 yet. OK, I wanted to install that anyway, so I canceled out and launched the VS 2008 SP1 installer. As with most service packs for Visual Studio it takes awhile to apply, but my experience was more positive then the service packs for VS 2005. No reboot was required, so I moved onto the TFS 2008 SP1 install.

So I must have mis-understood or did not read something with the TFS 2008 SP1 installer. It looks like it’s for the server components only, and VS 2008 SP1 handles upgrades to Team Explorer as well. This blog post makes reference to this, and even says that if you are installing Team Explorer on your TFS server, to install VS 2008 SP1. Looking at Help/About Microsoft Visual Studio, I see the version number for VS 2008 is now 9.0.30729.1 SP, and looking at the details for Team Explorer shows the same version number.

Jumping back to the SQL 2008 installer, I proceeding with my update. However it wasn’t really an update as much as it was a side by side install. Remember, I was just doing the client tools, had I had the database components installed, I assume that those would have been upgraded. I have a couple of SQL 2005 instances I can try an upgrade on to see what happens. The install went very smoothly and there were no issues.

First impressions of the new SQL Management studio are extremely positive. I saw the intelli-sense demo at the launch event, but can’t really test it as I already have SQL Prompt installed. My job as a Pseudo-DBA just got easier.Here are some new features I found.

  • When running queries, you can view the results in traditional grid view, but also as text (with options to choose your column delimiters), or export to a text (.rpt) file.
  • The new activity monitor actually provides useful information (well alot more information then the old one ever did). It reminds me of the task manager in Windows Server 2008. The new activity monitor does not work with SQL 2000, but I will be eliminating all SQL 2000 boxes by the end of September. As 4 line graphs across the top you get % Processor time, Waiting Tasks, Database I/O and Batch Requests/Sec. On the bottom you get 4 collapsible lists: Processes, Resource Waits, Data File I/O and Recent Expensive Queries.
  • The database publishing wizard from Visual Studio is now included. Actually there are a lot more options to control how your scripts are generated.
  • There are some very nice default reports built in now as well. The reports were an add-on for SQL 2005, but they are now included (and you can of course write your own). Stuff like Disk Usage, Index Usage, etc. I hope I can find a way to schedule these to be emailed.
  • New option to generate Create and Drop Script (along with the original separate options of generate create and generate drop). There is also an option to generate as SQL Agent job.

Finally I went ahead and upgraded our TFS server to SP1. First thing I did was install this month’s Windows Updates, as I was going to have to reboot anyway. Next up was Visual Studio 2008 SP1, as I have VS and Team Explorer installed. Unfortunately I was out of room on my system drive so I had to take the extra step of expanding my virtual hard disk first.

I rebooted the server, and then proceeded to install TFS 2008 SP1. It looked like everything was going good, but it failed at some point. Turns out the SQL server did not survive the reboot, VS 2008 SP1, or the system drive expansion. Somehow my mssqlsystemresource.ldf file got messed up at some point. The event log error stated “One or more files do not match the primary file of the database.”. I got better information out of the SQL error log which pointed me right to the System Resource ldf. I copied the ldf file from another SQL 2005 server and was back in business. The TFS update proceeded without incident after that. In case you are wondering, you can determine your TFS version by looking at the version of Microsoft.TeamFoundation.Server.dll in %Program Files%\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Services\bin. For SP1, the version number matches that which is displayed in Visual Studio 2008, or 9.0.30729.1.

Sunday, August 17, 2008 12:00:32 AM UTC  #    Comments [0] - Trackback
Technology | Programming | Sql
 Wednesday, August 13, 2008

My weekly Code Project newsletter had a link to a submission which talked about, and rated various Aspect Orientated Programming (AOP) frameworks for .Net. While I’ve heard about AOP in the past, I haven’t looked into much. What got me off the side lines, was that one of the .Net AOP frameworks, Post Sharp, lists support for the Compact Framework and Silverlight. In my experience, it is rare to see stuff that actually supports the compact framework, so this is a welcome change, however I have not tested it out yet.

Before I dive into Post Sharp anymore then I have, I wanted to read up a bit on AOP. WikiPedia has a good article explaining the AOP using AspectJ as the example language. PostSharp itself has a an article that focuses on the .Net Framework as well.

What is Aspect Orientated Programming (AOP)?

  • AOP increases modularity by allowing the separation of cross-cutting concerns
  • A concern is a cohesive area of functionality (think encapsulation).
  • Cross-Cutting concerns are those concerns which are used in multiple concerns
  • Logging is the most typical example of a cross-cutting concern. It itself is a concern (encapsulated functionality), that is used everywhere in your program.

Examples of Cross-Cutting Concerns

  • Logging
  • Exception Handling
  • Tracking is dirty on fields
  • Auditing
  • Security
  • Transactions

How does it work (based on Post Sharp)

  • Implement cross-cutting concerns as classes creating attributes (implementing various interfaces in Post Sharp)
  • Decorate your code using your attributes. Attributes can be added at the method, field, class and assembly level. At the class and assembly level you can specify a filter specify which methods or classes to work on.
  • When you compile, Post Sharp performs post build processing injecting code into your compile MSIL, producing modified MSIL as the final output.

AOP Frameworks

Performance

I was originally under the impression that by injecting code at compile time, there would be no performance hit at run time. This is not true, at least in PostSharp using the simple performance test from the user provided samples.

The simple performance test sample shows that AOP using Post Sharp incurs a variable performance hit. Running the sample application multiple times shows the first time the post sharp code is hit (view the complied .exe in reflector) it takes 73ms, and then this drops down to 14 ms, compared to 4 ms for the non PostSharp code. On subsequent runs, the first access of the post sharp code takes ~21ms and then drops down to 14ms, while the non PostSharp code remains at 4ms.

The sample in question uses the works on a field in a class. The aspect (attribute code) is required to cast an object passed in by the event args to a string. Perhaps generics could help with performance by eliminating the cast?

Final Thoughts

AOP and PostSharp look like very powerful tools that I would like to take advantage of. Learning from my past mistakes, I need to make sure that I take the time to understand these tools and use them where appropriate and not go overboard with their use. I think a good first step would be to find, or write some examples that implement some basic AOP functionality covering all of the cross-cutting concerns identified above.

The only complaint I have so far is that you have to either install PostSharp on your computer, or manually edit every project file that needs post processing. This seems a little heavy handed, but I’m willing to consider it a fair tradeoff. It just makes it hard to do a strictly x-copy deployment of a project/solution.

I’ve also been reading up on software architecture, including topics on Separation of Concerns and Loose Coupling. I think it is obvious that AOP can help with the separation of concerns (it’s pretty much stated in the definition). I also get the feeling that it could help with loose coupling, but I haven't seen a good example on that yet. All the examples I have seen would require tight coupling of your aspects (attributes) to something like log4net (in the logging example).

Finally, I will need to continue to evaluate performance to determine if it’s a fair tradeoff with increased maintainability of code. I am most concerned on the compact framework side of things, as the processing power that those apps run on is not as great as their desktop counterparts. This is not a knock on PostSharp, but just something to be aware of.

Wednesday, August 13, 2008 3:36:47 PM UTC  #    Comments [0] - Trackback
Programming
 Wednesday, July 09, 2008

We have some WSE 2.0 secured Web Services that we are migrating to a new data center. As part of this migration effort I needed to write some automated tests to make sure everything was working. In addition to working with the WSE 2.0 clients our customers have, I also wanted to see what was needed to make the services consumable by WCF clients. After finding this article on WSE 2.0 Interoperability on http://wcf.netfx3.com, it was pretty easy.

The main problem I was having was issues with the username token. In WCF some basic concepts were changed, such the removal of password encryption (instead recurring the transport, https for example to handle encryption), and replay detection.  

Here is the config section from the WSE 2.0 server piece (the diagnostic piece is optional)

<microsoft.web.services2>
   <security>
      <securityTokenManager xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" qname="wsse:UsernameToken">
         <replayDetection enabled="false"/>
      </securityTokenManager>
   </security>
   <diagnostics>
      <trace enabled="true" input="logs\InputTrace.webinfo" output="logs\OutputTrace.webinfo" />
   </diagnostics>
</microsoft.web.services2>

Here is a sample configuration section for the WCF Client:

<system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="InventorySoap" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="TransportWithMessageCredential">
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://Server/Directory/Service.asmx"
                binding="basicHttpBinding" bindingConfiguration="InventorySoap"
                contract="MonitoringServices.Inventory.Wcf.InventorySoap"
                name="InventorySoap" />
        </client>
    </system.serviceModel>

Most of the client configuration was created for me when I added a service reference to my project. The key part is the mode=TransportWithMessageCredential and clientCredntialType = “UserName”.

We have another project underway were we want to rewrite the WSE 2.0 services with WCF while maintaining full compatibility with deployed WSE 2.0 clients. The netfx3 article covers this scenario as well, and it seems like we will be able to accomplish our task. Look for a future post on that endeavor.

Wednesday, July 09, 2008 4:30:23 PM UTC  #    Comments [0] - Trackback
Programming
 Monday, July 07, 2008

Today I tried to use the web recorder in Visual Studio to create some new web tests, but the recorder tool bar would not show in IE. A quick search found Diagnosing and fixing Web Test recorder bar issues, by Michael Taute which had several troubleshooting tips.

I ended up changing my home page which is about:blank (and loads when web recorder is launched) to belong to the local intranet zone, as this is where my test site is. That didn’t fix the problem initially, so I deleted the following two registry keys using the 32 bit registry editor (C:\Windows\SysWOW64\regedit.exe):

  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021493-0000-0000-C000-000000000046}
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021494-0000-0000-C000-000000000046}

You need to make sure all instances of IE are closed before deleting the registry keys. Once I did this, my web recorder was up and running. I’ve left about:blank in the local intranet zone for now.

Monday, July 07, 2008 8:24:10 PM UTC  #    Comments [0] - Trackback
Programming
 Friday, July 04, 2008

Once again I need to generate some self signed certs for local development. Installing certificate services in Windows is a bit of an overkill for what I need, however, it would be nice to have a root CA to work with.

After some Googling, I found a site, http://ssl4net.com/ which allows you to create a self signed root CA, and then additional certs signed by the CA you created. It is extremely easy to use and once I got the certs I was able to install them without issue.

My only concern is that the certs do not appear to be encrypted on their server, nor do they use SSL (seems ironic). However, since I will only be using this for internal use, I have no problems with this. I would be a little cautious if I was going to use to verify my identity to other people.

It looks like they might be using open-ssl as the cert creation mechanism, so maybe it’s worth the effort to setting up a VM running linux to generate my own certs in house, but that’s for another day.

Friday, July 04, 2008 4:25:36 AM UTC  #    Comments [0] - Trackback
Programming | Tools
 Monday, June 23, 2008

This one took me a little longer then I figured. Maybe I’m just trying to do stuff the wrong way, but I don’t know, I feel like my use case is correct.

What am I talking about anyway? I am talking about creating a set of web tests in Visual Studio Test Edition (well Team Suite) that I can actually use in a real world situation (i.e. Have tests that work on a dev, staging and production server). The problem is/was, hard coded URLs for my dev server, which ultimately would have to be changed to point at staging and production.

Before proceeding, let me spell out what I’m trying to do (use case):

  • Use the VS GUI to create and most likely run my tests
  • Single place to store the web server, and other settings that I can use for all my tests

At first, I thought this was going to be a very easy change, as there is a “Parameterize Web Servers” option when you right click on the root node of your web test. This creates a context variable, which I thought was cool, until I realized it was on a test by test basis, not project. I guess I was looking for a project wide context parameters file, but couldn’t find one.

I did some searching and supposedly you can set an environmental (yes, from a command prompt) variable named Test.<ContextParameter>, however I was unable to get this to work. I think this might only work when invoking mstest from the command line which makes some sense, but kind of throws a wrench in the works. While this would be perfectly acceptable for a un-attended build server, what if I needed to point to a new dev server in the GUI?

I then moved to a XML data source with a single “line” of data":

   1: <?xml version="1.0" encoding="utf-8" ?>
   2: <Config>
   3:  <UrlRoot>http://dapltp101.dmz.pri</UrlRoot>
   4:  <LoginUserName>asalvo</LoginUserName>
   5:  <LoginPassword>123456</LoginPassword>
   6: </Config>

 

This worked pretty good, except that when selecting UrlRoot from the drop down list of available options, it replaced the entire URL, and not just the URLRoot. I do like how they made the property grid “strong typed” in that it gives you the fields you defined for your data source, but I didn’t want to replace my whole URL. Also, I could not edit the value after selecting my XML data source value.

Looking at the format of ContextProperties in values, as well as how the data source was referenced, I decided to try typing what I wanted in myself. I went to the URL value and replaced the URL root with the name my XML data element, and this worked.

For example, given:

Type this in the value field for your URL in the Request object on the test: {{ConfigXml.Config.UrlRoot}}/Location1

Like I said, that took me a little while longer then I would have thought. I should have went with my gut and tried that format soon after getting the regular XML data source to work.

I do have one last issue (well the fist of many I am sure), and that is, I have two URL’s when I really should only have one. When I hit the root of my website, I am redirected to a https:// URL, and that is treated differently. I’d like to capture the redirected URL and use that so I don’t have to maintain two values in my configuration file, but I’m just gonna roll with it for now.

Monday, June 23, 2008 9:14:44 PM UTC  #    Comments [0] - Trackback
Programming
 Thursday, June 19, 2008

Today I was working on installing a WCF application on Windows Server 2008, hosted by IIS 7. This was my first attempt at running WCF on IIS 7/Server 2008, and the first time WCF was used on this particular box. Needless to say, things didn’t work as expected.

Since this is a test box, I didn’t have a public cert for use with SSL, but IIS 7 adds a very nice Self Signing Cert feature, which is accessible in the IIS Manager under the root server node (look for server certificates under IIS). Unfortunately, the self signed cert uses the computers fully qualified host name, and you are not given an option to fix this. Looking around, it looks like the self signing cert tool that shipped with the IIS 6 resource kit allowed you to specify the domain name. Anyway, this is a minor inconvenience, and easily fixed by using the windows hosts file to redirect. You need to remember to export the cert from the IIS management tool, and import it to your trusted root certs on any client computer to avoid getting warnings in IE, and errors in your WCF client applications.

However, certs were not the reason for this post, the following error was:

Error the client and server are no longer in sync for their wcf service settings. System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (405) Method Not Allowed. ---> System.Net.WebException: The remote server returned an error: (405) Method Not Allowed. at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) --- End of inner exception stack trace --- Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at …

Looking back at this error, I think I may have missed a key clue. The phrase “The remote server returned an unexpected response” should have clued me in that something wasn’t setup right. I usually see this type of error when IIS tries to display an error message in HTML, thinking that it’s a browser request. The WCF client application isn’t expecting HTML, so it throws an error.

It’s been awhile since I worked with WCF, and I forgot basic trouble shooting 101 for a couple of minutes, and finally remembered to just type in the URL to the .svc file on the server. I was greeted with an IIS 7 error page that listed some pretty good trouble shooting steps. The first one said to check the server handler mappings, which I did, and noticed there were not mappings for .svc. I found a blog post on wcf and silverlight, which explained how to enable WCF on IIS 7.

Now I had installed WCF (.net 3.0) via the features section of server manger in Server 2008, but I guess that doesn’t actually enable it to work with IIS 7. Maybe I didn’t install something in the correct order. Fair enough, and the fix is simple. From a command prompt (I ran mine with admin privileges under UAC), execute ServiceModelreg -i in c:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation. Once this was done, I went back to my handler mappings and saw entries for .svc. 

I’d like to note that the error messages returned by IIS 7 in the browser window (when browsing from the web server itself), gives allot better error and diagnostics information for trouble shooting.

Thursday, June 19, 2008 9:16:52 PM UTC  #    Comments [0] - Trackback
Programming

So I find my self downloading disc 1 and disc 2 of VB 6 enterprise edition from MSDN subscriptions. I also downloaded the VB6 runtime files and SP6 for VB6.

You may be wondering why I am doing this. I wrote, and sold a copy of an application in a former life (or so it seems looking back to the year 2000), and I need to help my “client” get the app up and running on a new PC. However, I have to make a few tweaks in the VB6 code. I hope I still have all of the dependencies still.

This might actually motivate me to rewrite the app in .Net, something I have been wanting to do since .Net came out, now almost 7 years ago I think.

Thursday, June 19, 2008 3:21:57 AM UTC  #    Comments [0] - Trackback
Programming
 Friday, February 29, 2008

CLSA 3.5 is getting closer to release, with a beta announced this past weekend. CSLA 3.5 will be for .Net 3.5 and Visual Studio 2008 only. There is a 3.04 maintenance release which still targets .Net 2.0 that is coming out soon.

Announced earlier today, is a new way to write properties in CSLA, which Rocky refers to as property code reduction. Having worked with CSLA since version 1.0, I see this mainly as a welcome relief. My hesitation is in the fact that Rocky identifies a performance hit when using the fully reduced property declaration code. Adding an additional line which declares the backing variable (member variable, field, etc) alleviates this somewhat. Another way in which code is reduced is in the addition of child property management by CSLA. In the past you needed to override IsValid and IsDirty, and now CSLA handles this for you.

I love less code, truly I do, but I have attempted to implement stuff in the past with the good intention of less code, only to create something that didn't work out so well. Usually this involved an over use of reflection, where code generation would have worked just as well. I'm certainly not trying to compare my code writing skill to Rocky's, but I wonder if this is a case of programmers getting lazy? Well, I use code generation, so I guess that could be considered lazy as well. I guess the best thing to take away from this is, make sure you evaluate and inform your users (which Rocky has) of changes that save you, the programmer time. In the end the customer doesn't care if it took you 5 lines or 10 lines to implement a property, they just want their application to work.

Friday, February 29, 2008 4:58:21 AM UTC  #    Comments [0] - Trackback
Programming
 Monday, February 25, 2008

ScottGu posted over the weekend about Silverlight 2, and even though I will be away from the web scene for awhile while working on my current project, I am still excited. There are links to 8 Silverlight 2 tutorials.  Key features include:

  • WPF UI Framework: This is a compatible subset of the WinForms WPF framework. You should be able to re-use controls written in Silverlight 2.0 in your WPF projects. Some WPF controls may not be compatible, and hopefully control creators will try to target both frameworks.
  • Rich Controls: TextBox, CheckBox, RadioButton, StackPanel, Grid, Panel, Slider, ScrollViewer, Calendar, DatePicker, DataGrid, ListBox were listed in Scott's post.
  • Rich Networking Support: Out of the box support for REST, WS*/SOAP, PX, RSS and HTTP. You can access resources on the web, and there is also built in support for sockets.
  • Rich Base Class Library: A compatible subset of the base class library including collections, IO, generics, threading, globalization, XML as well as LINQ and LINQ to XML.

Now the question is, what ever happened with Silverlight on the Compact Framework? If you remember from Mix 07, during the MLB demo, the presenter showed off a "Silverlight" application running on a Smart Phone (see this blog post for some details). Is it any coincidence that this Silverlight 2 announcement happens only weeks before Mix 08 and painfully leaves out any compact framework details? Scott uses the phrase compatible subset in two places when describing the features of Silverlight 2.0. Compatible Subset is an interesting choice of words, as you could describe the Compact Framework in that way as well. Should I really be getting this excited in thinking that Silverlight 2 will be released for the Compact Framework when we having even seen a 1.x build that runs on it?

Yes. Maybe I'll be disappointed, but I will be keeping a very, very close eye on the Mix 08 conference. Larry has a great post up entitled 5 things to do if you are not going to MIX. If you are stuck in the middle of a frozen wasteland like Larry and I (well maybe not wasteland, but compared to Vegas, the upper Midwest leaves something to be desired right now), or can't attend MIX for any reason, I suggest you read up on how to make the most of MIX as a "virtual" attendee. So set your outlook calendar to out of office for Mach 5-7th.

Monday, February 25, 2008 1:25:22 AM UTC  #    Comments [0] - Trackback
Programming
 Wednesday, February 13, 2008

Three items were the focus of my attention today. Well, rather 2, and the 3rd I just saw over on daily tech and it got me very excited.

MSF for CMMI

I have been reviewing the process guidance for MSF for CMMI version 4.2 which ships with TFS 2008. I plan on using this process as the foundation on my next software development project. While out of the box it is a bit of an overkill for my team, project and company, I prefer to start with more (process) and remove what I don't need. I also feel that CMMI is a great compromise between management, who is used too, and wants a more traditional software development approach, and the developers, such as my self who are advocating a more agile process.

The great thing about MSF for CMMI is that it is written around agile concepts, yet still has processes in place for oversight. The process guidance, is written in HTML, making it very easy to edit and customize it after the project is created to meet your needs. There is a way to edit the template so that it generates the new project to meet your needs, but I figure this way is easier for the first go around.

My plan is to make changes to the HTML as needed, and then create a new template. In addition to tracking my changes, you can use a tool like WinMerge to compare your modified document library with a default one. You can access a document library via windows explorer by going to the document library and choosing open in explorer from the actions menu. This creates a UNC path in the form of \\SharepointServer\Sites\SiteName\Process Guidance, which you can supply to WinMerge.

I have spent some time going over the default tasks that are created with a new CMMI based project to see what workstreams and activities they relate to, and I think I have a pretty good handle on the first two tracks. I plan on documenting this in a future post.

Requirements

Oil and Water, Superman and Kryponite, Me and Requirements. I am having some difficulties in creating a formal software requirements specification, using this book as a guide. It's not the books fault (although I wish it hand an end to end case study of a project), but rather a differing of opinion on some of the definitions (which that end to end case study might help with).

  • Where is the line between Use Cases and Functional Requirements? Use cases look a lot like test plans to some people, and have a tendency to add test plan like information to them, which I feel is incorrect.
  • Where is the line between systems and users in the use cases?
  • How much detail is the right amount of detail?

Similar to my quest to gain a better understanding in the use of TFS and the MSF for CMMI, I'm going to have to put some time into researching (primarily looking for examples) software requirements. In addition to the book, which we now have 6 copies of at work, I found this website with some additional templates, as well as fairly detailed article on writing requirements from the perspective of a technical writer. There appear to be some good articles over at wikipedia as well, such as Requirements Analysis and Use Cases, and Use Case Diagrams. Someone today asked the question about how do all the use cases get related, and I believe the answer is the use case diagram (at least one use for a use case diagram), as illustrated in the example on Wikipedia.

I hope to be able to report back with some answers to my questions sometime in the future.

NVidia Application Processor

Daily Tech had an article on the NVidia APX 2500 application processor which is designed to add hi-def capabilities to mobile devices. The article states that NVidia has been working with Microsoft, so once can assume (as does the author of the article), that this is destined for a Windows Mobile application.

I've really been giving my HTC Mogul a work out and have always wanted a all in one device (video, mp3, phone, PDA, etc), so I am very excited about this. Since I have a bias against Apple, I am not a fan of the iPhone, although I can appreciate and respect what it is. This gives me some hope that my next Windows Mobile phone will be a force to be rekon with.

In addition to smart phones, I can also see this making it's way to other embedded systems, especially something like a mall kiosk. This brings me to the second reason that I am excited, and that is, my current software project is all about embedded systems running Windows CE. I have some future customer requirements that could take advantage of the functionality provided by this chip.

Wednesday, February 13, 2008 5:14:14 AM UTC  #    Comments [0] - Trackback
Programming | Review For Future Projects
 Saturday, February 09, 2008

I am adding my name to the list of developers who have not heard about the InternalVisibleTo attribute. I came across this while checking out Derik Whittaker's blog in response to the email I got saying that Derik will be presenting at this month's Milwaukee area .Net Users Group.

The InternalVisibleToAttribute was added in .Net 2.0 and most people seem to be using it in order expose internal methods to external unit test classes. However, there is nothing to prevent you from using it in non-testing situations., although I have not seen a good reason other then unit testing to use it.

The MSDN documentation talks about the special case of applying the attribute to a strong named friend assembly. This is also a C# only attribute.

Saturday, February 09, 2008 7:33:18 PM UTC  #    Comments [0] - Trackback
Programming | Tools
 Friday, February 08, 2008

Scott Hanselman today announced the Asp.Net Wiki (Beta).

"The idea is that folks spend a lot of time trolling the blogs, googling live-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost."

I think it's a great idea and I hope to see other product groups at Microsoft follow suit. Since it's linked off http://www.asp.net, and a Microsoft entity, I see it quickly becoming the one stop shop for Asp.Net information.

If you jump on and contribute to the wiki right now, you could be a top contributor, at least for a couple of days.

Friday, February 08, 2008 11:34:45 PM UTC  #    Comments [0] - Trackback
Technology | Programming | Review For Future Projects
 Tuesday, January 29, 2008

ScottGu's latest blog post talks about the VS 2008 web deployment project and the MS Web Deployment Team blog, which deals with a web deployment tool (not to be confused with the VS 2008 project).

I had to do a little digging, but found this white paper on MSDN which explains the web deployment project for 2005. From the abstract:

Visual Studio 2005 provides deployment support through its Copy Web Site and Publish Web Site features. While these are ideal for many scenarios, there are other, more advanced scenarios where developers need the following capabilities:

  • More control over assembly naming and output.
  • Custom pre-processing and post-processing for the build.
  • The ability to exclude, add, and transform files and directories during builds.
  • The ability to modify the Web.config file to change database connection strings, application settings, or the URLs for Web references, depending on the build configuration. (For example, it might be necessary to use different values for development, test, staging, and release settings).

this white paper describes a solution to these advanced scenarios and introduces a new feature called Web Deployment Projects for Visual Studio 2005.

The web deployment tool on the other hand, is a stand alone tool (currently just a command line utility called msdeply.exe), "that provides support for deploying, synchronizing and migrating IIS 6.0 and 7.0."

It supports moving configuration, content, SSL certificates and other types of data associated with a web server. You can choose to sync a single site or the entire web server. Because we know that one tool can never ‘automagically’ guess what your application relies on, we’ve tried to be pretty flexible and powerful – you can customize exactly what you want to sync using a manifest file. You can also skip sites or other objects, or you can perform regular expression replacements during a sync (like changing the home directory on the destination machine).

 

These two new tools will help make deployment a lot easier and enable a more agile environment. Unfortunately my project assignment at work has changed, so I won't be getting direct exposure to these.

Tuesday, January 29, 2008 10:57:29 PM UTC  #    Comments [0] - Trackback
Programming | Tools
 Saturday, January 26, 2008

Wouldn't you know, by TFS warehouse is not updating. It seems like I have had this problem before, but today, it was a new error.

Today, I added 2 test projects to TFS, one for the MSF Agile (4.2) and one for MSF CMMI (4.2) to reference while I read Software Engineering with Microsoft Visual Studio Team System (thanks Larry). I'm not even through chapter one and I am hooked on this book. Chapter 1 was talking about the Reaming Work report, and I wanted to view it for the 2 test sites.

I was able to view the report for the MSF Agile site, but not the CMMI site. A quick look at the reports via the Reporting Services web management UI, and I had a pretty good guess that the warehouse was not updating because there were no iterations or areas listed for those report parameters.

I went checked out the TfsWarehouse.dbo._WarehouseConfig table, and saw that, yes, the warehouse stopped updating a couple of hours ago. My attempts to manually run the update using the web services interface via IE didn't seem to work. Remembering some of my previous troubleshooting, I went to the event log and found several errors, starting around the time that I created the CMMI project.

Event Type:    Error
Event Source:    TFS Warehouse
Event Category:    None
Event ID:    3000
Date:        1/25/2008
Time:        6:20:57 PM
User:        N/A
Computer:    [TFSServer]
Description:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 1/26/2008 12:20:57 AM
Machine: DATFSP100
Application Domain: /LM/W3SVC/1977639788/Root/Warehouse-4-128456993088380000
Assembly: Microsoft.TeamFoundation.Warehouse, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
  Process Name: w3wp
  Process Id: 8512
  Thread Id: 9920
  Account name: [ServiceAccount]

Detailed Message: The pending configuration changes were not successfully added to the cube because of the following error: System.Security.Principal.IdentityNotMappedException: Some or all identity references could not be translated.
   at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess)
   at System.Security.Principal.NTAccount.Translate(Type targetType)
   at Microsoft.TeamFoundation.Warehouse.OlapCreator.AddAccountToRole(Role role, String accountName, Boolean needToUpdate)
   at Microsoft.TeamFoundation.Warehouse.OlapCreator.SetupAnalysisDatabase(Server server, String analysisDBName, String accessUser, String[] dataReaderAccounts)
   at Microsoft.TeamFoundation.Warehouse.OlapCreator.CreateOlap(WarehouseConfig whConf, String accessUser, String[] dataReaderAccounts, Boolean dropDB, Boolean processCube)
   at Microsoft.TeamFoundation.Warehouse.AdapterScheduler.EnsureCubeIsUpToDate()

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

So started my Google Search. I came across a post on the MSDN forums which had some code to check to see if account translation is working on the network, and it appears to be (I got a SID value back for both my tfs service and tfs reports account)

 

   1: using System;
   2: using System.IO;
   3: using System.Text;
   4: using System.Xml;
   5: using System.Xml.Serialization;
   6: using System.Threading;
   7: using System.Security.Principal;
   8:  
   9:  
  10: namespace CheckAccountForTfs
  11: {
  12:  public class Program
  13:  {
  14:   public static void Main(string[] args)
  15:   {
  16:    try
  17:    {
  18:     string accountName = args[0];
  19:     Console.WriteLine(new NTAccount(accountName).Translate(typeof(SecurityIdentifier)).Value);
  20:    }
  21:    catch (Exception e)
  22:    {
  23:     Console.WriteLine(e);
  24:    }
  25:   }
  26:  }
  27: }

 

Continuing my Google search, I found something embarrassing, I had the same exception for TFS listed on a previous post, on my very own blog. My solution last time was to run (Make sure you replace Server with your TFS server name, as well as use FQDN for the service and reports account).

setupwarehouse -o -s Server -d TfsWarehouse -c Warehouseschema.xml -a Domain\TfsService -ra Domain\TfsReports -v -mturl http://Server:8080 -rebuild

I did not remove the TFSWarehouse from Analysis Server before running this command. Also, the setupwarehouse command is in %Program Files%\Microsoft Visual Studio 2008 Team Foundation Server\Tools.

Eureka, manually invoking the warehouse job from the web service via IE actually starting processing, and with no errors in the Event Log. Looks like I might have to create a batch script to keep on the TFS server in case this happens again. I also need to search my own blog a little more carefully next time.

While I was trying to get the Remaining Work report to display initially, I somehow managed to mess up the parameter definition for Iteration and Area. I fixed this by saving the report (Go to the report's properties and click edit), along with another report with the at least those 2 parameters. Once saved as a text file, I copied the ReportParam element for both parameters from the good report to the bad report, then uploaded the fixed report back to reporting services. Problem solved.

Saturday, January 26, 2008 1:24:49 AM UTC  #    Comments [0] - Trackback
Programming
 Sunday, January 06, 2008

I jumped back into some compact framework development this weekend, and it was the first time since I had installed VS 2008 RTM. I went to connect to one of my CE devices via Visual Studio 2005, and was unable to connect. I also tried the remote performance monitor power toy.

I finally went to check on what version of the CoreCon files I had installed, and noticed right away that there date modified was 11/7/2007. I coped these latest versions over to my CE device, and was able to connect again.

Sunday, January 06, 2008 8:23:01 PM UTC  #    Comments [0] - Trackback
Programming
 Tuesday, January 01, 2008

Today's task, a somewhat detailed code analysis of one of our Windows CE projects. In addition to reviewing from a lead architect point of view (design and implementation), I also needed to take a look at general coding practices. For this I turned to the Code Analysis tool in Visual Studio, and NDepend.

I had remembered reading about NDepend on Scott's blog, and went back there to re-read his post. I highly recommend it, as it's a great quick start and introduction to NDepend. Scott also has a pod cast available, and the the NDepend web site has links to several video tutorials showing how to use it.

One thing I found lacking, was there were no support forums on the NDepend web site. I had a couple of issues getting my Compact Framework application to be property recognized by NDepend. The main issue, was NDepend was trying to use the full framework version of System.Data instead of the Compact Framework version. I noticed that there was an option when selecting assemblies to resolved missing ones (well, some it let me, others it didn't), and figured the resolved location was stored in the project configuration file. So I opened it up in note pad and sure enough, there were all the directory paths.

I removed all of the paths that were added by default, and added my own paths to my project. I also added paths to the SQL CE 3.5 directory, as well as the location of the compact framework dlls (See update below). Unfortunately I still had issues with NDpend detecting multiple dlls (System.Data and System.Windows.Forms) with the same name. I decided to remove the path statements for everything except my project. This resulted in warning about not being able to resolve dependencies, but the analysis completed.

There is allot of information presented, almost to the point of information overload. I highly recommend printing out and reviewing the NDepend placemat as a quick reference. I concentrated primarily on the metrics, which use NDepend's Code Query Language to identify possible problems. I found myself viewing all of the queries to figure out what they were looking at. The documentation of the queries is excellent, and each one includes a link to the NDepend web site which defines the metric is pretty good detail.

I am quite impressed with the amount of information that NDepend gave me about my project. There were/are a few usability issues, but they can be overcome. I hope that I can continue to find time to make use of this excellent tool. I spent some time watching the video tutorials, and they were very helpful. I've been trying to get a side project started at home to try out all the tools, techniques, patterns, etc that I don't have time for at work, and this will definitely find it's way onto my to do list. I think it will be very interesting to use this from the beginning and see how the different metrics change as I build out my project.

Update:

  • 1/2/2008 - After watching the videos, I discovered that when you are setting up your project in VisualNDepend, there is a screen that lest you add/remove directories in the application. This is much easier then editing the project file manually like I was initially doing.

Other Links:

Tuesday, January 01, 2008 6:01:14 PM UTC  #    Comments [0] - Trackback
Programming | Review For Future Projects | Tools
 Thursday, December 27, 2007

Inversion of Control (IoC) and Dependency Injection (DI) are two practices, patterns, techniques, that I have been very interested to take a look at in greater detail. I came across a tutorial (the tutorial) which goes over IoC and DI using the Castle Windsor Container (and Micro Container), part of the Castle Project. Two other similar implementations presented in the tutorial are Spring.NET and StructureMap, as well as Microsoft's ObjectBuidler DI framework. The ObjectBuilder framework is used in the Enterprise Library, and Composite UI Application Block (CAB), which is good enough for me to steer clear of it and try out the Windsor Container instead.

I have never really been impressed with the Enterprise Library, and the CAB seemed overly cumbersome. Granted, it has been over a year since I last looked at the CAB and EntLib in any great detail, so maybe things have gotten better. I know allot of people live and breath EntLib, but I'm trying to experience some other thoughts outside the typical Microsoft sphere, such as Alt.Net. Microsoft is starting to catch onto the Alt.Net movement especially with the introduction of the Asp.Net MVC framework, a topic for a future post.

Part I

So what exactly is inversion of control? It helps if you consider how an application is traditionally written and define what "control" means. "Control" can be thought of as adding references to various assemblies, declaring instances of specific specific classes by calling the appropriate constructor and passing in parameters. The tutorial refers to this as a "canonical programming process". Now if we take the opposite, or invert the control, then our application does not reference specifically assemblies and does not instantiate concrete classes. Instead your application makes use of interfaces or abstract classes and relies on a framework to instantiate the classes as needed. This is commonly referred to as the Hollywood Principle, and what post on design patterns would be complete without a link to Martin Fowler.

The tutorial talks about another design principle, which is the separation of concerns (SoC). Separation of Concerns states that a component should do only one task, and do it very well. In the tutorial's example application, the functionality to download HTML data should be separated from the logic to parse the HTML itself. By separating the two pieces and applying IoC, if a new, faster algorithm for parsing was written, it could be swapped out with the original with no modification to the application. Under a traditional model, you would have to edit the single class, change the parsing routine, and then recompile the class and application. Then what happens when management says, "well the first algorithm was slower, but it was written by the boss's nephew....".

The tutorial defines a component as: "... a small unit of reusable code. It should implement and expose just one service, and do it well. In practical terms, a component is a class that implements a service (interface). The interface is the contract of the service, which creates an abstraction layer so you can replace the service implementation without effort."

The power of an Inversion of Control framework does not become apparent until you have components with dependencies on other components, each with their own dependency. The Castle project refers to it's IoC as a container which is offered in two versions. The first exposes the core IoC functionality and is called the MicroKernel. In the simplest of terms, you add components by specifying a key (ID), type and assembly to load. You then ask the container for an instance, which it returns, loading all required dependencies. The 2nd version of the container, Windsor, extends the Micro Kernel and is used most often. It adds supports for generics to reduce casting and external configuration (app.config and web.config) options to name a few.

Part II:

  • Constructor, Setter, and Component Injection
    • Constructor arguments, and [property] setter arguments can be specified in the configuration file.
    • If more then one component of a service is specified, you can specify which component to use, using the ${ComponentName} syntax in the configuration file.
    • The name of the XML Elements in the configuration file should match a constructor parameter and property name.
  • Collections in the configuration file
    • Arrays, Dictionaries and Lists can be specified in the configuration file.
    • This allows you to pass in a collection of components and allow the parent container to decide which one to use.
    • Collections can be specified for constructor parameters and property setters.

Part III

  • Separation of configuration and data
    • The configuration file can get complex pretty fast, especially when you are specifying a large set of data for a collection.
    • Windsor allows you to work around this by moving the data to the top of the configuration file under a <properties /> section. Child elements can be referenced in the configuration section by using the #{ChildPropertyName}
    • The tutorial points out that the real power of this, lies in the fact that you can put the properties in a separate file.
  • Custom Converters
    • Windsor supports converting from strings (in the configuration file) to other types.
    • You need to implement AbstractTypeConvertor, and a new class inheriting from WindsorContainer to register your TypeConvertor
  • Decorator Pattern
    • The decorator pattern basically has you wrapping a component that implements IInterface, with another component that implements IInterface, taking the original component as a constructor parameter.
    • Once you have the new implementation, you can perform things like benchmarking around specific method calls.
    • Since everything is setup via the configuration file(s), there was no need to re-compile the main container.
  • Define and If
    • Windsor supports an IF/Else syntax in the configuration file
    • Windsor also supports using DEFINED variables, such as DEBUG. This is not the same as the compiler flags, you have to add your own DEFINE statements in the configuration file. this can be in either the main component configuration, or your properties configuration.

Party IV

  • Lifestyles
    • Windsor supports 4 object lifecycles
      • Singleton (Default) - Each call to Resolve returns the same instance
      • Transient - Each call to Resolve returns a new reference
      • Thread - Each thread gets a single instance
      • Pooled - Instances are retrieved from a pool. If there are no more available instances in the pool, a new one is created. All instances are created upon the container being instantiated. 
      • Custom
    • Specify the lifestyle using attributes (i.e. [Transient]), or via the configuration file
  • Facilities
    • From the official documentation (taken from the tutorial): Facilities augment the MicroKernel capabilities by integrating it with a different project or technology, or by implementing new semantics.
    • Built in facilities (Covered by the tutorial):
      • Factory - Allows you to use classes which implement an Interface but use the factory pattern
      • Startable - Components are "started" as soon as possible after the application is started, and stop when it's released. You can implement an IStartable interface, or, specify start and stop methods in the configuration file.
    • The logging facility is mentioned as one being worth while to investigate, but it's not covered.
  • Commission and Decommission
    • Implement the ICommission and IDecommission to specify code which should be run when the component is created and destroyed by the container. Depending on the lifestyle chosen, the actual time at which the decommission code is called varies, and without understanding this, you may get unexpected results.
  • IDisposable
    • If you implement IDispoable, the container will automatically call the dispose method when the component is no longer needed. 

Questions:

  • Is there a utility that can analyze an assembly, namespace and/or class and generate a skeleton configuration file?
    • The StructureMap lists some tools that make configuration file management easier.
  • Other ways to store configuration data. It would be great if you could load configuration, or the properties from a SQL data store.
    • StructureMap supports full programmatic configuration.

Conclusion:

I can't wait to try out the Micro Kernel and Windsor Container in a project. The flexibility is phenomenal, and the decorator pattern makes it extremely easy to extend functionality.  I only took a quick look at the StructureMap and Spring.Net, and they have some interesting features which need further investigation.

Thursday, December 27, 2007 4:10:24 AM UTC  #    Comments [0] - Trackback
Programming
 Sunday, December 09, 2007

It seems as if there is someone at Microsoft, who's sole purpose in life is to figure out how I might want to use something (WCF), and then make sure I can't use it in the way I want to. Today's issue, programmatically configuring a WCF client application.

Background

I have created a central repository store in the form of a SQL database, that put simply, contains key/value pairs that I can query. All of my applications (or each machine.config) only need to specify a single database connection string to this configuration database.  All other configuration settings are retrieved from the database (and cached), making it easy to keep track of configuration, view all current configuration settings, and deploy the applications on new servers.

Expanding upon my simple definition, there is a second "key", which corresponds to what environment (production, staging, development) the application is deployed. So my single configuration database controls the configuration of all applications in all environments. For those settings which are the same across all environments, no deployment key is specified.

So far this has worked great, and I wanted to add configuration information about a WCF client service.

WCF

WCF needs two properties set, a binding, and an endpoint, and each of these 2 properties have sub properties which may or may not have values that need to be set. Out of the box, WCF is most easily configured using application or web configuration files. All of the tools support the configuration files and it's easy to see what's going on (well sort of).

I basically wanted to take the XML sections that define the binding and endpoint, and place it into my configuration database. For some reason, I got it in my head that this would be really easy to do, but found out that it's not. Searching thru Google yielded no direct solution. While you can programmatically set the Binding and Endpoint properties of a proxy class client object, I would either have to have 1 setting per property (and sub property) in my configuration database, or come up with an XML schema, parse the schema and set the values. This was the path I was pursing, but instead of making my own schema, I just used the XML configuration schema provided out of the box, in hopes that one day I could just pass those sections to binding or endpoint objects and have it parse for me.

After creating classes to parse a single binding (WsHttpBinding), I decided there must be a better way.  The code to parse the configuration files must exist somewhere in System.ServiceModel, so I decided to go spelunking using reflector to see what was going on, and determine if I could hack something together.

Implementation

Overview

After spending a couple of hours in reflector, I realized the main roadblock was the use of the System.Configuration namespace to handle the configuration data for System.ServiceModel. System.Configuration only supports the file system, and provides no extension methods at this time (something I'd like to see from Microsoft in the future).

This left me with one option, which was to create temporary XML file with my configuration data from my database, and then read that configuration file using the proper classes/methods in System.Configuration. It took me awhile to accept this option, as writing a temporary file seemed messy, but then I realized, temporary files are a fact of life in .Net, programming, operating systems, etc.

Configuration Store

My configuration store was already defined as I mentioned previously. The 2 XML samples below are stored as separate entries in my configuration database. Below is the XML I stored for handling the bindings:

<bindings>
 <wsHttpBinding>
  <