 Thursday, May 12, 2005
I swear I’m not a paid endorser, but I have to mention BlogJet again. I just found out a new feature (well, new to me anyway) that I thought I’d share with the world. I was browsing through the BlogJet website looking to see the status of my feature request when I decided to look through the screenshots. I’d been having trouble with the properties tab – I can’t seem to get it to let me add TrackBack URLs through the tool. Anyway, I was flipping through the screenshots when I saw this unfamiliar view:
Recent Posts.

You can look through your recent posts and edit any one you want to! That’s pretty cool for making corrections to old posts (like I did for this one). I knew that I could get and edit the last post, but I didn’t know I could flip through all the old ones (complete with previews). I like it!
— Matt Ranlett
posted with BlogJet
I was reading a post from Steve Vore where he asked for recommendations about RSS tools – readers and writers. I couldn’t help but tell him about my favorite tools (which I’ve mentioned on here before, but I’ll mention them on here again)
“I went on a quest similar to yours a while back - looking for a good reader and a good editor. Here's what I like. In the reader category, I can't say enough good things about JetBrains Omea Reader (www.jetbrains.com). It's free if you get it quickly - they're going to charge soon. It has offline reading - indexed in a database so searches are lightning fast. It goes beyond simple folder organization of feeds with a workspace concept - where you can group feeds together and only see the ones you're interested in. For example, I have 60 feeds total, but I have a .Net workspace with only 25 feeds in it. I have a News workspace with 4 feeds in it. I can look at these workspaces to focus my blog reading energies. Omea reader is also great b/c it does more than just RSS. It is also a NewsReader, so if you want to follow newsgroups, you can subscribe to them and see them in the same window with your blogs. You can even sort them into workspaces. For example, I've subscribed to the two Microsoft Tablet news groups. Omea will also keep up with bookmarks for you, so if you have a favorite website that hasn't caught on to the RSS phenomenon yet, you can keep yourself up to date here as well. If you shell out the cash for the Pro version of the Omea product, it will also receive e-mail. I haven't done this for the exact reason you want to get your RSS out of Outlook. Time management.
On the editor side of things, I wholeheartedly recommend BlogJet (www.blogjet.com). It works really well - allows Rich text editing of posts with a tab to edit HTML when the occasion warrents it. Spellchecking in multiple languages. It integrates into IE so you can open it when reading an interesting page and blog about it while it's fresh in your mind. User profile controls allow you to connect to many different blogs, with over 20 different blog engines supported. Drafts are supported (and I use that all the time) and the developer(s) are pretty responsive to change requests. I use this tool almost as much as I use Outlook.”
— Matt Ranlett
posted with BlogJet
I don't know about the other speakers, but Brendon and I are coming up with a brand new presentation for Code Camp. This involves us coming up with a topic (done), an outline for the presentation (done - thanks Brendon), a slide show to keep us on track (mostly done - fine tuning still going on), some canned demos in case time gets to us (we're still working on these - more comments below), and practice some other demos so we can do some live coding but not look like morons when stuff doesn't work (still doing these as well). We've been working/watching webcast/reading books and MSDN articles for a while now. We've been shuffling the slide deck back and forth between us for additions and subtractions. We even got together last night (not easy to do b/c we both work a lot and Brendon lives in northern BFE where I live in Atlanta) and worked from 7pm to midnight. I'd like to say we're ready except for some last minute demo coding and a bit more polish on the slide show (take a few slides out and add a few new ones). We're mostly there and if I had to drop everything and give the presentation right now, I wouldn't be embarrassed for myself.
One thing - has anyone had problems with Visual Studio 2005 Beta 2 and the SQL Express product? I can't seem to connect to my SQL Server, so I can't create or attach a database. This means I am not going to be able to demo any kind of data binding (except from XML). I installed everything on the CD except the J# stuff (personally no interest in Java syntax) and got no errors during the install. I did notice that there are no useful GUI SQL tools that came with the Express edition (no management studio or query analyzer tool) but I'm comfortable with OSQL so that's not a problem. But I can't get any tool (OSQL, VS2005 Datbase Explorer, etc) to connect without timing out. Thoughts? Help!
-- Matt Ranlett
UPDATE - Brendon found the problem. SQL Express installs a named instance of SQL Server, so you can't just connect to the (local) server. You need to connect to (local)\SQLExpress or .\SQLExpress. Once you do that, everything works.
 Tuesday, May 10, 2005
