# Thursday, 09 December 2010

Herb Sutter has blogged a "trip report" (except he didn't travel, but anyway) about the November meeting of the C++ Standards Committee. In it, he tells us:

Things are going well and we are on track to complete the Final Draft International Standard (FDIS) for the C++0x standard after the Madrid meeting in March. If that happens and that ballot succeeds, the C++0x standard will be published in 2011.

There are still decisions being made, and I have to say I like the way they're going. I think contextual keywords are wicked smart, and that if compilers can understand them, developers sure can. Compare Herb's two examples:


class [[base_check]] Derived : public Base {
public:
virtual void f [[override]] ();
virtual double g [[final]] ( int );
virtual void h [[hiding]] ();
};
class Derived explicit : public Base {
public:
virtual void f () override;
virtual double g( int ) final;
virtual void h() new;
};

Contextual keywords make the second option possible, and I think it's much better. You can also read about noexcept and the whole exception-checking backstory, as well as rules for generating move constructors and move assignment operators. It's all good.

Kate

Thursday, 09 December 2010 13:24:29 (Eastern Standard Time, UTC-05:00)  #    
# Tuesday, 07 December 2010
Windows 7 developers have tons of cool stuff at their (our) fingertips. There's taskbar integration, the new sensors and location platform, access to devices, and more. Silverlight developers, on the other hand, have so far not been able to get to all of that. Well, now you can! The Native Extensions for Microsoft Silverlight leverages the ability of Silverlight to do COM integration, and puts COM Automation around a collection of Windows 7 functionality so that Silverlight developers can use it. How cool is that?

Because it's on the Code Gallery, you know it's from Microsoft. The first release, Dec 2nd, covers:
  • Windows Sensor API - Integrate sensors:  Accelerometers, Light sensors, compasses, gyroscopes etc. 
  • Microsoft Speech API - Text to Speech (Speech Synthesis) and Speech to Text (Speech Recognition) 
  • Windows Portable Devices API - Enumerate and access content from connected portable devices (cameras, phones, music players, scanners etc.) 
  • Windows 7 Taskbar Integration - Jump lists, overlay icons, overlay progress display, Thumbnail toolbars etc. 
  • Webcam Local Encoding and Window Capture - Encode webcam capture into mp4 (H.264/AAC-LC) media - Capture user interface interaction as video 
  • Window Message Interception - Intercept and act on Window messages sent to the Silverlight OOB host window

This certainly gives Silverlight developers some interesting options! There are some samples that come with the library to show you what you can do, too. You might also be interested in Maor David's blog entry about the library.

Tuesday, 07 December 2010 12:33:24 (Eastern Standard Time, UTC-05:00)  #    
# Sunday, 05 December 2010
I finally caught up some of my PDC-watching and really enjoyed this Herb Sutter talk on C++0x lambdas. I'm well known to be a huge lambda fan. Herb made this talk enjoyable for me by bringing his personality to the table. He showed aspects of C++ that are not exactly elegant, and how using lambdas can make some much neater code possible. Sure, lambdas are "just" syntactic sugar, but they add up to a new way of thinking about writing applications in C++. Well worth watching.

One warning though - I generally download videos and watch them at 1.5 or double speed. I highly doubt you want to do that with this talk - it's dense!

Kate

Sunday, 05 December 2010 11:59:12 (Eastern Standard Time, UTC-05:00)  #    
# Friday, 03 December 2010
Kenny Kerr is back in Canada and back writing about C++. Like a lot of us these days, he's looking at a stripped-down, more modern way to write Windows applications in C++ - no MFC, no ATL, no WTL. Plenty of STL and new C++0x features. I like it! Here's the first installment - stay tuned for the rest of them!

Kate

Friday, 03 December 2010 11:53:59 (Eastern Standard Time, UTC-05:00)  #    
# Wednesday, 01 December 2010
Lately there's been quite a lot of interest on programmers.se about interview questions, and specifically the "coding at the whiteboard" part of the interview. It came up in a discussion of FizzBuzz, in one about "testing" your whiteboard code, and in one about question 11 of the Joel test.

I ask candidates to code at the whiteboard. I ask an intensely simple question, because I am mostly testing for things other than the actual code the person writes. I know, however, that there are places that actually want you to tackle reasonably challenging problems. I came across this blog entry by Diego Dagum (who edits The Architecture Journal, writes architecture columns, and is committed to native C++big time) that walks you through a C++ whiteboard problem that is decidedly non-trivial. What I found interesting is that he starts his "thinking aloud" the same way I would, but then when I would start writing something that worked for valid input, he first started to set out examples of invalid input. And when he wrote the code, it starts by rejecting various categories of invalid input before processing anything. It's cool to see someone thinking differently from me.

One thing really struck me. He spends over a page on the signature of his method - why he called it rtoi, why it returns an unsigned int, why its argument is const, whether it should take a  unicode string or not, why an STL string and not a char*. See how much these problems reveal about a person? That kind of care and precision is not something you can discover by asking a person "how important is it to you that a method signature is chosen with care? Can you give me some examples of naming methods you have done?" Coding in a job interview is about so much more than syntax. Are you prepared for the whiteboard?

Kate

Wednesday, 01 December 2010 21:59:11 (Eastern Standard Time, UTC-05:00)  #    
# Monday, 29 November 2010
People love Apple hardware. They pay dearly for it because they love it so much. And apparently, the paying continues after the hardware is bought. This report says that Windows Phone 7 Apps cost, on average, half what iPhone apps do. You could argue that the higher price means that the platform is more popular, or the apps are better - but old-school Windows Mobile was higher than iPhone, so any explanation needs to be a little more complex than a quick fanboi reaction would be.

So far I haven't installed any paid apps on my Windows Phone. I've got a motley collection of free games, Twitter, a not-very-good Messenger client that I can get by with, and of course a flashlight and a level :-). I love the way it syncs with my Outlook mail and calendar, and I'm getting used to the Zune software for syncing videos and pictures. I've had a number of pleasant surprises and no unpleasant ones, which is itself a surprise, because I am real a control freak when it comes to syncing. Getting on Wi-Fi is dreamily easy - I actually have no SIM in this phone, and use it on Wi-Fi only, and that's turning out to be quite workable, believe it or not.

