Sign In

Navigation

On This Page

HTML Agility Pack - Contributor
The Case for Partial Properties
Recovering Mozilla Weave Passphrase
Speeding up the ASP Development Webserver in Firefox
Twin Cities User Groups and Events
Sorry for the Silence
Getting Started with Visual Studio 2010 Extensions
Small Basic Materials
Twin Cities Code Camp Presentation
Silverlight 3 Shader Effects
VS2010 CTP Expiring Jan 1st
MCPD: Web
PDC Showoff: DevXpress VS2008 Clipboard History
CLR 4.0 to include the DLR - With Limitations
Update on new C# 4 features
PDC Announcements Day 1
Windows Troubleshooting Tip of the Day: Failed ActiveX object creation
Deprecation of API's and Native Calls
SilverLight 2 Released
Twin Cities Code Camp 5: Over and Out

Archive

<September 2009>
SunMonTueWedThuFriSat
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

Categories

Blogroll

Contact

Send mail to the author(s) Email Me
MCPD
MCTS

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way


Copyright ©  2012
 Creative Commons License
This work by Jeff Klawiter is, unless explicitly stated in the article,  available under the Creative Commons Attribution 3.0 United States License.

Pick a theme:
# Tuesday, September 15, 2009
by Jeff Klawiter - Tuesday, September 15, 2009 10:02:42 AM (Central Standard Time, UTC-06:00)

For a few months now I’ve been working on a VS2010 extension I’m calling Funky Search. It’s basic intent is to bring tag based search and replace functionality to Visual Studio. My first order of business when creating this extension was the need for an HTML Parsing Engine. I had used HTML Agility Pack (HAP from now on) in the past. One downside of it is that it uses XPATH for querying the HTML. While in it’s day XPATH was a decent solution for searching XML structures, there are better searching solutions available today namely LINQ.

I set out and updated HAP to have all of it’s Node and Attribute collections to inherit from IList<T> instead of implementing their own Enumerators. I then added many helper methods to mimic LINQ to XML. With this I could now work on creating dynamic LINQ statements to power my extension.

While working on this I got into the community of people using HAP and I came across a larger issue, it had not been updated in years and the creator and other developer on the project had seemed to abandon it. I sent many emails to the creator Simon Mourier (former MS employee, and current CTO of SoftFluent) over the summer with no reply. I finally found his work email and discovered he was on vacation until early September. I was finally able to get in contact with him today and he added me as a developer on the project.

This will mark the first time in about 5 years I’m a developer on an open source project. Before coming to Sierra Bravo I was huge into open source, also at that time MS had no free versions of Visual Studio. I was working as a PHP developer and had contributed to some small projects and even worked on part of the Mozilla project adding in an easier way to code-sign your Mozilla/Firefox extensions.

I’m looking forward to advancing HAP, fixing bugs and making it easier to use. It sits in a unique position as being the only freely available HTML parser that works. While it can be used for dubious purposes as a page scraper it can also be used for good. I’ve used it in the past where we had a client that had their hosting provider go out of business, their site was going to only be up for another day and we had no direct access to their database server. We had FTP access to get the code of the site and access to a readonly front end that displayed the contents of the tables in html with no export functionality. I wrote a scraper with HAP to get those tables and put them into an importable format. With it I was able to download and import their database and save their site.

# Monday, September 14, 2009
by Jeff Klawiter - Monday, September 14, 2009 4:18:17 PM (Central Standard Time, UTC-06:00)

With the advent of ASP.NET MVC 2.0 and the new templated helpers we’re once again having to write out our entire data objects. This is something that ORM tools like LINQ to SQL and LINQ to Entities were supposed to alleviate. Even better is we must now implement a class in 3 files.

Case in point: http://blog.pagedesigners.co.nz/archive/2009/08/06/asp.net-mvc-2-ndash-buddy-classes-for-your-models.aspx

