david's profileDavid Yardy PE, MCSD.NET...PhotosBlogLists Tools Help

david yardy

dyardy
Xbox Live GamerCard
Rep:
5/5 stars
Score:
1756
Zone:
Family
Modern Warfare® 2FIFA 10Call of Duty: WaWCall of Duty 4Mad Tracks
No list items have been added yet.

David Yardy PE, MCSD.NET http://www.davidyardy.com)

January 25

.NET 3.5 SP1 : How to tell if it is installed?

Ever want to know if you have 3.5 SP1 installed?  Shown below are two ways to determine.

1.) Take a look at HKLM\SOFTWARE\MICROSOFT\NET Framework Setup\NDP\v3.5

Shown below are two servers.  The top one does not have SP1 installed while the lower one does.

image

2.) An easy way to see if you have 3.5 SP1 installed is to navigate to http://www.hanselman.com/smallestdotnet/ Near the top of this page you will be given an indication if you have the latest installed.

image

 

If you do not have it installed you can use the following link to navigate you to Microsoft Downloads for Microsoft .NET Framework 3.5 Service Pack 1.  This link will installed a small installer that will need to be executed.  A wizard will step you through the installation and additional downloads.

If you prefer a complete download of this SP1 you can use this link.

December 07

String Literals and C#

I was looking for some utility that would take a very long string and convert it to vb.net or c# with line continuation(s) characters. String literals to the rescue.  C# supports two forms of string literals: regular string literals and verbatim string literals. 

A regular string literal consists of zero or more characters enclosed in double quotes, as in "hello", and may include both simple escape sequences (such as \t for the tab character) and hexadecimal and Unicode escape sequences.  In c# regular strings can only span multiple lines with syntax similar to the following:

string sql = “SELECT customer “ +
                  “FROM customers “ +
                  “WHERE custId=10”;


A verbatim string literal consists of an @ character followed by a double-quote character, zero or more characters, and a closing double-quote character. A simple example is @"hello". In a verbatim string literal, the characters between the delimiters are interpreted verbatim, the only exception being a quote-escape-sequence. In particular, simple escape sequences and hexadecimal and Unicode escape sequences are not processed in verbatim string literals.

The above sample can be replaced with the ‘literal’ designated by the @ symbol as follows:

string sql = @“SELECT
                  FROM customers
                  WHERE custId=10”;

July 11

New Blog Location

I have moved my web log to the following location http://blog.davidyardy.com/

My RSS feed can be found at http://feeds.feedburner.com/davidyardy From this RSS feed you can view all log entries on my new and old blog location.

It was time to move my blog back to my own domain.  It was on that domain for quite a while then as it was short some features I moved to Spaces.  Now once again I am back to my own territory/domain.  Given a little time I hope to re-brand the blog and related web site.

June 17

Coding Emails on Vista

Microsoft removed the SMTP server on Vista.  As a result any email testing on your development box will need to address this change.  Most developers will discover this through some exception after they try to run their application locally.

Two options

  1. Use a free SMTP Server product locally http://softstack.com/freesmtp.html or http://www.smartertools.com/Products/SmarterMail/Free.aspx.  Both of these are very lightweight are quite simple installations.
  2. My preference is to configure mail settings to use a pickup directory.   See below…

Mail Settings Configuration – add the following to your web.config.  After making the modifications to your web.config all emails sent will be in .eml file format.  There are a number of benefits such as no more waiting for emails to be sent and also that you can monitor all emails generated from your application.

<system.net>
  <mailSettings>
    <smtp deliveryMethod="SpecifiedPickupDirectory" from="no-reply@mydomain.com">
      <specifiedPickupDirectory pickupDirectoryLocation="C:\temp\emailOutput\" />
    </smtp>
  </mailSettings>
</system.net>

Check it out.

June 16

Vista – Fix Folders

You may have noticed that if you modify the view settings for a folder in Windows Vista and then for some reason some graphics files are dropped in the directory the view settings will be reset.  I have struggled with this for a year.  I would keep setting the view defaults (showing date modified etc.) and then a week or so later the columns would reset.  Well, here is the fix for this. 

Save the following code in a file with the .bat extension and run this file.

setlocal

set BASE_KEY=HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell

:: Delete cached folder views
reg delete "%BASE_KEY%\Bags" /f
reg delete "%BASE_KEY%\BagMRU" /f

:: Set default folder template
reg add "%BASE_KEY%\Bags\AllFolders\Shell" /v FolderType /d NotSpecified

:: Restart Explorer
taskkill /f /im explorer.exe
start explorer.exe

 

Well worth the small effort.

Consolas for you Command Prompt

Use the following reg add command to add the Consolas to your command prompt window

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont" /v 00 /d Consolas

In the end after opening the defaults for the command window you end up with a very pleasant change.  This tip looks like it has been around for a while but I recently stumbled upon it.

image


image

May 14

Vista and Visual Studio: Error: Web site worker process has been terminated by IIS

"The web server process that was being debugged has been terminated by Internet Information Services(IIS).  This can be avoided by configuring Application Pool ping settings in IIS."

 image

  Very easy fix by following these instructions....

  1. Open the Administrative Tools window.

  2. Click Start and then choose Control Panel.

  3. In Control Panel, choose Switch to Classic View, if necessary, and then double-click Administrative Tools.

  4. In the Administrative Tools window, double-click Internet Information Services (IIS) Manager.image

  5. In the Internet Information Services (IIS) Manager window, expand the <computer name> node.

  6. Under the <computer name> node, right-click Application Pools.

  7. In the Application Pools list, right-click the name of the pool your application runs in, and then click Advanced Settings.

  8. In the Advanced Settings dialog box, locate the Process Model section and chose one of the following actions:

    1. Set Ping Enabled to False.

      —or—

    2. Set Ping Maximum Response Time to a value greater than 90 seconds.

    Setting Ping Enabled to False stops IIS from checking whether the worker process is still running and keeps the worker process alive until you stop your debugged process. Setting Ping Maximum Response Time to a large value allows IIS to continue monitoring the worker process.

  9. Click OK.

  10. Under the Services and Applications, click Services.

    A list of services appears in the right-side pane.

  11. In the Services list, right-click Terminal Services and then click Properties.

  12. In the Terminal Services Properties window, locate the General tab and set Startup type to Manual.

  13. Click OK to close the Advanced Settings dialog box.

    Close the Internet Information Services (IIS) Manager window and Administrative Tools window.

May 12

MVC Resources - including links to UI MVC Validation

MVC is a framework methodology that divides an application's implementation into three component roles: models, views, and controllers.  Interested...check out the following very excellent list of resource that can be found here

May 10

Visual Studio AddIn RockScroll

Very nice add-in which modifies the vertical scrollbar inside of Studio 2005/2008.  The download is small and can be turned off very easily through the Tools-Add Ins menu.

DownloadDownload Rocky Downs' RockScroll for Visual Studio

RockScroll

No more toolbars and buttons! - Keyboard only!

If you are a user that lives in an application day-in/out you must force yourself to learn the shortcut keys (at least until voice recognition becomes efficient).  For developers, simply remove the toolbars which immediately forces you to the shortcuts.

Very quickly you will notice clear clutter free IDE.

If you need assistance use the following to help out Visual Studio 2005 Keyboard Shortcut Posters

May 03

Windows Explorer (add to your tools menu) in Visual Studio

I often need to open Windows Explorer and browse to the current file, folder, or project that I am working on in Visual Studio. This tip allows you to achieve this by clicking "Windows Explorer" in the Tools menu, and is one of the most simple-yet-useful tips I know of.

To set it up, click Tools, then External Tools..., then click Add.  Now enter the following data:
Title: Windows Explorer
Command: explorer.exe
Arguments: /select,"$(ItemPath)"

Leave Initial directoy blank, and click OK.  Now when you click Tools, Windows Explorer, Windows Explorer will open with the current file you are editing selected.

 

Adding Windows Explorer to the toolbar

image

Right click on toolbar and select customize.   Select 'Tools' and if you have not added other External tools then select "External Command 2".  After you drag External Command 2 to the standard toolbar it will change to Windows Explorer.

image



I have also set the Alt-E key to open Windows Explorer also by selecting "Keyboard" and finding Tools.ExternalCommand2 and setting Alt-E as the shortcut.


image

