Fadzai Chamba

I disagree with everything I just said

November 2009 - Posts

 

I’m a firm believer in the mantra “When all else fails, read the instructions.” For most items, I just get stuck into what I need to do and figure out the details on the way. This is what I did when I started using VS2010 beta 2. I have never used a beta 1 product before, and I’m usually hesitant to try out beta 2 products, but I wasted no time with VS2008 and VS2010 because of the huge potential they carry.

As soon as my installation was done I opened Visual Studio and started to write some code. This was cool. I then unpacked the samples to see how some of the new things were done, and then finally I started to apply some of the new techniques to some applications that I already have.

One thing I tried this morning on Windows 7 was to add a jump list to my app. I wanted to add two tasks, and a recent file list. Piece of cake; to be exact, piece of cake without the flour to bake the cake with in the first place. After finding the namespace in Object Browser, I started playing around with the various classes to make the application work but there was no feedback; no jump list, no crash, no error message, Nothing (or null in C#). So I added a handler for JumpItemsRejected event.

The first bit of luck I got was a message telling me that there is no registered handler when I tried to add a JumpPath object. I figured this is because the file type used by my application hasn’t been registered on Windows so I associated this with my program by using Open With in Windows Explorer and tried again; then the weirdness began. I got the same message from my code, there is no registered handler. Meanwhile, I right clicked the task bar button and lo and behold, my JumpPath was right there.

I ran the code again, and again, and again, and again. But this time there was no joy, in place of the JumpPath, I got the message box. I changed the code multiple times to see if anything would change. But the definition of insanity is trying the same thing over and over again, without a Catch block. At this point, I mounted the VS2010 iso and installed the documentation for the first time. When that was done I searched for JumpList and got 33 results which helped me not one bit. It was the same info as what you would find in the Object Browser, no example code. So I went back to the insanity.

I added a task to the JumpList and that worked, only the JumpPath was rejected. All this was in a sample application that opens a .csv file, and the task was calling the same app with an argument of ”-doNothing”. The code in the startup procedure checks for an argument and displays it in a message box,or loads as normal if there is no command line argument. I invoked the task and take a wild guess what I got! The jump list with the JumpPath included.

 

It’s a conspiracy I tell you. It didn’t take me long to get to the bottom of it, the program that was registered to handle the file type is Jump.exe, the build result. The program that was running when I pressed F5 in the IDE is Jump.vshost32.exe (I am on Windows 7 64 bit). After spending a large part of the morning trying to get rid of the error in my code, I discovered that there wasn’t one; how annoying.

I don’t know if this is a known issue, it it isn’t then it is an unknown issue isn’t it. But I think the documentation for the final version should tell us that you should run the registered application for a Jump path from Windows Explorer or run without debugging from the IDE . This of course is assuming that the application you are writing has been registered with Windows for the file type you want. And something else for my wish list, give us some samples please. This isn’t an issue big enough that we have to try to figure out ourselves in the morning before heading to the office.

If you want to see the VS2010 code for creating Jump Lists, click here. Remember to register the .code file type before running this code (see the sample.code file inside the solution for instructions). Or better yet, run it without registering and have fun trying to figure out what went wrong. Happy coding. 

Posted by Fadzai Chamba | 1 comment(s)
Filed under: , ,

Last week I wrote about PowerTab and how it can be helpful. I went to www.dnrtv.com and saw something about PowerShell so I downloaded it since I have recently taken an interest in it. To my surprise, I then saw PowerTab in action, the guest actually recommended PowerTab.

Granted it is an old show (from 2007), but I think it is good. Anyone like me who never took notice of PowerShell when it first came out will find it valuable. In my case, I downloaded SQL Server 2008 Express and when installing it, it said I needed to get PowerShell. As a result I didn't check out SQL2008 as I kept forgetting to get PowerShell. Then recently at a developer conference, the speaker spoke of many possibilities with PowerShell. And now I'm game.

Been playing around with it and it is really cool. If you want to check out the video I found you can go to dot net rocks tv and there you will see PowerTab in action.

Posted by Fadzai Chamba | with no comments
Filed under: ,

I came across a great add-on for PowerShell, PowerTab which you can find at the power shell guy's site. This provides you with intellisense when accessing the .NET framework in PowerShell. I know that PowerShell in Windows 7 has a script editor, but I haven't used it so I don't know if it has intellisense or not. I will update shrotly in that regard. 

If you find yourself writing any scripts that access the .NET framework, or if you occasionally touch the framework from a powershell session, you will find PowerTab useful. Head on over to http://shrinkster.com/1bgc and check out PowerTab.

I wrote some software some time ago that is used by a mining company for maintaining their stores, HR, and monitoring production. I have been discussing with the MD about ways to give him reports in a centralised manner. 

Earlier, I had written a reporting app which can be plugged into the main app for his managers, or can run stand-alone for his own use. The problem is, he doesn't need all the reports it serves, and there are now a bunch of mine shafts and offices that he will need information from, since the company has expanded from mining chrome in one town, to mining gold and chrome in different towns. Seeing as he has a lot of work and a number of other concerns I am not involved in, I couldn't place a whole lot of apps on his machine just for reporting when all he wants to do is see some bottom line figures.

While I was thinking of a solution, I happened to attend a conference on Developing for Windows 7 about 2 weeks ago. One demo the speaker gave was on federated search. He searched for a Steve Balmer video and got a bunch of YouTube results right there in the Windows Explorer shell (in a similar format to the picture below) and I thought, whoa! I had been thinking of writing a shell extension for him to use which would go and search for his data from the various sources and he could see them all unified but this demo saved me a lot of time and effort. After the conference I asked how this works, and was told all I have to do is create an .osdx (Open Search Description) file, and Windows can use that as a search provider.

Screenshot of Windows 7's Federated Search feature at work.

My main concern was how much code I'd have to write but was happy to hear that I didn't have to re-write a single line of code. The osdx file can specify a service that I have already written that aggregates the data from all the various sites and the results can be displayed in the explorer window. 

This is what I am reseraching now, to see how best I can present these results in detail when he finds something he wants info on. I haven't isntalled the Windows 7 beta so this is something I was completely unaware of. For those like me who haven't heard of this, it is a feature that allows you to search multiple locations from within the Windows environment. For instance, if you want to find something on Bing, Youtube and amazon, you select search providers for these locations and type your search once, and you will have your results displayed right in there.

I will be updating you on my findings in the next couple of weeks. In the meantime, here is something that I found on MSDN that I think will be useful for understanding the schema for the osdx file (XML based) and how this works under the hood.

MSDN article for Federated Search

Posted by Fadzai Chamba | with no comments