The idea of “Partial Properties” follows the convention for Partial Classes and not Partial Methods. With Partial classes you can have the same class defined in two files. This is extremely helpful with extending generated code. With Partial Methods, one partial class file defines a method and another partial class file may if it choose implement that method. If the method is never implemented then the compiler completely throws away any code that may have referenced that method.

During a PDC talk Anders said that he couldn’t see a reason why we should implement Partial Properties but it’s becoming clear to me that we are starting to have the need.

Here’s the current situation:

  1. You create your models with LINQ to SQL or LINQ to Entities.
  2. You have no control over the auto-generated code so you implement partial classes for each class made in a separate file
  3. You need to annotate the properties in the generated classes so you then have to create a buddy class
  4. You take all the properties of the generated class and type them in and add attributes to them and thus mostly defeating the purpose of #1
//GeneratedClass.Designer.cs (the generated file)
public partial class GeneratedClass
{
	private string _name;
	public string Name
	{
		get{return _name;}
		set{_name = value;}
	}
}

//GeneratedClass.cs (your file)
[MetadataType(typeof(GeneratedClass_Metadata))]
public partial class GeneratedClass
{
	
}

//GeneratedClass.cs or GeneratedClass.Meta.cs (your other file)
public partial class GeneratedClass_Metadata
{
	[Required(ErrorMessage="Name Required")]
	public string Name{get;set;}
}

In the end you end up with 2-3 files and 3 implementations of your class. You also end up with the compiler generating more classes that their only use are for attributes.

With a “Partial Property” generated code could expose all of the public properties like so

//GeneratedClass.Designer.cs (the generated file)
public partial class GeneratedClass
{
	private string _name;
	public partial string Name
	{
		get{return _name;}
		set{_name = value;}
	}
}
//GeneratedClass.cs (your file)
public partial class GeneratedClass
{
	[Required(ErrorMessage="Name Required")]
	public partial string Name;
}

This may all be moot if we can at least get some tooling support for MetaDataType. We could use a Refactor –> Generate Buddy Class. This could auto-gen the metadata class for you so all you have to do is write the attributes in. Maybe even Class Diagram support?

Comments [0] #      C# | Rant  |  kick it on DotNetKicks.com Shout it
by Jeff Klawiter - Monday, September 14, 2009 1:16:03 PM (Central Standard Time, UTC-06:00)

I recently got a new laptop and was trying to get Mozilla Weave set up on it and I could not remember my passphrase. So I went to the site to see if I could recover it and could not. They will reset it and delete all of your data when you do. After that you have to resync from one of your working versions. My problem was that my only current working version was my desktop at work which was shut down due to me being on vacation.

Now today I’m back from vacation and I was wondering if there was some way to retrieve my passhprase. After searching my profile folder I realized, maybe they just use the password system built into FireFox. And sure enough there were two entries for weave.

image

After finding it in your list it just takes hitting “Show Passwords” to retrieve it. If you’re like me and have a Master Password set you will have to enter it again at this point.

Comments [0] #       |  kick it on DotNetKicks.com Shout it
# Tuesday, July 21, 2009
by Jeff Klawiter - Tuesday, July 21, 2009 1:33:17 PM (Central Standard Time, UTC-06:00)

 

I recently was directed to a nice trick on how to make the Visual Studio Web Development (WebDev.WebServer.exe) server run faster when accessing it in FireFox. I’ve long noticed it seem to lag quite a bit compared to running in IE.

Basically there is something that goes wrong when FireFox tries to connected the server via IPv6. The trick is to just disable it. Unfortunately this disables it for all sites and may cause problems in the future as more places switch over to IPv6. But for now it should be just fine. Changing the setting is quite easy

 

Type in “about:config” in your address bar (get passed the “are you sure you want to do this” nag screen) and search for ipv6. You should find a settings like below

IPv6 About:Config

The setting network.dns.disableIPv6 should be set to True. All it takes is double-clicking on the setting to change it. The effects should be immediate.

Comments [0] #       |  kick it on DotNetKicks.com Shout it
# Thursday, July 09, 2009
by Jeff Klawiter - Thursday, July 09, 2009 11:18:02 AM (Central Standard Time, UTC-06:00)

