Archive for December, 2006

Took the Which-Superhero-are-you test

December 30, 2006 3:01 pm

Hi! It looks like you're new here. Welcome! If you like what you see, I encourage you to subscribe to my RSS feed. If you're worried about adding another RSS feed that will add to your information overload, don't! I'm not a prolific poster. Thanks for visiting!

Saw this on TechCrunch and thought I’d play along. Looks like I’m Spiderman:

Your results:
You are Spider-Man

Spider-Man
60%
Hulk
50%
Robin
47%
Superman
45%
Supergirl
45%
Catwoman
40%
Iron Man
40%
Batman
35%
Green Lantern
35%
The Flash
30%
Wonder Woman
25%
You are intelligent, witty,
a bit geeky and have great
power and responsibility.


Click here to take the “Which Superhero am I?” quiz…

Finally added some links - are you surprised at what I picked?

December 28, 2006 10:59 pm

Today I got around to adding some links to my blog. If you look at the initial set you may be wondering why I mostly have the categories “Simplifying Life” and “Sensible Money Management” populated for now. What I’ve written about so far has been related to software and technology. So what gives?

Well, I since I work as a software developer, I’m somewhat naturally drawn towards high tech toys and software development topics. I’m a nut for tech toys, though I’m usually too cheap to buy them - working for a high tech company has its fringe benefits in that department. It’s easier for me to write about things from that sphere, since I know at least a little about it. So that’s where I started.

But one of my other big interests in life is limiting my impact on the environment and help make sure that our planet remains a viable habitat for my kids, their kids and so forth. I believe in picking up my own trash and making sure it goes into the proper waste stream. I believe in trying to limit the amount of trash I generate, so the waste stream becomes as small as possible. I believe that keeping my business as local as possible is important for reducing my impact on the environment. I believe that the only way to make a difference in the world is through personal action, meaning I have to do something. If I don’t do it, who will? And if I don’t do it, how can I get other people to join me?

I’m sure you can see that these things don’t mesh very well: a fascination with software, computers and high tech toys paired with an interest in reducing my impact on the planet. Let me just say that I struggle with this paradox a lot. I’m going to explore the notions of “voluntary simplicity” in addition to my ramblings about software and tech toys. Maybe you’ll enjoy it, maybe you won’t. Whichever way, I’ve now enabled “unregistered” commenting. So please comment away. I invite you to a conversation.

iRobot Roomba improvements I’d like to see

December 26, 2006 6:45 pm

I splurged on an iRobot Roomba robotic vacuum cleaner this Christmas. It’s quite a neat thing to watch working. But I’d like some improvements made to it:

  • A light that shows when the Roomba hits a virtual wall, so I can place the wall in just the right spot and at just the right angle to block the robot’s path. My house is full of door-less openings that would make the machine run out of juice if not stopped by virtual walls.
  • A “wall following first” mode, so I could be sure it has done the edges of the room before embarking on it’s normal “random” cleaning pattern.
  • Detection of area rugs. So far the Roomba gets stuck on our rag rugs and the Christmas tree skirt. Putting up virtual walls for these would be almost impossible.
  • Seeing the model of the room that the robot builds up somehow. Also, how much of that model it thinks it has covered and how often.

Other than that I’m pretty happy with this high tech “toy” worker so far.

Localizing an XBAP application without using LocBaml

December 12, 2006 4:23 pm

Using the LocBaml sample application that Microsoft provides with the Windows SDK for Windows Presentation Foundation can be very frustrating. By default it seems to pick up a lot of things that clutter the resulting CSV file. If your application contains a lot of image resources, those will get duplicated in the localized resource dlls as well, increasing the space that your application occupies on the hard drive. And finally, getting an XBAP application to be deployable after localization with LocBaml requires opening up the application manifest and adding all the localized resource files to it. Otherwise a deployment error will bite you.

So with all those problems, we decided to take a different approach for our WPF XBAP applications. We put all our strings into a standalone XAML file, producing a ResourceDictionary. This way our application can pick up strings using Text=”{StaticResource strXYZ}” for XAML markup and/or use Application.Current.FindResource(”strXYZ”) for codebehind. We name the file “Strings_en-US.xaml”. We can localize this file nicely, and name the resulting set appropriately: “Strings_de-DE.xaml”, “Strings_fr-FR.xaml” and so on. These files can then be included as resources in the application. They can also be added as “loose” XAML files, so we can add languages or make corrections after compilation.

