This blog has been moved to Redwerb.com.

Showing posts with label DotNet. Show all posts
Showing posts with label DotNet. Show all posts

Thursday, June 28, 2007

Orcas Workshop: Day Four

Last day of the workshop went well. I'll be sad to leave the prepared lunches, snacks, ice cream, etc at Microsoft, but I won't be sad to leave those horrible chairs (my back is killing me).

Most of today was on Microsoft Office integration with a short bit at the end for Team System. I left a few minutes early hoping to avoid the traffic on my way home, unfortunately my plan didn't work out that well (2 hours!).

Office Integration

  • OBA (Office Business Applications) enable MS Office products to deliver business services in the form of add-ons. It is not a product, but a technical concept. OBA bridges the gap between unstructured processes (individuals making up their own process, such as storing notes in Word documents) and structured processes (line-of-business applications).
  • SharePoint is an important aspect of OBA.
  • VSTO (Visual Studio Office Integration) is the bridge between Visual Studio and Office. It will be shipped with Visual Studio 2008 Professional edition.
  • The visual designers that come with VSTO look great. If you are extending a Word document, you get a designer that looks like Microsoft Word. If you are extending just the ribbon control, you get a designer that looks like the ribbon. You can add controls and hook up event handlers the same way as with WinForms development. Very easy.
  • Debugging is easy too. Simply press F5 and the Office product that you are extending is started and your add-in is loaded and run. You can place breakpoints in your code in order to step through it just like any other VS project.
  • VSTO for Orcas has improved security and deployment. I'm not entirely sure what this means since I'm not a VSTO developer, but if you are, this might be interesting to you.
  • VSTA (Visual Studio Tools for Applications)  is the underlying infrastructure for VSTO. It is essentially managed code macros.
  • The code that you write for VSTO is separate from the document. The assembly must be installed on the client in order to be used. You are also able to deploy it on a remote server, but the client will need to be able to access that server in order to use the macro (it is configured using a manifest file).
  • The Office ribbon control is extensible through XML.