I recently sent the list below to a colleague. I figured I should share it further.

This is a list of user groups I attend fairly regularly.

  1. .NET User Group
  2. Developers Guild 
    • Second Tuesday of the month
    • In depth talks on .NET, programming patterns, project patterns. Talks have been in depth azure, dependency injection/inversion of control
    • http://www.twincitiesdevelopersguild.com/
    • Held at New Horizons Mn in Edina
    • I may be giving a talk here this fall
  3. Languages User Group
    • Second Thursday of the month
    • Held at Magenic in Golden Valley
    • A new language or part of a language every month. Talks on java, lisp, creating your own language. The next one is going to be great, esoteric languages.. the languages that are made for fun
    • http://www.twincitieslanguagesusergroup.com/TCLUG/Default.aspx
  4. Silverlight/WPF Users Group
  5. XNA User Group
  6. Twin Cities Code Camp
    • Twice a year, sometime in spring and fall. Around March/October
    • Large free event that's all about code and is always full of great talks and cutting edge topics. It takes place on a Saturday and ends with tons of prizes, normally an Xbox 360 or two in the top prizes. (done by random name selection of attendees). I've been to everyone so far and I always come away feeling like it was worth it, something I have not been feeling after going to conferences that I paid for.
    • http://www.twincitiescodecamp.com/TCCC/Default.aspx
    • I'm giving a talk this fall on Visual Studio 2010 extensions. I gave a talk in the spring about Visual Studio Tips and Tricks
  7. Twin Cities Web Design:
    • Meetings don’t seem to be on a schedule,
    • Covers general web design things like JavaScript frameworks, CSS tools
    • Meets at Sierra Bravo
    • http://tcwebdesign.org/
  8. MySQL/Drizzle user group
Comments [1] #       |  kick it on DotNetKicks.com Shout it
# Wednesday, July 08, 2009
by Jeff Klawiter - Wednesday, July 08, 2009 1:26:33 PM (Central Standard Time, UTC-06:00)

 

I’ve been so busy working on things at and out of work I’ve fallen behind with updating my blog. I’ve got many things I want to blog about but finding time for putting one together is becoming difficult. Things I’ve been working on lately

  • Visual Studio Extension: I’m working on a VS 2010 extension that is going to be whole worlds of awesome for ASP.NET developers. Most of the work so far has been in getting the backend pieces in place for doing the actual “work” and figuring out where to get the things I need from Visual Studio.
  • ASP.NET MVC: I’ve been working on my first ASP.NET MVC site so I can start using it at work. I was reading the ASP.NET MVC book put out by the scotts and others. The first Chapter of the book covers creating a site from start to finish
  • Preparing for the WPF MCTS exam
  • Wrote a bunch of SQL CLR code
  • Testing Blend 3 and Sketchflow
  • Preparing a talk on VS2010 Extensions for Twin Cities Code Camp 7

 

Upcoming Blog Articles

VS2010 Extensions Take 2
SQL CLR

Comments [0] #       |  kick it on DotNetKicks.com Shout it
# Saturday, May 23, 2009
by Jeff Klawiter - Saturday, May 23, 2009 1:43:05 PM (Central Standard Time, UTC-06:00)

I searched far and wide and was unable to find a good quick tutorial on getting  a Visual Studio 2010 extension up and running. There are a few things wrong in the verbiage used that can be quite confusing.

Obtaining the VS 2010 Beta 1 SDK

The first order of business is to get the Visual Studio 2010 Beta 1 SDK, which will add the new templates for creating an extension.

http://www.microsoft.com/downloads/details.aspx?FamilyID=d197feb6-ced5-40d4-949d-a51f02309ee8&displaylang=en

After downloading it and trying to install it you may run across an uncaught exception (like I did)
UnHandled Exception VS 2010 SDK Installer

The error lies in the Bootstrapper (setup.exe). Since the VsSDK_sfx.exe is a self-extracting zip archive you can use your favorite unzipping utility to get the contents. (or you can take the hard way and get the files in your temp folder after it’s been unzipped). I prefer to use WinRar, it makes it extremely easy
Extracting VSSDK To Folder

