Sign In

Navigation

On This Page

VS2010 Extensions Followup
PDC ‘09 Predictions
The overloaded .NET developer
Uninstalling VS2010 beta 1 – Work Around
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

Archive

<October 2009>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

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 ©  2010
 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:
# Monday, October 26, 2009
by Jeff Klawiter - Monday, October 26, 2009 12:15:10 PM (Central Standard Time, UTC-06:00)


Thanks to all those who came to my talk. When I first planned to give the talk Beta 1 had been out for a little while and I was working on my own extension. There was news that Beta 2 was no longer accepting bugs (beginning of august) and it was probably due that month. I thought that’d give me a couple months time to give the talk on Beta 2. But as we all know now, it took much longer to get Beta 2 out the door and it landed at the worst time.

When Beta 2 came out, 3 days before my talk, I set up a Windows 7 Bootable VHD up to install it and test my code, just in case I wasn’t able to get anything working and had to use Beta 1 for the talk instead. As I started trying out all the extensions I had I was almost ready to just use Beta 1 since none of them worked. As I got further into trying to use Beta 2 I realized some large fundamentals of all the extensions I was going to show had changed. Classes were removed, new classes introduced, easier ways of declaring your extension. The changes were big enough that I felt I would be doing a disservice to people by showing them the Beta 1 examples. I would rather show 1 working extension in Beta 2 than cause confusion by showing 5 in Beta 1.

Aside from the SDK changes in Beta 2 there were interface, feature and performance changes that I felt important to show. Beta 1 was much slower all around. There were new features in the Extension VSIX Manifest Editor and changes to the VSIX manifest itself. Also there were new templates included.

In the end I’m glad I used Beta 2 instead of Beta 1. While I was missing my examples of adding menu items, commands, doing search and replace in the editor, I was able to show real world working code that anyone going out and downloading Beta 2 after my talk would be able to implement. If I had another week or two between Beta 2 and the talk I would have had all of them.

I’d like to know your thoughts, I’m not above being criticized as long as the dialog is civil. I want to be a better speaker a better person. I know I’m not the most witty or animated, but I love to code and I love to share my knowledge.

Here’s links to some of the resources. The first sample code you can find below, The second two samples shown were from the Codeplex editor examples. I had more hand rolled examples but they didn’t work in Beta 2 but I ran out of time in getting them working.

Where Button Marker
WhereMarker.zip

Editor Examples on Codeplex
http://editorsamples.codeplex.com/

Visual Studio Extensibility on MSDN
http://msdn.microsoft.com/en-us/vsx/default.aspx

Black Editor Colors
JeffKlawiterBlackColoring.zip

Comments [0] #       |  kick it on DotNetKicks.com Shout it
# Friday, October 23, 2009
by Jeff Klawiter - Friday, October 23, 2009 12:01:27 PM (Central Standard Time, UTC-06:00)

Disclaimer: These are solely my personal opinion and thoughts of what will be unveiled during PDC this year.

Windows Mobile 7

With the current rumors that WM7 will beta in Nov it’s a no brainer that it will be unveiled at PDC. I’m expecting a major UI update, rewritten graphics system and more integration with .NET CF. The .NET CF team has been rather silent on their blog for a while now and that’s normally a sign of big things to come. I have a inkling that the new UI will be WPF based. Since Silverlight Mobile is WPF, this would give a great chance to make WPF a full UI framework for windows mobile

Silverlight 4

Becoming a staple of PDC and Mix, Silverlight has been on some extremely fast paced development. I’m expecting SL 4 to have webcam and microphone support. Along with more .NET 4.0 features like dynamic types and the DLR.

Silverlight Mobile

It has been talked about more than once, last PDC had quite a large demo for it. I expect it to be announced probably for Windows Mobile 6.5 and higher.

Windows 8

With Windows 7 out of the way, I think we may be teased with some of the ideas they have for Win8. There has been a lot of activity on linkedin related to it. Like 128bit support, which I’m expecting is probably Intel’s Itanium successor and not meant for desktop chips.

Blend 3 SP1

MS has already said that Blend 3 will get .NET 4.0 support in SP1 and it was expected to ship Q3. I think most of this update will only revolve around .NET 4 and nothing in the way of new killer features.

Comments [0] #       |  kick it on DotNetKicks.com Shout it
# Wednesday, October 21, 2009
by Jeff Klawiter - Wednesday, October 21, 2009 4:51:23 PM (Central Standard Time, UTC-06:00)

