Sunday, June 17, 2007
I was helping a mentoring client translate some sample code from VB to C# - he has written a lovely library and a customer wanted to see C# code that called it. The original samples had been written by someone who wasn't in the room, so I could have a bit of a vent. They had made heavy use of the Microsoft.VisualBasic namespace (nothing wrong with that) so as to access familiar (to a VB6 programmer) string manipulation methods. The problem was, these methods were being used to do things like finding the extension given a file name, or extracting a file name from a long path. This work should never be done with Left, Right, and Mid - and using Substring doesn't make it better. There are all kinds of methods in System.IO that manipulate paths and file names in a more robust and localized way than you can possibly do by hand. For my client's code, I ripped out a whole pile of hand written code (including a loop that looked character by character at a string testing to see if each was '\' or not) and replaced it with calls to library methods.
Phil Haack lists a bunch of these (and his commenters even more) in a very useful post. Developers who know what's in System.IO and the other meat-and-potatoes parts of the .NET Framework will write code more quickly, and that code will be better. Never assume you're the first person who wanted to parse a file path, check if a string is a good date, or any of a thousand other general tasks. Trust me, what you want is in there ... look for it.
Saturday, June 16, 2007
I brought home a paper copy of MSDN magazine from Tech Ed and found this as one of the cover stories: An Inside Look At The Next Generation Of Visual C++. It's by Tarek Madkour and definitely worth a read. Were you wondering if MFC's wrapper for the new file dialog would be tweaked so you get the all-singing all-dancing new Vista common file dialog? Yes it will. Will there be a class to represent a Command Link? Yes. And a split buttton? Yes. Pretty much all the new controls and dialogs are in the new MFC. There's also resource editor support for PNG, for 32 bit images, and for large icons.
As I mentioned in my blog post about Sarita's Channel 9 Video, UAC support is also a lot easier. Then there's the marshaling library and STL/CLR. Toss in faster builds, and make developers everywhere happy. Roll on, release day.
Friday, June 15, 2007
Herb Sutter reports on the April meeting of the ISO C++ standards committee. They are now consistently referring to C++ 09 not C++ 0x (with a hope that x would not be hex, which seems to be turning out ok.) The meeting added features to the draft standard for the language itself (template aliases aka typedef templates, variadic templates, and unicode) and for the standard library (variadic templates, unicode, and rvalue references.)
The next meeting is July 15th - 20th in Toronto. I am trying to plan to be there.
Thursday, June 14, 2007
Have you tried writing a gadget yet? They're really simple and can have an immediate impact on your productivity. If you're a Canadian adult, you can enter your gadget into Microsoft Canada's contest and win some serious hardware.
The contest site has plenty of links to get you started and give you some inspiration. You have till July 16th, so get creating!
Wednesday, June 13, 2007
I like to let Hugh MacLeod's gapingvoid cartoons rattle around in my brain for a while before I decide if I like them or not. It's a fine line between pithy and banal, after all. This one is working for me:
Keeps my focus where it belongs, even when making custom software or mentoring the folks who are making the software. Forest and trees, don'tcha know.
Tuesday, June 12, 2007
Have you ever heard the career advice that you should consider doing some volunteer work in your field to gain experience? Sounds like a lovely plan, but how does someone without contacts find volunteer opportunities anyway? Or maybe you have the job you want, but you want to put your time and effort to a good cause, if only you could find one. If you're in Canada, MatchIT.com is just the ticket. Sign up, fill out a form, and get matched with needs from nonprofits. There's lots of folks looking to have their websites redone, or a registration system written, or their servers looked after. It's a chance to make a real difference, so please look into it if you have some time to spare.
Monday, June 11, 2007
Recently I had some major issues with a VPC somebody prepared for me. It came from a DVD and I just could not get it to run on Vista, though it ran great on XP. I was fairly sure that it would run OK if I could just launch VPC elevated and then open the .vmc file, but when I launched VPC (elevated or not) the only evidence of its existence was a taskbar entry (there was no window to be seen) and even that disappeared if I right-clicked on it.
I solved the first problem by granting Users access to the .vmc and .vhd files (I went with Full Control since I had them on a non-shared drive) and then the VPC ran perfectly. That was a better fix than elevating VPC every time anyway. But along the way I discovered how to fix the disappearing console. This post by Steve at EssJae.com shows what you need to do: find the options.xml file in C:\Users\%current_user%\AppData\Roaming\Microsoft\Virtual PC and open it -- make sure the console is not up and you're not running a VPC. Scroll down and find the <console> section and you will see some very large numbers for left_position and top_position. Change them to something normal, like 10 or 100, and save the file and you'll be back in business.
Sunday, June 10, 2007
During my blogging gap, some good channel 9 videos came out. I wanted to highlight Ale Contenti: VC++ Safe Libraries and More. Ale is the new Martyn Lovell and he wants to show you the safe libraries and how to write sensible C++ code. If you like to see C++ code written live on the whiteboard (no intellisense, no compiler to find your typos) this is the video for you
But wait, there's more. How about a C++ program without pointers? Well, without explicit use of pointers. Check it out.
© Copyright 2019 Kate Gregory
Theme design by Bryan Bell
newtelligence dasBlog 2.3.9074.18820
| Page rendered at Wednesday, October 23, 2019 2:04:25 PM (Eastern Daylight Time, UTC-04:00)
On this page....
Pluralsight Free Trial
Click Start a FREE 10-Day trial