After this there are only 5 files extracting.
VS SDK Unzipped

We only care about 2 of them. vssdk.cab and vssdk.msi.
Launch the vssdk.msi . This is the main installer for the SDK. It gives little feedback and will auto close when it’s done installing.

Creating Your First VS2010 Extension Project

Launch Visual Studio 2010. In your New Projects dialog under <Your Language>/Extensibility you should now have “VSIX Project”
New VSIX Project

This project defines the basic extension for visual studio. Out of this you will be able to build your VSIX file for installation into Visual Studio.

After giving your new project a name you are given a barebones extension.
New VSIX Project in Solution Explorer

The Visual Studio Extension Manifest

First we’ll start off with an unfamiliar file, the extension.vsixmanifest file. This defines your extension, from title, to license agreement to pictures. While this file is a fairly simple XML file. The VS Team provided a nice interface for editing it.
image 

While most of the form is pretty self explanatory, there are some specific points to make

  • ID: This is your global ID for your extension. After you first publish your extension, it is probably a good idea to not change this.
  • Version: this can be viewed as your installer version. It may not necessarily mirror your dll versions.
  • Supported VS Editions: This is a big one and is also forward thinking. Here you can select from all the different versions of VS2010, including Express, Integrated and Isolated Shell. It can also be expanded later to include the next version of VS.

For more information on the vsixmanifest file, see the documentation http://msdn.microsoft.com/en-us/library/dd393700(VS.100).aspx

The last two pieces are where things get interesting. There hasn’t been much said about how extensible Extensions are in VS2010.

Under References you can create references to other VS2010 extensions that your extension may depend on. Clicking on the Add Reference button gives you this dialog.
image

You’re given the options to select an extension you already have installed, add an external VSIX package or manually define one and a URL to download it from. The URL part is the real beauty. When installing your Extension it has the ability to get the latest and greatest of an extension. You can of course limit it as well to certain version numbers to avoid breaking changes. This creates a lean, mean on demand Extension.

The Content editor doesn’t seem to be fully baked. Here you can add extra content into your vsix package and have it registered upon install.  One example is a registering a Project Template. I’ve borrowed an example from the Card Game Starter Kit .

image

 

The Code

You will find one lone code file in your new project. Here is the CS version

using System;
using System.Collections.Generic;
using System.Threading;
using Microsoft.VisualStudio.ExtensibilityHosting;

/// <summary>
/// Empty VSIX Project.
/// </summary>
namespace MyFirstVs2010Extension
{

}

Not much in there. This is where your imagination comes in

Here is where I’ll leave you to fend on your own for now. Navigating the Visual Studio SDK assemblies is another post all in itself.  You’ll find all assemblies you need under the Microsoft.VisualStudio namespace in your add references dialog. It is also possible to tie into Team System via the Microsoft.TeamSystem .

For some full source examples of VS 2010 Extensions, check out the Editor Samples on codeplex
http://editorsamples.codeplex.com/

# Friday, May 15, 2009
by Jeff Klawiter - Friday, May 15, 2009 4:31:39 PM (Central Standard Time, UTC-06:00)

I gave a talk on Microsoft Small Basic last night at the Twin Cities Languages User Group. I promised to post my materials and here they are.

The zip contains the powerpoint presentation file, the example programs and the example extension.

For the guy that asked about mp3s. It looks like they will work as long as the computer it’s running on has an mp3 codec installed (which is very unlikely).

Comments [0] #       |  kick it on DotNetKicks.com Shout it
# Tuesday, April 07, 2009
by Jeff Klawiter - Tuesday, April 07, 2009 11:12:30 AM (Central Standard Time, UTC-06:00)

Just a quick post here for the people that attended my presentation. Thank you for coming to listen to me blabber about snippets and little tips and tricks. I hope you found it of some use.

