zaterdag 28 november 2009

Windows 7 needs memory on VirtualBox

Today finally time to install Windows 7 on a virtual machine. Only it ended fairly quickly with a "failed to start" message. Without any clue as to what might be wrong. Searching on the internet did not reveal the answer directly, but someone had made a description of his own installation, mentioning the amount of memory allocated. That rang a bell. VirtualBox's default is 192 MB. That's not enough. I raised it to 1024 MB and now Windows is installing happily.

woensdag 11 november 2009

Outlook knows what's good for you

Well, sure it does. But if I want to receive an Access database file (.mdb), I do not want to be held back by it. Luckily, Microsoft provided a solution. You just have to edit the registry and reboot your machine. Apparently this cannot be done easier...

For the solution, see the Microsoft Knowledgebase, article 829982.

woensdag 9 september 2009

Clone a virtual machine in VirtualBox

I have a 'standard' virtual machine with XPsp3 running under Sun's VirtualBox. Now I want to test Mule ESB, so I need a clone of this virtual machine to build Mule ESB on. I have the virtual hard disk file in .VHD format to keep it compatible with the company's standard (but less good) VirtualPC.

I started simple by copying the WinXPtest.vhd to WinXPMule.vhd. Then into VirtualBox, New Virtual Machine, use existing harddisk, add the WinXPMule.vhd to the device list, BANG! ERROR! Problem turns out to be that both have the same id.

Luckily some guy Stuart explained on his blog how to do this by way of the vBoxManage.exe. He suggested the use of the clonevdi command, but checking the commandline help of vBoxManage I found the clonehd command. So I entered (include the double quotes):
"c:\program files\sun\VirtualBox\VBoxManage.exe" clonehd WinXPtest.vhd WinXPMule.vhd --format:VHD --variant:Standard --type:normal.
I actually don't know the meaning of the --variant and --type parameters, but Standard and normal sounded quite right. It took some time (copying a file of nearly 4GB always takes some time), but then the command returned with "Clone hard disk created in format 'VHD'. UUID: (some not very interesting GUID)"

Back to the VirtualBox program, New Virtual Machine, use existing harddisk, add the newly created WinXPMule.vhd to the device list - no error this time - and you're done.

vrijdag 4 september 2009

Contact from Nokia to Windows Mobile HTC

My wife has bougt a HTC phone on Windows Mobile. Now she would like her contacts from her old Nokia imported. Could you do that?

Well, it can indeed be done, without the use of Outlook (I was afraid of messing up my own contacts that are in sync with Outlook). Here's how.
Mind you that the PIM backup tool will ask you to map the incoming columns (from your csv) to the internal contact fields. So make sure you tidy up your data prior to restoring, using Excel or OpenOffice Calc. And keep a copy of the data open on your computer while doing the restore, so you can see which columns to map where.
Be aware that whereas Nokia calculates the displayname from the first- and lastname, WM6 does not. So while tidying up, also add a column "displayname" in which you combine first-, middle-, last- and companyname as you see fit.
Fortunately, if you make a mistake, you can easily try again by selecting the restore-option to delete all Outlook-contacts on the phone prior to restoring. It won't touch the SIM contacts, if at all present.

In my case there were contacts on the SIM, and they should be hidden. Microsoft has decided that that should be very difficult (why???) and be done through the registry. Here's how. In case you need a registry editor first (it's not included in WM6), see here for PHM Registry Editor. Choose a version for installation on the device (a .cab file, not through ActiveSync). For both our HTC's (Touch Cruise & Touch Cruise II) I use "Pocket PC 2002,2003 (ARM/PXA)". Copy the downloaded .cab to your phone and doubleclick it there. It will install itself.

maandag 31 augustus 2009

Chapter title in footer, MS Word vs. OpenOffice.org Writer

In the office we use Microsoft Office, in my case 2007. Apart from having to search my way to the ribbon, and missing some keyboard shortcuts that were present in previous versions, I can get used to it.

However, I am writing a frankly large document in which it would be nice if you could read the chapter title in each footer. Enter MS Word help. After some searching, I found that it can only be done with sections. That means that each chapter would have to start a new section in order to make this work. The other way round, you then have to make sure that every section gets the right header and footer by linking them together. More sections = more trouble, always.

Obvious question: "Would this be any easier in OpenOffice?" Start it, open help, type 'headers', and there it is, right in the index: 'chapter information'. It's easy: First determine the style you prefer for the heading that you want to use (generally that is Heading 1), then select it as a field in the footer (or header if you prefer).

Plus, all the commands are right where they should be, in a menu, accessable with the keyboard.

