Posts
243
Comments
24
Trackbacks
13
December 2006 Entries
WCF and Sharing Data Contracts

A nice feature of Windows Communication Foundation ("WCF"), and specfically, the svcutil.exe utility for generation of proxy code (it has a few other uses - one other nice feature is the pre-generation of serialization code) is having it share Data Contracts contained in a shared assembly on both the sender and receiver.

The /reference switch provides this capability - below is the /? help from the command line:

/reference: - Reference types in the specified assembly. When generating clients, use this option to specify assemblies that might contain types representing the metadata being imported. (Short Form: /r)

Now, this probably violate some core SOA tenets with regards to WSDL or Schema based contracts, but if you're in an all .NET world, or you've got ownership of both sides of the wire (or service boundary) then this does help a bit.

In ASMX a couple of ways to do it was to hand-code the proxy or use WSDL.exe and then comment out the type you want to share inside of the generated code.  Now, with the /reference switch for svcutil.exe this does the same thing.

 

posted @ Sunday, December 31, 2006 12:20 PM | Feedback (0)
When a property isn't a property...

I spend about 95% of my time, when coding, in C#.  So, recently rolled onto a project that had built a framework using VB.NET (that's the first indication of trouble).

So, I see something like the following when trolling through the code:

Public Class PoorClass

    Public ReadOnly Property BadProperty(ByVal aParm As String, ByVal bParm As String) As String

        Get

            Return "This isn't really a property anymore"

        End Get

    End Property

I had no idea you could add parameters to a property.  Turns out, it's only possible in VB.NET that I've seen.  You can't do this in C# - and with good reason.

The problem with the above code (other than the total verbosity of VB.NET itselft) is it violates a core concept of what an object is: something described by "state" and "behavior" - or for .NET we can use Properties (and fields) and methods.  So, a property is supposed to be an object's state.  But if we're passing in parameters, it now has become a "method".

From Wikipedia (Object (conputer science))

In the case of most objects, one can access the data members only through the method members, making it easy to guarantee that the data will always remain in a well-defined state (class invariants will be enforced). Some languages do not make distinctions between data members and methods.

Three properties characterize objects:

  1. Identity: the property of an object that distinguishes it from other objects
  2. State: describes the data stored in the object
  3. Behavior: describes the methods in the object's interface by which the object can be used

So, this to me violates the core concepts of objects. 

The Java world has had Javabeans that provide designer support for interpreting method names such as get_, set_, Is_.  Ultimately, they all boild down to methods in the bytecode, and in .NET methods, but it's about "object thinking".  And the framework that I'm looking at violates that principle.  And a misuse of a capability that probably should be prevented in the first place by the compiler - but that's when you get a bunch of VB.NET programmers, with VBA & VB6 as their heritage, building an OO based framework that should be re-usable across any .NET language.

In fact, if I try to consume this from C# it looks more like magled IL, but nonetheless, consumable:

    BadLibrary.PoorClass c = new BadLibrary.PoorClass();

    c.get_BadProperty2( "test" );

 We see the property looks like a method with the "accessor" verb (get_) prefixed.  This is what the IL looks like that's emitted from the VB.NET compiler.

.property string BadProperty {

     .get instance string BadLibrary.PoorClass::get_BadProperty(string, string)

}

So, it's a property.  Just doesn't act like on, nor does it appear as such to C#.  Here's the real method in the IL that's consumed from C#:

.method public specialname instance string get_BadProperty(string aParm, string bParm) cil managed {

   .maxstack 1

   .locals init (

     [0] string text1)

   L_0000: nop

   L_0001: ldstr "This isn\'t really a property anymore"

   L_0006: stloc.0

   L_0007: br.s L_0009

   L_0009: ldloc.0

   L_000a: ret

}

 

This is just a single example of numerous issues that I've seen.  The framework is ripe with magic numbers, hungarian notation, type name abbreviations that are more cryptic than valuable, overly complex nesting of interface implementations.  And that's just the code.

posted @ Sunday, December 31, 2006 12:06 PM | Feedback (0)
Backup for Vista that Works and Gives you Control

