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!
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!
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?
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.
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.
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.
Tuesday, 23 November 2010
Windows 7 introduced a lot of new ways for an application to give information to users. There's a thumbnail which is usually a miniaturized version of the whole application, and possible overlays of icons onto your taskbar icon (like how Outlook shows you have new messages, or Twitter shows there are new tweets) and progress bars under your taskbar icon. There are also cool ways for the user to give direction to or about the application. For example, you can right-click the taskbar to bring up a jumplist and launch another copy of the application, or another application.
Right from the beginning, some applications pushed that architecture a bit to use the jumplist to communicate with the application itself. (This requires launching some other application that communicates with the first instance.) For example, Outlook has this jumplist:
But this isn't the only way to send a command to an application from the taskbar, and it's not always the right one. Tasks are the right choice if you're willing to take on the extra work to code them up, and furthermore if they make sense even when the app isn't running yet. So in this example, Outlook, if I want to send a new message then I want to send a new message, even if that means needing to launch Outlook to do so. But what about Messenger? Here's how it used to look:
Does that make sense when Messenger isn't even running? To me, it doesn't. Here's how Messenger handles that now. There's a much smaller jumplist:
How do you set your status? With thumbnail toolbar buttons:
Sweet! Much easier to code, easy for the users to understand, and they don't clutter up the place when the app is not running. Nice decision. And keep this in mind for your own Windows 7 applications.
Sunday, 21 November 2010
Opinions seem to vary a little on the birthday of Windows. Charles Petzold says the files are dated November 15th, 1985. Ray Ozzie says it's the 20th. ComputerWorld says the 20th also.
Whatever you think the date should be, you really need to read the article by Charles. He did a keynote "selling" Windows 1.0 (a product almost none of us used) as a solution to the problems of the day:
Will it spoil the gentle humour throughout the piece, written 5 years ago, if I show you the output of his demo? I think not:
And that is Windows, and I don’t know about you, but after this event is over,
I’m going home and writing me some Windows apps.
I'm with you, man.
© Copyright 2018 Kate Gregory
Theme design by Bryan Bell
newtelligence dasBlog 2.3.9074.18820
| Page rendered at Monday, 15 October 2018 17:28:22 (Eastern Daylight Time, UTC-04:00)
On this page....
Pluralsight Free Trial
Click Start a FREE 10-Day trial