Archive for the 'Software development' category

HP TouchSmart application development in a nutshell

September 24, 2009 5:09 pm

There is a document available for download (wrapped in an MSI to keep the HP lawyers happy) that describes all the nitty-gritty details of how to create an app that “fits” into the HP TouchSmart software environment. But some people might enjoy just a quick introduction to what it takes to get an application to show up in the HP TouchSmart software. So here’s my attempt at providing just the essentials in a bulleted list:

  • Create a Windows app using any technology you please (C++, MFC, VB, WPF, Flash, Air, whatever)
  • Do not use DirectX exclusive mode
  • Make sure the app produces one Win32 window (and only one window) and does this quickly
  • Make sure the window has no “chrome” whatsoever (no borders, resize grips, close/minimize/maximize buttons, system menu, etc.)
  • Make sure the window can still be resized by WM_SIZE and moved by WM_MOVE messages (and make sure it does so very responsively)
  • Make sure the window content is touch friendly

That’s it. If you know how to produce a program that does the above, you’re all set. No need to learn any interfaces, new programming models, technologies, nothing. I’ve actually had partial success at getting apps designed for Windows 1.0 to run inside the HP TouchSmart environment.

Now, if you want to improve on things, here are some more things you could do:

  • Make sure you have a black background for your window
  • Support the three “layouts”/sizes that HP TouchSmart uses as the user interacts with the UI (small, medium, large)
  • Take into account that the user can only interact with your window in large layout/size
  • Present something useful/informative in small and medium layout/size
  • Provide a beautiful, large icon

And to make it really great:

  • Use the notification mechanism that the environment provides (if your app needs to notify the user of anything)
  • Use the mechanism for launching IE that the environment provides (if your app needs to put the user in a full web browser experience)

Finally, use the RegisterSmartCenterApp.exe registration mechanism (described in the document linked to above) in the package you deliver for installing your app. You need to do that so program you’ve developed can be integrated into the HP TouchSmart UI.

If you’ve climbed the WPF cliff, the latest version of the HP TouchSmart software (2.8) includes a library that you can use for even closer integration. Leave a comment if you’d like more information about that. I don’t consider that part of the “nutshell”, since it ends up binding you to a specific technology stack.

Why are you not a member of the ACCU?

August 6, 2009 9:36 am

ACCU Home page

You may never have heard of ACCU, the Association of C and C++ Users as it was originally called. It is a volunteer organization, consisting of programmers who care about programming. The ACCU publishes two magazines, both devoted to raising the standards of programming everywhere: C Vu and Overload. On top of that they organize a conference every year, where some of the top names in C/C++ programming (and many other software development fields) come to speak and mingle with programmers from all around the globe.

I was introduced to the ACCU several years ago, when I first came to Silicon Valley, and still renew my membership every year, even though I don’t attend the local ACCU-USA events anymore. Yes, there is a local “chapter” of the ACCU in Silicon Valley, and they have monthly events that you can attend for free. I had the good fortune of hearing Bjarne Stroustrup speak once (plus going to dinner with him and the rest of the attendees afterwards, and even getting to exchange a few words with him in private.)

C Vu Volume 21 Issue 3 Cover     image

At one time I also co-hosted an event for the ACCU, and I think it is this personal connection that has kept me going as a member, even though I’ve not been much directly involved since. What keeps me hanging on now are the two excellent journals, which are largely ad-free and contain almost nothing but passionately written articles and code samples, demonstrating how to become a better programmer.

If this is something you strive for, I highly recommend checking out the ACCU and encourage you to become a member. Even if you live in the United States or elsewhere outside the UK.

Windows Vista Ultimate customers get the shaft – again

June 26, 2009 8:04 pm

A lot has been written about how Windows Vista Ultimate was a major disappointment. First it was billed as the version that would “keep on giving” in the form of Ultimate Extras – cool new features that would be exclusive to Ultimate customers. When those extras finally materialized most people were underwhelmed. The extras were mostly Language Packs, DreamScene (with a few content packs) and a game or two. And for that, people paid a hefty premium over the Home Premium edition.

Now Microsoft has published special early upgrade pricing to entice people to rush out and get Windows 7 “while supplies last”. And they’re at it again. Guess what the upgrade price for Windows 7 Ultimate is:

WindowClipping

Yup.

$219.99!