Comments [0] #       |  kick it on DotNetKicks.com Shout it
# Wednesday, March 18, 2009
by Jeff Klawiter - Wednesday, March 18, 2009 5:41:54 PM (Central Standard Time, UTC-06:00)
With the release of Silverlight 3 Beta we can now run PixelShader effects on any control. This can produce some powerful stuff as shown during the Mix 09 Keynote this morning. I delved in as fast as I could to find out how to make your own and work with them in VS.

I downloaded the WPF shader library from http://wpffx.codeplex.com/ . I only imported the ShaderEffectLibrary so far, I have not tried the transition one.

I simply copied the EffectFiles, ShaderSource and EffectLibrary.cs files into my project and tried to compile.  Issues I ran into
  1. UIPropertyMetadata needs to be replaced with PropertyMetadata
  2. Color.FromScRgb needs to be replaced with Color.FromArgb and it's inputs run through Convert.ToByte
  3. MagnifyEffect.cs and SwirlEffect.cs reference classes that do not exist in Silverlight like the Vector class. I could have got them from reflector but in sake of time I didn't (that and being able to release this code)
  4. Getting the ps resources required a minor change to the Global static class. Basically changing the path to do a Relative URI lookup.
The basics here for doing your own shader effects is included save 1 thing. You need the DirectX SDK to compile your HLSL code. You can add a new build event or do it from the commandline. This is a good tutorial on how to do it http://windowsclient.net/wpf/wpf35/wpf-35sp1-hlsl-primer.aspx.

So the basics of doing your own Pixel shader in Silverlight is damn near identical as WPF. You inherit from the ShaderEffect class, load your compiled HLSL bytecode resource and expose any properties you need to modify as dependency properties.

Attached is my ugly but working example. I couldn't find anyway to bind to properties on an effect so I had to just do it by event.

SlShaderEffectDemo.zip

Comments [2] #      HLSL | Silverlight 3  |  kick it on DotNetKicks.com Shout it
# Wednesday, December 17, 2008
by Jeff Klawiter - Wednesday, December 17, 2008 11:05:58 AM (Central Standard Time, UTC-06:00)
For those of you still playing with the VS2010 and .NET 4.0 CTP bits, be aware that it will stop working on Jan 1st. MS has not released any word if we will be getting an updated CTP or a beta anytime soon. This is a bit unlike them where they had a bit of overlap between a VS CTP and the beta.

There are some ways around this. I found a nice post that covers some of the options and links to the information
http://blogs.msdn.com/granth/archive/2008/12/10/visual-studio-2010-ctp-vpc-will-expire-jan-1-2009.aspx

Basically you need to disable time syncronization for the VPC image.

I was worried about this since the get go. I wanted to do some talks coming up on .NET 4.0 and the new parallelism features but it's very hard to do that when you're not sure if you'll even have a working copy to demonstrate on.

Comments [0] #       |  kick it on DotNetKicks.com Shout it
# Tuesday, December 09, 2008
by Jeff Klawiter - Tuesday, December 09, 2008 9:25:58 AM (Central Standard Time, UTC-06:00)
Well I took my MCPD: ASP.NET 2.0 test yesterday and passed. It has been just over a year since I took my .NET 2.0 Foundation test. In that time I've taken MCTS for windows and web and now MCPD. There are many more certs to go. Next stop I think are the new .NET 3.5 TS certs.

Comments [0] #       |  kick it on DotNetKicks.com Shout it
# Tuesday, October 28, 2008
by Jeff Klawiter - Tuesday, October 28, 2008 11:29:58 AM (Central Standard Time, UTC-06:00)
I'm definitely installing this one when I get a chance. http://channel9.msdn.com/posts/briankel/PDC2008-ShowOff-Entry-Clipboard-History-for-Visual-Studio/

Basically it keeps a history of your clipboard items like Office but with one killer twist. "Paste as {Language}". It will take the C# you copied and Paste it as VB. I'm sure it's not 100% but still helps quite a bit.

