|
>
 Wednesday, February 01, 2006
 |
|
 |
|
|
|
|
|
I blog when I have time and have something important to share, but I don't always have time to blog everything important I have to share (that's what articles and books are for I guess)...sometimes I blog just to hook you up to content references for events I've been part of...but today...I'm just blogging to vent my frustration with code snippet management in Visual Studio 2005. Aaarrrrghhhh...
Don't get me wrong, code snippets rock for productivity, but creating your own and getting them to freaking appear in the right place seems like a feat of great energy and time that I really do not have...sigh...but I took the time anyways because I figure if I just spend 2 hours (or 7200 seconds) now to get it working, then spend and extra 5 minutes (or 300 seconds) creating snippets for my repeatable code...it will pay off after I use about 200 snippets. Assuming I use about 3 code snippets per code sample, and that I create several code samples per day for my WCF book, not to mention other code samples and vertical slices for clients...I should be able to recover this time about 20 days time or less. Of course, I'm not factoring in time to write this blog...
So here goes my experience creating code snippets:
Creating new XML config snippets, no problem at all. Just copied an existing code snippet sample and away we go! Off to a good start.
Adding the code snippet to the Code Snippet Manager. Well first of all, figuring out what Add... versus Import... mean in that dialog is a pain. No, I didn't take the time to read an article about it...and frankly I expected it to be pretty easy to figure out. Well it seemed like sometimes Add worked, sometimes it didn't, but I seem to have finally figured out that you are supposed to select a directory that holds the code snippet type for the language you are adding folders to.
So, I created a WCFSnippets folder with two subdirectories:
\WCFCode -> holds my C# WCF code snippets
\WCFConfig -> holds my XML WCF code snippets for configuration
Then, from the code snippet manager, you select XML for the language and click Add. What you are supposed to do is find the folder with your XML snippets, so I navigate to \WCFConfig...but don't just navigate to that directory, drill all the way into the directory where the snippets are stored before you select the directory. Here are the screenshots: wrong, right and result...respectively.



For C# or VB.NET snippets, just select the right language, and drill into the directory where those are located.
Extra crap in my code snippets intellisense...make no "sense". I know the above seems really super easy...and it is once you know where to navigate and how to organize your stuff. Still, I had all kinds of extra crap left over in my snippet manager, and in my code snippet intellisense...let me explain.
After trying Add/Import, I was left with extra folders in my code snippet manager, that somehow didn't reflect all the snippets I was creating...it was nuts...I was going nuts...maybe I am nuts...anyways it turns out that Import is not really necessary if you have added your snippets folder according to the Add method I explained. Any new snippets you create in those custom folders will now appear in the magical snippets list. But, if you want to copy (import) a snippet from somewhere and put it into one of your folders (or, one of the predefined snippet folders for VS) you can Import.
If I navigate to my WCF configuration snippets folder and select a snippet, I will be presented with the already existing XML folders (preexisting or resulting from Add). You decide where you want the snippet to go and a copy is made there. Watch out for dupes!


The bugger of it is, you can't remove snippets. You can add them, but they will never go away...that is unless you delete the actual snippet from the file folder. So much for snippet management. You can remove folders, just not those living in the VS snippet folder, that's too official to remove...
Things to watch out for.
1. Beware not to add your snippet directories more than once. Or not to add the parent directory, only to decide on the child directory as in my WCFSnippets and WCFConfiguration example earlier. What happens? Well, somewhere out in snippet configuration land (a lost land that I cannot find) there is memory of every (wrong) directory you ever added using Add...and you can't freaking get rid of it. Well...I'm sure you can, but I care not spend more time to figure out why...perhaps someone else can tell me!!!