Sorry to shout there. At least this time there’s no promise of “Extras”. Only BitLocker and Language Packs (in addition to the Professional features). Not sure that’s worth $120 over the Professional Upgrade or $170 over Home Premium (even considering XP mode.)

Oh, and you can’t do an edition “downgrade” from Vista to 7. You can buy the upgrade package, but you’ll have to use it to do a “custom install” (i.e. clean install) and then reinstall all your programs and data. Despite that inconvenience, I’ll go for the Home Premium upgrade, thank you very much. I’m done being an Ultimate customer. Or is that Ultimate fool?

(And just for the record, Windows 7 is a fantastic product in my opinion. I hope Paul Thurrott is right when he says it may be the next Windows NT. Unfortunately he also seems to be right about how Microsoft can mess things up with their pricing)

MSI custom action type 50 / 51 failures? Beware of quotes.

April 25, 2009 10:37 pm

This one cost me a lot of wasted time recently. I was authoring an MSI package using the otherwise excellent open source WiX package from Microsoft and kept getting 1721 errors when a custom action was supposed to run. If you get this problem, let me attempt to save you a bit of time.

If you author a type 50 custom action that runs an exe on the system, based on a registry app search in combination with a type 51 action for example, make sure you don’t put quotes around the property that defines the exe path in the type 51 custom action. In other words, don’t author it as “EXEPROPERTY”, but just EXEPROPERTY.

You may think you need the quotes if your exe path has a space in it somewhere, but you don’t.

Now, if your type 50 action uses an ExeCommand and part of that has spaces in it, that usually needs to be quoted.

Looks inconsistent to me, but I guess the ways of the Windows Installer are inscrutable and mystical at times.

My type 50 action actually ended up as 1138 or something because of deferred execution and no impersonation, but basically the same idea applies.

HP TouchSmart development on .NET Rocks!

December 2, 2008 11:54 pm

Check out the interview with some of the HP TouchSmart folks on .NET Rocks! It just went live earlier today.

http://www.dotnetrocks.com/default.aspx?showNum=399

The parts for developers are mostly in the first 15 minutes. I have some PDF slides that might illustrate things for people who are just looking for a quick visual and not a whole lot of depth. If you’re interested, let me know and I’ll post them here.

WIC metadata in .NET: Getting around "Property cannot be found" / System.ArgumentException /"Exception from HRESULT: 0x88982F40"

November 16, 2008 9:39 pm

Here’s a bit of an obscure error message I’ve run into while working with WIC (Windows Imaging Component) on .NET/WPF, trying to write XMP metadata into an image:

image

 

 

 

 

 

 

 

 

 

 

So far, a search on Google has yielded few usable results. I hope this post will change that, yielding at least one useful thing.

The Exception message tells you that you’re trying to write data to a property that doesn’t exist in the file. Microsoft has a tool called WICExplorer that can show you the metadata like this:

WIC_Before

The above shows an image in WICExplorer directly after coming off of my digital camera. Notice that there is no “XMP Reader” node, which would represent XMP metadata. So if you want to put new XMP metadata into the picture, you need to know two things: how to create a new metadata node and what the correct syntax is for doing so.

What helped me figure those two things out were these pages:

http://social.msdn.microsoft.com/forums/en-US/wpf/thread/8f297b11-99ba-459c-b085-1ff3ae526487/

http://msdn.microsoft.com/en-us/library/bb643802.aspx

The first one showed how one can create new metadata objects using WIC, the second showed the needed syntax for some of the queries.

So here’s an example of how to create XMP metadata in an image that doesn’t have XMP metadata embedded yet:

   1: string file = "C:\Temp\IMG_1687.JPG";
   2: BitmapCreateOptions createOptions = BitmapCreateOptions.PreservePixelFormat | BitmapCreateOptions.IgnoreColorProfile;
   3: Stream originalFile = File.Open(file, FileMode.Open, FileAccess.ReadWrite)
   4: BitmapDecoder original = BitmapDecoder.Create(originalFile, createOptions, BitmapCacheOption.None);
   5: BitmapMetadata metadata = original.Frames[0].Metadata.Clone() as BitmapMetadata;
   6:  
   7: string q = "/xmp/exif:UserComment/x-default";
   8: if (metadata.ContainsQuery(q))
   9: {
  10:   metadata.SetQuery(q, comment);
  11: }
  12: else
  13: {
  14:   metadata.SetQuery("/xmp/exif:UserComment", new BitmapMetadata("xmpalt"));
  15:   metadata.SetQuery(q, comment);
  16: }