by Jeff Klawiter - Tuesday, October 28, 2008 10:23:43 AM (Central Standard Time, UTC-06:00)
All of these new C# 4.0 dynamic features require parts of the DLR. Thus it looks like MS is taking the DLR and making it a first class citizen in the CLR. This also I'm guessing will make IronPython and IronRuby first class citizens as well. A huge win for the dynamic languages community. For C# 4.0 it is bittersweet. It means better interoperability when calling things created in IronRuby or IronPython but there are limitations. Below is an excerpt from the C# 4.0 WhitePaper (available here http://code.msdn.microsoft.com/csharpfuture)

Open issues

There are a few limitations and things that might work differently than you would expect.

·         The DLR allows objects to be created from objects that represent classes. However, the current implementation of C# doesn’t have syntax to support this.

·         Dynamic lookup will not be able to find extension methods. Whether extension methods apply or not depends on the static context of the call (i.e. which using clauses occur), and this context information is not currently kept as part of the payload.

·         Anonymous functions (i.e. lambda expressions) cannot appear as arguments to a dynamic method call. The compiler cannot bind (i.e. “understand”) an anonymous function without knowing what type it is converted to.

One consequence of these limitations is that you cannot easily use LINQ queries over dynamic objects:

dynamic collection = …;

var result = collection.Select(e => e + 5);

If the Select method is an extension method, dynamic lookup will not find it. Even if it is an instance method, the above does not compile, because a lambda expression cannot be passed as an argument to a dynamic operation.

There are no plans to address these limitations in C# 4.0.


To me this is a very huge limitation. I can already see that most of my interop with dynamic languages will probably involve collections of some sort. Also this would come into play with collections from Dynamic COM objects. LINQ is so powerful and easy to use, it may end up being a major annoyance to have to move away from it for dynamic typing. I hope they work on this for C# 4.5


Comments [0] #      C# 4.0  |  kick it on DotNetKicks.com Shout it
by Jeff Klawiter - Tuesday, October 28, 2008 8:13:13 AM (Central Standard Time, UTC-06:00)
While browsing through MSDN blogs I came across this nice little post. http://blogs.msdn.com/dparys/archive/2008/10/28/neue-m-glichkeiten-in-c-4-0.aspx . After translating the page I found that he linked to the new C# 40 page http://code.msdn.microsoft.com/csharpfuture

I played around with VS 2010 last night. I was able to test the dynamic keyword. It works as advertised but the biggest thing one has to realize is using it removes intellisense for that variable. Compiling type safety as well. I hope they'll be able to add some sort of limited intellisense by looking at the last assigned type.

Also on the Dynamic front is DynamicObject. A new base object type that allows for on the fly Property declaration. The DynamicObject uses a PropertyBag (looks like a Dictionary<string,object>). You can declare properties on the fly. Like
public class MyBag : DynamicObject
{
// überschreibt Getter / Setter
} 
dynamic b = new MyBag();
b.Id = 124;
b.Name = "Windows 7"
b.Price = 499.99m;
b.IsAvailable = false;

One thing I was unable to figure out was the optional, default and named parameters. Again the blog provided some answers.

public void InsertCustomer( int customerId,
                          string companyName = "Neue Firma",
                          decimal creditLimit = 2000m )
{
}

InsertCustomer( 1, creditLimit: 2000m );  

InsertCustomer( creditLimit: 2000m, customerId: 1 );





Comments [1] #      C# | C# 4.0  |  kick it on DotNetKicks.com Shout it
# Monday, October 27, 2008
by Jeff Klawiter - Monday, October 27, 2008 7:03:34 PM (Central Standard Time, UTC-06:00)
Well I spent most of the day working on some peculiar problems with PICK. Then left to take my girlfriend out for her birthday. Just now catching up on whats gone on today at PDC. Man it seems like it was a huge day.

First off Windows Azure and the new .NET Services. From what I've read so far I can see some compelling uses for the .NET services and sharing content, id's and roles around the web.

The big one that I haven't seen much press on yet is C# 4.0. Looks like we are getting dynamic binding in the language. While this loses compile type safety it gives C# good ground against things like Ruby and PHP.