2. Make sure you put the correct language in your snippet code. If you call it XML but it's really C# (spelled csharp in snippet terms) you won't see it appear in your C# snippets after all...another ghost I chased...for a short while.
Sample snippet...for your time...more to come :)
<?xml version="1.0" encoding="utf-8" ?> <CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <Header> <Title>system.serviceModel.diagnostics</Title> <Author>Michele Leroux Bustamante</Author> <Shortcut>serviceModel.diagnostics</Shortcut> <Description>Sample system.serviceModel.diagnostics section.</Description> <SnippetTypes> <SnippetType>Expansion</SnippetType> </SnippetTypes> </Header> <Snippet> <Declarations> <Literal> <ID>perfCounters</ID> <Default>true</Default> <ToolTip>Enable performance counters: true|false</ToolTip> </Literal> <Literal> <ID>wmiProvider</ID> <Default>true</Default> <ToolTip>Enable WMI provider: true|false</ToolTip> </Literal> <Literal> <ID>logEntire</ID> <Default>false</Default> <ToolTip>Log entire message content (beware! production performance hit): true|false</ToolTip> </Literal> <Literal> <ID>logMalformed</ID> <Default>true</Default> <ToolTip>Log malformed messages (or, provide your own logging mechanism, don't do both!): true|false</ToolTip> </Literal> <Literal> <ID>logServiceLevel</ID> <Default>false</Default> <ToolTip>Log messages at service level: true|false</ToolTip> </Literal> <Literal> <ID>logTransportLevel</ID> <Default>true</Default> <ToolTip>Log messages at transport level: true|false</ToolTip> </Literal> <Literal> <ID>maxLog</ID> <Default>100000</Default> <ToolTip>Maximum message log count (runs out fast, must backup the file!)</ToolTip> </Literal> </Declarations> <Code Language="XML" Format="CData"> <![CDATA[ <diagnostics performanceCountersEnabled="$perfCounters$" wmiProviderEnabled="$wmiProvider$" > <messageLogging logEntireMessage="$logEntire$" logMalformedMessages="$logMalformed$" logMessagesAtServiceLevel="$logServiceLevel$" logMessagesAtTransportLevel="$logTransportLevel$" maxMessagesToLog="$maxLog$" /> </diagnostics>]]> </Code> </Snippet> </CodeSnippet>
|
|
|
 |
|
 |
 Tuesday, January 31, 2006
 |
|
 |
|
|
|
|
|
Ok folks...here's a sample (er full blown wicked application) that makes all my 6 project WCF samples that include security, transactions, reliable messaging, MTOM file uploads and more...look like Hello World...
Clemens Vasters, founder of Newtelligence, leader of the community project dasBlog (my blog engine), well known blogger/speaker/writer/thought leader, and a person I am proud to call my friend...has really done it this time.
Newtellivision, get it here (he's popular, hence the site might be slightly slow)...
http://www.newtellivision.tv/2006/01/30/GoingOutAndInWithABangNewtellivision.aspx
|
|
|
 |
|
 |
 Wednesday, January 25, 2006
 Tuesday, January 24, 2006
 |
|
 |
|
|
|
|
|
We just pulled off our first Code Camp in Southern California and if I do say so myself - it rocked! Not only because we had great speakers, great sessions, and a fantastic organizational staff and volunteers...but because we also had a GEEK dinner and put on a fun show with some rock bands.
Things that stood out for me at our Code Camp:
- We had sessions on everything from .NET/ASP.NET and WinFX (W*F) technologies to Java, Ruby on Rails, test driven development, VSTS and more. I expect the future events to increase in size, and include even more platforms and community integration.
- The community that attended ranged from LA to San Diego...and we had several from out of state on the speaker roster as well like Rick Strahl and Rory Blyth. So, at the next event in San Diego (late June is the current target)...we are hoping to inspire folks from OC and LA to make the trek...more sessions, more speakers, more music!!!
- Attendees seemed to really enjoy the event...lots of great feedback...and the main request: more, more, more...we'll be looking to add BOF sessions for open discussions, and panels with a mix of speakers to make for interesting forums for comparison.
- ROCK & ROLL - we put on a geek dinner, and I had the fun of organizing the bands...through my Stuntmusician project. A band I had interviewed last August, Killola, agreed to come down and play at our dinner...they put on a great performance (of course, I already knew they were awesome live!) and after that, we had a jam band made up of Paul Sheriff (drums), Dave McCarter (bass/rhythm), Brad Smith (drums/bass/vocals) and my brother Paul Leroux (lead guitar/vocals). Actually, my brother helped me organize the sound gear order, setup logistics for the band, and was nice enough to participate in the jam as a ringer, since he actually is a rock musician (EvilDoers) in Toronto. They played some Van Halen, Ramones, Led Zepellin and more...and they sounded great after practicing ahead their parts, then getting together at Paul Sheriff's house Friday night to practice together. I taped it, we'll have video for some of the practice and live show posted soon...
It was great fun working with Woody Pewitt, Daniel Egan, Mark Rosenberg and Brian Maso to organize this event. And I'm already working with three other conferences to supply great independent bands to play (info to come...) which is really excited because that was a ton of fun to put together...plus I'm a big fan of indie bands, they need our love. Killola sold some CDs at the show, and I for one want to thank those that supported the band who volunteered their time and effort to drive 1 hour to the event and give up a Saturday night playing in LA. I'm telling you, this band is constantly playing, and just produced a full length CD (www.killola.com) that rocks.
You might be seeing them and others at future geek events, in particular code camps :)
I'll be posting links to my session content next...stay tuned!
|
|
|
 |
|
 |
 |
|
 |
|
|
|
|
|
I just started a new column for ASP.NET Pro: ASP.NET Under the Hood
In the first edition, I answered a reader's question about dynamically applying themes based on user profile settings at runtime. You can check out the column here: http://www.aspnetpro.com/features/2006/02/asp200602mb_f/asp200602mb_f.asp
If you have other questions, don't forget to send them my way and if I write about it in the column, of course I will also answer you personally in the process.
Cheers!
|
|
|
 |
|
 |
 Thursday, January 05, 2006
 |
|
 |
|
|
|
|
|
I had some questions on versioning contracts, so I thought I'd write up a quick list of tips on this subject, some of which applies to any platform where contracts drive communications (read: web services in general).
Point #1 – breaking changes require contract versioning
Here are an example of some breaking changes that cause serialization requirements for a service to change:
- Remove operations
- Change operation name
- Remove operation parameters
- Add operation parameters
- Change an operation parameter name or data type
- Change an operation's return value type
- Change the serialized XML format for a parameter type (data contract) or operation (message contract) by explicitly using .NET attributes or custom serialization code
- Modify service operation encoding formats (RPC Encoding vs. Document Literal)
Point #2 – modifications to implementation semantics require contract versioning
Even if there are no contract versioning violations from #1, if the implementation semantics of an operation have changed this warrants contract versioning. If your clients call an Add operation and you decide that Add will no longer add, it will subtract...then your existing clients should continue to call the "old service operation" and you should create a new operation for the subtract operation. If the change is subtle, and if clients will not be affected by the change, no need to create a new operation.
Do you have to version the contract if you add a new operation? Not necessarily, however if you have a contract that has been published with methods A, B and C...and clients have been programming against that contract, then when you add methods D and E it would be good to provide a distinction between the original contract, and the new one. If the new methods are still related to the same contract, you can provide a new contract by the same name, with a new namespace.
Point #3 – you can avoid contract versioning
You can reduce the changes of #1 and #2 being directly violated. For example, a parameter can receive alternate serialization formats, the service can opt to forgive missing elements, or ignore extra elements. You can design the service contract to be forgiving by things like this:
- Using optional elements in data contracts
- Using IXmlSerializable types and “handling” serialization differences behind the scenes
- Intercepting parameter serialization and deserialization at a lower level to overcome differences
You can also avoid parameter list modification issues by avoiding specifying a list of parameters in your methods. For example instead of:
use:
void Add(AddRequest message);
where AddRequest is a type that receives x and y:
[DataContract] public class AddRequest {
[DataMember] public int x;
[DataMember] public int y;
}
Now, if you add another public member to the AddRequest type, and make sure it is not a required element, old clients can send their reduced set along:
[DataMember(IsRequired="false")] public int z;
You can preserve unknown serialization elements as well, on the client or on the service side, by implementing IUnknownSerializationData in your data contract types. You can find out more about this in my book chapter on Contracts, which will be posted when I launch my book blog this week.
|
|
|
 |
|
 |
 Saturday, December 31, 2005
 Wednesday, December 07, 2005
 |
|
 |
|
|
|
|
|
I just presented the ASP.NET session for the launch yesterday in Anaheim...lots of people indicated how excited they are about the improvements to ASP.NET...and I agree. I promised some tips on “getting started” with all the new features, to guide you on your way. If you look at these sections in the MSDN library, including articles written by myself and others...that should help!
This article link will take you to the ASP.NET\Infrastructure articles (look at the treeview on the left!): http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/asp2local.asp
If you scroll down in the MSDN on the left side, you'll see a number of other categories, all based on ASP.NET 2.0...this is a good start for reviewing a collection of articles on ASP.NET 2.0.
|
|
|
 |
|
 |
 |
|
 |
|
|
|
|
|
My pal Jennifer Ritzinger at Microsoft has kicked off a new Channel 9 series highlighting women with cool jobs in technology. The first interview is with Angela Mills who is the Group Program Manager for Indigo (WCF)...my favorite new technology. She talks about what it is like guiding the process of building the next generation platform...she's awesome.
Oh, another cool interview I saw there (haven't heard yet) from the speech writer for Steve Ballmer...what a job! He doesn't something like 200 speeches per year, and you know they have to rock!!
Anyhow, check it out:http://channel9.msdn.com/Shows/WM_IN
Oh, and don't confuse WM_IN with a Windows message :) Gosh, that gets me thinking...the last time I messed with anything WM_XXX was when I programmed ATL/C++ in the late 90's...gosh it's good to have .NET!!!!
|
|
|
 |
|
 |
 Wednesday, November 30, 2005
 |
|
 |
|
|
|
|
|
I posted some WCF samples earlier in this blog, and they were built against a (then) unreleased version of the bits. Now you can get them too, here: http://www.microsoft.com/downloads/details.aspx?FamilyId=E5376297-DA10-4FC3-967D-38C96F767FC4&displaylang=en
This build works with VS 2005, the steps to build a machine:
Enjoy! Check out my earlier Indigo posts for code samples. Some are built for PDC bits, later are built for these bits... thought I can't absolutely guarantee it since I am using early builds before they are public. Let me know if you find incompatibilities so I can try to help.
|
|
|
 |
|
 |
 |
|
 |
|
|
|
|
|
In a recent exchange on this forum: http://forums.asp.net/1126817/ShowPost.aspx a few people are looking for tools to help them with the localization process. WARNING, the thread is really long, it will take you two hours to get through it!!! I have already made a lot of remarks in the forum, but it is pretty clear that although ASP.NET 2.0 has taken some of the pain away with the new tools they provided including:
- Generation of local page resources
- Declarative expressions that generate code to link control properties to local or shared global resources
- ResourceManager lifetime management
- Automatic culture selection from browser settings
...people (of course) still want and need more. I have a perspective on this that is based on my experiences, but you all may have other challenges that differ, so this blog entry is an attempt to collect feedback from you on the tools you'd like to see improved for localization of Web sites. Here's my synopsis of what is needed, and the roles that use the tool:
Improvements to developer tools (VS IDE):
- Help me associate control properties to local or shared resources and manage my shared resources as well if I have made those links. Currently this can be done with IDE extensibility, no tools on the market.
- Don't let me compile without notification that resource should be regenerated due to changes in the page. In other words, developers are concerned that the page changes might be out of sink with resources associated to the page...and not resolved because the developer forgets to generate resources again.
- Provide a tool to automatically (programmatically) generate resources for all pages.
- Help me link a resource entry to a database field. THis would be like data binding, with a custom localization expression linking a $Resource entry to a database field, which implies I need a way to configure the connection string for design time as well. This would still look like an explicit localization expression for a shared resource, but connect to the database instead. THis can be done with extensibility but no robust solutions currently exist.
- Perform change management to reconcile changes to invariant resx (local or global) and make sure keys are reconciled with variant (NOTE: I don't agree that this is necessary in the IDE, I think it belongs in change management, but let's keep it here and see what people think).
Change management tools:
- Create a difference report for resources on check-in (VSS or VSTS or external tool that can be run against selected source files).
- Allow the difference reports to be reconciled from last translator shipment to the latest build (what resources were added, changed, deleted in the invariant version? reconcile this against variant resources)
- Pull all resx into a single file, allow translators to edit that single file, the push all translated values into appropriate individual resources again (easy, with XML, and clients have done custom work on this, no tool on the market that I know of)
- Pull database content and file content for translators into a localization package for editing by translators offline, then reconcile after changes are made (lots of variations here, what tools do people use today for database access besides running reports and pushing in translated values with script?)
- A way to manage this process and keep track of all relevant files/changes
I know this is not an exhaustive list, but it is relevant to the discussions on the thread I mention above.
Please comment or add requests in this blog entry. I speak with this team at Microsoft with some regularity, and have told them about this blog entry...and they are just a great group so they are really interested in hearing this feedback!!!
|
|
|
 |
|
 |
|
|
ON THIS PAGE
|
|
|
|
SEARCH
|
|
|
|
CATEGORIES
|
|
|
|
ARCHIVES
|
| | Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|
| 29 | 30 | 31 | 1 | 2 | 3 | 4 | | 5 | 6 | 7 | 8 | 9 | 10 | 11 | | 12 | 13 | 14 | 15 | 16 | 17 | 18 | | 19 | 20 | 21 | 22 | 23 | 24 | 25 | | 26 | 27 | 28 | 1 | 2 | 3 | 4 | | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
|
|
BLOGROLL
|
|
|
|
|
 |
|