The keys are in line 7, where the initial metadata query is shown and in line 8, where the code tests if the metadata is already present. If not, line 14 shows how to create a new XMP metadata node, which then gets populated in line 15. The writing of the data can be done using a JpegBitmapEncoder according to Robert Wlodarczyk’s blog post (without the InPlaceBitmapMetadataWriter piece.)

After running code like this, you’ll now have the metadata in the file, as shown by this WICExplorer screenshot (I added “App0 Reader” metadata to this image as well):

WIC_After

Hopefully this is useful to some folks out there. Enjoy!

HP TouchSmart / badges at PDC 08

October 24, 2008 10:44 pm

You’ll see a lot of the HP TouchSmart PC at the Microsoft PDC 2008 starting on Monday. Not only physically, but also as it relates to the software. Can’t say any more than that right now.

We’ll have two of the HP TouchSmart software developers attending, so if you see them, don’t be shy. Please come and say "hi".

If you do, we’ll have some stuff to share that should make people who have commented on some of my previous posts a little happier, I think. Again, I can’t say any more than that now.

Oh, and we’ll have PDC badges to hand out. Here’s a sample:

ATouchDifferent

We have five different ones, but only a limited supply.

Oh, and we may do an OpenSpace session, although I’m not sure we’d be in "compliance" with the rules. Let’s see.

I’m definitely looking forward to PDC 08!

I’ll be wearing my geek tie (recently "upgraded", too). Hope to see you there!

Going to SD West 2008 – a planning worksheet

March 1, 2008 2:37 pm

I have the good fortune to be able to attend SD West this year. I’ve heard people at work rave about this conference right in my backyard, and was lucky to get approval to go this year.

Unfortunately I’ve been so swamped with work (really exciting new stuff, too) that I haven’t been able to prepare at all. In other words I still have no idea about what sessions to go to. Argh. To add to that frustration, the SD West website doesn’t make it really easy to plan your days for maximum efficiency. Double Argh.

Here’s how I like to plan my attendance: I have an idea at a high level about what kind of sessions I’d like to focus on (in my case .NET and People, Process & Methods mostly). So I need to be able to filter all sessions by those high-level criteria. Next, I need to figure out which sessions in those high level tracks are available at what time and how they may conflict relative to how interesting they sound to me.

The information provided on the SD West website provides some ability to filter and search for sessions, but it doesn’t help you with detailed planning.

So I decided to spend a little time pulling down all sessions as an Excel sheet (which the site allows, thank goodness), and started to shape and mold the sheet to my needs. The result is available for you to use as well, in case you’re as late as I am: sdwest08_all.xlsx (update: rename this file to have an .xlsx suffix after downloading, WordPress changed the extension on me).
(I think I have all sessions in there, but I noticed that one session seemed to not be fully downloaded (a session with quotes in the description), so I added it back by hand. Maybe there are others missing too, but I think that was the only one.)

You’ll see all sessions sorted by time, color coded by time slot/event type (keynotes, birds-of-a-feather), color coded by track, and with filters on each column. I also added a priority column at the beginning to perhaps help making decisions if you change your mind while at the event.