Named, Optional and Default parameters. Oh how I've been waiting for these since switching to .NET from PHP. I used to take advantage of these features all the time. It annoys me when I can use them in Attributes in C# but not on actual methods. I'm going to love this.

VS2010 and C# will CTP are available in a virtual PC here

Here's a better overview stolen from http://blogs.msdn.com/samng/archive/2008/10/28/microsoft-visual-studio-2010.aspx
  1. Dynamic binding. We've introduced a new type, dynamic, which behaves much like object, but allows the operations performed on your object to be bound at runtime instead of compile time.
  2. Named and Optional parameters. You can now specify default values for your parameters, allowing them to be optionally specified at the call site. We've also added the ability for your arguments to be passed by name, so that you can specify exactly which arguments you want to give, and refrain from specifying the rest (assuming they're optional).
  3. Com interop features. We've done quite a bit of work to improve COM interop. These include:
    • No ref for COM calls. For all COM calls that take ref arguments, you can specify an argument without a ref, and the compiler will generate a local for you and generate a ref to that local as the argument.
    • No PIA. We have introduced the ability to deploy your applications which use Primary Interop Assemblies (PIAs) without referencing the actual PIA at runtime. This allows compiling against them, but not needing to ship them with your application.
    • Implicit dynamic for COM types. We now give you the option of turning all objects returned from COM into dynamics so that you can perform late bound calls off of them instead of having to cast the result in order to make it useful.

Comments [1] #      C#  |  kick it on DotNetKicks.com Shout it
# Friday, October 24, 2008
by Jeff Klawiter - Friday, October 24, 2008 9:25:44 AM (Central Standard Time, UTC-06:00)
So today I was tasked with helping a client move an old custom VB6 app to a new Windows 2003 server. The company that created it was asking for an arm and a leg for a simple transfer. After we moved the entire program directory over everything seemed to be fine until we encountered an "ActiveX component can't create object" error. I was perplexed on how to track down the issue. There were not accompanying DLLs or OCX files. I tried Process Explorer to see if I could find any failed openings and the strings contained in the exe.

After some searching on the net I found this lovely page http://www.cryer.co.uk/brian/windows/trbl_nt_axccco.htm . It details on how to use Sysinternals Regmon to track down issues with failed ActiveX creation. Basicall you watch your program for registery key openings and look for any failed opens in the HKCR/Classes path. After running the program and encountering the error I found it.
HCKR\Classes\cdonts

When I saw that come up I immediately knew what to do. cdonts is no longer included with windows server. It is an emailing library using cdo. I've had to install it on new Windows 2003 servers more than once so old ASP classic sites could run. All I needed to do after figuring it out was copy the cdonts.dll over to the C:\windows\system32\ directory and run regsvr32 on it. Everything was golden.

I've been using Sysinternals for years. I'm always amazed at what new ways I can use their utilities to track down issues. Process Explorer has been a godsend for me over the years. After discovering it, removing malware from computers took me less than half the time it used to. It gives me so much information I'm not sure how I got by without it.

The Sysinternals Suite is a must have for any serious windows programmer or administrator. It ranges from programs to monitor network connections to being able to see and suspend individual threads in a program.

Comments [0] #      blog  |  kick it on DotNetKicks.com Shout it
# Thursday, October 23, 2008
by Jeff Klawiter - Thursday, October 23, 2008 8:15:23 PM (Central Standard Time, UTC-06:00)
The other day I was posed with a problem to implement a "Send as Attachment" feature to an existing application. I thought, well this should be easy I've seen many other do it before. I quoted the work at a few hours, figuring some quick searching would give my my answers. I was wrong.

Sending an email using the default email client is very easy with the mailto: protocol. The problem lies in adding an attachment. Common mail programs like Outlook and Thunderbird do not support the attachment option. So, I started looking at MAPI the native API for doing this. I could not find any .NET wrappers. I did find that there were controls created by MS for VB6. Most of the .NET examples I found used COM interop with the ActiveX controls. But after trying these controls (which look like they were last updated in 98) I found them to not work in XP SP3. I'd get random exceptions and was never able to actually get an email dialog to pop up.