Visual Studio Team System

  • There isn't much new stuff coming out in Orcas for Team System (it is considered a point release for VSTS).
  • Rosario is the next major version of VSTS. It will offer better project level management and test case management. I'm not sure what the release date for this is.
  • Rosario will support dependencies between work items.
  • The source control built-in to VSTS allows for cherry picking changes. This allows you to make a hot fix to production code within the development branch without having to include all of the changes since that was released (of course a person will need to determine if that is reasonable or not).
  • You can setup a proxy for remote offices that will cache source code so that when you request a version that is already cached, you get that instead. This is very useful when dealing with remote locations with slow connections.
  • If after setting up your VSTS project you need to add a field to your work items, Power Tools 1.2 provides the ability to do this graphically. (apparently there is a video that was posted somewhere recently that shows how to do this, I wasn't able to find it though)

PowerPoint Presentation

I downloaded the PowerPoint presentations from the workshop. If you would like me to email you one, just mention which one you want and leave your email address. I don't feel comfortable just putting them on the Internet, but I don't see why Microsoft would care if I shared them (they said it was ok to download them and there wasn't any NDA that I remember anyway). If you want one, please note that they were built with PowerPoint 2007. If you don't have PowerPoint 2007 you will need to download a 28MB Office Compatibility pack.

Well, this ends my Visual Studio 2008 and .Net Framework 3.5 Workshop journal. I hope you enjoyed it. I'm excited to see the final release of VS 2008.

Wednesday, June 27, 2007

Orcas Workshop: Day Three

Three days down, one to go. There was a great presentation on WCF (Windows Communication Foundation) today! I'm really impressed with some of the stuff they provide out of the box for free. They also talked about WF (WorkFlow) and mobile devices.

WCF

  • Microsoft says that WCF is the next generation platform for building distributed systems (and I haven't even gotten the chance to use the last generation platform).
  • WCF provides the infrastructure to hook up any number of different protocols to a published service. This can be SOAP, REST, or any number of different protocols (there are a lot of them that WCF understands).
  • End points are essentially the transport layer for calling a service. A single service can have multiple end points defined for it (so it can be called using SOAP, REST, etc). The developer does not have to write any code to hook up these end points, it's handled by WCF. The end points can be created in a post-deployment scenario using configuration files.
  • 3.5 offers a lot of new features such as better tooling support for building and debugging services. There is a service host similar to the ASP.Net debugging host that will run so that you can test your services without having to setup your own server. There is also a WCF client that will allow you to call any of your services, including setting parameters and viewing return values. This will allow you to set break points in  your code and debug into it. These should be available in the beta 2 (I don't believe they are in the beta 1).
  • 3.5 includes 1st class support for REST, syndication, JSON (JavaScript Object Notation), Oasis, and WF (I'm sure I'm missing a bunch!).
  • There is an SDK available for syndication that I believe will run using the 3.0 bits at http://labs.biztalk.net. The name of the SDK is BizTalk Services SDK. You should be able to just reference the assembly that exposes the syndication library in order to use it (sorry, I don't remember exactly which one it is).

WF

I didn't find this presentation as interesting because I already know something about it and it doesn't look like they are adding much for 3.5.

  • WF is the software implementation of the business process or business logic.
  • WF is a lightweight process (as compared to other workflow services available)
  • Provides the infrastructure for maintaining state over a long running process.
  • A workflow can be a flow chart, state diagram, or rules based.
  • WF can be built using either code or markup
  • 3rd party designers available for designing workflows and saving as XML
  • Context Exchange Protocol allows for long running workflows. This works on a similar concept as cookies so that the workflow instance can be re-constituted when new events arrive.
  • WF provides static role based authorization as well as dynamic (code based) authorization.

Mobile Apps

There seems to be a lot of cool new features for mobile devices within the Orcas time frame, especially for developers.

  • The designer surface in VS08 can be made to look like the mobile device that you are targeting.
  • The emulator starts quickly once you have saved the state (otherwise it has to load tons of stuff when you start it).
  • You can create unit tests the same way as you would any other project in VS08. The emulator contains the testing framework. When you run the unit tests, the emulator starts and the unit tests are loaded onto it and run.
  • The emulator can be easily configured using XML to test different deployment scenarios such as RAM, screen resolution, screen orientation, battery level, etc (I'm sure you get the picture).
  • There is a device configuration manager built into VS08 that allows you to change the security context of the device.
  • If you want to connect to devices from a desktop application, you can use the Microsoft.Smartdevice.Connectivity.dll. This will let you discover any devices connected to the computer and connect to them.

Compact Framework

  • In order to make the compact framework fit on the device, many features had to be removed. This includes many libraries that weren't that useful on the device (such as the ASP.Net assemblies) as well as removing many classes and class members from the ones that were left. The end result is around 6MB.
  • Version 3.5 of the compact framework will include WCF capabilities, however, in order to meet the size requirements, much of the WCF was stripped out. This makes it more difficult to use WCF on a mobile device, but at least it's still possible.
  • 3.5 will be supported by all devices that support 2.0. You will just need to deploy the 3.5 piece.
  • Due to the occasionally connected environment and the stripped down version of the WCF, the compact framework uses email to provide reliable transport of messages.
  • 3.5 will support LINQ, but not all implementation of it. LINQ for SQL and LINQ for entities will not be supported. Expression trees are also not supported (the compact framework doesn't support Reflection.Emit which is used by expression trees).
  • There will be a remote debugging tool made available that will make it easier to find memory leaks on a device.

Tuesday, June 26, 2007

Orcas Workshop: Day Two

Another busy day, at the Visual Studio "Orcas" and .NET Framework 3.5 Training Workshop. The first topic was a very high level roadmap of the different Microsoft technologies that are available or are coming available within the next year or so (ASP.Net 2.0, ASP.Net 3.5, Silverlight 1.0, Silverlight 1.1, WPF 3.0, WPF 3.5, etc). I'm not sure who the prime demographic was for this presentation, but I find it hard to believe it was too many people in the room. All the information was already well known to everybody in the room (either because they knew it coming into the conference or because it was discussed yesterday at the conference).

The presentation I found the most interesting today was the one on ASP.Net 3.5. I've listed some of the interesting things I learned today about it below.

New Features for ASP.Net 3.5

Even though I don't work with ASP.Net professionally (at least, not much), I do work with it personally (I've volunteered to maintain my communities website which I am switching to ASP.Net 2.0 tonight!). So I was pretty interested in this topic. It's also important to keep up with this stuff since the Internet is not going away, in fact, it's more likely that desktop development will go away that browser-based development (though I won't be holding my breath for that).

  • Support for multi-targeting. This allows you to use Visual Studio 2008 to build ASP.Net 2.0 websites.
  • Better support for AJAX.
  • Designer support for nested master pages.
  • Much improved CSS support in the designer. There is a Manage Styles window that allows you to view the styles that effect an element on a page.
  • Direct Style Application - This is a feature that allows you to have more control over how styles are applied to you HTML. There is the default automatic mode that will figure out how to set the style based on the context and there is the manual mode that provides more fine grained control over how the style is applied (you can set the target rule to determine what element gets the style set).
  • The designer has a split view so you can view the HTML at the same time as the designer. This allows you to make changes to either the HTML or the designer and see the changes reflected immediately in the other.
  • There is eye dropper support for selecting colors (hopefully the eye dropper works outside of Visual Studio, but if not, I still have Color Cop).
  • CSS Property Grid window shows the CSS styles that effect a particular item. Very cool. Select an element in the designer and the window shows the styles that are being used (this is different from the Manage Styles window however, I don't actually recall how :) ).
  • New ListView control - Provides more control over displaying lists of items. This can be hierarchical (a ListView can be put inside another ListView).
  • JavaScript Intellisense - Wow, this has been needed for awhile and they seem to have done a very good job with it. The Intellisense will show you what scripting elements (methods, properties, etc) that you have available, even in included JavaScript libraries. If you decorate your methods with XML comments, the Intellisense will even provide your comments including suggested data types (if a parameter should be a string, you can include that in the XML comments and it will display the data type in the Intellisense). If you include the data type of the return value, VS08 will give Intellisense on the returned value. Since variables can change types in JavaScript, Intellisense will provide the proper comments based on the context.
  • JavaScript debugging - You can now set breakpoints in JavaScript and debug into the script. While debugging, you have access to data visualizers similar (the same?) to what is available with VB.Net or C# code today (view as string, HTML, etc).

Silverlight

I'm not sure if I will be able to make use of this technology, but it's certainly interesting for it's own sake and who knows, this could become the future of browser based development.

  • Supported on IE, Firefox, and Safari browsers on Win XP, Vista, Windows 2003, Longhorn, and Mac (but I'm not sure what versions of the Mac).
  • Expression suite can be used to create Silverlight applications.
  • RTM for 1.0 by end of summer. The 1.1 beta will be released sometime by the end of 2007, but there is no release date for it yet.
  • 1.0 only allows JavaScript for programming for the client. 1.1 will support a subset of .Net.
  • The download size for 1.0 is around 1MB. The size of 1.1 will be around 4MB.
  • Silverlight provides an HTTP downloader for applications that includes progress, ZIP packaging, and asynchronous HTTP GET.
  • Expression Blend will be available in February 2008.
  • Expression Media Encoder will allow media to be converted to types supported by Silverlight. You can also adjust the quality of the media to improve download performance. You definitely have to check it out. Learn More (I don't think the website does a very good job of showing how cool this really is). I believe a beta version is available for free download on the site as well.
  • They showed a video of Scott Guthrie doing a demo of a Silverlight 1.1 application that showed the power of compiled .Net code vs JavaScript. It's a chess game between .Net and JavaScript. .Net wins every time! There is a better video of it out there, but I couldn't find it.

WPF

Blah blah blah. This is a technology that seems very important, but I just haven't been able to get excited about it yet. It's such a huge paradigm shift and there just isn't enough tool support, 3rd party controls, or compelling features available to make this feasible for a large scale, line-of-business application (which is what I write at work). As a developer I would love to dive into this technology, but as a professional, I've got to consider how this will effect the company I work for and the customers we serve. Unfortunately, this means I cannot commit to the time it will take to learn this.

What this means for you is that I tuned out for a large portion of this talk and so my notes are fairly sparse (I've been through it all before anyway at a previous conference that went into way more depth). But what I paid attention to I will share :).

  • xbap is a WPF application that can be deployed from a browser in partial trust mode.
  • Use Visual Studio for code: code editing, events, debugging, deployment, XAML editing (direct)
  • VS08 is still considered an early adopter tool. It doesn't contain all of the features that would be nice to have for building WPF applications, but it will get you there if needed.
  • VS08 beta 2 will provide designer support for automatically generating the default event handler when a control is double clicked (this is not available in beta 1). However, there will be no support for adding non-default events from the designer (such as the property grid in C#). However XAML will allow you to automatically create events using Intellisense (similar to C#).
  • Use Expression Blend for design: designing controls, templates, etc.
  • Expression Blend does not contain any source control integration.

Monday, June 25, 2007

Orcas Workshop: Day One

I have completed day one of the Visual Studio "Orcas" and .NET Framework 3.5 Training Workshop. Today included a great overview of many of the new language features coming in this release. Unfortunately there wasn't enough time to go over all of the new features, but the features that I saw, I like.

Perhaps the defining feature of .Net 3.5 is LINQ (I haven't figured out the "official" way of pronouncing this yet, but I heard it pronounced as link at the workshop today). LINQ stands for Language INtegrated Query and is basically just that. LINQ allows for a developer to query any IEnumerable data source using a strongly typed, compiler validated, and Intellisense enabled syntax. If you are familiar with T-SQL, you will probably be comfortable with LINQ. The biggest difference between T-SQL and LINQ is that a LINQ query starts with the From keyword. There are also numerous other differences, however, given the Intellisense, they are easily discoverable (IMHO, one of the most important aspects of any API). 

[UPDATE 06/26/2007]I forgot to mention a couple of things yesterday. According to one of the speakers, the primary performance goal of LINQ is to be as good as a for loop. However, there was a mention of a team working on a divide-and-conquer algorithm that will make it far faster on multi-proc/core machines. At this point it's just research. There is no date for release and there is a possibility that it won't get released. I should also have mentioned that there appear to be many different implementations of LINQ, there is LINQ for SQL (DLinq), LINQ for Entities (Entity Data Model), LINQ for XML (XLinq), and LINQ for Objects. There might be others as well. I'm not entirely sure of all of the terminology or how they are all used.[/UPDATE]

It appears that C# and VB.Net have widely differing capabilities in regards to LINQ. They both support a basic set of LINQ features, but VB.Net has a lot of keywords that are not available with C#. Many of these differences are based on the philosophy of each language team, but I imagine that developers will eventually demand (and hopefully get) features that one language supports that the other does not.

I thought the C++ section was going to be more interesting than it actually was (if you read my previous post about this conference you would know that I didn't think it was going to be that interesting :). I pretty much surfed the Internet the whole time and didn't get anything interesting out of it (sorry for anybody that is interested in the new improvements for C++).

However, I did pay rapt attention to the new language features for C# 3.0 and VB.Net 9.0. Most of the new features either directly support LINQ or are necessary to enable LINQ but can be used for other things as well. One of the cool things about the latter set of language enhancements is that they seem to be backwards compatible with .Net 2.0, so if you use Visual Studio 2008 to create .Net 2.0 applications using the built in ability to target different versions of the .Net framework, you can use some of the new language features!

Below I have included a list of some of the features that I found interesting. Unfortunately, given how quickly the speakers went over these features, I do not fully understand some of them, so if you find something interesting, you might want to look into it further just to make sure I'm not completely wrong about it ;).

New Language Features for C# 3.0

  • var keyword - Declares a variables that will be created as the type that it is set to. This is particularly useful for LINQ, but it can also be used in foreach...

foreach(var cus in customers) // cus is strongly typed as a Customer type.

  • Object initializers - Allows you to initialize an object by setting properties.

var cus = new Customer() { Name = "Boeing" };

  • Collection initializers - Similar to object initializers, but used to load a collection. Any Add method exposed by the the collection can be used to define the initializer. This allows you to add elements to lists as well as dictionaries or any custom Add method that you create.
  • Auto-implemented properties - Allows you to define a property without having to define the field or the get and/or set. The code is inferred by the property.

public string Name { get; set;}  // this is expanded by the compiler to be a standard property with corresponding field

  • Anonymous types - Allows LINQ to automatically create a type when transforming data. The type is not directly available from code, but you still get Intellisense to help you use the object.
  • Lambda expressions (=> operator) - This is basically a lightweight version of anonymous methods. A lambda expression can be passed as a parameter to another method, just define a delegate that matches the lambda expression.
  • Extension methods - Allows a type to "attach" methods to another type. To do this, add the this keyword in front of the first parameter in a static method.

public static string DoSomething(this string s) // This can be called like this - var something = "Hi".DoSomething()

  • Partial Methods - I didn't quite catch how this works, but it seems like it allows designer generated code to define a method that you can implement.

New Language Features for VB.Net 9.0

  • XML Literals - XML is now a first class feature within the language. You can can embed XML directly in the source code (without using quotes) and get Intellisense to boot (if you import your XML namespace). You can also embed ASP.Net-like code in the XML. This gets really interesting when combined with LINQ.

Dim myXml = <People><Person><%= person.FirstName %></Person></People> ' Example of using XML as a native feature in VB

  • New XML API - The new API is much easier to use than the DOM, especially when creating a new XML document. (if you are looking for keywords to find it on Google, try XElement and/or XAttribute). An XElement is automatically created when using a XML literal.
  • XML properties - .., .@, <> can be used like properties. This is a very cool way to get Intellisense support for XPath-like syntax.
  • XML namespaces - XML namespaces can be imported similar to regular .Net namespace imports.

Imports <xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">

  • Anonymous types - Similar to C# anonymous types above.
  • Into keyword - Calls LINQ aggregate methods, available when using the Group By (I do not believe this is available in Beta 1 of VS 2008)
  • Group Join keyword - Another VB.Net LINQ feature that allows hierarchical results.
  • Aggregate keyword - Alternative starting keyword to LINQ query that will return a scalar value instead of collection. The scalar value can be a complex type, but you will only get one of them. This is typically used with the aggregation methods such as Sum, Average, etc.

Saturday, June 23, 2007

Visual Studio "Orcas" and .NET Framework 3.5 Training Workshop

I was invited to the Visual Studio "Orcas" and .NET Framework 3.5 Training Workshop at Microsoft next week (June 25th through June 28th). I'm pretty excited about going, it looks like a high level overview of all the major new features of VS 2008 and .Net 3.5.

I included the agenda for the workshop below (hopefully that's ok with MS, it doesn't say anywhere that I can't share it). I'm most looking forward to .NET Language Integrated Query (LINQ), What’s new in Visual Basic 9.0?, Introduction to Silverlight, Integrating Office & line of business systems using VSTO, and the Company Store Visit, though all the sessions look interesting other than maybe the one on C++ (I am beginning to think I will never program in that language again). 

Day

Start

End

Session

Monday, June 25

8:00

9:00

Registration & Breakfast

9:00

9:15

Welcome & Introductions

9:15

10:00

Lap around Visual Studio 2008 & .NET Framework 3.5

10:00

11:00

.NET Language Integrated Query (LINQ)

11:00

12:00

Using LINQ with relational data

12:00

1:00

Lunch

1:00

2:00

Hands-on lab: LINQ

2:15

3:15

What’s new in C# 3.0?

3:30

4:30

What’s new in Visual Basic 9.0?

4:45

5:45

What’s new in C++ 9.0?

Tuesday, June 26

8:30

9:00

Breakfast

9:00

9:30

Introduction to the Microsoft Client Continuum

9:45

11:00

Building Web Applications with Visual Studio 2008 and the .NET Framework 3.5

11:15

12:30

Introduction to Silverlight

12:30

1:30

Lunch

1:30

2:30

Essential Windows Presentation Foundation

2:45

4:00

Building Smart Client Applications with Visual Studio 2008 and the .NET Framework 3.5 using WPF and “Cider”

4:00

5:30

Hands-on lab

5:30

7:30

Evening Event: Barbeque at building 20

Wednesday,

June 27

8:30

9:00

Breakfast

9:00

10:15

Building WCF and WF Applications with the .NET Framework 3.5

10:30

12:00

Web Programming with WCF

12:00

1:00

Lunch

1:00

2:15

Workflow Services

2:15

3:30

Hands-on lab

  •  

3:30

5:00

Building Mobile Applications using Visual Studio 2008 and the .NET Compact Framework 3.5

5:00

6:00

Company Store Visit

Thursday, June 28

8:30

9:00

Breakfast

9:00

10:00

Overview of Office Business Applications and VSTO

10:15

11:30

Extending the Office Fluent UI using VSTO

11:30

12:00

Hands-on lab

12:00

1:00

Lunch

1:00

2:30

Integrating Office & line of business systems using VSTO

2:45

3:45

Hands-on lab

3:45

5:00

What’s new in Visual Studio Team System 2008?

Saturday, April 28, 2007

Windows Workflow and Your Next Build System

Recently I've been messing around with the new workflow foundation developed by Microsoft and included in .Net 3.0. It is very cool! It has great design-time support, it's easy to extend with your own custom activities, and it seems to be very well documented.

At first I was a bit put off by the fact that it doesn't include a simple, run-time configuration process. They do give you the ability to host the designer in your application, but it appears that you have to write a lot of code to make that work (I didn't actually try it, but I did glance over the documentation). However, as I thought about it more, it seems that Visual Studio is a great way to reconfigure the workflow. It might be a bit of overkill for a non-technical person who just wants to reconfigure one or two of the activities, however, if they just go to the workflow designer, it seems pretty easy to use (but what would I know, I'm a developer :). On the other hand, if somebody that is more technically inclined wants to extend the workflow with code, they can do that easily as well.

If you are new to Windows Workflow, I think a build system is a great starter project. It's simple (as far as workflow is concerned anyway), it fits into the workflow concept very well, and it will make your build process easier to configure and extend (if your build process is anything like our current one, as long as it's working, the last thing anybody wants to do is touch it). Even if you don't use it for the build process for the entire product, it can make many tasks that you have to perform on a regular basis on your computer easier (such as preparing your machine for a new build).

Before you can start building a workflow, you will need to install .Net 3.0 as well as Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow Foundation). This will provide the necessary pieces that Visual Studio needs to create workflows.

For the build system I'm creating at work, I created a Workflow Activity Library (a project template available in the New Project dialog) that contains most of the activities that I want to use, such as GetFromVSS, CopyFiles, RenameFile, AttachDatabase, RunSQL, etc. Each activity has one or more properties that allow it to be configured (for example, RenameFile has a property for the path to the file and another property for the new name of the file). As you can tell, these are just building blocks for a build system. For the build itself, I create a Sequential Workflow Console Application (this is a new project type installed with the VS 2005 workflow extensions). If you have several different types of builds (such as a developer build, test build, and production build), you can create a separate project for each one.

So what makes Windows Workflow such a great tool for a build system? Other than making configuration easy, you can also disable activities. This is very useful, especially when testing. There are several parts to the build system that I'm working on (for example, compiling the code and building the database), each one is made up of several activities. I can simply create an activity that contains all the activities for that part of the build and, if I don't want to run it, I can simply click on the parent activity and set it's Enabled property to False.

The diagram below shows a very simple workflow diagram in the Visual Studio Workflow designer. It includes two activities, one of the activities has been disabled. As you can see, the Workflow designer is very similar to the WinForm designer. You start by picking the activity that you want to run from the toolbox (on the left) and dragging it onto the workflow. The workflow will show you the places that you are allowed to drop the new activity. Once you drop an activity onto the workflow, you can set the properties associated with it using the property window (on the right).

If there is interest, I might be willing to write a more detailed article for Code Project that includes sample code. So if you want to read more, make sure you leave a comment.

Tuesday, April 17, 2007

Silverlight now available

On April 16, Microsoft unveiled Silverlight (formerly known as WPF/E). From the website...
Silverlight is a cross-browser, cross-platform plug-in for delivering the next
generation of media experiences and rich interactive applications (RIAs) for
the Web.

This could be the Flash killer, though it will probably take a few years to get there. I haven't actually seen the development environment for this, but if you can use .Net (or something very similar), Visual Studio 2005, and Expression Suite to build it, then this will be very compelling for a large number of developers.

Friday, January 12, 2007

The Great 2006 Software Review

2006 was a great year for software. I thought I would make my first post of the new year as a review of the software that was released last year that caught my interest. This is software that I think will have an impact on the world (some big, some small). It is not necessarily software that I use on a regular basis (or at all :).

I know I'm going to miss some great software, so please feel free to post anything I might have missed.

NOTE: Most of the links go to the original announcements. Some are official press releases, others are just blog entries.

Google Bookmarks (via the toolbar) - January 30th

Everybody that uses a browser knows what bookmarks are (also known as favorites). The Google difference is that these bookmarks are stored online, but are accessible through the Google toolbar in the browser.

I love being able to share my bookmarks between home and work and that I don't have to remember to back them up before I get a new computer.

Google Calendar - April 13th

My wife and I now share a calendar. This is a very convenient way to communicate events between us. There is also a very handy Google calendar gadget for the Google Sidebar that shows me the calendar right on my desktop at work so I always know what's coming up.

Windows Live Writer (beta) - August 11th

I'm using this software write now to create this post. It is a very nice blog entry tool. There are still a few kinks to work out, but overall it's great! It was very easy to set it up to upload my posts to my blog.

Firebird 2.0 RC3 - August 13th

This is a great database. It's reliable, performs well, easy to use, and it's free with no limitations. I've been using the previous version of the DB for close to a year and have been very impressed with it.

Of course most people need more than a command-line utility to create and manage a database (not to mention testing it). IBExpert is a great commercial product with a free version for individual developers (it's limited, but you can still do a lot of stuff with it). If you've used SQL Server Enterprise Manager you can probably imagine what features it has (I actually believe that IBExpert has more features than SQL Server Enterprise Manager).

Logitech MX Revolution Mouse - August 24th

Ok, this isn't software, but I'm still damn excited about it! Mostly it's the flywheel for scrolling. It actually switches between a flywheel and ratchet (standard scroll wheel behavior) depending on the application you are using.

PowerShell RC 2 - September 26th

Command-line + .Net, what's not to like :). If they can fix the performance issues, I'm sure that many Windows admins are going to be very happy people.

Google Docs & Spreadsheets - October 11th

The future of the office software suite is here! Google has created an Internet based document editor (like Word) and spreadsheet application (like Excel). They allow for a high degree of collaboration, including the ability to work on the same document at the same time and receive live updates, almost like an instant messenger program (as rumor has it anyway, I haven't had the opportunity to see that work).

Internet Explorer 7 - October 18th

It's about time Microsoft updated its browser! They have done a great job of cleaning up the UI and providing the features that experienced web surfers have come to expect (such as tabbed browsing).

Firefox 2 - October 25th

I am very impressed with the improvements that have been made in such a short amount of time by an open-source project. It's great to see a viable alternative to Internet Explorer (if for no other reason than to encourage Microsoft to keep its browser up to date).

Microsoft Windows Desktop Search 3.0 - October 25th

This is the most effective way to search your Outlook email that I'm aware of. It also searches other documents (including MS Office) on your system as well. It's easy to use, fast, and produces good results.

.Net 3 (including WPF and WCF) - November 6th

These technologies will definitely have an impact on the world, especially Windows Presentation Foundation (WPF), though it may take a few years for the hardware to catch up. Expect to see some amazing consumer applications coming out soon.

Basically the WPF (not to be confused with WTF) allows designers to create graphically intense (including animations) user interfaces quickly and easily. .Net 3 comes installed on Windows Vista and can also be installed on Windows XP and Windows 2003 Server.

Windows Vista - November 8th

Microsoft's new OS is possibly one of the best yet (based on the presentations I've had of it anyway). It has some great features for security and usability. As I look into my crystal ball, I see a new computer with Windows Vista on it in my future :).

I really looking forward to Windows Home Server. Home Server is essentially an appliance that you can hook up to your network for file sharing and other nifty things (it's a full version of Windows Vista). Unfortunately it's not due out until the second half of 2007. If you're interested in this, here's a great Ch 9 Video.

SQL Prompt 3 (beta) - ~December 11th

It's about time somebody added Intellisense to my SQL scripts. This has made writing SQL much less painful. I know longer need to scan the object browser every time I need to find a table or field.

Google Patent Search - December 14th

Patent surfing just might be the next big time-waster (ok, probably not). Google has certainly made looking for patents much, much simpler. You can now search for patents from the comfort of your home using Google's excellent search capabilities in order to make sure that your new "great idea" is not already patented.

Again, if you know of something I missed, please post it.

Friday, November 17, 2006

Securing Text Data

Perhaps it's just me, but trying to figure out how to secure text data is confusing. Based on all of the articles available, if you are creating an application that uses passwords or other sensitive information, you should use a SecureString, that much is clear. However, a SecureString isn't very useful since it is encrypted (you can't compare a SecureString against a database value, pass it to your credit card processing, etc).


After many hours of research, I was able to find a single example of how to secure text in an MSDN article (of course, it's only mentioned in passing). How to encrypt and decrypt a file by using Visual Basic .NET or Visual Basic 2005 contains a reference to the ZeroMemory API that allows you to clear a string from memory and GCHandle to make sure you don't end up with a bunch of copies of the string.


The following code will create a string, pin it in memory using GCHandle (to make sure it doesn't get moved or have multiple copies made), then destroy the contents of the string so that it can't be held in memory.


    Sub Main()
Dim str As String = "HI"
Dim gh As GCHandle = GCHandle.Alloc(str)
Console.WriteLine(str)
ZeroMemory(str, str.Length * 2)
gh.Free()
Console.WriteLine(str)
End Sub

Private Declare Sub ZeroMemory Lib "kernel32.dll" _
Alias "RtlZeroMemory" _
(ByVal Destination As String, _
ByVal Length As Integer)



The idea behind this is to leave the text in memory for a very short period of time to make it very difficult for a hacker to get. The sensitive text can be stored in a SecureString until you are ready to use it.


Before I found the ZeroMemory solution, I had written another one that I'm going to post here just because it seems interesting. Basically, I use reflection to call a method on System.String that is intended to be used by StringBuilder that will replace a char without making a copy of the string (typically Strings are immutable, any changes to it result in a copy of the string).



    Public Shared Sub DestroyString(ByVal str As String)
Dim mi As MethodInfo
mi = GetType(String).GetMethod( _
"ReplaceCharInPlace", _
BindingFlags.NonPublic _
Or BindingFlags.Instance)

For i As Integer = 0 To str.Length - 1
Dim ch As Char = str(i)
Dim args() As Object
args = New Object() {ch, ChrW(0), i, 1, 0}
mi.Invoke(str, args)
Next
End Sub

I am currently working on another article for Code Project on securing text data, complete with a PasswordBox WinForm control, SecurePassword class, and more. Once it is available, I will post a link to it here.

Saturday, November 11, 2006

Event-Based Asynchronous WebRequest

I've created my first Code Project article! I was looking for a place to upload some code so I could share it from my blog, but the only place that I could find was Code Project, of course that meant that I had to write an article too.

If you are interested in reading about using the WebRequest/WebResponse classes (including processing of the response stream) or implementing the Event-Based Asynchronous Pattern (the pattern used by the BackgroundWorker component), you can read my article at Event-Based Asynchronous WebRequest.

The article includes a project that contains a BackgroundWebRequest component that can be used to perform asynchronous web requests from a WinForm application.

Friday, November 10, 2006

The Holy Grail of .Net Threading

The Epiphany

I was working on a project that needed to be able to process a WebRequest/WebResponse from a thread within a WinForm application. I tried several approaches, including using a BackgroundWorker, however, what I really wanted to do was create my own component similar to the BackgroundWorker, but specifically for WebRequests. Unfortunately, I didn't know how they did it.

As I was driving home from work I had an epiphany. The obvious solution would be to use Reflector for .NET to figure out how Microsoft did it.

Meeting Up With Sir Galahad

I opened the class up in Reflector and used the File Disassembler (an add-in to Reflector) to output it as a VB class. I waded through the code trying to understand what it did when I found the first hint as to the location of the Holy Grail, the AsyncOperation class.

This class looked important in the threading for BackgroundWorker, so I looked up the documentation for it. In the first sentence of the remarks, it contained a link to the Holy Grail.

The Holy Grail of .Net Threading

The Event-based Asynchronous Pattern is a design pattern that is useful for creating a class that can run operations on a separate thread, but will raise events on the main thread (very useful for threading in WinForms).

MSDN has a series of articles that clearly describe this pattern and how to implement it. The Asynchronous Programming Design Patterns node in the MSDN documentation discusses several different asynchronous patterns that you can use.

Wednesday, November 08, 2006

ClickOnce Deployment Rocks!

Just recently I configured an internal tool I'm working on to use ClickOnce deployment. It is the first time I've used it and I have to say that it certainly lives up to it's name.

At least for a small, simple application like the one I've been working on, all you have to do is open up the project properties and push the "Publish Now" button under the Publish tab (VB.Net anyway).

It automatically generates a webpage that other people can use to install the application and, if the application is updated, it will automatically reinstall the next time the user opens it.

For the app I was working on, the most difficult thing to figure out was how to include some assemblies I was referencing from the GAC. To do this, open the project properties, go to the Publish tab, open Application Files, and change the Publish Status to Include. When somebody installs the application, the assemblies are automatically copied locally (they are not installed to the GAC).

If you are interested in where the files are installed on the users machine, it appears they are placed in C:\Documents and Settings\<user>\Local Settings\Apps\2.0\. The application will be in a directory with a randomly generated name.

Monday, October 30, 2006

Protecting Data in .Net

Security is a big issue in computing these days. One way you can protect user's data is by using the DPAPI (Data Protection Application Programming Interface) available on Windows.


The article Managed DPAPI Part I: ProtectedData provides a very good explanation of what this is, so I won't bore you with the details here, but I will provide you with a code sample that you can use. To use this code sample, simply create a C# console application in VS.Net 2005 and paste this into the main file (I believe it will be called Program.cs).


One thing that should be mentioned, this does not protect the data in memory. It can be used to protect data that is written out to disk, but an industrious hacker can get the sensitive information out of memory. Check out Managed DPAPI Part II: ProtectedMemory for more information on protecting data while it is in memory.



using System;
using System.Security.Cryptography; // reference assembly System.Security.dll
using System.Text;

namespace DPAPIExample
{
class Program
{
static void Main(string[] args)
{
string test = "hello world";
string encryptedValue;
string decryptedValue;

Console.WriteLine(test);
encryptedValue = Encrypt(test);
Console.WriteLine(encryptedValue);
decryptedValue = Decrypt(encryptedValue);
Console.WriteLine(decryptedValue);
Console.ReadKey();
}

// This is an article on using the ProtectedData API (a wrapper around DPAPI)
// http://blogs.msdn.com/shawnfa/archive/2004/05/05/126825.aspx
private static byte[] sEntropy = System.Text.Encoding.Unicode.GetBytes("put whatever you want here");

public static string Encrypt(string text)
{
Byte[] data = Encoding.Unicode.GetBytes(text);
Byte[] protectedData = ProtectedData.Protect(data, sEntropy, DataProtectionScope.CurrentUser);
return Convert.ToBase64String(protectedData);
}

public static string Decrypt(string encryptedText)
{
Byte[] protectedData = Convert.FromBase64String(encryptedText);
Byte[] data = ProtectedData.Unprotect(protectedData, sEntropy, DataProtectionScope.CurrentUser);
string text = Encoding.Unicode.GetString(data);
return text;
}
}
}

Friday, October 06, 2006

PowerShell = Command-line + .Net

PowerShell is the future of the command-line for Windows. It's most significant feature is the fact that it is built around .Net and is easily extendable by .Net. In fact, you can use reflection to access any .Net object!

It includes the ability to assign alias's to frequently used commands, define functions, and call a number of pre-defined (and very useful) CmdLets (the equivalent of a command-line utility). It also has it's own scripting language including looping and conditional constructs reminiscent of C#.

Another feature I really like is the ability to navigate to non-filesystem drives, such as the registry. This allows you to navigate the registry the same way you would navigate the file system. You can define your own drives based on the drive providers that come with PowerShell (there are a number of them) or you can create your own provider using .Net.

PowerShell has not been released yet (due Q4 2006), however, you can download RC2.

PowerShell Home Page

Download PowerShell

PowerShell Team Blog