I write this as I’m sitting here working on a .NET CF 2.0 project in Visual Studio 2005 while installing Visual Studio 2010 Beta 2 onto my laptop which is running windows 7 installed on a vhd file booted natively. I look at the list of components being installed with 2010 Beta 1 and I’m just left feeling inadequate. The one that really tipped it was Visual F# 1.0. F# has been out in for a while now and I’ve only seen talks on it. I haven’t written a line of code in it. I can also say the same for Work Flow and many other MS/.NET technologies.

I sat in on an interview today with a rock star programmer. His code sample he sent in to us was the best we’ve ever seen. He’s got strong ASP.NET (and MVC) skill along with HTML/CSS-fu. Then I ask the questions about what else he has done in .NET.. barely any WinForms, no compact framework, little WPF. I do not hold any of this against him, I know full well what it is like to try and keep up with things when your current job doesn’t entail them. Here at Sierra Bravo my job does entail them, sometimes. We do such a large variety of projects I’ve had to learn almost everything under the .NET sun and I still feel like I’m behind.

I’ve spent the last few months trying to write a talk on Visual Studio 2010 Extensions and I sure hope my talk goes well but I’m not optimistic. After getting into doing the extensions, hoping for a nice easy to use SDK as was promised, I found still a complex system of interfaces, attributes and unclear APIs. Mind you, it is still beyond  what was available in 2008. I also gave a talk on SQL CLR programming and have been working on learning ASP.NET MVC. Beyond that, reading a WPF certification book and hoping to one day expand my certifications passed the VS 2005 realm. I spend nearly every minute of my spare time reading, coding and learning.

Things I have done

  • .NET CF 1-3.5 (about 10 applications)
  • ASP.NET 1.1 – 3.5 (lost count of how many sites)
  • .NET WinForms 1.1 – 3.5 (about 20 applications)
  • Windows Services (around 10)
  • ASMX (lost count)
  • WCF ( a few)
  • SQL Server 2000-2008 (full and express)
  • SQL Reporting Services
  • SQL CLR
  • SharePoint integration (2)
  • Visual Studio Extensions (a few)
  • Command line Programs (20+)
  • Library development (HtmlAgilityPack, Sierra Bravo Connector aka PickDB)
  • TCP Client/Server protocols
  • Serial Port controlled vending machines
  • RFID integration
  • Surface
  • Silverlight 1.1-3.0
  • C# and VB.NET
  • Dabbled in XNA
  • Dabbled in MVC
  • Office Integration
  • LINQ to SQL, LINQ to Entities
  • T4 programming
  • Got MCTS WinForms/ASP.NET 2.0 and MCPD ASP.NET 2.0 certified

Things I still need more experience in, have yet to do, work with or even look at

  • TDD/DI/IoC – I’ve dabbled a bit but feel like I’m really falling behind with these dev patterns
  • Micro Framework
  • F#
  • Work Flow
  • TFS
  • Full WPF Application
  • Full Mono application
  • M/Oslo
  • Parallel Extensions
  • Tons of the new stuff in VS2010/.NET 4.0 (like the asp.net 4 features)
  • Write a LINQ provider

While the latter list seems small, I’m sure it will grow again. The first list covers 4 1/2 years of work. To me it is mind boggling that I’ve done so much and also a testament to how powerful the .NET framework is. In the PHP world there are a couple great frameworks these days but it has taken many many years to get to that point. Also PHP 6 is turning into PERL 6 with it being on the horizon for many years now. It also has the issue of only being a web language.

I really hope after VS2010 Microsoft slows down for a bit and waits until VS2015 or something. I’m not sure if I can keep up on this pace much longer. Some days I wish for a job where I’m working on a product, or in a slower paced project. Other days I think I’d go crazy if I was working on the same thing all the time. One thing is for certain, I need to start doing things outside of work again.

Comments [0] #      Rant  |  kick it on DotNetKicks.com Shout it
# Saturday, September 26, 2009
by Jeff Klawiter - Saturday, September 26, 2009 6:05:35 PM (Central Standard Time, UTC-06:00)

Today I was cleaning off my old laptop for my girlfriend to use. While trying to Uninstall Visual Studio 2010 Beta 1 I ran across an error. It was on the step trying to uninstall the “TFS Object Model”. The error said it was looking for “TFSObjectModel-x86_ENU.exe”, it asks for the install DVD but the exe is not on the disc at all. After some digging I found a way to get the uninstall to work.

The trick is to uninstall the component on it’s own. It’s called “Microsoft Team Foundation Server 2010 Beta 1 Object Model – ENU”

image

After uninstalling that I was able to run the VS2010 uninstall without a hitch.

Comments [0] #       |  kick it on DotNetKicks.com Shout it
# 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