After failing with the ActiveX controls I was out of time. The MAPI native commands may have worked but it would take too long to set up the native calls and test it. After discussing with the client we ended up coming up with a bit hackish but workable solution. I would use the mailto: protocol and then launch explorer with the attachment selected. To them this is a minor annoyance that is acceptable. To me this an unfortunate sign of the times.

Things that were once "easy" for native applications become complicated and buggy for managed. It seems too often that I must make use native calls or old unsuported COM objects to get the job done. While MS has done a great job building up the .NET Framework. It seems that many native API's still remain unwrapped. Furthermore some places I read that the MAPI api is unstable on Vista. It seems that some API's are slipping through the cracks.


Comments [0] #      Rant  |  kick it on DotNetKicks.com Shout it
# Monday, October 13, 2008
by Jeff Klawiter - Monday, October 13, 2008 12:22:40 PM (Central Standard Time, UTC-06:00)
There are blogs on MSDN popping up that SilverLight 2 is indeed gold and will be public tomorrow Oct 14th. They also announced Silverlight Tools for Eclipse with the promise of cross platform development for Silverlight. I think this is a huge step in the right direction for MS. By giving developers on OS's other than windows to do Silverlight Development in a fairly competent IDE it will give them a better position against Flex.

I have done some playing around in Silverlight 2 and really loved it. I'm just hoping for a Silverlight 2 project to come our way at Sierra Bravo.

I look forward to downloading the public bits and seeing what I can do with the full version.


Comments [0] #       |  kick it on DotNetKicks.com Shout it
# Sunday, October 12, 2008
by Jeff Klawiter - Sunday, October 12, 2008 11:59:53 AM (Central Standard Time, UTC-06:00)
Well Code Camp 5 is in the bag. It was a large turn out and many great talks. My talk however drew no interest. Oh well, I tried and will try again. I'm thinking of making my post about LINQ and Refactoring into a talk.

The talks I went to:
The Intersection of F# and LINQ
This was a great talk about how F# takes LINQ and adds much more value to it with it's functional nature. The demonstration was a ray tracer that used LINQ to build up all of the reflected pixels. It was quite impressive. Combine it with the Arc talk and I am now very interested in Functional programming.

The Arc Programming Language
I had seen this talk a few days earlier. The speaker was hilarious and did a great job of bringing excitement back to lisp. Arc is a new dialect of Lisp that aims to cut down on parenthesis and add shorthand for common operations. He added objects to Arc with six lines of code, quite impressive.

BOO! A Wrist-Friendly Language for the CLI
BOO! is a another language along the lines of Lisp where it can redefine parts of itself through macros. The difference is it is statically typed like C#. It does offer quite a bit of reduction in code written. The presenter Justin Chase did a good job showing many aspects of the language. I also won a shirt for figuring out that the mystery function was calculating a fibonocci sequence. The code for it was quite cool, a,b = b + a or something like that.

Building MyTube with Microsoft Silverlight 2
Jeff Brand from Microsoft was giving this talk. It was a basic overview on SilverLight, the purpose for it and how to implement a simple youtube interface. I didn't stay for the entire thing, I had to go get ready for my talk.

My talk "Pick/Multivalue 101"
No one that was interested showed. Not that I was surprised but still a bit disappointed.  While giving the talk at my work we had over 15 people show. One of my co-workers showed and the other guy that showed was just looking for a place to sit. So instead we talked about LINQ, customized programming in Linux and a bit about Multivalue

I went to the speakers after party, got to gossip with some people from Magenic. Learned that Justin Chase left Magenic a few weeks ago to work on the Blend team at MS. He's a lucky guy and seemed rather excited for the features they are working on that he can't talk about. I'm sure some of them may come up soon at PDC. I did hear some gossip earlier in the day that SilverLight 2 RTM is going to be released as early as tomorrow (Oct 13th).


Comments [0] #      blog  |  kick it on DotNetKicks.com Shout it