# Wednesday, 20 October 2010

I've been pretty active lately on StackOverflow, a question-and-answer site where people ask "what does this error message mean and I how can I make it go away?" for a variety of languages, platforms, and business purposes. There are a number of brilliant features on StackOverflow including voting on both questions and answers, and closing questions that are off topic for the site. This means less junk to wade through and a bit more confidence that any particular answer is actually going to be helpful.

One of the reasons questions get closed on StackOverflow is because they don't have an answer. There's a category of nasty questions of the form "Have you stopped [bad thing] yet?" that have no answer. If you never [bad thing]'ed in your life, then you obviously haven't stopped. Yet answering "no" implies you continue to [bad thing]. Answering "yes" implies you [bad thing]'ed for some time, but have no stopped. Either way, it's bad. So I knew the question "Should LINQ be avoided because it's slow?" was going to be closed. And sure enough, it was. But not before some really excellent answers and comments accrued to it. Like these:

  • I would not avoid code because it only executes 250 million cycles a second instead of around 750 million, unless that kind of throughput is an actual business case. Also, chances are that the data comes from something that is a lot slower than this code anyway (a database, disk, ...). Go for what seems most convenient and optimize where it matters.
  • Slow is irrelevant to your customers, your management and your stakeholders. Not fast enough is extremely relevant. Never measure how fast something is; that tells you nothing that you can use to base a business decision on. Measure how close to being acceptable to the customer it is. If it is acceptable then stop spending money on making it faster; it's already good enough.

  • So what you're saying is that the devil you know is better than the devil you don't. Which is fine, if you like making business decisions on the basis of old sayings. I think it is generally a better idea to make business decisions based on informed opinions derived from empirical measurements.
Those last two are by Eric Lippert. Yes, that Eric Lippert. He's answered almost a thousand StackOverflow questions, and he's by no means the only product team member who's answering questions there. In addition, other answers fix a different perf bug in the asker's code (an unnecessary and expensive cast) and provide a wide range of opinions about performance decisions, architecture, choosing technologies and so on.

I love StackOverflow for fixing immediate blocking problems, but don't neglect the possibility of gaining philosophical wisdom from reading an offtopic question or two.

Kate
Wednesday, 20 October 2010 12:55:03 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 18 October 2010

Jeff Blankenburg has produced a great quantity of blog posts about developing for Windows Phone 7. Now he's supplementing that with an all-in-one resource page that links out to a ton of great material in addition to his own. Oh I know, you might not need to see the TV ads to learn how to develop for the thing, but I appreciate the link anyway. If you're doing phone work, or thinking about it, this list is for you.

Kate

Monday, 18 October 2010 15:58:45 (Eastern Daylight Time, UTC-04:00)  #    
# Saturday, 16 October 2010
Jennifer Marsman has built a very nice list of Windows 7 developer resources. Of course, she had me at Code Pack (the very first item she lists as a matter of fact), but she carries on, drilling into both native and managed scenarios, covering libraries, SDKs, training materials, UX guidelines, samples, blogs - even Twitter handles!

There is a LOT of material out there and it's a little bit fragmented. This is a great post to help you find your way around. Remember, if you have a Windows app, it should be a Windows 7 app!

Kate

Saturday, 16 October 2010 13:07:42 (Eastern Daylight Time, UTC-04:00)  #    
# Thursday, 14 October 2010
According to Wired, C++ was born October 14th, 1985, with the publication of the first official reference guide by Bjarne Stroustrup. That's 25 years ago! I've still been "working in C++ since before Microsoft had a C++ compiler", as I like to say at the start of any C++ sessions I deliver. While that is a long time, it's not the full 25 years the language has existed - not quite, anyway.

Wired marks the anniversary with an interview with Bjarne. If you're curious about what kind of computer he uses day to day (a small Windows laptop) or what music he likes to listen to, now you can find out. Or this advice for young programmers:

Know your fundamentals (algorithms, data structures, machine architecture, systems) and know several programming languages to the point where you can use them idiomatically.

I'd call that "simple but not easy", as much advice is. C++, of course, is neither simple nor easy, but it is incredibly rewarding to those who take the time to learn it and use it well, and I hope it will continue to do so for at least another 25 years.

Kate