Microsoft releases a new version of Windows Mobile (version 5) with more reliability, more hardware, and more features. Designed to compete with the Symbian OS (Nokia’s favorite OS) and Palm OS (like the Treo 650). Microsoft Mobile now supports some great features like wireless LAN support in Smartphones and Media Player 10 Mobile. We should be seeing some great new devices on the market soon!
— Matt Ranlett
posted with BlogJet
Enter this contest hosted by Microsoft and compete for the chance to win $50,000. The Microsoft Connected Systems 2005 Developer Competition is a global, skill based competition intended to highlight and reward creativity and programming excellence using SQL Server 2005, Visual Studio 2005 and BizTalk 2004/2006. There are 15 categories for the competition, including a SmartPhone app category, a Visual Studio PowerToy category, and more. Entries are accepted up to August 30th. The contest ends September 15th.
Thanks to Martin Crimes for bringing this to my attention.
-- Matt Ranlett
 Monday, May 09, 2005
Thank you to Unisys and Melanie Marks for providing the pizza and prizes for the evening.
Doug kicked off the meeting with a quick demo of the DTS Integration Services Data Flow interface in the new 2005 Reporting Services Reports Builder UI (part of Whidbey’s 2005 Visual Studio interface). In Doug’s quick demo, he showed how easy it would be to take a flat file, pipe the input from the flat file to a pair of tables using Data Flow sources (flat file), transformations (to pipe the raw input to one table and the summarization of the raw input to another table), and destinations (database tables in this example). One of the really neat things about the demo was how the drag and drop tool turned from the design environment to a graphic representation of the progress of the DTS program in the debugger. During this quick preview of SSIS data integration, a question came up about the differences between SSIS and BizTalk. The results of the discussion were that BizTalk is assured delivery across a heterogeneous environment where SSIS is called integration services but usually functions as a data movement engine.
The main presentation was an introduction to SQL Server 2005’s Reporting Services Report Builder. The core changes to RS 2005 include some tighter integration with Sharepoint and the end to end BI. Rich Client printing has been added to RS. The Expression editor has been enhanced with VB.Net functions complete with Intellisense. Multi-Valued parameters have been added – the report processing will create SQL. the ASP.Net date picker has been included. Interactive sorting has been added so sorting can occur without requerying the data. Floating header (like Excel) so you don’t have to build paged tables with header rows. Custom report items allow the API to be exposed, so that 3rd party vendors can provide charts, maps, etc. Analysis Services support now integrates MDX parameter support and data mining query builders. Management Studio integration functions as a single point of management for all SQL Server components, a supersert of Report Manager functions. SharePoint Web Parts have been added – now you can integrate your reports into Sharepoint Services and Sharepoint portal server. Visual Studio’s integration is better. The Report Controls in Visual Studio make it easier to embed reporting functionality into applications (both web and winform).
The Report Builder fills the need between the report manger (for report consumers) and the report designer (for power users and developers). The business users would be using the report builder. Caution – report builder requires SQL Server Enterprise Edition. Report Builder is an ad-hoc report design tool for SQL Server RS. This is targeted at business users who want to find and share answers. This is not an analytical client or a replacement for pivot tables. Report builder doesn’t query SQL objects, but rather queries a semantic model of the data making is so that the business users don’t need to know SQL to write the reports. The report builder is a smart client application downloaded directly from the Report Manager web application. To build a report, you pick a template (chart, matrix, table) and drag table fields onto the design surface. When you build the report, you can page through the report and click on any detail to look in more detail (infinite drill).
Next we took a look at the semantic modeling tool. We used Visual Studio to build a report model for the Northwind database. You would use this to build a semantic model the business user would use to generate Report Builder reports. You start out with a Data Source View – use the wizard to create one if one’s not already been created to meet your needs. Once you have a data source view, the report modeling wizard makes some assumptions about the data (you can override these assumptions, but the wizard is pretty powerful) and generates a set of metadata in 2 passes. Once your model is completely processed and you have an SMDL (semantic model definition language) file, you can publish it to the reports server, or you can add expressions and calculations to the report model. Now that the SMDL file has been published, and you have your new report model, you can build new reports with the Report Builder tool.
My personal impression of the tool is this – this is a great tool which has great potential. I can easily see savvy business users creating their own reports to explore details that are smaller and less sophisticated than full RS or Analysis Services reports. I especially like the infinite drill capabilities and the ability to save any drilled down view to the report server as a stand-alone report. However, currently you can’t reverse-engineer the data connections of a report builder report in Visual Studio, so you’ll have a hard time taking a report builder report (also RDL like Visual Studio’s Report Designer’s reports) and turning them into true Report Designer reports (with true SQL as the data source, rather than the semantic model of the SQL objects). Another problem is the enterprise edition requirement – drastically increasing the price of the tool for small shops.
I asked a couple of people at the UG meeting what they thought of the presentation and our presenter. Based on the questions I heard from the group during the presentation, there seemed to be a good deal of excitement around the possibility of granting the users the ability to generate their own reports via infinite drill, but there seemed to be several questions concerning the underlying technology. I got the feeling that a lot of the developers/DBAs were uncomfortable with the semantic model’s removal of SQL – perhaps the feeling of a loss of control? Otherwise, people were very positive about both the presenter and presentation. Great job Doug!
— Matt Ranlett posted with BlogJet
Thanks to our omnipresent sponsor, Microsoft (personified by Doug Turnure), the Atlanta .Net Regular Guys have some t-shirts with the ADNRG logos to give away. Start showing up to the user groups regularly and you’ll get a t-shirt of your very own. Remember – Brendon and I aren’t the only .Net Regular Guys in Atlanta – anyone who shows up regularly to two or more meetings a month is eligible to receive a shirt.
Don’t forget to sign up on the www.devcow.com site to be an Atlanta .Net Regular Guy!
— Matt Ranlett
posted with BlogJet
This is just a reminder – the May 19th meeting of the .Net Book Club has been cancelled due to the MSDN Event and Pub Club. Be sure to sign up for the MSDN Event on www.microsoft.com/events!
The Pub Club will be held immediately after the MSDN Event at a nearby location, but you need to attend the MSDN Event or any user group between now and the 19th (the Mobility UG and the VB UG both have meetings scheduled)
— Matt Ranlett
posted with BlogJet
I flipped through the Microsoft Events site and thought I’d report my findings
Management and Operations of .NET Applications Workshop – $165 – Monday, May 09, 2005 9:00 AM - Tuesday, May 10, 2005 5:00 PM
SQL Server 2005: New Features for Developers – $175 – Monday, May 16, 2005 9:00 AM - Tuesday, May 17, 2005 5:00 PM
MSDN Event – $0.00 – Thursday, May 19, 2005 1:00 PM - Thursday, May 19, 2005 5:00 PM
TechNet Briefing – SQL 2005 & Windows 2003 SP1 Technical Sessions – $0.00 – Tuesday, June 28, 2005 8:30 AM - Tuesday, June 28, 2005 12:00 PM
Visual Studio 2005, Developing Business Value – $99 – Monday, August 01, 2005 9:00 AM - Monday, August 01, 2005 5:00 PM
More stuff going on in Atlanta:
Atlanta Code Camp – May 14th
Pub Club – immediately following the MSDN Event, location to be announced at the MSDN event
— Matt Ranlett
posted with BlogJet
 Saturday, May 07, 2005