The string resource file looks something like this:



<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"
>
  <sys:String x:Key="strButtonOK">OK</sys>
  <sys:String x:Key="strButtonCancel">Cancel</sys>
</ResourceDictionary>


At application load time, we look at the CurrentCulture and attempt to load the ResourceDictionary object like this:


ResourceDictionary rd = null;
System.Globalization.CultureInfo ci =
     System.Globalization.CultureInfo.CurrentCulture;
string langCountry = ci.Name;
string languageFile =
     string.Format("/Resources/Strings/Strings_{0}.xaml", langCountry);
try
{
  rd = (ResourceDictionary)Application.LoadComponent(
                              new Uri(languageFile, UriKind.RelativeOrAbsolute)
                                  );
}


You can imagine this with some catch {} fallbacks for when a specific language-country combination doesn’t exist. We’ll fall back to a file that’s only language specific, and if that doesn’t work out, we’ll fall back to en-US.

We’re not using CurrentUICulture, since that seems to be tied to the UI language of Vista, and we want our apps to follow what the user sets in Control Panel. CurrentCulture seems to work for that.

To load the strings into the global resource dictionary, we just do


Application.Current.Resources.MergedDictionaries.Add(rd);

To load loose XAML files that are not part of the application’s resources, we do something like this:


ResourceDictionary rd1 = null;
string languageFileLoose = string.Format(
         "pack://siteoforigin:,,,/Resources/Strings/Strings_{0}.xaml",
         langCountry
      );
Uri uri = new Uri(languageFileLoose, UriKind.Absolute);
System.Windows.Resources.StreamResourceInfo info;
System.Windows.Markup.XamlReader reader;
try {
  info = Application.GetRemoteStream(uri);
  reader = new System.Windows.Markup.XamlReader();
  rd1 = (ResourceDictionary)reader.LoadAsync(info.Stream);
}

Again, we extend this with catch {} blocks to fall back to a file that’s only language specific. We do the loose XAML loading after we’ve loaded embedded resources, so we can rely on a basic set of languages and strings, but can add languages, fix string translation errors or make improvements in the loose XAML after compiling things.

It may work for you as well, but ymmv.

Update: Changed the first Uri to UriKind.RelativeOrAbsolute

Taking personal action on global warming

1:28 pm

This is something I’ve wanted to post for a long time, but have so far been too ”chicken” to do. Now I think the time has come, though. It’s time for my first “opinion” post. Here goes:

I went to see “An Inconvenient Truth” a while back. I remember seeing a show on television many years ago that tackled the same topic. I don’t remember much about it, except for the illustration it ended with: It said that the amount of warming going on in the atmosphere was equivalent to the heat of one atomic bomb going off every 30 seconds. So they showed footage of just that every 30 seconds for about two or three minutes. Now, I was quite young when I saw this show, and I realize with time gone by that the images were manipulative, but it stuck with me.

As a result I’ve always had a very adverse relationship with cars. Not only do they pollute the atmosphere with particles and noxious gases, they also contribute greatly to global warming. Around the time I left high school I vowed that I would not buy a car until I at least was 30. Well, I never kept that vow, since I got married and had my first child at 26. Still, the car we bought was small and we used it as little as possible, going shopping using a bicycle trailer, using buses as much as possible and so on. Even today, I refuse to buy more than one car. Yes, that means you have to plan your trips more, and it makes it hard to do things independently, but I just can’t bring myself to getting another one.

After seeing An Inconvenient Truth, I was compelled to do more. We’ve already replaced all the lightbulbs in our house with compact fluorescent ones, where possible and practical. We use the air conditioner as little as we can and keep the house relatively cool in the winter. I was going to sign up for being trained on Al Gore’s presentation, but it turned out to be too much of a commitment to be practical for me. So I decided to go “carbon neutral” instead. I visited http://www.nativeenergy.com/ and put my data into their carbon calculator. It spit out a number of carbon emissions I needed to offset, and I did so by supporting projects that nativeenergy.com works on. Here’s my certificate:

Carbon Offset Certificate

I don’t think there is any doubt that global warming is happening, and since there are no other intelligent beings on the planet that can do something about it, I think we humans need to act. Even if it is just to make the planet habitable for our children. I’m sure life in general will survive, even if we do nothing. I just don’t want my kids to have to live in a world as envisioned in An Inconvenient Truth.

 

Close
E-mail It