Kate

Monday, 29 November 2010 14:28:38 (Eastern Standard Time, UTC-05:00)  #    
# Saturday, 27 November 2010
People say you can't get unit test support from Visual Studio for native code. That's not strictly true. Your tests will need to be managed code, but that doesn't mean the code you're testing needs to be.

As I hope you know, it's super easy to call native C++ code from C++/CLI - include the header, link to the lib. So here's the deal. Make yourself a lib that holds all the code you want to test. This can be completely native code, no problem. Build your UI (or your web services layer or your service or server or whatnot, I don't mean by UI an actual interface that a user clicks and types to, I just mean the part of your app that consumes your business logic) in native code if you like. Or in managed code, that's cool too. Then create a C++/CLI test project that includes the header for the logic, and links to the lib. There you go.

For the gory details including precisely what menu items to select and how to set up the project, John Socha-Leialoha has you covered. I love his conclusion:

After so many years writing in C#, I never thought I would enjoy C++ programming again. I was wrong. Using TDD to write C++ code is almost as nice as writing C# code, and I’m really enjoying the experience.

Kate

Saturday, 27 November 2010 14:20:05 (Eastern Standard Time, UTC-05:00)  #    
# Thursday, 25 November 2010
You know I just love jumplists. Probably my favourite app to have a jumplist is Windows Explorer. After all for Word, PowerPoint, Visual Studio and so on, there is a MRU list on the file menu or the like. But getting to folders I've used recently is super important to me.

That's why I kind of freaked out when the jumplist for my Windows Explorer disappeared.



I tried rebooting my laptop (something I do less than once a week.) No help. I caught up on updates. No help. So I started searching. And I found two articles, one about a jumplist that is slow to load itself, and other other about an "orphaned" item that couldn't be removed from a jumplist. That one helped me realize the likely cause of my problem - although I hadn't pinned a mapped folder, I had mapped a drive at a client site, and now that drive wasn't accessible any more, which is perhaps why the jumplist wasn't loading.

But anyway, what to do? Based on what I read in those two articles, I navigated to %APPDATA%\Microsoft\Windows\Recent\AutomaticDestinations (that's exactly what I typed into the Run box, it figures out %APPDATA% for you.) There I saw a whole pile of apps with a strange extension, a little reminiscent of the files that hold the details for libraries:



If you open any of these files in Notepad, you'll see that amongst all kinds of unintelligible strings are paths to files you've dealt with recently. What's more, you can kind of guess which app each file is for by looking at those paths - one file will have a bunch of .pptx files mentioned in it, while another will have a bunch of .xlsx files.  Now, which one is Windows Explorer?

Well, both articles said the same name: 1b4dd67f29cb1962.automaticDestinations-ms.I had a file called that, and when I browsed in Windows Explorer to another folder, the timestamp on that file changed. It seemed quite sure that it was for Windows Explorer on my machine too. So, I deleted it, as the articles suggested. Now I still had no jumplist, but when I then browsed to another folder, I had a jumplist with one item in it. From then on life was back to normal.

Something to know if you get a stuck jumplist someday.

Kate
Thursday, 25 November 2010 13:42:06 (Eastern Standard Time, UTC-05:00)  #