And, yes, I will most likely be wearing my Geek Tie at the event (it has a Red Verbatim Store’n'Go USB memory stick and a gray CaseLogic case at the end).

WPF ControlTemplate Trigger tip

January 5, 2008 2:11 am

I didn’t fully realize how ControlTemplate Triggers work (or don’t) until I solved a problem with a UserControl today, with the help of this post on the MSDN forums.

A Triggers’ EnterActions or ExitActions don’t seem to get fired when a UserControl is constructed. If you want, say, an animation in your control to start on a property change, you can put a BeginStoryboard element into a Trigger’s EnterActions and a reverse BeginStoryboard into the ExitActions.

But for the control to start out right at initialization you also need to have the right Setter element on the Trigger to set initial states (in addition to setting the opposite initial states on the elements to be animated/initialized.)

Here’s a tiny example:

 1 <UserControl> <!-- Namespaces omitted for brevity -->
 2   <Grid>
 3     <ToggleButton x:Name="Toggle">
 4       <ToggleButton.Template>
 5         <ControlTemplate TargetType="{x:Type ToggleButton}">
 6           <Grid>
 7             <!-- Initial opacity is 1 for the initially unchecked ToggleButton state. A trigger changes it to 0 for an initial checked state. -->
 8             <Grid x:Name="HideMe" Opacity="1">
 9               <TextBlock Text="Hidden"/>
10             </Grid>
11             <!-- Other parts of the control go here -->
12           </Grid>
13           <ControlTemplate.Triggers>
14             <Trigger Property="ToggleButton.IsChecked" Value="True">
15               <!-- This setter hides the desired element when the ToggleButton's initial state is checked -->
16               <Setter TargetName="HideMe" Property="Opacity" Value="0"/>
17               <Trigger.EnterActions>
18                 <BeginStoryboard>
19                   <Storyboard>
20                     <DoubleAnimation BeginTime="00:00:00" Duration="00:00:00.05" Storyboard.TargetName="HideMe" Storyboard.TargetProperty="(UIElement.Opacity)" To="0" />
21                   </Storyboard>
22                 </BeginStoryboard>
23               </Trigger.EnterActions>
24               <!-- ExitActions go here to make the Grid with the TextBlock visible again -->
25             </Trigger>
26           </ControlTemplate.Triggers>
27         </ControlTemplate>
28       </ToggleButton.Template>
29     </ToggleButton>
30   </Grid>
31 </UserControl>

The ToggleButton contains a TextBlock in line 9 that I want hidden when the ToggleButton’s IsChecked state is True. The animation in line 18 takes care of doing that when the user interacts with the control, but when the control is initialized, I need the Setter in line 16 to hide the TextBlock initially if the ToggleButton is checked by default (through data binding, for example.)

The software free-conomy

December 19, 2007 11:50 pm

Richard Stallman, the prophet of free software, St. IGNUcius After looking through the comments to Jeff Atwood’s recent post on software product keys, I noticed that quite a few went down the rabbit-hole of  free versus paid software. People suggesting that if you don’t like paying for software, typing in license keys, managing them and other hassles, you can always go to using free software.

I can see where these people are coming from. I use plenty of free software myself: Windows Live Writer, Audacity, WinMerge, Process Explorer, PowerMenu, WiX, Notepad2, Firefox, Reflector, JAlbum, Gallery, Linux (contribs.org), Paint .NET, etc. etc. etc. Many of these are essential for productive work and I’m glad they let me accomplish things.

In October 2002 I attended a talk by Richard Stallman, where he was spreading the gospel of free software, which is often equated with open source software, or OSS. It wasn’t the first time I’d started thinking about the implications of OSS, but his comments sparked further puzzlement: Is it really possible for programmers to make a living on open source software? Seeing the comments on Jeff’s blog brought back that question.

It seems to me that a lot of the more successful open source projects out there had their origin in the world of what I want to call the free-conomy, or perhaps the carefree-conomy. It’s the world all around us consisting of people who do not have to worry about real-world problems connected to making a living: Students, living on their parents’ money or borrowed money; programmers employed by large corporations (that have other means of generating income that enable them to pay the programmer to work on free software); professors in tenured positions at universities, contributing as part of their research. You get the idea.

I’d be curious to know how many of the commenters to Jeff’s post fall into that category. I’d also be curious to know how all the people who contribute to open source, or free software make a living, or how they sustain themselves. These are honestly things I’m curious about. If you’re one of them, please tell me.

I think once you transition from the free-conomy to the reality-based economy (“real life”?), your perspective changes. You start realizing that you need an income to pay the rent, clothe yourself and your family, buy food, utilities and transportation. You begin to see that if you don’t pay for the music you like to listen to, the programs you like to use, the books you like to read, the movies you like to watch and the games you like to play, the people who produce those things will not be able to support themselves, and thus there may come a time when you will no longer have that music, those programs, those books, those movies or the games.

So all the hassles that the producers of software or other digitizable content make you go through to access their creations begin to seem like a small inconvenience to pay for the privilege.

Of course, you can still debate what a fair price for such creations is, but that’s a topic for a different post. You can also debate the principles of “fair use” of the creations you may have paid for. That’s also a topic for another post.

What’s your perspective on the implications of open source software for people who make a living at software programming/development?

Stop SOPA