I got to spend 2 days with the folks from the Microsoft CLR team, but I don’t feel like I learned enough from them. Heck, I think you could lock me in a room with them for a year and I’d still come out feeling like a mushroom on the underside of a log. However, I was scanning through Kirk Allen Evans’ blog post about a conversation with the CLR team (great questions and answers, btw) when I got to the bottom. A collection of links to other people’s blog postings about their times with the CLR team. Since I’m big on writing what I think, I had to go read what other people had to say. My two favorite posts are:
But I was jealous when I got to read Joseph DeCarlo’s post about what the team talked about while they spent time with the fine development staff of Turner Broadcasting. I’d have loved to hear Jason Z. really explain generics to me (and why they’re different from C++ templates). I wanted to leave a comment on Joseph’s post asking him to give the blow-by-blow, but he appears to have comments turned off. So I’m sending him an e-mail instead.
— Matt Ranlett
posted with BlogJet
 Friday, May 06, 2005
We had a few new faces at the VB.Net meeting tonight. After a bit of social chatting, Jim Wooley started the meeting with a presentation of the FileSystemWatcher done in VS2005 Beta 2. For the sake of simplicity, we went with a Windows Forms applications. Take a form, drop on a ListBox and a FileSystemWatcher control. A FileSystemWatcher component basically does what it sounds like – it watches the file system for some file and some event. You can filter by file type (ex. *.txt) and you can filter by event (changed, created, deleted, etc.). With this really simple demo, we were able to see that the operating system raising events to our code. Something we did notice is that the OS throws several events where we might only expect one event. For example, open Notepad, type some text, and save it into your monitored directory. You’ll see that you get CREATED, DELETED, CREATED, CHANGED, and CHANGED events. So you’ll want to do error handling to prevent yourself from acting on the wrong one of those events. Extremely simple, but a great demo to show how useful the FileSystemWatcher can be.
The next presenter was Harrell Perlman, showing us Avalon. If you plan on taking a look at Avalon, you need to have XP service pack 2. Longhorn’s betas are not supported yet. You’ll also need a beta copy of VS2005 to work with it. Harrell had a heck of a time getting his Virtual PC installed with the WinFX and Avalon, so he spent a good deal of time making sure that we’d understand the installation procedure. WinFX is an extension of the .Net Framework that is utilized by Avalon (meaning that Avalon runs entirely on managed code). Avalon uses XAML (a flavor of XML) to describe the layout and ties to code behind classes for event wiring. We’re really early in the Avalon lifecycle (still Alpha) but there are already a wealth of articles discussing Avalon concepts. Download the Avalon, WinFX, and (possibly) the LongHorn SDKs, install them in a Virtual PC or Virtual Machine, and go! We took a quick look at a demo or two to see what the XAML markup language looks like. The general reaction of the group was that we didn’t really know where we were going with XAML. To me personally, it looks like the ASP.Net seperation of the presentation layer and the UI Process Layer.
Dan Bredy was presenting an article from Mike Gold (VBHeaven.com), recreating the W2 tax form. The program uses GDI+ to render the content of some textboxes and place them directly onto an image of an actual W2 form. Basically, set the background of a form to an image. Place a bunch of textboxes and checkboxes on the form. Then use the DrawString function to render the text directly onto the image (you basically can’t see the textboxes). This takes place during the print preview portion of the application. This makes use of the System.Draw.Graphics namespace to render the image and to draw the text from the various textboxes onto the image based on the location of the actual control.
— Matt Ranlett
posted with BlogJet
 Wednesday, May 04, 2005