Now, why is my company so determined to use MS Office???

maandag 17 augustus 2009

Saving your Outlook shortcuts

Outlook has a handy feature in the navigation pane: It let's you save shortcuts to often-used folders.
But I noticed that sometimes these shortcuts disappear (I suspect after an automatic update, but MVP says that cannot be true).
My system administrator has searched for a solution. You cannot make them disappearance-resistent, but you can make a backup of
C:\Documents and Settings\(username)\Application Data\Microsoft\Outlook\(profilename).XML.
Now, if you lose them again, simply restore this xml file from its backup location.

A related tip is to reset your navigationpane entirely (should you want that): Start | Run | outlook.exe /resetnavpane.

dinsdag 21 juli 2009

Blue screen, dump and debug

Bluescreen today, did not happen to me for a long time.
Found out that the dump-info is saved and that you can examine it with WinDbg (part of Debugging Tools for Windows).
Did not know where to find the file, but it turned out to be in C:\Windows\Minidump\.
If you load it in WinDbg, you need to load the matching symbol information along with it. I didn't bother to find out what to load to make it work. Maybe some other time.

maandag 29 juni 2009

Microsoft Bluetooth mouse requires passkey

New laptop, new problems. Connecting Microsoft mouse with bluetooth connection to the laptop. Although Microsoft says that the OS won't ask for a passkey, it does and won't go further without. Solution: type '0000' (four zero's, without the quotes) and you're done.

woensdag 27 mei 2009

Forgot your SQL Server Instance name?

I stumbled upon this useful blog about SQL Server instance names. In short, you can find the installed instance names in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL. It also tells you which instance name is associated with which data directory (default names by SQL Server are MSSQL.1, MSSQL.2 and so on).

vrijdag 22 mei 2009

iContact phantom contact

Recently I installed iContact (supware.net) on my Windows Mobile phone (HTC Touch Cruise). Works a lot nicer than the built-in contact manager.
Then I started synchronizing my contact through an Outlook Web Access connection (so far I synced with Outlook on the desktop). Something went wrong, and I ended up with two versions of every contact entry. That's not funny. At the office - with Outlook having a connection with Exchange - I de-duplicated all the entries. Sync the phone again - all well, you might expect.

However, in iContact I still had all the double contacts. One thing changed: With all contacts, one of the two did not contain any data. What was wrong?

De-installed iContact, so I could see the original contact manager. There I saw that the data was allright. No duplicates. So the problem was in iContact. Re-installed iContact, thinking that might help. Not so. So it had to be in the iContact settings that had remained on the memorycard after the uninstall. Retry:
- uninstall iContact
- I found the directory <storage card>\Program files\iContact, with allcontacts.dat and favorites.dat files in it. Deleted the directory
- re-installed iContact
Yes, now it was ok.

Conclusion: iContact does not detect it when you remove contacts outside of iContacts' own program interface. If in trouble: remove the allcontacts.dat files from the program files\iContact directory.

Edit: the iContact faq also gives a solution: "While viewing the "all contacts" tab, touch the contacts tab at the bottom of the screen again."

maandag 18 mei 2009

WinDiff with Visual Studio

Microsoft has built a nice tool for comparing files and folders ages ago, and it's called WinDiff. It used to be deployed along with Visual Studio, but as of version 2008 I cannot find it anymore. So if you want to save your WinDiff, you can copy it from VS2005\Common7\Tools\Bin\Windiff.exe. Looking for it in VS2008 is useless.

Of course you can also download it on numerous places on the web, or use WinMerge.

The right keyboard settings

Today somehow I found myself with smart quotes. It's that annoying option in Windows where you type a quote, nothing appears, then you type a letter, and you get an accented letter. If I type a quote, I mean a quote. If I want an accented letter, I can type in the alt-code.

So I had to find out what the solution was (not for the first time, this also happens with fresh Windows installations, but I did not remember exactly). For me it was (on Windows XP SP3):
  • Open Control Panel, Regional Options, tab Languages, button Details.
  • Remove everything but Dutch (as language) and US (as keyboard layout).
  • Make sure that you don't use US International keyboard layout, since that comes with the smart quotes.
  • Hit OK a few times and logoff/logon.

woensdag 11 maart 2009

Throw ex

No, don't throw your ex anywhere. It's just that a collegue mentioned something I didn't know about re-throwing exceptions in .Net.

Say you want to catch an exception and rethrow it after you're done with it:

    Try
      ' try something
    Catch ex As Exception
      ' do something useful
      Throw / Throw ex
    End Try

There's a difference:
- Throw: ex is rethrown, and stack trace is left intact.
- Throw ex: ex is thrown, but stack trace is erased.

So, generally you want to do Throw, not Throw ex.

C# works the same, although with other syntax of course:

            try
            {
                // try something
            }
            catch (Exception ex)
            {
               // do something useful
               throw; / throw ex;
            }

Also see MSDN for an explanation.

dinsdag 3 maart 2009

Entering string parameters in constructors with Unity

A Microsoft.Practices.Unity container will try to resolve any parameters that a constructor expects. However, for simple string (or int) parameters, that won't work. My example for this was a queue that expects a name parameter:

Public Class Queue
Private mName As String
Public Sub New (name As String)
mName = name
End Sub
End Class

This can be solved, and Microsoft explains how in this section of the documentation.

In this case it results in code like this:

MyContainer.Configure(Of InjectedMembers)() _
.ConfigureInjectionFor(Of Queue)( _
New InjectionConstructor("testqueue"))

donderdag 26 februari 2009

Picture organizing software

I have used Photoshop Elements for about 4 years now, starting with PE3, and now PE6. It's nice, though not free. I primarily bought it for organizing my pictures, and have come to appreciate the many editing capabilities as well. But, I have found some pretty annoying 'features' as well:
  • By now there are some 12000 pictures in it, and the organizer is getting really slow (on my AMD Athlon64 3000+, 2GB). You use the organizer constantly, so that is a problem.
  • The tagging system is basically very good. But the interface to work with it is not. All tags are displayed in a hierarchial list. You assign tags to photo's by dragging the tag to the photo. For searching, you click a checkbox in front of the tag. If you have many tags (I have), you're constantly scrolling the tag list. You cannot easily do this with some shortcuts.
  • You cannot zoom further than 'fit in window' in the organizer itself. For that you have to start the preview (F11). Which has another problem: it is horribly slow on RAW files.
  • The editor has very many functions inherited from it's big brother Photoshop, and together with my Wacom tablet it's a fun to use. If... it would not crash about every 5 minutes. I must say, on the aforementioned PC. On my Dell - Intel laptop, this problem is not present.
  • The program is very eager at doing things automatically. Just now, I switched to it (simple Alt+Tab), and then it started 'updating...' for 2 minutes or so. No clue what needed updating though....

One thing on the upside: As of version 6, PE uses an SQLite database for it's data. So with some SQL knowledge and common sense you can do some nice things. Like moving all the pictures to another disc.

Well, if PE is starting to fail on me, let's look at all those free alternatives that have emerged lateley. After some reading on the Internet I decided to try Picasa 3 (I was already using 2 for exchange with PicasaWeb), open source My Photo Index and Microsoft Photo Gallery.

My Photo Index: Indexing the first small directory of pictures looked promising. So let's try one with (Panasonic FZ-50) RAW files in them. Hmm, it stops responding. That's not good. OK, it's open source and .Net, so theoretically I could try to fix this myself. But hey, I was working on my other hobby now.

Picasa 3: Indexing goes well, also with the RAW files. As per version 3 it also correctly recognizes multi-word tags (instead of breaking them up), that's nice. Less impressive: labels can not be ordered in a hierarchy. Let's try the search. Simple search box in the upper right corner. Type in 'cat': It matches not just on the label, but on all sorts of things. I cannot find an option to search just the labels, let alone to combine multiple labels. PE is doing far better here! Adding labels however, can be done entirely with the keyboard. I like that.

Photo Gallery: This is Microsoft, so 'My Pictures' is by default indexed. And cannot be deleted from the index either. Well, MS, not everyone saves his pictures in 'My Pictures'. Duh. However, you can add other directories as well. From here the story is pretty much the same as with Picasa. No hierarchy, no obvious way to add labels, same search-problems. File | Exit.

So, the sad conclusion is that I will have to stick to PE, or install Linux on my main machine. Since digiKam or F-Spot is said to do this very well. But that is still one bridge too far for me.

However, while writing this I have gave F-Spot a try on my secondary PC with WUBI (Ubuntu alongside Windows). Wow! Tagging with the keyboard, hierarchical tags, search on multiple tags (And + Or functionality), correct import of multi-word tags and RAW files. If you press '/', you get a Find-typing area that understands both tags and filenames. It just does as promised. Why can't all the others do this??? Maybe I should turn over to Ubuntu after all. Whooaa, I need some time & beer to get used to that!

If you have any other good ideas, please keep me and other readers posted.

dinsdag 17 februari 2009

Visual Studio extensions

Resharper is said to be very good, although it slows VS down. I don't know, because I never used it and I do not intend to pay that much money. Recently I installed two extensions that I'm very happy with. Both are free!

- CoolCommands, with info in the makers' blog, here and here. The newer PowerCommands looks a lot like it, it might be a rebranding.

- Exact Magic Studio Tools. I like the powerful Go To command the most. It's definitely something that should have been a part of the Solution Explorer all along.

Pictures backup strategy

This week there was a discussion on the Panasonic FZ Yahoo group about backup strategies for al those pictures. I also added my own. Maybe it can be of help for you too. (BTW: I have a Panasonic FZ-50. Very good camera in the niche between really compact cameras and DSLR's.)
------
I've seen a lot of nice options, yet I add my own for anyone who still
isn't satisfied.

Most solutions in this thread use synchronization. My problem with that is when you did something stupid (deleting that nice picture for example) but you notice a little while later, after the sync, your backup won't save you.

That's why I use backup software, Peters Backup (http://pbackup.sourceforge.net/), simple, free and open source. Configuring it requires you to be a little bit of a geek, but after that you're all set to go. It can make incremental and full backups. It can also save 'the history' (multiple versions) of files. I make a full backup once in a while, and incrementals every time I add new pictures (before deleting them from the memorycard). I even added a clever MSDOS script for automatically saving the previous two full
backups, and deleting the oldest. Incremental is quick, so no problem there. The format is plain and simple zip, so you can get it out anytime. The backup goes to an external USB harddisk. If you need more speed but your computercase is full, try e-Sata (external SATA).

Last but not least: At the end of the year (ok, that's should be more often) I burn the pictures to DVD and bring them to my brother who lives nearby. That gets me an off-line and off-site backup, all in full-format (even raw if I want to), something most online storages won't give you. Plus a good cup of coffee, something I have never seen in any online storage :-)

maandag 16 februari 2009

Log level Synergy service

I use the excellent tool Synergy for using my mouse & keyboard on multiple computers. It can also run as a Windows Service, see the manual.
Annoyingly, it kept showing me warnings about not finding the server side when I'm at work (it's configured to work with my home PC as the server). Here's how to set the log level for the Synergy service on Windows:
- Stop the running service.
- Start the Synergy program from the Start Menu.
- Click 'Autostart', then 'Uninstall' - that uninstalls the service.
- Set the logging level (to Error).
- Click 'Autostart', then 'Install' - that re-installs the service again.

Now the service will remember the configured logging level.

donderdag 5 februari 2009

What type?

I always get confused on how to get to the type of anything in VB.Net. So I sum it up here and now:

Let's say we have a class:
Class Relation
and an object:
myMother As Relation.

For comparison: TypeOf myMother Is Relation

For retrieving the type from the class: GetType(Relation)

For retrieving the type from the object: myMother.GetType()

woensdag 4 februari 2009

Short usage of String.Split

For some reason I don't seem to have a file in my head for the most efficient usage of the .Net String.Split method. Especially the inline declaration of the array of separators always fails. So, when I found out today I decided to note it here. For myself and everyone else:

For more than one separator:

VB: Dim SplittedStrings() As String = InputString.Split(New [Char](){";"c, ","c})


C#: String[] SplittedStrings = InputString.Split(new Char[]{';', ','});

For just one separator:

VB: Dim SplittedStrings() As String = InputString.Split(";"c)

C#: String[] SplittedStrings = InputString.Split(';');

dinsdag 3 februari 2009

Mapping of different NHibernate collection types to .Net

Today I had to create a many-to-many relationship with some attributes of its own in NHibernate. I ended up with a set construction with a composite type embedded, like shown on page 229 of Hibernate in Action.

That left me with one question: How to represent the <set> in .Net? There is no built-in Set type. However, NHibernate solved that by using the Iesi.Collection.dll, which is part of the NHibernate download. On the blog of rextang I learned this mapping:

<bag> IList
<list> IList
<set> Iesi.Collections.Iset (from the Iesi.Collections.dll assembly in the \bin folder of the NH distribution)
<map> IDictionary

And it works!

maandag 2 februari 2009

Wubi Ubuntu boots into CLI

I have a spare PC running Windows XP and Ubuntu through a Wubi installation. This evening Ubuntu wouldn't start normally. Instead, it just showed me the command line interface, starting with "(initramfs)". Not good.

Searching on the Net I stumbled upon the phrase "Ubuntu cannot be booted if Windows has not been shut down cleanly" on the WubiGuide. That made me think that indeed I had not shut down Windows properly before. So I did a checkdisk on both volumes (Windows is on E:, the Wubi files are on C:, don't ask me how I came to this odd configuration), restarted into Ubuntu and everything was fine again.