Need a backup tool that let's you take control?  Vista's backup just plain stinks.  Microsoft is supposed to release NTbackup.exe for Vista after public RTM as internally the reasons for dropping it were trashed.  Who knows what they were thinking.

But, this tool works on Vista... 

Link to 2BrightSparks | SyncBackSE | Features

posted @ Thursday, December 28, 2006 12:23 PM | Feedback (0)
CPU Monitor Updated - 1.3 Posted.

Finally got the "right" bug... Shutdown / Logoff working correctly. 

posted @ Tuesday, December 19, 2006 6:42 PM | Feedback (0)
CPU Temperature Monitor

!!! STILL A MINOR BUG - WILL BE UPDATED TONIGHT - 12/19/2006!!!

Updated 12/18/2006 - fixed issue with not listening for Microsoft.Win32.SystemEvents.SessionEnded event - can't logoff/shutdown issue

Updated 11/24/2006 - added check if system implements the required WMI objects.

Updated 11/30/2006 - fixed GDI memory leak

Given the issues with Toshiba laptops running very hot with Vista Glass Aero enabled, and just in general with XP as well ( Hot enough to burnout motherboards that require replacements from the manufacturer)  I wrote this utility to give me system tray status on the current CPU temperature.  I'm currently adding GPU temperature but that requires distribution of licensed components (dynamic libraries).

Installation Files - a self extracting Exe file that contains the MSI installer - built with WinRar.

Solution Files - only contains projects with no private certificates - you'll need to change some things to get it working.

Basically, it just sits in your system tray showing the current CPU temperature with the following color schemes:

  • Green - Running at below 50% of critical temperature
  • Yellow - Running at > 50% but < 75% of critical temperature
  • Red - Running >= 75% of critical temperature.

These settings are configurable if you modify the TemperatureMonitor.exe.config file, along with the maximum readings.

The first reading shown is the current CPU temperature; the second is the Critical Temperature as reported by WMI. 

The WMI namespace and object is root\WMIMSAcpi_ThermalZoneTemperature

WMI unfortunately requires elevated permissions on Vista.

The task bar icon has 2 menu options;

  • Restore - restores the window as shown below
  • Exits the application

The main window is show below:

  • The first tab just shows a Line Plot of the history of readings
  • Second tab is a list of those readings
  • Third tab is used for diagnostics and has a list of any exceptions.  There's also a file written to the application directory but it only has the last exception
  • The last tab is the about box that also has the "Install Public Certification" action button on it.

The assembly is signed with my sample signing certificate.  If you click on the about box you can install the public certificate but it still requires user action to launch in Vista given UAC restrictions and Windows Defender doesn't recognize the program.

Use at your own risk!!!

 

Some users are reporting issues.  This is dependant upon specific WMI obects being present and implemented on your system.