Label to a form input field

If you set a label to a form element set the AssociatedControlID property. This will force the label to render as <label> rather than <span>. A benefit of using the AssociatedControlID property is that clicking a label when this property is set automatically changes the form focus to the associated form input.

May 01

Visual Studio 2008 Offline Support

When saving files from within Studio I was prompted  to "Save As", "Overwrite", or "Cancel".  I thought it was very odd.  I then looked around and noticed that none of my files displayed the typical source control lock.  It looked like my solution was not connected or related to source control.

For some reason I had lost my connection to Team Foundation (Source Control).  Confused for a little... I then noticed that VS.NET 2008 had this "Go Online" option. 

Nice...offline support for source control is now built into Studio 2008.  In 2005 there was an add-on tool to review and reconnect disconnected files to source control.

After selecting "Go Online" Studio 2008 will check the solution for changes while you were offline and will show a dialog window with the differences.  Now, when checking in you will see those files that you modified while offline as files that need to be checked in.

April 26

Windows Vista Shortcuts - Tips

1.) Did you know that in Windows Vista you can launch all the shortcuts in you quick launch bar by clicking the “Win” button + a number (”WIN” + 1 will launch the first link from the left and so on…)?

2.) Create a shortcut to the application you want to run with the shortcut by right clicking the executable file and selecting “Create shortcut” from the menu.

Right click on the shortcut that was created, and select properties.

All you need to do is go over to the Shortcut key line and select your desired shortcut.  For instance I have made the F1 and F2 function keys open Internet Explorer and Firefox respectively.

image

3.) If you need to configure more keyboard shortcuts check out GoHeer.com - Keyboard ShortCuts application

April 25

Using LINQ (Language Integrated Query) - got to have this tool!

What is LINQ to SQL? - implementation of the IQueryable interface over the SQL Server Schema
                                  - generates queries directly against the schema objects (pretty much 1 to 1)
                                  - queries returning objects (strongly typed experience over Sql Server Schema)

Visual LINQ Query Builder is an add-in to Visual Studio 2008 Designer that helps you visually build LINQ to SQL queries.

Functionally it provides the same experience as, for instance the Microsoft Access Query Builder, but in the LINQ domain.

The entire UI of this add-in uses Windows Presentation Foundation. The goal of this tool is to help users become more familiar with the LINQ syntax.

The tool may also demonstrate to users how to create their own Visual Studio 2008 add-in using Windows Presentation Foundation.

You can find this tool here and nice walk through of the tool on Mitsu's blog.

image

April 23

DevConnections 2008 Orlando - (Day 3) Sessions

Miscellaneous Tips/Tricks