Everyone has been putting their own report of what they learned from the CLR team on their blog, so I thought I would add mine. I was lucky enough to have dinner with them twice this week and had plenty of time to get to know them, just like a friend you know from the user group. The first night anyone that attended the UG could have come out with us after the meeting and talked with the CLR guys. They stayed out with us until Midnight after a long day and long flight. Let me tell you, the Microsoft guys that travel and talk with us are the nicest guys you could ever meet and they are always willing to go the extra mile. Over the last 2 years Microsoft has made an effort to see what the users of their products want and have made the effort to go find out. Keep coming out to user groups they are full of great people and the UG leaders are always working hard to get good speakers for you. Big thanks to Microsoft and UG leaders for all the hard work everyone is putting in.
Matt and I, have been giving recaps of the user groups for some time and we have always made them a recap of the meeting. This is a great plan and helps to share what happened at each group, but does not complete the circle. What do I mean by this? Well one of the CLR guys asked me what the UG members thought about each meeting and what was their feedback to the presentations. I told him we only do a recap of the meeting and don’t usually put feedback information on the blog entry. I told him if we do hear feedback about topics or presentations we would try to get some feedback for the Microsoft team about the UGs up with the reviews. So we would really like to get UG members input on the meetings and without putting up names, give some feedback to the meetings. Obviously we will not put up that you didn’t like the meeting because you don’t like the speaker, but anything that can help constructively, we will look into. Come see us at the end of the meeting or leave us some comments! Microsoft is looking for feedback so make sure you get it to them.
—Brendon Schwartz
Posted with BlogJet
I like to tell really bad one-liner jokes, and one of my favorite categories is the "guy with no arms and no legs" variety. I've written down the ones I knew and then I've culled some from various websites. I know you'll laugh at some of these!
what do you call a guy with no arms and no legs sitting on a doorstep? Matt
what do you call a guy with no arms and no legs hanging on a wall? Art
what do you call a guy with no arms and no legs stuffed in a mailbox? Bill
what do you call a guy with no arms and no legs in a lake? Bob
what do you call a guy with no arms and no legs in a lake being dragged behind a boat? Skip
What do you call a guy with no arms or legs in a pile of leaves? Russell
What do you call a guy with no arms or legs in a ditch? Phil
What do you call a guy with no arms or legs in your hot tub? Stu
What do you call a guy with no arms or legs on your grill? Frank
What do you call a guy with no arms or legs going over a fence? Homer
What do you call a guy with no arms or legs In your girlfriend's lingerie drawer? Teddy
What do you call a guy with no arms or legs Who every one takes a dump on? John
What do you call a guy with no arms or legs who holds up your car? Jack
What do you call a guy with no arms or legs who's upside down in the end zone? Spike
What do you call a guy with no arm and no legs in a coffee cup? Joe
What do you call a guy with no arms and no legs on a poker table? Chip
What do you call a guy with no arms or legs nailed to your spice rack? Herb
What do you call a guy with no arms or legs on a stage? Mike
What do you call a guy with no arms or legs under a car? Axel
What do you call a guy with no arms or legs in a bank? Buck
What do you call a guy with no arms or legs on a piece of paper? Mark
What do you call a guy with no arms or legs in a British restroom? Lou
What do you call a guy with no arms and no legs in a field of marijuana? Bud
A girl with no arms and no legs, lying on a grill? Patty
What do you call a girl with no arms or legs on a beach? Sandy
What do you call a girl with no arms or legs in your dishwasher? Dawn
What do you call a guy with no arms or legs between two buildings? Ali
What do you call a girl with no arms or legs hanging on a clothes line? Peg
What do you call a girl with no arms and no legs who is stuck on a fence? Barb
What do you call a girl with one leg shorter than the other? Eileen.
What do you call an Asian girl with one leg shorter than the other? Irene.
What do you call a cow with one leg missing? Lean beef.
What do you call a cow with no legs? Ground beef.
What do you do with a dog with no legs? Take it for a drag
Why does Snoop Dog carry an umbrella? Fo' drizzle.
What does Snoop Dog use to do his laundry? Ble-atch!
-- Matt Ranlett
I feel like a lucky guy - I've been able to go out to dinner with the CLR team (Brad, Claudio, Kit, and Jason) twice now. Each time it's been three or four of them and about ten or so of us. We sat around and discussed their recent presentations, the future directions of the industry and random bits of trivia. It makes for an entertaining and instructive evening all the way around, adding depth to the people behind the CLR. These guys are out traveling the country (Atlanta and Arizona count as the country, right?) trawling for feedback from the users of their products, and we try to give them what they ask for. What do we like about the .Net Framework? It's easy to work with and it genuinely makes your job of developing applications easier. What don't we like about it? It's memory intensive and it doesn't go far enough - Brendon specifically asked Claudio for the Psychic Friends namespace. I'll do a bad job of explaining his idea, but Brendon has this theory about creating a low level eventing system where the CLR or OS pushes the events to registered software. The catch is, with Brendon's design, he wants the registering software to define the event, not the event server. So you would essentially be telling the event server what events it should create and serve. Like I said - the Psychic Friends component.
One of the topics that came up was the upcoming Professional Developers Conference, or PDC. Some of the folks on the CLR team have input to the PDC content, and they want to hear from us what we want to learn about. Do we want this PDC to focus on the here and now of VS2003? Do we want to look at the near future with Whidbey and Yukon? Should we be looking 2 or more years down the road at LongHorn? *I am not saying that LongHorn won't deliver inside of 2 years - let's not start that rumor.* Beyond the topics covered at the PDC, what kind of presentations do we want to see? Of course, there will be plenty of lectures with slides and code demos, but what kind of code demos and slides do we want to see? Do we want to see the low down nitty gritty stuff where you need conceptual diagrams of memory stacks or do we want higher level application logic. Do we want to see more easy to follow tutorials or do we like larger, more involved examples of best practices? What kinds of hands on labs do we want to see? Should those be the tutorials or best practices? Should they show us how to use the Enterprise Library and BizTalk or should we be looking at the effects of memory pressure on the GC and how we can add graphical monitoring to our own applications? Would you guys like the opportunity to bring your own applications to a booth and sit with a MS developer for 30 minutes (or an hour? Two?), letting him or her give you advice on how to improve performance or security? I'm actually soliciting feedback on behalf of Microsoft now. What do you guys want to see? Jim Wooley and I blue-skied for a while with Brad and we came up with the idea of taking a non-trivial application written in VS2003 and learning how to correctly profile the app with freely available tools and simple instrumentation. Then improve the program in VS2003 based on the information we've just learned. Then take that exact same application and migrate it to VS2005 (without making any code changes). Check the profiling and see what improvements we get with just the new CLR. Now take advantage of the new features offered in 2.0 like generics to speed things up and simplify the code. Look at the profiling again to see what kind of performance improvements we have gained. Maybe next we could migrate the UI of this same app to Avalon. Finally we could talk theory about the changes coming up for LongHorn and the next version of the .Net Framework. But the basic idea is that we take an app and work it through several generations of code review and performance monitoring until we've gone from currently in production code to the theoretical future of our applications. This sounds to me like a fantastic lab and I'd love to see it. If nothing else, maybe it should be turned into an article for MSDN or something. *I am not volunteering to write this - it sounds like it might require a book!* These were a great bunch of guys to hang out with and I really enjoyed meeting them. I'll bee keeping up with them via their available blogs and I urge everyone else to do the same.
— Matt Ranlett
posted with BlogJet
I think that lots of people are of the “try it first, read the manual last” mindset. I’m one of them, and it recently jumped up to bite me on the rear. I had previously installed the February CTP of VS2005 and played around a bit. Then I downloaded Beta 2 and ran the installer. It told me to uninstall Beta 1 before continuing. I did so, re-ran the install and everything seemed to go just fine.
Then I tried to create an empty project and look at the form. The empty form wouldn’t display and I got this error:
——————————————————————— Microsoft Visual Studio ——————————————————————- Could not load type 'Microsoft.VisualStudio.Shell.Interop.IVsRunningDocumentTable2' from assembly 'Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Browsing around on the web, I found that I was not alone, other people ran into the same problem. Apparently there are a set of manual uninstall steps that must be followed in exact order before installing VS2005 Beta 2. Of course, I failed to do this. The Beta 2 install program told me to uninstall the VS tools, but said nothing about the earlier version of the framework or anything. So I didn’t remove any of that other stuff. I tried uninstalling anything even vaguely related to .Net and tried reinstalling Beta 2. Same error message. This went on for like 3 uninstall/reinstall cycles.
Finally I found Aaron Stebner’s blog posting where he talks about creating an automated cleanup tool that helps us get through the “prep the machine for Beta 2” steps. Too late for me to bother with the tool, but he did have this post where he details the manual steps a user can go through to get the machine back in shape. Going through the steps one at a time, I believe this step was the one that finally made things work:
Go to %windir%\assembly and delete anything with *1.2* or *2.0* in the folder name. Delete the GAC_32 and GAC_MSIL folders as well.
You can not view the contents of %windir%\assembly in Windows Explorer when the .NET Framework is installed. In order to view the contents, you will need to set the following registry value and reopen Windows Explorer
Key name: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion Value name: DisableCacheViewer Data type: REG_DWORD Value data: 1
Note: You should remove the DisableCacheViewer value after you complete this step because this is only used for debugging purposes.
I had two different versions of the 2.0 framework, and I think that something, somewhere was conflicting. I know that shouldn’t happen thanks to .Net’s stand-beside ability. I have no proof that this was the magic bullet to the problem (other than everything works now). I just thought I’d throw this info online because it deserves to be easy to find online.
— Matt Ranlett
posted with BlogJet
 Tuesday, May 03, 2005