To Test, put the following into a VBS file, then run the following script from an elevated command prompt as follows:
cscript CpuTemp.vbs
============
''''On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM MSAcpi_ThermalZoneTemperature",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "MSAcpi_ThermalZoneTemperature instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "CurrentTemperature: " & objItem.CurrentTemperature
Wscript.Echo "CurrentTemperature: " & objItem.CriticalTripPoint
Wscript.Echo "CurrentTemperature: " & objItem.ThermalStamp
Next

posted @ Monday, December 18, 2006 7:17 PM | Feedback (0)
VMWare to Microsoft VPC converter...

Link courtesy of Greg Duncan...

http://coolthingoftheday.blogspot.com/

Link to Files

posted @ Monday, December 18, 2006 4:37 PM | Feedback (0)
Slipstreaming the VS.NET 2005 SP1 Installation

Answers to my prayers - kind of.

Good post on slipstreaming the SP1 patch into a Visual Studio 2005 Fresh Installation.

http://blogs.msdn.com/heaths/archive/2006/12/16/slipstreaming-visual-studio-2005-service-pack-1.aspx

posted @ Monday, December 18, 2006 8:36 AM | Feedback (0)
Verizon Triple Play now in NJ

Sorry about the advertisement, but been using Verizion FiOS since August and it's by far the best Internet service I've had.  I live in a fortunate area that was wired, I mean "fibered" early on.

Now, TV is ready - here's the list of towns that are on the initial list which begins this Monday:

http://www22.verizon.com/about/community/nj/nj_pdfs/Deployment_Schedule_Public.pdf

http://www22.verizon.com/about/community/nj/

Who says NJ sucks?  Well, it actually has the highest taxes, most populated, higest car insurance rates, and of course Camden and Newark.  But what the hell, we have FiOS!!!!

posted @ Sunday, December 17, 2006 2:13 PM | Feedback (0)
Firefox 2.0 Freeze Up on Vista

 I've been running FireFox 2.0 for some time and have noticed way too many Freeze-ups causing me to kill the process somehow.

Funny thing is, when Vista's Crash Analysis comes back it indicates that "Firefox has a new version" - but when I check for new versions from within Firefox it comes back indicating I have the latest.

So, disabling some of the extensions that come with Firefox seems to have done the trick.

Generally, I run Google Toolbar & Google Browser Sync.  I also checked yes on installing both the DOM Inspector and Talkback.

So, I started out with all disabled - No lockups.

Then, just turned back on the 2 Google extensions (can't live without em). Still no lockups.

So, I've disabled Talkback and DOM Inspector and all is good.  You'd think that the core extensions that the Mozilla team distributes with the browser would be the most tested.  My guess is Google's are just becuase of the deeper pockets.

posted @ Sunday, December 17, 2006 8:54 AM | Feedback (1)
Visual Studio 2005 SP1 - Microsoft Please create a new Clean Install Version!!!! Refresh the New Installation Media

If it takes 30+ minutes and on some machines 1+ hour to install SP1, why not refresh the installation media so that a clean install contains SP1?

Microsoft wake up!!!  Churn is bad enough but many of us wipe machines and restart projects with clean hardware.  If we've now got up to 2 hours just for VS.NET that's a killer.

posted @ Friday, December 15, 2006 9:03 AM | Feedback (0)
Heath Stewart's Blog : Save Time and Space for VS 2005 SP1 by Disabling the Patch Cache

Good pointer for those that can't wait :) Sorely needed SP1 is out soon... 

Link to Heath Stewart's Blog : Save Time and Space for VS 2005 SP1 by Disabling the Patch Cache

posted @ Thursday, December 14, 2006 3:29 PM | Feedback (0)
DevDiv Hotfix Public Availability Pilot Program

This is a great move on Microsoft's part.  Could never understand the hoops general folks need to go through to get Hotfixes.  Especially for Visual Studio.... 

Link to DevDiv Hotfix Public Availability Pilot Program

posted @ Thursday, December 14, 2006 2:01 PM | Feedback (0)
Excellent Example of Factory Pattern using Generics and Configuration

Just had to bookmark this one...

 

http://www.softinsight.com/bnoyes/PermaLink.aspx?guid=f9834693-e992-4bf1-9408-1ab8d2cb518c

posted @ Thursday, December 14, 2006 9:28 AM | Feedback (0)
Pro WCF - Index has been created...

The book I particpated on (Pro WCF: Practical Microsoft SOA Implementation) finally has had the index created.  It's getting close to publication date, I'm told January.  This has been a long road, actually inception goes back 2 years.  Timing is good as we're up to RTM on the content & code.

An index is fundamentally how I judge a book. Generally, tech books you pick up, read in the reading room, but refer back to it for concepts starting at the TOC or the Index.

This one's rich...

posted @ Wednesday, December 13, 2006 7:58 PM | Feedback (0)
Profits rise at Microsoft joint venture - Avanade

Nice blurb on how we're doing!!!! 

I like the relation to how we're doing is an indication of the uptake of Microsoft products in general.  1/2 a billion ain't bad for a company that's only 6....

 

Link to Profits rise at Microsoft joint venture

posted @ Wednesday, December 13, 2006 7:45 PM | Feedback (0)
.NET 3.0 Training Content - InnerWorkings - Catalog

A bunch of  .NET 3.0 Training related materials.  Haven't sampled, but I think I'll be trying out the WF Custom Activities module.  I'll let you know how good the content is....

Link to InnerWorkings - Catalog

posted @ Wednesday, December 13, 2006 7:41 PM | Feedback (0)
XSD Object Generation for .NET 2.0

Today I needed a "better" XSD for .NET 2.0.  The one with .NET 2.0 is "ok", but in .NET 1.1 there were a couple of nice tools to help with Xml serialization in creation of better types, more complex types (nesting, etc.)  from Xsd.  Also an Inference tool.

XSDobjectgen is a tool that is used to generate objects from XSD files. But XSDobjectgen was built using framework 1.1 and hence does not use the new framework enhancements like generic class, partial types etc.

http://devauthority.com/blogs/ram_marappan/archive/2006/10/03/4755.aspx

 

For .NET 1.1 we had:

XSDObjectGen - Sample Code Generator 1.4.2.1

http://www.microsoft.com/downloads/details.aspx?FamilyID=89E6B1E5-F66C-4A4D-933B-46222BB01EB0&displaylang=en

XSD inference tool - generate a schema from Xml..

http://download.microsoft.com/download/8/0/f/80fca9f1-292e-4b50-b512-ccf004d4b58e/xsdinference.exe

posted @ Friday, December 08, 2006 8:20 AM | Feedback (0)
GeeksWithBlogs MetaBlog API service endpoint...

I've been doing lot's of machine rebuilding as of late.  Each time I have to re-setup a blogging tool, I can never remember the GeeksWithBlogs Uri to use.  So, here it is to remember.... 

http://www.geekswithblogs.net/<account>/services/metablogapi.aspx

This is an old engine as the CS folks have changed that structure quite some time back (CS 1.0 I believe).

posted @ Friday, December 08, 2006 7:44 AM | Feedback (0)
Visual Studio 2005 Team Edition for Database Professionals – now on MSDN Downloads

Been working with, and did quite a few demos during my short stint with Microsoft, VS 2005 Db Pro. The tool is Microsoft's 1st real entry into bringing the Database team into the Visual Studio experience. So, if anyone believes that DB Projects in VS as they exist prior to DB Pro were real tools, I'm suggesting you take a look at this immediately. The tool takes advantage of Per User Instancing of SQL Express in the design time part of using the Tool. So, all validation is done direct against a working version of SQL 2005 (SQL Express in a User Instance).

It also has nice schema and data comparison tools, along with data generation, and integration with the testing tools as part of Team Suite. The DB tests actually provide a nice abstraction layer over the C#/VB.NET code underneath the test. So, DB Administrators, developers, testers don't have to know C#/VB.NET to write tests. The following is from the MSDN Site:

Visual Studio 2005 Team Edition for Database Professionals delivers a market shifting database development product that provides a foundation for managed database evolution through the use of an offline, visual studio project-centered source code control system together with a suite of tools designed to streamline database changes and help understand the impact of proposed changes. Schemas, DML and metadata can be versioned, unit tests can be created and executed to ensure quality, and comparisons can be made with test and production systems prior to deployment. Integration with Team Foundation Server helps increase the productivity of the database professionals by enabling them to become an integral part of the application team.

With Visual Studio 2005 Team Edition for Database Professionals users can:

•    Take control of database change by leveraging an offline, version-controlled representation of the database which is the one true version of the database schema

•    Improve software quality by automating database testing using integrated unit testing and data generation features

•    Be more productive when making changes to the database using powerful T-SQL and refactoring tools

•    Deploy incremental updates using powerful comparison, build and deploy functionality for the database

•    Improve collaboration and communication between all team members through integration with Team Foundation Server

posted @ Friday, December 08, 2006 7:44 AM | Feedback (0)
Forcing the Upgrade Issue - Only way to get a fix is to Upgrade to Vista?

I was setting up a Virtual Machine from a sysprep image, and I came back to the system and on the screen was the following message - guess Microsoft is forcing the upgrade path.  Guess what I put in that survey....

posted @ Tuesday, December 05, 2006 7:27 PM | Feedback (0)
News





Tag Cloud