Encapsulate Common Code (Ultimate Base Page Class http://tinyurl.com/2mjyud)

Avoid Storing Config Settings in <appSettings> - http://tinyurl.com/2lr6vw

  • not strongly typed
  • cluttered
  • risk of collisions

Register Controls in web.config

  • Custom Controls

    <pages>
       <controls>
          <add tagPrefix="aspalliance" assembly="AspAlliance.Web.UI.Controls" />
       </controls>
    </pages>
  • User Controls

    <pages>
        <controls>
           <add tagPrefix="user" src="~/UserControls/LeftNav.ascx" />
        </controls>
    </pages>

Favor Hyperlinks over LinkButtons

Avoid Excessive use of Label

  • label renders with span tags and has viewstate by default doubling bandwidth footprint
  • use Literal or <%= Variable %> instead

Avoid Passing DataReaders

  • open and close (and dispose) datareaders in the same method
  • use using() and commandBehavior.CloseConnection
  • if you must pass between methods use delegate pattern (http://aspalliance.com/526)

Visual Studio Tips

  • Autocomplete variable names with ctrlspace
  • Hold down ctrl to make the Intellisense
  • window transparent so you can see your code
  • Ctrl-K, Ctrl-D to reformat code
  • Ctrl-. will add using statements
  • Add shortcut to remove/sort using statements (Ctrl-Alt-O)

Tools/Products

DevConnections 2008 Orlando - (Day 2) Sessions

ASP.NET 3.5 New Things

New Controls

  • ListView (supports binding/editing/selecting/deleting/paging/sorting and complete control over html)
  • DataPager (adds paging support to other controls (currently only ListView, customizable UI)
  • LINQDataSource (Binds to any LINQ enabled data model)
  • ASP.NET AJAX built in to VS.NET 2008

Visual Studio 2008 Enhancements

  • multi-targeting support
  • javascript intellisense
  • javascript debugging
  • AJAX Control Extender Support
  • Web Designer and CSS Support
  • Nested Master Page Support
  • Vertical Split View (good for multi-monitor)

ASP.NET MVC (Model-View-Controller)

  • Enables much better testability of web applications
  • Provides complete control over output of web application
  • Very few working controls, no viewstate

ADO.NET Data Services

Easily makes data easily available to other clients via http

.NET & Silverlight Client Libraries

  • Microsoft.Data.WebClient namespace (WebDataContext, WebDataQuery)
  • Query with LINQ or Object Services
  • All CRUD operations available

LINQ the defining feature in .NET 3.5

  • LINQ is an expression parser (implemented via Extension Methods) i.e. Select(), .Where(), .GroupBy()
  • Core LINQ Language Features
    • Anonymous Types (dynamic type creation)
    • Type Inference (var)
    • Object Initializers (default value assignments)
    • Extension Methods (extend existing classes with new methods)
    • Lambda Expressions (simplified predicate or expression syntax)

LINQ to SQL (Database to Entity Mapping)

  • maps database schema to object schema
  • simplified 1 - 1 mapping (tables -> entities)
  • LINQ to SQL Designer allows customization

LINQ over Entity Model

LINQ TO SQL is not Business Layer - one of the challenges of LINQ is to establish appropriate business layer approach.  No place to hook up business logic in model.  No multi-tier logic abstraction.  Essentially two-tier if used in UI directly.  There are some techniques to establish or wrap LINQ to establish business layer behavior.

ASP.NET Custom Controls with AJAX

AJAX Control Options

  • Build a control from scratch (ultimate in flexibility but can be time consuming)
  • use ASP.NET AJAX Extensions classes as a foundation (require custom mapping of server side and client side properties)
  • use the ASP.NET AJAX Toolkit control framework (simplifies control development but requires AjaxControlToolkit.dll assembly)

AJAX Extensions Steps

  1. define/register control namespace
  2. create control with constructor and private properties
  3. create control properties with prototype design pattern
  4. dispose of resources
  5. register type with ASP.NET AJAX Script Library

AJAX Toolkit Extension Control

  1. Reference AjaxControlToolkit.dll
  2. Create server control and derive from ExtenderControlBase
  3. Reference embedded script control using WebResource and ClientScriptResource attributes
  4. Map properties using ExtenderControlProperty

 

 

April 22

DevConnections 2008 Orlando - Day 2 (CLR in SQL Server 2005)

CLR in SQL Server 2005

CLR Option (disabled by default, once enabled it is hard to turn off)

CLR Code can be used in…

  • Stored procedures, Triggers, Functions, Aggregates, UDTs, Reports

But Should it? - consider performance, security and development issues
Extended Stored procedures (SQL 2000) are excellent candidates for application of CLR Technology.

Where Does CLR Technology Fit?

  • To replace existing Extended Stored Procedures
  • For complex mathematical formulas
  • For access to .NET Framework functionality (i.e. encryption)
  • As an interface to non-standard data sources
  • CLR-based User-defined types
    • Permit smarter, more complex data types

Challenges

  • No control over 'safety' of code created (all or nothing)
  • Database Dependencies - once a udt is used, dependencies must be removed before it can be changed
  • Visual Studio support - more complex development to integrate

CLR Assemblies designate security level

  • SAFE (the default)
    • No external system resource access (code not trusted)
    • VS.NET 2005 assumes permission Level = Safe (anything but safe means the CLR can blue screen SQL Server server.
  • EXTERNAL_ACCESS
    • Permitted to access specific external resources (code has provisional trust)
  • UNSAFE
    • Permitted to access anything (code fully trusted)

Development of more complex CLR assemblies requires build scripts to tear down dependencies and recreation.

Comparisons of performance must be done through SQL Enterprise Manager (as opposed to VS.NET).  VS.NET adds a lot of overhead to performance information and thereby skewing the end results.

User Defined Types (defined with VS.NET in managed language)

  • Serialization - taking properties of UDT and save out as bits into backing store (serialization provided by VS.NET only is functional with fixed length data types)
  • De-Serialization - taking bits and populating properties of UDT

DevConnections 2008 Orlando - Day 2 (Getting Started with Entity Framework - EF)

A common design pattern for data modeling is to divide the data model into three components

  • Conceptual Model - defines the entities and relationships in the system being modeled
  • Logical Model - normalizes the entities and relationships into relational database tables with foreign key constraints
  • Physical Model - specifies engine-specific storage details such as partitioning and indexing

The ADO.NET Entity Framework expands the power of the conceptual model by enabling developers to write code that operates against objects generated from an Entity Data Model (EDM) instead of directly against the logical (relational) model. The Entity Framework then maps those operations to storage-specific relational commands.

Benefits

  • developers can develop against a model independent on underlying storage mechanics
  • mappings between the model and physical structure can be performed without changing code
  • multiple models can exist for a single storage schema
  • model has features such as strong typing with type hierarchies, navigable relationships, and complex types.

Getting Started with Entity Model

Key Aspects

  • Conceptual mapping - logical layers
  • Entity Data Model (EDM)
  • Entity Client
    • ADO.NET data provider that exposes data in terms of a conceptual Entity Data Model, queried through a common Entity SQL language
  • Entity SQL
    • SQL based query language extended to express queries in terms of EDM
  • Object Services
    • Providing services such as state management, change tracking, identity resolution, loading and navigating relationships, propagation of object changes to database modifications, and query building support for Entity SQL
  • LINQ for Entities
    • Allows you to write LINQ queries through Entity Client to return data

Entity Framework Compared to LINQ to SQL

  • LINQ is rapid development
  • Direct 1:1 mapping of classes and schema
  • Can override CRUD methods
  • SQL Server DB

Entity Framework Highlights

  • Write less data access code
  • Reduce maintenance (maintenance is done through UI with EM)
  • Abstracts structures into Object Oriented model

Querying the Entity Framework

  • Entity Client with Entity SQL
    • Flexible string based syntax (good for getting back data based on dynamic requests (i.e. search page))
    • Ado.net data provider
    • No entities
  • Object Services with Entity SQL (more dynamic)
    • Flexible string based syntax
    • Can return objects
  • LINQ to Entities (more dynamic)
    • Strongly typed syntax
    • Can return objects

Editorial: This technology is the one that has been missing from Microsoft in the last x years.  In lieu of this framework there have been a number of other technologies (i.e. NHiberate, Subsonic, CSLA.net etc.).  In short this is Microsoft's Enterprise level object relational/mapping product.  It is currently in beta but is to be released this summer.  In short EF provides wizards that aid in the mapping of database tables (currently only SQL Server but other vendors Oracle/MySQL are already building providers to hook up) and maps them to database objects.  It differs from LINQ to SQL in the fact that it builds a model that is now available for additional manipulation such as merging tables, filtering tables and creating additional tables build from query/view or stored procedure.

Modifications to the underlying database require updates to the model but with custom code in partial classes this can be done with very little effort. 

Currently, only the primary entity is serialized through WCF but in the following release child objects will be serialized through WCF without any data loss.  At the current time, this can be managed through passing the primary object in list object with child objects in related list object.  This can be accomplished with wrapper for transmission of the entity through serialization process.

April 21

DevConnections 2008 Orlando - Day 1 (Keynote, IIS7, Silverlight, MVC)

I have the good fortune to attend the Orlando DevConnections 2008.  This is a Web/Winform/Sharepoint/Sql conference with attendance > 3000 developers.  The conference started Saturday for some that chose to attend pre-conference sessions.  I flew in Sunday evening early enough to catch part of the 8pm keynote talk.  The keynote covered at a high level features of both Sharepoint and Studio 2008.  Thomas Rizzo and Norman Guadagno.  The content was light and really just intended as a kick off for the days to come.

Keynote Monday morning started with a very good review of new Microsoft products by the always entertaining Scott Guthrie.

  • IIS7 Coverage
    • Delivered with Windows 2008
    • Microsoft.com (4th in world based on hits) is running 3.5 with IIS7 Windows 2008
    • Dell.com (2nd in world based on hits) is running 3.5 IIS7 Windows 2008
  • Silverlight 2.0 Beta 1 w/Expression Blend and Studio
    • 38 controls available now (100 by end of the year provided by Microsoft)
    • Expression Blend and Visual Studio seamless integration for editing of asp.net and Silverlight applications
    • Silverlight live example http://memorabilia.hardrock.com
  • Dynamic Data Controls
  • Model View Controller
    • Enables easier TDD development
    • Enables more control HTML
    • Separation of layers which allows better testing of each layer in isolation
    • Currently a Beta product that may fit your development needs but it was clear that this is the type of technology that may or may not fit your requirements (motorcycles and cars)
  • Linq / Entity Model
    • Linq to XML (some really nice features as an alternative to XPath and DOM access to XML documents)
    • Linq to Entity Model
    • Linq to Datasets
    • Linq to SQL
  • Sharepoint (the next version will be 64bit only)

Of all the technologies - Silverlight was the single most important language/platform that is going to have influence on all developers.

What's New in IIS7

  • Most of the configuration(s) that can be done through the administrative tools can be setup within the web.config of the application
  • IIS7 provides both classic and integrated modes
    • Classic utilized with asp and .net 1.1, 2.0 without any migration
    • Integrated mode establishes the web stream and respective objects as first class objects in .net
      • command line migration utility available for 2.0 applications
      • ability to define handlers/modules all within web.config
      • ability to include non-aspx files in authentication schemes
      • output caching feature now available through IIS (admin tool) as well as with web.config
      • soon to be released ability to synchronize IIS7 configurations across multiple web servers
      • ability to point via unc IIS configuration to a shared file on the network (ensure that multiple servers are setup consistently)
      • iis7 in vista is the same as provided with Windows 2008
  • Ability to remotely configure IIS7 services
  • Ability to manage .NET users/roles that is involved with provided Membership system through IIS 

Silverlight and Cross Platform Development (Scott Guthrie)

  • Scott covered overview of basic components of Silverlight include lines, shapes, panels, textboxes as well as panels, brushes and transforms etc.
  • Demonstrated the ability to create user control with Blend (re-use), databinding (2-way), open file dialog box
  • Ability to store styles and behaviors separately from code (for re-application) across projects
  • 1000 faster than JavaScript
  • Networking support
  • Local caching ability up to 1mb (with granted privileges can be higher)
  • SMS policy can automatically install Silverlight across company
  • Blend next version with have source control integration (currently, you must check out via vs.net then edit with Blend)

Model View Controller Pattern (Scott Guthrie)

  • typical pattern {controller}/{action}/{id} i.e. /Home, /Home/Index, /Home/Add?x=5&y=7 (querystring values map to method parameters)
  • int? (new nullable types)
  • demos, demos, and demos

Linq / Entity Model / Datasets (What's all this about)

  • Linq
    • Linq to XML (some really nice features as an alternative to XPath and DOM access to XML documents)
    • Linq to Entity Model
    • Linq to Datasets
    • Linq to SQL
  • Entity Model
  • ADO.NET and Data Services

Exhibit Hall (Vendors of interest)

  • CorasWorks - Sharepoint collaboration and data-mining product
  • Telerk - new releases of their Asp.net Component Suite 2008 Q1

More to come on Tuesday...

April 13

Styling Input Fields and More CSS Tips


Want your input fields to look sharp.  To review the complete article click here. image
Iconize TextLinks image
CSS Cheat Sheet Nice resource for css styles.
Very cool Styled buttons with CSS  
CSS Templates to go! Quick easy layouts with css.
Hide Email Addresses From Spider with CSS of course! Always an issue when designing public sites.
CSS Bubble Tooltips  
CSS Zen Garden  
Image Rollovers with CSS  
   

The above links and more came from 50 CSS Tips and Tools.

March 09

Silverlight 2 (beta 1) Tools for Visual Studio 2008 Installation Error

I received the following error while trying to install the latest Silverlight tools.  Michael Sync had an excellent post regarding these errors.    I read through his post three times, reviewing each potential problem.
image

I remembered that I had installed VS 2008 on my D drive.  No...that couldn't be it I thought.  I took the next 45 minutes to uninstall and re-install on the C drive.  Installed the VS 2008 and the update patch (KB946581) on the C drive. 

Then finally, I installed the Silverlight Tools Beta 1 for VS.NET 2008. 

The problem was that I had installed VS.NET 2008 on the D drive.

All installed perfectly this time.  (p.s. I am on Vista 32 bit)

March 08

Microsoft Silverlight vs. Microsoft MVC (smack down)

Being a human with limited time and brain space I try to focus myself on learning technologies that can be applied to my current or upcoming projects (as well as those technologies that I feel will be the focus of development in say the next 1-3 years).

Silverlight and MVC are two new products/frameworks that have come into view.  MIX08 announced new versions for both these budding technologies.  Not really a fair fight as really one is a framework for the existing Asp.NET platform while the other is a new platform for developing code.  The following is a brief introduction to each technology followed by questions that I have used to focus my energy.

Silverlight

  • cross-platform, cross-browser plug-in which enables rich application development including media, interactivity and animation
  • enables identical development modal regardless of user operating system and browser
  • .NET language support (c# and vb.net) as well as Ruby, Python and managed JScript
  • XAML (pronounced zamel) is the language for user interface design
  • enables exchange of data between client and server via ajax technologies
  • unlike Adobe Flash, Sliverlight code can be delivered to the client in one package with content such as pictures and video separately thereby promoting re-use of code
  • WPF XAML and Silverlight XAML is different.  The latter is a simplified version compared to the former.

Microsoft MVC (Model View Controller)

  • framework methodology that divides the application's implementation into 3 components (Models, Views and Controllers)
  • primary benefit being increased ability for unit testing since the interfaces between layers is more clearly defined
  • support for existing asp.net aspx, ascx and .master markup files (these would be considered view templates)
  • does not utilize existing post-back/viewstate paradigms

Where to concentrate my energy?  Consider the following questions:

  • Which technology is more revolutionary?
  • Which technology would my customers see the largest benefits?
  • Which technology appears to have the greatest longevity and/or have the biggest impact on future projects?
  • Which technology could potentially be utilized across a number of Microsoft platforms and technologies(i.e. Sharepoint, Report Solutions, CRM and potentially WCF (Communication Foundation), WF (Workflow Foundation), WPF Desktop applications)
  • Which technology resolves current 'limitations' in the current development environment? (if you were listing the biggest limitations of current application (web) development which of the above has biggest impact on those limitations)
  • How 'ready' is the technology for implementation in real world projects? (at this point I am guessing that both are neck in neck in this 'production' ready race (currently both are beta 2 products)

For me while answering the above questions; the answer to the question "Which technology to focus on?" becomes quite obvious.  Tomorrow I start with Silverlight.

Through the development of a number of small Silverlight applications my goal is to very quickly understand the technology.  I will also be able to gain perspective as to the direction of the technology and to schedule future implementations (based on limitations). 

I will try to document my findings.

Downloads:
Silverlight 2 Beta 1
Microsoft Silverlight Tools Beta 1 for Visual Studio 2008

March 04

SQL Server String Concatenation (T-SQL) - New way to do this in SQL 2005

For years I have been doing something similar to the following:

DECLARE @list varchar(200)
SET @list =''
SELECT @list = COALESCE(@list + ',','') + DisplayName FROM Customers

Here COALESCE returns the first thing in the list that is not null.  This can also be achieved with

DECLARE @list varchar(200)
SET @list=''
SELECT @list = @list + ',' + DisplayName

The problem with the above approach is dealing with NULLs and also if you attempt to order the values that are concatenated you may not get all the values.

New in SQL 2005 provided specifically for string concatenation FOR XML Path('').  The above can properly be achieved by

DECLARE @list varchar(200)
SET @list = ''
SELECT @list = STUFF((SELECT ',' + DisplayName FROM Customers {WHERE } {ORDER BY})  FOR xml path('')),1,1,'')

Note: FOR XML Path is only situation where you can use Order by in a subquery.  Using an unnamed column for XML Path('') you get a straight concatenation with no XML tags.  This is the recommended way for concatenating strings in SQL 2005