Kit George, Program Manager on the Common Language Runtime (CLR) team in charge of the base library, stood up as our first presenter. He jumped right in to some demos to show some v2 improvements. (All the demos are available on the Visual Component Library (VCL) website)
- The first demo introduced us to some memory management (Garbage Collection) concerning unmanaged resources.
- The second demo showed the improvement in performance between Try{Parse}Catch and TryParse.
- The third app showed us how the VCL now supports the serial ports. It also showed us color in console applications and generic collections.
Brad Abrams, a founding member of the .Net Framework team, was here to present the deep internals of the CLR and basically show that he knew everything about CLR and compilers. He strongly warned us that his presentation was not going to cover knowledge required to be a programmer and that everything he showed us was going to change as the CLR evolved. After a rapid review of the process of creating an executable, we created a quick “Hello World” application and looked at the Intermediate Language (IL) code thanks to ILDASM. Looking at the IL we were able to see which version of the CLR the exe was compiled with, the assembly hash information, and the entrypoint information. We even saw that by modifying the IL entry point and recompiling via ILASM, the behavior of the program could be changed (not that there is ever any practical use for this information). We learned that .Net assemblies are made up of the Manifest (external data) and the compilable IL + it’s metadata and required resources. IL metadata is the actual language for execution. It is independent of the CPU and platform, making it capable of running as both 32 bit and 64 bit applications without change. IL is also a stack based language, meaning that every operation runs on a stack – pushing and popping variables. IL bakes type safety into the CLR through a process called verification. This helps prevent mixing incompatible types and bad array handling. Brad covered the startup logic, showing how the CLR uses mscoree.dll to check version numbers and run the correct CLR version, allowing multiple .Net frameworks to be on the same machine and code designed for each to run successfully. We looked at what happens in memory when an object is allocated and its methods are called. This included understanding the memory hex addresses (pre-stub dispatcher addresses and compiled method addresses), JIT compilations, and more. We looked at the Just In Time (JIT) Compiler optimizations, including register allocations, loop unrolling, dead code elimination, constant and copy propagation, and processor specific code generation. A new JIT optimization in v2.0 is range check elimination – not repeating range checking on arrays when the array is reused in an identical or safer manner (resulting in faster JIT compile times). Brad’s favorite runtime service (I’m guessing b/c this is the one he covered) is the Garbage Collector. Brad wanted to point out that a better way to think of the GC was to consider it a stuff collector – it copies everything that still has references and anything left behind is zeroed out. Brad then introduce Claudio, who would cover the GC in more detail.
Claudio Caldato presented how to write faster managed code. When talking about application performance, the following points are important to keep in mind. You need to set realistic goals and evaluate them continuously so they’re not too optimistic or conservative. You need to measure frequently. Know your platform to know where to make changes (memory, processor, etc). Performance improvements are not a one shot deal – make continuous improvements (automated tests help). Finally, build a performance culture – the developers need to understand that performance is part of their development process. Claudio talked about the garbage collection in action – maintaining objects with references and collapsing the memory queue to prevent fragmentation. Garbage collection works in a generational cycle. Gen 0 is run every time. Gen 1 is run only when Gen 0 doesn’t have enough memory on the heap to create all the required variables. The GC will pause threads, trace reachable objects from roots, compact live objects and recycle dead memory. Each generation is it’s own heap, so there are three Gen heaps and a large object heap (separated b/c moving large objects is expensive). To improve performance, make sure you understand the lifetime of your objects – don’t let them live to Gen2 if you can help it. Use perfmon and the CLRProfiler to examine your allocation profile. Some common pitfalls include keeping references to dead objects (be sure to null out object references). Implicit boxing (casting value types to ref. types) without knowing it happens when you do something like creating an ArrayList of Ints. Don’t do GC.Collect if you can help it. Because ~C( ) is not deterministic (you don’t know when the memory is cleared) you should try to use the Dispose pattern – implement IDisposable and call .SuppressFinalize. In C# this is as simple as the using keyword. Claudio showed us what he was talking about with some demos, using the CLRProfiler (available online for free). The demo also showed us explicitly how much the String.Append object method costs vs the StringBuilder.Append object method when modifying the string. The difference was astonishingly huge. The next demo showed the difference between the Finalize method and the using statement (which calls the IDispose interface). The point of this demo was to show how much memory could be saved by having deterministic memory clearing. We talked about Reflection a bit – noting that the new Token/Handle resolution APIs are very fast. An example would be calling MemberInfo on an object (a costly call), retrieving a token for that member, and then calling the Token API for future references to that object. COM Interop is efficient but frequent calls add up. This is because marshaling can be expensive. Primitive types and arrays of primitive types are cheap, but Unicode to ANSI string conversion are not. To diagnose some of these problems, you can use some of the built in CLR Interop counters in Perfmon. You can mitigate Interop call costs by batching calls (chunky, not chatty) or move the boundary (helpful if you control both the managed and unmanaged code). finally, some deployment considerations are to reduce the number of assemblies to speed load times, use the GAC to prevent repetitive signature verification, and use native code (NGEN) to reduce startup time and improve code shareability. Also, keep in mind that XML is not always the answer – System.XML.dll is 2Mb and might be overkill if you’re storing extremely simple data. When working with Performance Counters, start by looking at how much time is being spent in GC. 20% is too much. Next you’ll want to look at the promotion rate. If Gen2/(Gen0+Gen1) > 1/20 then look at the objects’ lifecycles. Next you’ll want to check the byte allocation to ensure you’re not above 30Mb/s under stress. This indicates too many objects. When using the CLRProfiler, examine the total allocation, the reallocated memory, the allocation graph, and the time line. To improve startup time, reduce the number of dlls loaded at startup (your own app dlls and .Net platform dlls), NGEN your assemblies to prevent JIT costs. Place strong named assemblies in the GAC. Finally, check your own application logic to see if your own computations are the bottleneck.
These guys are seriously smart. They’re so smart that just writing about them makes ME sound smart! Well, they’re product managers so you have to keep that in mind, but even so… I think they might each have more than one brain. Be sure to check out their blogs and books.
— Matt Ranlett posted with BlogJet
© Copyright 2008 Atlanta .NET Regular Guys
Theme design by Bryan Bell
newtelligence dasBlog 1.7.5016.2  | |  | Page rendered at 12/3/2008 7:41:20 PM (Eastern Standard Time, UTC-05:00)
Reset | Slate | Movable Radio Heat | DasBlog | Just Html | Candid Blue | Discreet Blog Blue | Movable Radio Blue
|
On this page....
Search
Navigation
Categories
Blogroll
Sign In
|