Thursday, 14 October 2010 11:10:13 (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, 12 October 2010

I'm teaching OO design and UML again this term, and one of the things I emphasize to the class is the dangers of coupling. (Get your mind out of the gutter, I mean classes with dependencies on each other.) It's not about calling methods of each other necessarily; it's more about if-I-change-this-one, I'll-have-to-change-this-one-too. Changes that ripple through a system are expensive and dangerous.

When I am helping clients with interop, they are often surprised to learn how entire applications and libraries can depend on each other without ever calling each other's code. For example, App A writes a record to a database table. Service B checks the table regularly for new records (or records with a 0 in the Handled column, or whatever) and calls a web service (or whatever.) Those applications are now coupled - if a change in one necessitates a change in the format of that table (or its name, etc) then the other must be changed too. Thinking ahead and doing all you can to reduce this kind of coupling is part of the challenge of doing good application integration, even if there are no interop calls in the solution.

And then there's performance. So often left until last, it provides another consideration that you should ideally have in mind all the way along. And as Rico Mariani points out, it also couples applications and libraries you may have thought were independent:

Two subsystems that both (loosely) use 2/3 of the L2 cache are going to use 4/3 of a cache... that’s not good. There may be no lines between them in the architecture diagram but they are going to destroy each others ability to work.

Sound advice as always. Please read the post, and keep one more "don't forget" floating around as you design and architect your systems and solutions.

Kate

Tuesday, 12 October 2010 10:58:52 (Eastern Daylight Time, UTC-04:00)  #    
# Sunday, 10 October 2010
This is really fitting, isn't it? You have a product code named Dev10 and released as Visual Studio 2010 (with the tens not related to each other - see my history of Visual Studio and Visual C++ version numbers and release names). And today is 10/10/10 no matter what date format you prefer. So today is a great day to take a quick survey about Visual Studio 2010. Seven questions. I recommend you read them all before you start answering because they are asking about different aspects of the product and you wouldn't want to answer a question about speed with your thoughts about ui features. But it will take almost no time so go and do it.

Kate

Sunday, 10 October 2010 10:34:04 (Eastern Daylight Time, UTC-04:00)  #    
# Friday, 08 October 2010
I've gained a lot of Twitter followers in the last few days, and I'm pretty sure I know why. John Bristowe included me on a list of Canadian Developers that includes a full list of luminaries. I counted 112, and he's included blog links as well as Twitter handles. Most, but not all, are .NET developers. John follows all of them (us), which shows remarkable dedication. Why not take a look and see if there's someone there you'd like to follow too?

Kate

Friday, 08 October 2010 17:43:25 (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, 06 October 2010

The Tech Ed Europe Session Catalog has been updated with my third talk. In the order they're happening, I have:

WCL322 - The Windows API Code Pack: Add Windows 7 Features to Your Application

DEV311 - Modern Programming with C++0x in Microsoft Visual C++ 2010

WCL329 - Advanced Programming Patterns for Windows 7

The first two I blogged earlier, but the third is new. Here's the abstract:

Windows 7 development in managed code can be very simple, especially for those using the Windows API Code Pack. But your integration with Windows 7 doesn't have to be limited to simple interactions with the new API. This session goes beyond the simple into aspects of Windows 7 development that have, in the past, been left for you to explore on your own. See how to create a jump list with a task that delivers a command to your application, as Messenger and Outlook do. Explore a simple and powerful recipe for connecting to Restart and Recovery, with minimal effort. Discover how Trigger Started Services can reduce your power footprint, while giving your users better responsiveness. Explore all that Libraries has to offer beyond "File Open", and learn why using a library is a better approach than having a user setting for "save directory."

It's going to be a great week!

Kate

PS: About the fourth item you might see under my name ... stay tuned! :-)

Wednesday, 06 October 2010 17:38:21 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 04 October 2010

I started paying attention to "app compat" around the time Vista was in beta. It stands for Application Compatibility and refers to all the various techniques for ensuring that an application continues to work when it's moved to a new environment, such as from XP to Vista or to Windows 7. Some of these techniques involve changing the source code of the application and rebuilding it, but others don't. And paradoxically, in order to be good at those no-writing-code techniques it helps if you're really a good developer. It really helps if you have strong skills in areas that the .NET Framework generally hides away or abstracts from you.

There are folks whose job it is to solve app compat problems. It's the kind of job that really appeals to me, where you aren't exactly sure how things are going to go each day when you get up, and you think on your feet and react to what you find. And now there's an opening to be such a person if that interests you. Aaron Margosis writes:

The job is basically to figure out why applications that are important to the customer and that work on earlier versions of Windows (typically running as admin) no longer work on Windows 7, and then to get the apps to work correctly without reducing security posture and (typically) without seeing or touching source code. Don’t worry – we will teach you the tricks.If you enjoy problem solving on the Windows platform, you will love this job.

Interested? Have some experience writing Windows apps in native C++ or C? Know a little about how Windows works? Think that being handed unknown problems and asked to fix them is more fun than a regular job? Then read the blog post and apply!

Kate

Monday, 04 October 2010 17:29:10 (Eastern Daylight Time, UTC-04:00)  #    
# Saturday, 02 October 2010
As a Canadian RD, MVP, speaker, and general involved-in-the-developer-community-person, I interact a lot with the nice folks at Microsoft Canada. It's not unusual for Canadians to be transferred to Redmond to work at "the mother ship" and I tend to keep an eye on them in their new roles and watch what they're up to. That's even more likely when they go to an area that interests me, as Mark Relph did in the summer of 2009.

He appeared recently on Dot Net Rocks to talk about developing for Windows and I really enjoyed listening to the episode. I'm not the only one keeping an eye out, obviously, since John Bristowe blogged a nice summary of the episode with helpful links. Be sure to read that, then listen to the episode, then come on back for the links.

Kate

Saturday, 02 October 2010 17:20:01 (Eastern Daylight Time, UTC-04:00)  #    
# Thursday, 30 September 2010
By now I'm quite addicted to jumplists. When I want to open a PowerPoint deck or a Word document, and I have another one of those open, I just right-click that instance, spot my document among the recent documents, and click it to open what I want. It frees me from remembering exactly where documents are, or opening folders just to open documents they contain, and I like it a lot. I also like the tasks lists that more and more applications are adding, like these:

But older apps have so much less to offer:

What if you could add tasks to the jumplist of any application, without needing access to the source code? That's what Jumplist Extender does. There's a nice review on How To Geek that demonstrates adding tasks to the calculator that comes with Windows.

Neat, isn't it? Get your own copy and have some fun.

Kate

Thursday, 30 September 2010 16:13:56 (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, 28 September 2010

I love this image:

I know this is true because in my role as friends-and-family help desk, I get people to read the error messages and then I repeat whatever they just told me and then they are like "oh, I get it! Thanks! I'm glad I know someone who understands these darn computers!" This works over the phone when I can't even see the message.

Now why am I mentioning this, besides the fact I love this dialog? Because it comes from a lovely blog entry by Chris Jackson on why app compat problems can't be fixed by talking to the user about them. You slave over a lovely dialog with a button which might as well say CLICK HERE TO GET A VERSION THAT DOESN'T HAVE THIS PROBLEM or a checkbox that might as well say CHECK THIS IF YOU DON'T THINK ITS A PROBLEM AND ARE SICK OF BEING REMINDED but instead the user clicks JUST THIS ONCE I WANT TO USE THE OLD ONE BUT BE SURE TO TELL ME ALL THIS AGAIN NEXT TIME. 

Is there a solution? I don't know. But you need to know people are like this.

Kate

Tuesday, 28 September 2010 14:36:19 (Eastern Daylight Time, UTC-04:00)  #    
# Sunday, 26 September 2010
The high levels of the Pluralsight On-Demand! subscriptions let you download the courses to your mobile device - perfect for learning while you're on a commuter train or bus, or other places away from your laptop. Check this video of a prototype of the experience on a Windows 7 phone. Looks great!

Kate

Sunday, 26 September 2010 16:32:01 (Eastern Daylight Time, UTC-04:00)  #    
# Friday, 24 September 2010
I've mentioned the Pluralsight library many a time. I have three courses in it: Windows 7 development, Extending Visual Studio 2010 without writing code, and Extending Visual Studio 2010 with code. There are a variety of subscription plans available, each with their own benefits. But of all the possible prices you could pay, I'm betting that "free" is the one you would be happiest paying. Am I right?

Well, if you have an MSDN subscription, you can have a month of the Pluralsight library for free. That should give you a great idea of what the courses are like and what you can learn from them. Try it out!

KAte

Friday, 24 September 2010 16:29:08 (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, 22 September 2010
I came across this blog post of a farewell email from Philip Su, written as he was leaving Microsoft after twelve years. You might expect that someone leaving a company would have some negative things to say about it, but not Philip. He sounds like a very nice person and one who's done pretty well by being nice. I thoroughly approve. It is full of specific and actionable advice as well as philosophy. I liked "Smart people understand why smart people disagree." and his thoughts on how people rank themselves, and what influences their ranking of others.

Well worth a read.

Kate

Wednesday, 22 September 2010 16:16:33 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 20 September 2010
This release actually slipped out at the end of August with little fanfare. But you really should check in to it. First, if you're already a Code Pack user, you'll want the update for the bugfixes and related tweaks. If you're one of the people who looks at the source code to this useful library, for example for an interop reference, you're going to find it much improved. One really obvious thing is that all the samples are now happy to convert to VS 2010 which had been an issue for me with 1.0.1.

As well there are three new capabilities: Shell Object Watcher, Preview Handlers, and Thumbnail Handlers. Shell extensions used to be offlimits from managed code because they run in process with either the shell or whatever process launched them (which could be anybody's app that uses the Common File Dialogs) and you were forbidden (but not prevented) from using managed code in that situation. The issue was that if the launching process was already managed code and it had a different CLR loaded, then weird things would happen when your managed code wanted your own CLR. But now that restriction is lifted, so you can write preview handlers (which are out of process, so you were allowed to write them before) and thumbnail handlers (which are in process and therefore were native code only before) for your own file types. The Code Pack makes that pretty simple, all things considered.

Download it, install it, and if you have issues someone is reading and responding on the discussions tab, so please join the conversation.

Kate

Monday, 20 September 2010 13:59:31 (Eastern Daylight Time, UTC-04:00)  #    
# Saturday, 18 September 2010
A first glance, a book about social media might seem to be "dancing about architecture." But of course the target audience for the book is people who are not yet fully fluent in social media and it makes perfect sense to talk to such people using a medium in which they are fully fluent. That means book form makes sense.

I was lucky enough to get a preview copy of Working the Crowd: Social Media Marketing for Business from Eileen Brown. She and I have been working together and bumping into each other for years, which is why I agreed to read it. But I'm recommending it simply because it's good. It's full of no-nonsense advice and useful anecdotes. Just a few pages in, for example, she says:

If you want to progress in business, don’t wait to be discovered.  Make sure you have a great online profile and a positive brand.  

I'm not saying that no-one has thought of that before. I am saying that clearly stated and useful advice is a good thing, and this book is full of such advice. She clearly tackles this "this is just a fad" crowd, explains about "influencers" (like me) and lays out specific actions steps you can follow to have a good social media experience. This includes how to measure what is happening, which most companies desparately need. She even covers specific sites and tools, guidelines for blogging and Twitter, and how to protect yourself from reputation damage or legal consequences.

It's a good book. If you don't have a social media strategy yet, then reading this one will take you a long way forward. I recommend it to any business wondering about "the twitter". You can pre-order on Amazon now and I suggest you do, though you may want to adjust this link to point to the Amazon nearest you.

Kate

Saturday, 18 September 2010 13:36:43 (Eastern Daylight Time, UTC-04:00)  #    
# Thursday, 16 September 2010

It took a while for the session catalog to update online, but it's official now:

DEV311 - Modern Programming with C++0x in Microsoft Visual C++ 2010

Session Type: Breakout Session
Track: Developer Tools, Languages & Frameworks
Speaker(s): Kate Gregory
Why wait for the C++ committee to finish the specification when you can enjoy much of the power of C++0x today! C++0x, the next C++ standard, is almost upon us and it contains the most important updates to the language since the mid-90s. It even accepts the existence of multiple threads for the first time in the history of the language. Needless to say, these new features bring more expressiveness and power to the native C++ developer. Visual Studio 2010 has added support for some of these key features in order to enable these modern programming techniques. This session clarifies what features are in Visual C++ 2010 and what is yet to come. It illustrates how new constructs such as lambda expressions enable better use of existing libraries and how your code can be simpler, safer and faster all at the same time. If you are itching to show off how C++ is one of the coolest languages on the planet, this talk is for you!

WCL322 - The Windows API Code Pack: Add Windows 7 Features to Your Application

Session Type: Breakout Session
Track: Windows Client
Speaker(s):Kate Gregory
Accessing new Windows 7 features is a challenge from managed (.NET) code. The level of interoperability required is out of reach for many developers. The Windows API Code Pack for the Microsoft .NET Framework is a sample library you can use in your own projects today that provides access to new user interface features (taskbar jumplists, libraries, sensor platform and more) as well as "behind the scenes" features that make your applications more aware and responsive (restart and recovery, power management and more.) Discover a shortcut to Windows 7 development for Microsoft Visual Basic and Visual C# programmers and get started today.

I've done talks with these titles and abstracts before, but I'm not repeating those this time. I'm rejigging the demos pretty substantially and generally rewriting the talks. Register now, and I hope to see you there!

Kate

Thursday, 16 September 2010 11:19:56 (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, 14 September 2010

I love speaking at DevTeach. It's a must-do conference for a lot of A-list speakers and it's always fun and informative. I've blogged about it a lot already. Now Jean Rene has released the session videos online. So if you didn't get out to see us, you can still watch - how cool is that?

Scroll down the page till you see this:

Click on the title to watch the video, and on the Material link to get the powerpoints. (I recommend you watch these in the reverse order than they are shown - first Lighting Up, then Code Pack. Enjoy!

Kate

Tuesday, 14 September 2010 07:25:50 (Eastern Daylight Time, UTC-04:00)  #    
# Sunday, 12 September 2010
Over six years ago, I helped to found the East of Toronto .NET Users Group, because I didn't want to drive all the way across Toronto to attend user group meetings, and I was pretty sure I was surrounded by others who felt that way. The meeting location has varied over the years but is always in Oshawa or Whitby. That's about a 45 minute drive from my house, and never slows down because of rush hour traffic. I get to as many meetings as I can.

About a year and a half ago, the Markham .NET Users Group kicked off, for much the same reason - wanting to learn more, but not wanting to drive for hours to get to meetings. And now our schedules finally mesh and I can speak there. It's also about 45 minutes from my house and immune from traffic problems.

So, on October 25th I will be speaking in Markham, on Extending Visual Studio 2010. I hope to cover both finding and using extensions and a tiny taste of writing your own. If you live closer to Markham than to downtown, or North York, or Whitby, then please come out and learn how to make Visual Studio your own! I'll be bringing some cool prizes, too - free Pluralsight training, for example. Please register so we know how many to expect.

Kate

Sunday, 12 September 2010 07:17:12 (Eastern Daylight Time, UTC-04:00)  #    
# Friday, 10 September 2010

Intel and Microsoft are offering free training:

Learn directly from Intel and Microsoft when you attend this free one-day course on parallelism and threading. This is a great opportunity learn about threading your applications for multi-core platforms. This course is targeted for Windows* C++ developers using Microsoft Visual Studio*.

The performance benefits of application parallelism on modern computing platforms will come from threading software. Learn how to develop software that utilizes many cores! Familiarity with threads is helpful, but not required (target is beginning- to intermediate-experience with threads, experts would not benefit as much from this course). 

They are going to cover concepts of parallelism plus instructor-led demos of Intel Parallel Advisor, Microsoft PPL, and Visual Studio 2010.

Sound good? The dates are coming up soon:

  • 20-Sept-2010 Montreal
  • 22-Sept-2010 Chicago
  • 28-Sept-2010 San Francisco
  • 29-Sept-2010 Seattle / Bellevue
Register as soon as you can!

Kate
Friday, 10 September 2010 09:29:16 (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, 08 September 2010
Here's another thing I learned when preparing demos for a non technical crowd on Office 2010. Putting videos into PowerPoint can actually be fun. My exposure to these was mostly at large keynotes and so on, where the speaker would play a video and stand there kind of awkwardly while it played. Not my thing.

Now, have you ever been at a party or get together that had a slideshow of pictures playing? Weddings, wakes, milestone birthday parties, seems like you can almost always spot a laptop in the corner just quietly cycling through dozens (or hundreds) of pictures. It's actually a really nice trend. Most of the people I know do that with PowerPoint. One picture per slide - sometimes filling the whole slide, sometimes with some text added - and then set it up to auto advance and to repeat indefinitely. Well, if you're going to do that, you can include videos as well. And PowerPoint has some built in tools to let you crop (or clip) the video, fade it in and out, even display it in a slightly more interesting layout.



I can see adding videos to my next slideshow using these tools. And not having to open a second product will make it that much more likely that I'll actually do it.

Kate
Wednesday, 08 September 2010 08:58:16 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 06 September 2010
Earlier this summer I was invited to talk to some non technical users about Office 2010. As always happens when I am preparing new material, I learned something. My problem is that I often learn how to do things and then figure I'm done, I know how to do that. But software changes and sometimes the 11 step, 3 application approach that I've learned gets superseded by a much simpler way.

Here's an example: let's say you're putting together a Word document, but it's not a requirements document or a specification or a response to an RFP. It's something a little more personal, a little less technical. It has actual photographs in it. Not screen shots, not a GIF exported from Visio, a photograph. You have the photograph, but it's not quite the right size, or perhaps it's too dark, or too light. You need to fiddle with the contrast and such. If you're a geeky person, you probably have various apps installed on your machine that can do that. So you open the photo in app 1, do something to it, maybe also in app 2 and do something else, and then finally you paste the picture into Word.

Well that process is just old school. Word can do all kinds of neat stuff right from within the app. Try it! Paste in a picture that needs some tweaking. Then select it, and click on Picture Tools.



You can adjust brightness and contrast with a live preview. Or try out the Artistic Effects:




This is a lot quicker than fooling around with multiple applications, and makes this sort of document fun.

Kate
Monday, 06 September 2010 08:44:25 (Eastern Daylight Time, UTC-04:00)  #    
# Saturday, 04 September 2010

Back in July, I mentioned that my Extending Visual Studio course for Pluralsight was live. As I completed the course, it just kept growing and growing, so in the end it became two courses.

Customizing and Extending Visual Studio 2010 Without Code covers macros, snippets, templates, and so on - ways that you type stuff into a file, and thus make Visual Studio behave differently, but don't actually write C# or VB or C++ to make that happen. The modules are:

  • Overview of Visual Studio 2010 Extensibility  
  • Why write extensions for Visual Studio? 
  • Visual Studio Macros 
  • Visual Studio Snippets
  • Getting and installing extensions for Visual Studio  
  • The Visual Studio 2010 SDK
  • Visual Studio Start Page
  • The VSIX Format 
  • Templates
  • Deploying Templates

Customizing and Extending Visual Studio 2010 by Writing Code covers the rest of the story - cases where you actually write and compile code (in this course, the demos are all in C#) and thus make Visual Studio behave differently. The modules are:

  • MEF, The Managed Extensibility Framework  
  • Writing Editor Extensions
  • Testing and deploying editor extensions 
  • Visual Studio Add-Ins  
  • Visual Studio Packages
  • Extending Modeling and Diagramming tools
Together, these courses total 9 hours. Please let me know if they help you!

Kate


Saturday, 04 September 2010 08:23:51 (Eastern Daylight Time, UTC-04:00)  #    
# Thursday, 02 September 2010
I'm having a Coffee and Code of my own in downtown Toronto on September 23rd all afternoon. Actually, I'll start at 11 and be there until 6 to catch the "stop by after work" folks. If you've heard of Coffee and Code at all, you know how this works. If you haven't, I've made a page on our web site about it. Just drop in and ask me "Is it true that the C++ language is getting new keywords and stuff? How can that be? And does it really matter?" or "Do you have the Windows Phone 7 tools installed? Can you show me an app on the emulator?" or "Is Visual Studio 2010 really nicer than Visual Studio 2008?" or "What local user group meetings should I be coming to?" or whatever else is on your mind.

So stop by any time between 11 and 6 on the 23rd to the Starbucks at Yonge and King. I'll be at the big table at the back, just walk up and say hi. We'll talk about whatever is on your mind, maybe some of you will talk amongst yourselves, maybe you'll show me what you're working on. I'm looking forward to it!

Kate

Thursday, 02 September 2010 10:18:01 (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, 31 August 2010
Let's say you read the entry about data structure visualizers and in addition to all the STL humour you got excited about being able to control the way the debugger shows your objects as you work at understanding your application at runtime. And then you were sad because you don't do native C++ work and you don't know how you could get the same behaviour in a managed application. Well, have I got a keyword for you - DebuggerDisplay. Don't like that MSDN page about it? Here's another. Quick and easy, at least for simple types with only a few member variables. Give it a whirl. There's a nice example with screen shots at Dev102.

Kate

Tuesday, 31 August 2010 19:19:29 (Eastern Daylight Time, UTC-04:00)  #    
# Sunday, 29 August 2010
I somehow missed this John Robbins blog post from back in May. He calls out an excellent presentation on writing data structure visualizers presented at BoostCon 2010. Here's the title slide:



Oh yes, this is a fun talk. I wish I had a recording, but the slides alone are entertaining and useful. I am already planning to put some of this code into practice, and I must find time to check the other talks, too. The links are in John's blog post.

Kate
Sunday, 29 August 2010 17:43:29 (Eastern Daylight Time, UTC-04:00)  #    
# Friday, 27 August 2010
As a new school year starts to roll around I naturally pay a little more attention to articles about undergraduate education. I'm once again teaching a one-term course on Object Oriented Design and UML at Trent University in Peterborough. This is of course just one piece of the curriculum. Trent is an interdisciplinary place and its graduates are expected to understand the concepts that underpin what they're learning. In fact this is what I see as the main difference between those with a university education and those without (though there are exceptions on both sides.) It's one thing to learn, perhaps by rote, the steps required to make a certain kind of application, and it's another to understand what you are doing and why. The latter kind of person generally finds it easier and easier to learn new things, connecting them to things already known, while the former finds it harder and harder as a mass of seemingly-unconnected facts moil around in an overly-crammed head that feels ready to explode.

I approve of valuing concepts over specific how-to's. It's hard work keeping up with the very latest technology when all you're doing is using it. It's even harder when you're also working on concepts and trying to teach. I don't expect a university to teach students how to use a specific user interface framework (MFC, Winforms, WPF, whatever) -- I expect it to teach them user interface concepts, illustrated with some framework the prof happens to know that's generally available. The students can then learn a variety of UI frameworks over their careers. But that doesn't mean I approve of all the ways in which programming as part of undergraduate education varies from programming in real life. Two specific variations I have a problem with are team size and problem size.

In real life, it's rare to work all alone, all the more so when you've only just graduated. Most university computer science grads will join a team of 2-10 developers reporting to a lead of some sort, with various people from QA, user reps, the business people and so on having various positions of semi-authority, semi-teammate in relation to them. Yet undergrads are generally expected to work alone on all projects and never discuss them with anyone until handing them in.

In real life, problems are not well specified, certainly not as tightly as undergrad assignments are. Most importantly, in real life user input is bizarrely ill formed. Users type letters where numbers belong, leave mandatory fields blank, even deliberately construct complicated bad input as part of hacking attempts. Yet most undergrad assignments do little or no input validation or error handling unless those are the point of the assignment. And of course, most undergrad assignments can be completed by an inexperienced programmer working alone a few hours a week (10 at most) in a week or two while most real problems take weeks and months of work by one or more dedicated resources to produce even a preliminary solution.

Trent (and I presume most other universities) addresses these issues with a fourth year course in which a team of students works on a real problem for an outside entity - usually a local firm or charity. They must gather requirements, code, test and implement a solution, and present to their peers and professors a summary of the project. Some students benefit immensely from this, though most take on far too big a challenge and struggle to complete it.

My contribution is to point out to my students where things are being simplified for them, where things would be vastly different in real life. Undergraduate courses simply cannot be the same as on the job training, and I don't want them to be. I want my students to be learning concepts and underpinnings as much as language syntax and how to work particular tools. But I want them to understand that when they start to put all this to use, things will feel very different than they did during class time. An assignment from your boss and an assignment from me are very different. (I've blogged before that in real life, you don't get 7/10, you have to keep doing it until it is right.)

I don't have all the answers. Lots of people muse about this stuff. Here's the inventor of C++ on the same issues. Easy to complain, hard to do anything about it, but we can all do our bit.

Kate

Friday, 27 August 2010 16:45:29 (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, 25 August 2010

I mentioned Hilo when it was first released. This is a cool project doing Windows 7 development in native C++ with no frameworks - not MFC, for example - so you can really see just how it is done. It's not just code, it's also a walkthrough of their design thoughts, and explanation of that code.

The next application, Hilo Annotator, is ready. It features a ribbon, it uses the Windows Imaging Component, Direct2D, and so on. While you probably don't need an image annotator, you may find the code useful in your own applications. And remember, this is all native C++ code.

Your best place to start is the Visual C++ Team Blog entry about it. It's rich in links and has a nice screenshot too.

Kate

Wednesday, 25 August 2010 15:38:57 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 23 August 2010

Have you ever heard of the All-in-One Framework? Well I hadn't. They've been around for about 18 months. Back in February, on their first anniversary, they described themselves like this:

...this initiative [has been] developed by the CodeFx Project Group to an "all-in-one code framework" that includes more than 300 code samples, covers almost all Microsoft development technologies, ranks 18th among 13000 open source projects on CodePlex, received numerous kudos from customers, proved its values in real support incidents, and created a lot of win-win opportunities within the corporation.

It looks like the participants are all Microsoft employees and they're collecting pieces of code for any language and platform that can be used to solve real world problems. On the CodePlex site, they elaborate:

Microsoft All-In-One Code Framework delineates the framework and skeleton of Microsoft development techniques through typical sample codes in three popular programming languages (Visual C#, VB.NET, Visual C++). Each sample is elaborately selected, composed, and documented to demonstrate one frequently-asked, tested or used coding scenario based on our support experience in MSDN newsgroups and forums. If you are a software developer, you can fill the skeleton with blood, muscle and soul. If you are a software tester or a support engineer like us, you may extend the sample codes a little to fit your specific test scenario or refer your customer to this project if the customer's question coincides with what we collected.

For example, they've written a summary of the ways to call native C++ code from managed code. You can find the pieces elsewhere, but having them all together makes it easier for you to compare and contrast. They often blog additions as they are completed.

Now as you can imagine, a big team creating hundreds of samples needs some sort of vision and structure to keep things consistent. That's where the style guide comes in. And now you can download it from CodePlex. It's an 87 page Word document that covers everything you might wonder about, for both native and managed code, including tabs-vs-spaces (no tabs, please), how much to comment (as I blogged recently and not so recently), Hungarian Notation (use it in native code if you must, but it's a relic; do not use it in managed code), smart pointers (yes, but don't bring in all of ATL for them - I look forward to this section being updated for C++0x), the right way to implement IDisposable, and an especially nice section on Interop at the end.

I don't care what language you work in - this is a document you should at least skim. It could settle some arguments at the office, improve your code, and spare you from some horrible bugs. Download it, won't you?

Kate

Monday, 23 August 2010 15:26:16 (Eastern Daylight Time, UTC-04:00)  #    
# Saturday, 21 August 2010

Recently, I was shown this quote. The person who showed it (in a general talk, not to me personally and specifically) is a smart person I respect, so I'm going to leave that person un-named. The authors of the quote, Kernighan and Plauger, are legends of the field. In 1979 (the very same year I was first paid to program) they wrote:

1. If a program is incorrect, it matters little what the documentation says.
2. If documentation does not agree with the code, it is not worth much.
3. Consequently, code must largely document itself. If it cannot, rewrite the code rather than increase the supplementary documentation. Good code needs fewer comments than bad code does.
4. Comments should provide additional information that is not readily obtainable from the code itself. They should never parrot the code.
5. Mnemonic variable names and labels, and a layout that emphasizes logical structure, help make a program self-documenting.

In general, I agree with this. Point 5 is really strong. But when I watched that person I respect walk through this quote I suddenly realized, for the first time in all the times I've seen this, that 1 and 2 are wrong. Really. They're wrong.

Imagine you came across this in a code review:
// Process the first 5 elements
for(i = 0; i <= 5; i++)
{
ProcessElement(i);
}
I hope it's clear that this code actually processes 6 elements. The program is almost certainly incorrect. Perhaps the reason we're reviewing this part of the code is that there is some sort of message in the event log or unprocessed records or incorrect answers that have led us here, suspecting and hoping to find some incorrect code. And look! A comment that disagrees with the code! It's like a giant arrow pointing to the incorrect code. The documentation doesn't agree with the code, and that's great! It makes it really likely that we've found the bug. This sort of thing happens all the time - developers write the correct logic, as agreed in the requirements, into a comment, but sometimes make mechanical errors in representing that logic in code.

If a program is incorrect, comments that represent what the developer hoped or planned or tried to write may be of great value in rendering the program correct (fixing the bug.) If the documentation doesn't agree with the code, with any luck at least one of them is correct.

I still actually agree with the conclusions of the quote, and of those who quote it. Good variable names and function names, well structured code, and written requirements are all more helpful than comments inside the code, as I've written before. A true conclusion can follow from a false premise. Still, I was initially shocked to find myself disagreeing with these premises, and I wanted to share that insight. And don't feel bad if you leave "translating into English" comments around from time to time. They may surprise you some day.

Kate

Saturday, 21 August 2010 13:34:03 (Eastern Daylight Time, UTC-04:00)  #    
# Thursday, 19 August 2010

Telerik is having an Eastern Canada User Group Tour this fall. Evan Hutnick will visit 6 user groups to speak on Silverlight topics. Here are the details for the East of Toronto event:

Monday, September 13, 2010

Silverlight Development Best Practices

Speaker: Evan Hutnick

Location: Whitby Public Library - Room 1B
405 Dundas Street West, Whitby, ON, L1N 6A1

In this session, we will explore best practices of development with Silverlight. This will include a look at the current toolset (VS2010/Blend) as well as the different options for architecture and data access (to MVVM or not to MVVM, WCF RIA Services or not, etc.), as well as how you can structure your application for intelligent reuse of styles and resources, making it easier to design a large-scale application with a unified look and feel.

Agenda

Time Title
6:30 - 7:00 Socialize and refreshments
7:00 - 9:00 Presentation

See you there!

Kate

Thursday, 19 August 2010 11:06:59 (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, 17 August 2010
This is a story you might find hard to believe. A guy's project is cancelled and he's laid off, but he just shows up to his building (without being paid) and keeps working on it. He gets other people to help him and the product actually ships! One of my favourite quotes:

"The secret to programming is not intelligence, though of course that helps. It is not hard work or experience, though they help, too. The secret to programming is having smart friends."

Could this happen today? Almost certainly not. It probably couldn't even happen in another company. Remember the start of all this wasn't the support from former coworkers - that only happened once the product was almost done and the glamour of working unpaid on a feature caught on. The start of this was that a laid-off guy's badge still worked, and then when it finally stopped working he was able to tailgate through the doors every morning. Which leads to my second favourite quote:

"We wanted to release a Windows version as part of Windows 98, but sadly, Microsoft has effective building security."

A fun read and a reminder of how some people felt (and still feel) about creating software.

Kate

Tuesday, 17 August 2010 10:46:52 (Eastern Daylight Time, UTC-04:00)  #    
# Sunday, 15 August 2010
I'm collecting link on Windows Phone 7 topics and now is as good a time as any to blog some of them:
Plenty of material no matter how you prefer to learn. Why not get started?

Kate

Sunday, 15 August 2010 10:01:48 (Eastern Daylight Time, UTC-04:00)  #    
# Friday, 13 August 2010
I'm curious about Windows Phone 7, and I've been playing around a bit with the development tools. So when I read that Joey deVilla was holding another of his semi-regular Coffee and Code sessions in downtown Toronto, and bringing his phone, I made the last minute decision to pop down there and join them. I'm really glad I did.

A steady stream of people stopped by, mostly just to look at the phone, but a few to deploy their code onto it and see it in live action. There were technical conversations, and some less technical, and a general good time. Joey's blogged about it (with pictures) and is looking for folks who think these would be fun where they live. Let him know if you would participate.

Kate

Friday, 13 August 2010 09:45:11 (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, 11 August 2010

On August 10th, Udi Dahan came from Haifa, Israel, to Whitby, Ontario, to speak at the East of Toronto .NET Users Group meeting. (Well, OK, he was in Toronto to teach a course.) He was talking about high availability and some architectures that let you keep a system up, for example, even while you're upgrading it. I took a few pictures:

Udi did a great job demonstrating that design up front and thinking about architecture doesn't mean you're not agile. Taking the time to architect something so that it's highly available gives you the freedom to be agile.

Watch for the fall schedule of the East of Toronto group in the next few weeks. And if you're visiting the area and would like to speak, let me know!

Kate

Wednesday, 11 August 2010 11:58:19 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 09 August 2010

Visual Studio 2010 has pretty cool Windows 7 integration. It gets jumplists right, for example:

But it could do more, and this little add-in adds some fun extras.

Here's a taskbar progress bar overlay during a build:

(If your build results in errors or warnings, you'll also get a taskbar icon overlay when it's done letting  you know about them.)

And here we have handy thumbnail buttons - for build, debug, and start without debugging:

Give it a whirl! You can download it from the gallery, or use Tools, Extension Manager, Online Gallery right in Visual Studio and search for Taskbar.

Kate

Monday, 09 August 2010 09:43:37 (Eastern Daylight Time, UTC-04:00)  #    
# Saturday, 07 August 2010
I got a call this week from a recruiter who is trying to find senior C++ developers for a firm with a growing need. He has placed people with them in the past and it's worked out well and they want more. They write performance-sensitive applications for the financial industry and need someone who's comfortable with templates, and has experience with applications that process high volumes of data. If you're interested, drop me an email and I'll forward it to him for you. Good luck!

Kate

Saturday, 07 August 2010 12:46:31 (Eastern Daylight Time, UTC-04:00)  #    
# Thursday, 05 August 2010
I'm speaking at TechDays 2010 in Toronto. So are some other very good speakers. (Feel free to click the links on that page to other cities to see the equally good crop across the country.) Would you care to join us?

Seriously, Microsoft has an entire track in each city, ten hour-long talks and two half-hour ones, for Local Flavour. The most important criteria is that you want to talk on something you're passionate about. Seriously, this isn't "Introduction to Visual Studio 2010" or "What's New in C#" - instead it's something that is far more specific and personal. A technology or methodology that you use and care about. A story that will help other developers, or IT pros, or DBAs. Something important that won't be covered in the entire two-day conference unless you step forward now and offer to talk about it.

As John Bristowe puts it:



You need to get cracking on this to meet the submission deadlines. Download the application form from the Canadian Developer's Blog, and submit as many ideas as you have.  You don't have to have prior speaking experience, but if you do, be sure to mention it!

See you in the speaker room,

Kate
Thursday, 05 August 2010 12:30:24 (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, 03 August 2010
Recently I had a nice chat with David Starr on the Pluralcast about Visual Studio Extensions. This topic is just so much fun. Visual Studio is where most of us live all day, and making it work perfectly for us is incredibly appealing. The introduction of the VSIX format with Visual Studio 2010 takes so much of the deployment pain away and is really changing the landscape of who is willing to write and share handy little things that make Visual Studio a tiny bit different - in a good way.

If you want to find some great extensions, do check out the Visual Studio Gallery or click Tools, Extension Manager and then click Online Gallery. There you can search for Triple Click, Ctrl-Click Go To Definition and many more. You can also look around to see if anyone's implemented your fun idea.

If you'd like to learn how to get in on the fun, please do check my course - I am having such fun writing it and as always learning a few things I never knew as I go. Also check the links David has on the Pluralcast page - they will get you started.

Kate

Tuesday, 03 August 2010 12:06:33 (Eastern Daylight Time, UTC-04:00)  #    
# Sunday, 01 August 2010
I've done a lot of training in my day. I really enjoy it - you get immediate satisfaction, as a trainer, from seeing people leave changed by having spent a week with you. It's one of the easiest ways to have a major impact on someone's career and even their life. These days, there's a lot less of it going on. Partly it's because technology has enabled other ways of learning. Partly it's because we're a lot more "fast-paced" - someone who realizes they are missing knowledge will search for it online, ask on StackOverflow, watch a recorded talk or screencast and then carry on, rather than waiting several weeks to be able to go on course. There is still a lot to be said, however, for spending a day or three days or a week with a really smart person who has committed to making you better at something you don't know enough about.

So why would someone who was lucky enough to be "sent on course" by their employer, or who has invested their own time and money on taking a course, waste that opportunity with self defeating behaviours? I don't know, but I know for a fact that it happens. I've had people in my courses who didn't care, who didn't want to learn, who were hostile to the language or tools or methodology I was there to tell them about. Sadder still were the people who did care, wanted to learn, wanted to learn this topic, but still chose to act in a way that prevented it. Back in the day when you couldn't check your email in class (no wireless, and email on phones was rare) it was the folks who burst out into the hall at every coffee break and every lab period to go check their email and voicemail. Often they would say "I read the exercise and I only need 10 minutes for that, so I'll check my messages then come back and do it." My reply was always "if you really only need 10 minutes, do the exercise and then go check your messages." But this group of people can't make the training their top priority even for this one day, this one week. And often, they don't learn much as a result. In person training is probably a bad fit for them, and they might even give it a bad name. Then there's the showoff, the arguer, the "sorry I was zoned out can you say that all over again", and so on.

Paul Randal and Kimberly Tripp are still teaching more than I ever did. And now Paul's written up a lovely list of ten things NOT to do when you're on a course. None of it is SQL-specific and it's all good advice. Enjoy.

Kate

Sunday, 01 August 2010 11:58:21 (Eastern Daylight Time, UTC-04:00)  #    
# Friday, 30 July 2010

Oleksandr Krakovetskiy, a Regional Director in Ukraine, has written a cool Bing Maps application that shows you where Regional Directors are located and provides a bit of their bio. It's an interesting supplement to our blog aggregation and event calendar at The Region.

Hover over a star to see someone's name (as in the screenshot) - click it to read their bio and get links to their Twitter, blog, etc. You can zoom out to the whole planet or in to a region that interests you. Nice work, Oleksandr!

Kate

Friday, 30 July 2010 12:07:54 (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, 28 July 2010

Here are some interesting lists. Each of them is fleshed out in a blog post you really should read. I'll give you the lists so you know you want to read them.

First, Ted Neward on 10 Things To Improve Your Development Career:

10: Build a PC.
9: Pick a destination
8: Be a bell curve
7: Learn one new thing every year
6: Practice, practice, practice
5: Turn off the TV
4: Have a life
3: Practice on a cadaver
2: Administer the system
1: Cultivate a peer group

Some of those are metaphors: I'll let Ted explain them.

Then, we have Jim Carroll and How to Get Faster When the World is Faster:

  • build up experiential capital
  • master collaboration and share
  • focus on tactical to strategic transitions
  • fuse generational insight
  • take on anticipatory projects
  • be a farmer
  • displace indecision
  • implement quicker
  • think bold

The advice is aimed at entire companies, but I think it can resonate well with an individual. Again well worth the read.

And then there's John MacIntyre and 11 Personal Programming Assumptions That Were Incorrect.

  1. The customer and user are the same person.
  2. You isolate and kill all bugs without exception.
  3. Writing beautiful software as an act of craftsmanship.
  4. Working 24/7 would be rewarded.
  5. Vendors can be believed.
  6. You are not actually working from the monitor.
  7. That I wasn’t a very good programmer.
  8. You need to / should grok a language or tool before you even start.
  9. You don’t say you know something unless you’ve grok’d it.
  10. Other programmers saw beauty in their work.
  11. The best programmer is recognized.

There's some cynicism in there, but others might call it realism. I suspect most of this you have to learn from experience, but perhaps you recognize a few?

Kate

Wednesday, 28 July 2010 11:48:33 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 26 July 2010

The latest refresh of the Windows Phone 7 Tools is now available! Combined with Visual Studio 2010 (any edition, you don't need Express any more, though if that's what you have it will work) you can create apps in no time flat and run them on the emulator. I couldn't resist:

If you've ever done a WPF or Silverlight app, you can do Hello World in a matter of minutes. I put the picture in there just so I could say I had edited the XAML beyond putting my own name in an attribute. If you'd like to do some serious work, there are all kinds of training resource links on Yochay's blog. Don Burnett has some interesting thoughts on why Blend gives you power and productivity for Windows Phone 7 development and how there's just nothing like it for iPhone development.

I have some fun ideas I want to try that will take a little more than 5 minutes, so I'll report back on that front soon. I'm going to put my phone posts in my Client Development category, since after all, client development includes devices like phones just as much as it includes pure Windows apps.

Kate

Monday, 26 July 2010 15:16:30 (Eastern Daylight Time, UTC-04:00)  #    
# Saturday, 24 July 2010

The Productivity Power Tools is a super cool pack of extensions that will make Visual Studio 2010 tremendous fun, and make you more productive. Now the team has announced a new version. This lets you turn individual tools on and off, so if you love Highlight Current Line and Go To Definition, but hate Align Assignments, you're in luck:

There's also new tools in the pack. Solution Navigator "merges functionality from Solution Explorer, Class View, Object Browser, Call Hierarchy, Navigate To, and Find Symbol References into a single view" according to Adrian Collier, and lets you pin tooltips of information near the place in the code where you use them, pops up previews of image files when you hover over them in the tool pane, and just generally reads your mind to make you a happier and more productive developer.

This package had me at "Go To Definition" but these additions make it even more of a must have. You can install right from within Visual Studio 2010, too. Choose Tools, Extension Manager. Click Online Gallery. In the search box type Productivity.

When you see this dialog, click Install:

You'll be prompted to restart Visual Studio:

Click Restart Now and wait a sec. And that's all it takes! You really will love it.

Kate

Saturday, 24 July 2010 12:15:24 (Eastern Daylight Time, UTC-04:00)  #    
# Thursday, 22 July 2010
Would you like your machine to use up to 25% less power? Are you on XP now? You can see a big improvement by switching to Windows 7. There are some other things you can do too, like changing some drivers, but those are probably a bit difficult for most people. We have a number of machines kicking around the office that we've left on XP because they're really just file and print servers, people don't use them directly very often, so the obvious UI benefits of Windows 7 didn't seem relevant. But lowering the power bill is relevant, right? Or, if you're out and about with your laptop, having the battery last longer is relevant, right?

Here's the blog where I found some numbers ... it's a summary of a longer whitepaper and you should probably read that too.

Kate

Thursday, 22 July 2010 11:55:10 (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, 20 July 2010

I mentioned I've been recording videos. That's because I'm doing another Pluralsight course. This one is on Customizing and Extending Visual Studio. About half of it is live already:

  • Overview of Visual Studio 2010 Extensibility
  • Why write extensions for Visual Studio?
  • Visual Studio Macros
  • Visual Studio Snippets
  • Getting and installing extensions for Visual Studio
  • The Visual Studio 2010 SDK
  • Visual Studio Start Page
  • The VSIX Format

There's more to come, of course - I'm about half done. I'm really enjoying this material. You can get your work done a lot faster if you tweak Visual Studio to meet your needs. It doesn't have to cost you money and it doesn't have to cost you much time. Take a look!

Kate

Tuesday, 20 July 2010 10:41:26 (Eastern Daylight Time, UTC-04:00)  #    
# Sunday, 18 July 2010
Pluralsight On-Demand! now has a second Windows 7 development course. I'm happy to see this - Eric and I co-ordinated while I was doing my course. In the first modules that are online now, he tackles topics that I did not - Restart and Recovery, Task Dialog, and Search. Feel free to use both courses to make yourself a better Windows developer!

Kate

Sunday, 18 July 2010 15:31:09 (Eastern Daylight Time, UTC-04:00)  #    
# Friday, 16 July 2010

I've had a chance to watch a number of the videos from the Windows Summit - an online event to help you with Windows development of all kinds. You can learn more about it and register at the main summit site, or check the lists of sessions for developers. The only trick is that once you've registered, you need to go to a different site to actually watch the sessions. Once you know that (and there is a link on the main site) you're all set.

I've been getting "Windows 7 for Developers" training since before the first public beta, so I had seen a lot of this before. But several sessions were noticeable improvements from the way that material had been covered in the past, and none of them were poorly done, so I recommend this as a way to learn the concepts that are important to anyone writing for Windows 7, and to learn the advantages that Windows 7 can offer to you as a developer and to your users.

I saw three different approaches to code in the sessions I watched:

  • Full on demos with Visual Studio involved
  • Code on the PowerPoint slides, and links to resources that include code demos
  • Mention the name of the API but don't show how to use it
I also saw a mix of native and managed code, with some sessions going all the way to the native side of the spectrum and some all the way to the managed side. Most of the sessions mentioned the Code Pack, of course, and call out a link to it in their resources.

Even if you know all about the taskbar, maybe you could learn about power management, or background services, using sensors, or writing location aware applications? It's really worth taking a look around.

Kate

Friday, 16 July 2010 13:46:01 (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, 14 July 2010

Here is something I've been asked more than once, and seen asked on various forums as well. I'll paraphrase rather than quote one specific asker:

We have an application written 15 years ago that's been working flawlessly. But when we run it on Windows 7, the users can't find the files it writes. Worse, there are no error messages, so they think they've saved the files, but when they go to C:\Program Files\MyGreatSoftware\UserExports - the files aren't there! 

Often, the question trails off into a rant about how sneaky and mean Windows 7 is to somehow prevent access to Program Files but not give error messages. The rant might also include a paean to how amazing the lost files were and how many workyears of productivity have been lost now that these files cannot be found, and why this means you can't trust Windows to do something as simple as write a file to the hard drive. Sometimes, the asker has established that this is related to UAC and they are recommending everyone turn it off to avoid this disaster. I thought I would make some less drastic suggestions.

First, your files are not lost. A few people know this, but they then claim the files are almost impossible to find and no end user will ever find them. Let's tackle this one first because if you know this trick you may be able to get by without changing anything else about your application. Tell the user to go to the place they expect to find the files, say C:\Program Files\MyGreatSoftware\UserExports. Then have them look in the toolbar for a button that says Compatibility Files. Click it. Ta-da!

Ok, now the next thing is, why the heck are your files being written there? Because you are trying to write to a protected area and you don't have a manifest. You have several things you can do about this, and they boil down to two main things:

One, don't write to a protected area. You can get this by installing somewhere other than Program Files (not a good idea) or by changing the application to write to a better place. Two, get permission to write to the protected area. This means running as administrator. Train the users to right-click Run As Administrator when they run the app, or train them to set the Compatibility Settings for the app (neither very likely) or ship the application with a manifest that includes requireAdministrator. Now matter how you arrange this second thing, your users are not going to like agreeing to the UAC prompt every darn time. So really, that brings you back to number one, don't write to a protected area. Use AppData instead - there's a simple function call to get that path on any machine (including older XP machines) and you'll be in fine shape. If you think your users can't find that, and the files are for the users and not just some internal settings, then use a folder under Documents - again, there's a simple function call that will get you the path.

If virtualization makes you nuts - that your code thinks it's writing to C:\Program Files\whatever but really it's writing somewhere else, and the OS is cheerfully lying to it and saying all the writes succeeded - then put a manifest on your app. Doesn't matter whether it's requireAdministrator or asInvoker. Doesn't matter whether it's embedded (VS will embed them for you from 2008 on easily, and there are tools that do just manifest adding) or just a file of XML in the same folder as the exe. Once the app has a manifest, virtualization stops. Of course this may mean the users get all kinds of Access Denied errors that they don't like. Now you see why virtualization was invented.

Should you rely on it? No. For one thing, it may go away in some future version of Windows. And it goes away when you add a manifest, which for many people happened when they migrated to a new version of Visual Studio. What you should do is understand it, including how to find the virtual store, so it doesn't make you quite so crazy.

Now go turn UAC back on,

Kate

Wednesday, 14 July 2010 09:25:20 (Eastern Daylight Time, UTC-04:00)  #