Too Aggressive for My Taste

Illustration

Last night I had some videos to encode. I prepared everything upfront and I left my computer to do work overnight. At morning I was greeted with logon screen. My Windows decided to install updates. It didn’t matter to them that some other program was running. Kill and burn was their motto.

Yes, I know that I can turn on “Download updates but let me choose whether to install them”. However, when I do that, Action center starts complaining about non-optimal settings. If I turn this warning off, I just turned off all messages regarding Windows Update. If I leave it on, it leaves tray icon and I may miss other important messages.

There is just no right solution for this and it annoys me quite a bit…

P.S. I know that tray area is called notification area these days. I just prefer old naming.

Extracting Sparse Tar

I had to move some files from Unix. File was big, I had small USB drive - one thing led to another…

GZipped tar was obvious solution. In addition to that a friend of mine recommended to also use --sparse argument with it. Theory behind sparse files tells that block of 0 should be saved extremely efficiently thus making my file smaller even before zipping part gets involved. This made my command look like “tar cfzS somefile.tar.gz somefile”. It all worked as advertised.

Next day I got to extract this on Windows. My trusty WinRAR had no idea how to proceed. I just got “The archive is corrupt” message. My next efforts went into searching for Win32 version of tar. Since GNU tools like to be small and concentrated, of course this was not sufficient - I needed Win32 GZip also. Notice that I might be wrong here and there might be Win32 tar somewhere with everything integrated - I just haven’t found it.

Since (on Win32) extracting this tar.gz needed temporary files, I did it in two steps: first with gzip (gzip -d < somefile.tar.gz > somefile.tar) and then with tar (tar xSf somefile.tar). Even with all this, file was just too small.

After testing few more programs I gave up and recreated this archive without --sparse option. It ends up that size difference (with compression on) is not that high after all but final result is much more portable.

Here are tools I used:

Visual Studio 2010 SP1 Beta

Illustration

Visual Studio 2010 has SP1 lurking around. It just arrived in form of beta accessible only to MSDN subscribers but I am sure that general public will get it at Thursday.

Total download size is 593 MB in single ISO. Exact content of package was not published (as time of writing this post) so I risked my main development machine and I installed this service pack beta based on faith alone. Installation took around an hour with need for single restart and with annoying flashing of taskbar button every few minutes (probably as each independent package was queuing-up).

I must confess that I see no big difference. Everything is where it should be. There might be some new templates and there is probably a lot of bug-fixing around. However, everything appears to be stable and this is best thing I can say about any beta.

As expected, it also contains new offline Help Viewer. Cries for normal offline viewer started with Visual Studio 2010 beta and only grew stronger with final release. This service pack finally brought something that works as good as offline viewer in times of Visual Studio 6.

I am eagerly waiting to see which features I missed and what exactly is in this service pack. In meantime I hope that my machine will not crash… :)

[2010-12-08: Official announcement is available now.]

Repairing Hibernated Windows XP Mode.

Illustration

I like Windows XP Mode a lot. As soon as I need to test something in XP, it is there. As soon as I am done, it just gets hibernated and waits for next chance to be used.

After upgrading my BIOS I could not get it to start anymore. It just said “‘Windows XP Mode’ could not be restored because either host processor type mismatch or lack of hardware-assisted virtualization support in the system.” I just love those messages that pinpoint issue to few unconnected solutions…

Fortunately (since I already used that Virtual machine and since Windows XP mode does not require hardware-assisted virtualization support anymore) I could quite easily scratch one error cause and focus my attention only to host processor type mismatch.

My BIOS error got Virtual PC into thinking that restoration would not be wise move. Since I had no idea myself whether this would be good move or not, I decided just to delete hibernation files and reboot machine.

First I had to find configuration file. I had not need for one that ends in .wmcx since there is absolutely nothing of any significance there. I needed one that ends in .vmc and it is usually next to virtual disk (mine was at C:\Users\Josip\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines\Windows XP Mode.vmc). There is lot of data in it but I was interested only in section.

...
  &lt;settings&gt;
    &lt;configuration&gt;
      &lt;next_id type=&quot;integer&quot;&gt;1&lt;/next_id&gt;
        &lt;saved_state&gt;
          &lt;path&gt;
            &lt;absolute type=&quot;string&quot;&gt;C:\Users\Josip\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines\Windows XP Mode.vsv&lt;/absolute&gt;
            &lt;relative type=&quot;string&quot;&gt;.\Windows XP Mode.vsv&lt;/relative&gt;
          &lt;/path&gt;
        &lt;/saved_state&gt;
      &lt;/configuration&gt;
    ...
  &lt;/settings&gt;
...

In this section there was data that defines where hibernation support files can be found. To make machine forget that it was hibernated, I only had to DELETE this section. Once that is done I could start machine once more.

P.S. This same recipe should be valid for any other hibernated Virtual PC machine.

Fixed Width Columns in ListView

I like .NET’s ListView control and I often end up using it in places where even ListBox would suffice. ListView with single column in Details view is exactly look that I usually shoot for.

Of course, width of column needs to be adjusted in order to maximize usable space. This is easily done by simply resizing column to fit width of ListView but with some space reserved for vertical scrollbar. Here is code for e.g. Form_Load:

listView_columnTest.Width = listView.ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth;

And, if there weren’t any users, that would be enough. Problem is that any user can change with of column and thus disturb our delicate balance :). Solution is in handling ListView.ColumnWidthChanging event. Somebody would expect that setting e.Cancel to true would be enough but this is actually not a case. Full solution requires two lines:

private void lsvFilters_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e) {
    e.NewWidth = ((ListView)sender).Columns[e.ColumnIndex].Width;
    e.Cancel = true;
}