Tuesday, December 07, 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.
Sunday, December 05, 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, December 03, 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, December 01, 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, November 29, 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, November 27, 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, November 25, 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, November 23, 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.
© Copyright 2022 Kate Gregory
Theme design by Bryan Bell
newtelligence dasBlog 2.3.9074.18820
| Page rendered at Saturday, May 21, 2022 7:08:50 PM (Eastern Daylight Time, UTC-04:00)
On this page....
Pluralsight Free Trial