Eddy's blog

Eddy maintains a blog to record occasional items of interest, both technology and non-technology related. You can access the latest blog postings at any time by visiting www.snoopdos.com/blog.

For convenience, the most recent entries are shown below.

Windows 10 Default Route Vanishing (again)

Wednesday 15 May 2019, 11:57 AM

My previous attempt to stop the Windows 10 default route vanishing turned out to be unreliable; after a few Windows Updates, the default route was gone again.

However, I’ve finally found a way to make a statically configured default route properly persistent across reboots (something that other operating systems, and older versions of Windows, have no trouble doing at all).

To recap: for various reasons, I assign static IP addresses to most of my PCs instead of using DHCP to allocate them automatically. As part of the configuration I specify a default gateway to the Internet, like this:


Windows 10 appears unable to remember this default gateway across reboots, especially when I have additional IP subnets configured on the same network interface.

This isn’t a big deal if I’m sitting in front of the PC, since I can fix it quickly. However, it’s a show-stopper if I need to access the PC remotely since it is no longer connected to the Internet. When it happens with our main family PC, it’s even more annoying since the steps to resolve it are not intuitive for my wife and sons.

Today, after yet another such unplanned outage (thank you, Windows Updates), a lightbulb finally went off in my head — why not use the existing Windows Persistent Route capability to add a persistent default route? I’ve now tried this approach on several PCs and it seems to work reliably!

So without further ado, if you too are suffering from this problem, here’s how to fix it.

  1. Open a command prompt with Administrator privileges by right-clicking on the Command Prompt option and selecting Run As Administrator, or pressing <WindowsKey>-<R>, typing CMD in the Run box, and pressing <CTRL>-<SHIFT>-<Enter>
  2. Type ROUTE DELETE to delete any existing default route; if you don’t have one at the moment, this will give an error which is fine.
  3. Type ROUTE ADD -p MASK to add a new default route using the IP router gateway; replace this with your own gateway IP.


That’s it! Your default route should now be added back automatically whenever you reboot. If you need to change to a different default route, just repeat the steps above.

Default route keeps vanishing on Windows 10

Monday 15 Aug 2016, 10:52 AM

A number of my PCs have a persistent problem with the default route disappearing when the system is restarted. Since I use Remote Desktop to control most of these machines remotely, it’s rather annoying; if the PC reboots, I no longer have remote access.

I hoped it would correct itself when I upgraded to Windows 10, but it’s still happening. In fact, it’s much worse — Win10 feels it has carte blanche to reboot to install upgrades without asking my permission first and when it does, I have to visit the PC to reset the default route, or find someone to do it for me.

This all started a year or two ago, with a particular Windows 7 update (I’m not sure which one). The only common factor is that all the affected PCs use static IP addresses with a manually configured default route. It doesn’t occur when DHCP is used. Most of them also have multiple network adapters.

While I have a workaround using a startup script to manually re-add the missing route, it’s awkward to run this with the elevated command privileges needed to change the default route.

Google suggested various solutions, including:

  • Editing the network adapter and switching it to DHCP, exiting, then going back in and switching it to static again. This needs to be done twice to work.
  • Resetting the TCP/IP stack (by running netsh int reset from an elevated command prompt). This is quite drastic.

I tried both of these but neither fixed it for me.

Today, I found something that *did* work. I’m recording it here in case it helps someone else.

  • Run RegEdit and navigate to Computer\HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
  • Go through each of the interface GUIDs in turn.
  • One of them will have an IPAddress field matching your main network interface. On this one, confirm that there is a REG_MULTI_SZ field called DefaultGateway containing a single text line with the IP address of your default route. If it’s not there, create it. Similarly, there should be a DefaultGatewayMetric field, also REG_MULTI_SZ, containing the single string ‘0’.
  • On all the other interface GUIDs, delete any DefaultGateway and DefaultGatewayMetric fields entirely.

After completing these steps, restart your PC. The correct default route should now be configured.

How big is the Eircode database?

Monday 13 Jul 2015, 10:26 AM

Ireland’s new postcode scheme, Eircode is officially launched today. It’s been a long time coming and like it or lump it, we’ll all be using it soon.

Eircode logoThere’s been plenty of debate and criticism of Eircode in recent months, some of it valid, some of it misplaced. However, I did read one thing that caught my attention — the suggestion that Eircode was impractical for use with portable GPS navigators because the full country-wide database would require 2 GB storage and exhaust their flash storage.

That sounds like a lot. Let’s see if it holds up to scrutiny.

A mapping table

A GPS navigator is already perfectly good at taking GPS co-ordinates and telling you how to get there. All it needs is a way to convert an Eircode to the corresponding location. The most straightforward approach is a mapping table that stores GPS co-ordinates for each possible Eircode.

Eircode has two parts: a three character routing key, corresponding to a broad geographic area, and a four character unique ID within that area. Let’s create a routing key table that stores each routing key in use along with an index into our co-ordinate table. This co-ordinate table will store the GPS co-ordinates for all the IDs in each routing area.

We can also save some space by not storing the full Eircode with each entry, just the unique ID portion:

Eircode Mapping Table

How much space will these tables occupy? Let’s consider the Eircode character set which is a mix of uppercase letters and digits. Letters that are often confused with numbers are omitted, so the full set of characters that may appear in an Eircode is:

0 1 2 3 4 5 6 7 8 9

That’s 15 letters and 10 digits for a total of 25 unique characters. Each character can be encoded using five bits (32 possibilities), leaving a few left over for other purposes.

The routing code has further restrictions: the first character must be a letter, the second a digit, and the third a digit or ‘W’ (to allow the infamous D6W area code). Each of these can be encoded using just four bits, for a total of 12 bits of storage to store all three. Let’s round this up to 16 bits (two bytes) for simplicity.

A routing table entry also needs an index. We’ll use 32-bit indices, supporting up to 4 billion discrete entries – far more than we’ll ever need.

Together, the routing key plus index need 48 bits – 6 bytes of storage. With 139 routing areas initially planned for Eircode, that’s just 6 * 139  = 834 bytes of storage for the entire routing key table. So far, so good.

The co-ordinate table

Now let’s consider the co-ordinate table. The 4-character unique IDs encode to five bits for each character, so the whole ID takes 20 bits. Rounding up to 24 bits (3 bytes) leaves a few spare for other uses.

What about the GPS co-ordinates? Ireland and its surrounding islands fit in a box defined by these points:

Position Location Latitude Longitude
North Inishtrahull, Co Donegal 55.430019 -7.233810
South Fastnet Rock, Co Cork 51.384167 -9.600278
East Lambay Island, Co Dublin 53.491000 -6.017000
West Tearaght Island, Co Kerry 52.075667 -10.651278

So that’s from 51’N to 56’N latitude and 6’W to 11’W longitude – five degrees in each case. Using millionths of degrees, that’s a range of 0-5 million discrete integer values which provides accuracy to approximately 0.1 metres on the ground, more than enough to pinpoint any individual building and well beyond the precision of consumer GPS equipment.

24 bits is enough to encode any value in the range 0-16 million, so 48 bits (6 bytes) stores the latitude and longitude co-ordinates of any point in Ireland as an offset from 51’N, 6’W.

With each ID code occupying 3 bytes, a total of 3 + 6 = 9 bytes will be used by each entry in the co-ordinate table. At the moment, there are approximately 2.2 million unique addresses in Ireland, so 9 * 2.2 million = 19.8 million bytes (18.8 MB).

Adding this to the routing code table size of less than 1 KB, we can confidently say that the Eircode co-ordinate database will occupy less than 20 MB of storage. On modern devices, this is a very modest amount of storage, equivalent to around 10 JPEG photos or songs.

Adding Addresses

A GPS navigator should be able to convert co-ordinates into an approximate address using its existing database if needed. However, for user convenience, it may want to display the official address for an entered postcode. How much extra space would it take to add a full address to each entry in the co-ordinate table?

This is a bit harder to calculate accurately, without a copy of the entire Eircode address database on hand. However, we can make an educated guess. Let’s presume a 64 character alphabet (enough for uppercase, lowercase, digits and some punctuation), so each character can be stored in 6 bits. We’ll also assume that the average address length is 50 characters. Of course, some are shorter and some are longer.

50 characters of 6-bits each is 300 bits, 38 bytes. We’ll add another 4 bytes of overhead to index the table for quicker access speed. That gives 42 bytes per Eircode. Multiplying by 2.2 million entries, the whole address database would occupy 88 MB.

This is a very simple implementation. Since the full address database contains a lot of repetition and redundancy, it should compress very well. To test this, I used a database with 3,000 addresses distributed throughout Dublin and Ireland. The average address length turned out to be 40 characters, so with 6-bit encoding, 90 KB is needed for the database. This compressed down to 34 KB using standard ZIP encoding, a compression rate of 2.6:1.

Assuming a similar level of compression for the entire Eircode database, and treating the index values separately, the compressed address data would take (38 bytes * 2.2M / 2.6 = 30.6 MB) + (4 bytes * 2.2M = 8.4 MB), 39 MB in total.

So, a full set of Eircode co-ordinate and address data at present should take no more than 20 + 39 = 59 MB – a far cry from the 2 GB scaremongering.

And in fact, this is very close to the figure mentioned by Pat Donnelly of autoaddress.ie in his comprehensive rebuttal to Brian Lucey’s original post criticising Eircode.

What next?

The debate about Eircode will no doubt continue for the months to come. Let’s make sure it’s informed by facts rather than speculation.

Further reading

USB playback problems on Samsung TVs

Thursday 26 Feb 2015, 01:19 PM

My dad has a Samsung Smart TV (UE55H6400) which he uses mostly as a display device for his Sky+ box; the advanced features of the TV are a little beyond him.

Recently though, he’s been asking for a way to play movies locally. When we met for lunch, I gave him an 8 GB USB flash drive with some films and later, over the phone, I walked him through selecting the USB device for playback using the Samsung TV remote.

This should have been straightforward – it certainly is on my older Samsung TV. But no dice – whatever we tried, his TV wouldn’t recognize the flash drive. There are three USB ports, including one labelled “USB HDD” but it made no difference which one we used.

Perhaps I had accidentally formatted the flash drive using NTFS instead of FAT32? My mum, who is a lot more computer literate than my dad, plugged the flash drive into their PC and I examined it using Remote Desktop. Sure enough, it was formatted as NTFS. While the newest Samsungs can handle this fine, my Dad’s model is a few years old so conceivably it was expecting FAT32.

Copying the movies to the PC, reformatting the drive, and copying them back again took about 20 minutes (cheap USB flash drives are SLOW). Ultimately, it made no difference – the TV still refused to recognize the drive. We gave it up as a bad job.

A week later, I was visiting and had a chance to try it myself – exactly the same results. At least user error wasn’t to blame.

Eventually we figured it out – it’s rather obscure! It seems that at least some models of Samsung TV decide whether or not a USB device is “hard drive”-like based on the precise way it is formatted. A single partition doesn’t count; it needs to have a full partition table with multiple partitions for the TV to recognize it as a valid drive.

How do you format it like this? The easiest option is to use a special tool like RMPrepUSB – download the latest version from the list on the home page.

RMPrepUSB’s initial options screen looks rather daunting:


It’s not too bad though if you just follow through the numbered sections:

  • Select your USB drive from the list at the top
  • In section 2, type a suitable Volume Label and set the partition as non-bootable
  • In section 4, select FAT32 and choose “Boot as HDD”
  • Click the Prepare Drive button at the bottom and off you go.

After a brief delay, you’ll have a freshly formatted USB flash drive that is now recognized by your Samsung Smart TV. Copy movies, photos or music to it and have fun!

I should emphasise that this only seems to be necessary for some models of Samsung TV (and also, reportedly, LG TVs); it wasn’t needed for my own model.

If RMPrepUSB seems a little too daunting, you could also try Rufus by Pete Batard of Akeo, only up the road in Co. Donegal. While I haven’t had a chance to use it for this particular application yet, using the Advanced option “Add fixes for old BIOSes” option should have the same effect. Please let me know if it works for you!

From b2Evolution to WordPress

Thursday 5 Feb 2015, 10:43 PM

In January 2005, I wrote my first blog entry. b2Evolution was my tool of choice to manage my blog — it was free, simple to install, and more than adequate for my needs. I’d never heard of WordPress back then, though it shares a common origin with b2Evolution – they were both forks of b2/cafelog, one of the original blogging systems.

Fast forward ten years, and WordPress rules the world. I’ve used it on countless projects for clients and friends, and it’s an extremely flexible and powerful CMS. I’m also now far more familiar and comfortable using it than I ever was with b2Evolution.

Which is why, finally, I’ve migrated this blog  to the latest version of Wordpress, version 4.1. (If you’re wondering, the photo in the banner is Pan’s Rock in Ballycastle, Co Antrim, taken last April. Here are some more Antrim photos from the same trip.)

For those interested, the nitty gritty steps required are below; everyone else can stop reading now.

Database Migration

The biggest challenge was transferring the existing blog contents from b2Evolution’s database to WordPress’s database. Since many bloggers have travelled this path in the past, I expected this to be straightforward. However, most of them appeared to (a) be running a much newer version of b2evolution than me, and (b) have made the move long ago, to a much older version of WordPress.

No matter. First step was to find a script close to what I needed, in this case a script called import-b2evolution-wp2.php.txt at themikecam.com, referenced by Christian Cawley’s helpful b2evolution migration guide. Unfortunately, themikecam.com is no longer online, but luckily, archive.org still has a copy of the most recent import-b2evolution-wp2.php.txt available for download, along with all the older copies.

Although it should go without saying, now is a good time to backup your b2evolution database! Just in case…

While the script didn’t work right away, it was certainly a good start. I made a few tweaks to it and managed to get it working properly on my installation. You can download my copy here – make sure to remove the trailing .txt suffix after downloading.

I installed WordPress as usual, specifically WordPress 2.7 from the WordPress archives since I wanted a fairly old version. I configured it to use b2evolution’s database —  Wordpress uses different table names, so they don’t conflict with each other. Plus, the migration script expects this, so you don’t really have a choice.

Next, I uploaded the migration script to my WordPress wp-admin folder, then invoked it directly (e.g. http://yourblogaddress/wp-admin/import-b2evolution-wp2.php) and filled in the relevant values in the form presented.

It took me a couple of goes to get it right, so after the first failure, I installed the WordPress Reset plug-in; this makes it very easy to reset the WordPress database ready for another try, without having to do a full WordPress re-install, and without altering the b2evolution entries.

I highly recommend checking your database with phpAdmin afterwards to make sure the posts appear correct!

Even with the script, I still had to manually update the categories – my version of the script didn’t migrate them across properly. Since I only had 100 entries or so, it was easy enough to sort them on b2Evolution using phpAdmin. I could then select multiple posts by hand in WordPress and assign them to each category using the bulk update option.

(If I’d had many more posts, I might have spent some more effort getting the category migration working correctly.)

Finally, once I was confident everything was working okay, I updated WordPress from 2.7 to 4.1, which is MUCH nicer.

And all done!

Legacy URL support

Well, not quite done it turned out. There are plenty of links out there to my old b2evolution posts, and it would be nice if they could magically redirect to the new WordPress equivalent, to keep both the search engines and users happy.

This turns out to require a little .htaccess magic, and some PHP scripting. I added the following to WordPress’s .htaccess (I’ve reproduced the entire file for reference):

# BEGIN WordPress

RewriteEngine On
RewriteBase /blog/

# Check for references to the old b2evolution blog and send them
# to our redirect script where they'll be properly handled.
RewriteRule b2redirect.php - [L]
RewriteCond %{QUERY_STRING} ^(m=|.*cat=|.*blog=5|.*author=|pb=1|title=)
RewriteRule .* /blog/b2redirect.php [L,R=301]

# Normal WordPress rules
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

# END WordPress

(Watch out for word wrap on the QUERY_STRING line – the bracketed items are part of the same line.)

Essentially, this says that any query strings passed in to the blog of the form m=xxx (date reference), cat=xxx (category reference), blog=5 (my old Blog’s internal ID), author=xxx (show author posts), title=xxx (title reference) or pb=xx (b2evolution specific) should be directed to my custom script b2redirect.php without further ado and everything else should be handled by WordPress as usual.

(We use a 301 Redirect to indicate to browsers and search engines that this is a permanent redirection, and the new URL should be used in future.)

I learnt a couple of useful things about mod_rewrite figuring this out. I hadn’t fully appreciated that RewriteRules can only match against physical disk filenames from the URL; if you need to match parameter names or values, you must use RewriteCond in conjunction with the QUERY_STRING parameter.

And of course, I got caught out by having the parameters in my redirected URL immediately trigger another redirect when the page was refetched, until eventually it gave up. This is why the very first rule says that references to b2redirect.php should be passed through without any rewriting at all.

So what is b2redirect.php? It’s a small script I wrote that interprets the old b2Evolution parameters and figures out a WordPress equivalent. Here it is:

// Redirect b2evolution blog URLs to WordPress
$baseurl = "http://www.snoopdos.com/blog";

$catmap = array();

$catmap[14] = "observation";
$catmap[15] = "technology";
$catmap[16] = "random-thoughts";
$catmap[17] = "networking";
$catmap[18] = "windows";
$catmap[19] = "rant";
$catmap[20] = "useful-links";

$title  = $_GET["title"];
$m      = $_GET["m"];
$cat    = $_GET["cat"];
$author = $_GET["author"];

// Set default URL
$url = "$baseurl/";

if (!empty($title) && !strpos($title, ":"))
$url = "$baseurl/$title";
else if (!empty($cat) && !empty($catmap[$cat]))
$url = "$baseurl/category/$catmap[$cat]";
else if (!empty($m) && (strlen($m) == 4 || strlen($m) == 6))
$year  = substr($m, 0, 4);
$month = substr($m, 4, 2);
if ($year >= 2005 && $year <= 2013)
$url = "$baseurl/$year/";
if (strlen($month) > 0)
$url .= "$month/";
else if (!empty($author))
$url = "$baseurl/author/eddy/";
// Now issue the permanent redirect to the new location
header("HTTP/1.1 301 Moved Permanently");
header("Location: $url");


Once again, the categories needed some special handling. Otherwise, it was straightforward – month references get changed to WordPress archive format (year/month); titles are mapped to the equivalent WordPress direct URL; category numbers go to the new WordPress equivalent name; author references show the WordPress author page; and everything else goes to the home page of the blog – better than a 404 Page Not Found.

So that’s that job done. Now let’s see what the next 10 years brings…

Windows 7 filesharing limit

Friday 22 Mar 2013, 12:03 PM

I have a Sonos music system at home, and it’s great — I use it to make music stored on my Windows 7 Media Center system accessible throughout the house, among other things.

One of the nice things about Sonos is that it’s really easy to setup. I just point its music library at a network Share on my Media Center system and it automatically keeps everything indexed and up to date. Every now and again, however, I go to play a music track and I’m told it can’t find it. Specifically, it can’t access the file using the network share path, even though the file is there and I can play it fine locally on Media Center.

Recently, I finally figured out what was going on – a simple but not-very-well-publicised limitation built into Windows 7 Home Premium which restricts the resources used to manage network file shares. If you have a number of PCs in your house, as I do, all accessing shares on a particular PC, you can run out of resources. When this happens, any further attempts to access the share will fail. Not good!

Happily, there is a straightforward fix – Alan Lamielle describes it on his blog.

The short version is to find this registry key on the Windows 7 machine:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache

and change the following registry key from ‘1’ to ?3?:


Then restart the ‘Server’ service (or restart Windows itself if you prefer) and everything will be back to normal again.

Since making this change, I haven’t had a single recurrance of the problem – happy days!

Fixing Visual Studio 2010 keyboard text selection

Wednesday 13 Feb 2013, 01:13 PM

Short version: does shift-selecting blocks of text in Visual Studio, Word, Outlook, Notepad or other Windows apps mysteriously cancel your selection from time to time? The problem may be to do with your keyboard’s PS2 to USB adapter. Skip to the end for an easy fix.

I spend a lot of time editing text. Sometimes, this is in Word or Vim, but mostly it’s in Visual Studio’s code editor. So, when something I’m used to breaks, something I do so often that it’s hard-wired into my fingers, it gets my attention.

I often select blocks of text by holding down Shift, holding Cursor Down until the block of text has been selected, and then pressing Cursor Up to move back up a line or two. When I’m working quickly, I often press Cursor Up before releasing Cursor Down. And until recently, this would work perfectly – the Cursor Up stroke would take precedence over the repeating Cursor Down and things would smoothly come to a halt.

I started a new project recently which needed Visual Studio 2010 (I’d been using VS2008 until then). I installed VS2010 on a fresh development PC and pretty quickly noticed that whenever I tried to select a block of text, it would end up unselected again. Selecting it a second time, more carefully, worked fine. During periods of heavy editing, I might do this operation several times a minute, so this was DEEPLY AGGRAVATING.

I figured out that things worked fine as long as I released Cursor Down before pressing Cursor Up while making the selection. Unfortunately, training my fingers to do this was a lot harder than I expected, so the problem continued. Since I was only working on the VS2010 PC a couple of days a week, I was able to live with it. I checked Google, of course, but nobody else seemed to be suffering from this problem. I even used the Spy++ development tool to monitor keyboard messages going to the Visual Studio window, but nothing seemed amiss.

Over Christmas, I rebuilt my home office, incorporating some new monitors, KVMs, moving things around, etc. Soon after, I noticed the problem had spread to my main development PC. Worse, it turned out that applications other than Visual Studio were now being affected. Even Visual Studio 2008, which had been fine up until now, was suffering, as was Notepad, Outlook, and pretty much any application that accepted multi-line text input!

What was going on here? I checked a couple of my other PCs — some of them were doing it, some of them not. Was this some sort of strange new virus with an unanticipated side-effect? Several full virus checks (all clean) suggested not. Both Windows 7 and Windows 8 systems were showing the problem, but I had other similar systems that were clear, as was Windows 2012. More intriguingly, when I connected to an afflicted system using remote desktop, the problem vanished. I even considered the issue might be related to a keyboard switch I was using to share a single keyboard & mouse between several PCs, but where I had such a setup, some of the PCs on the switch were fine, others were not.

At this point, I reckoned the cause must be some system utility I had installed on some but not all of the PCs, or possibly a Windows update. An audit of all such software didn’t point to any culprits, however. And the problem continued to sit there, annoying the heck out of me on a daily basis.

Until finally, today, a break-through! I decided to connect an old PS/2 keyboard to my main PC at the same time as the USB KVM switch I was using day-to-day — and using the old keyboard, the problem didn’t occur! I then connected the PS/2 keyboard to a USB port, using a cheap PS2 to USB adapter, and the problem returned. It was something to do with the KVM after all.

The next step was to go back to Spy++ again and do some A/B comparisons. I used Notepad as my test application — it’s so simple that I figured there would be very little noise to get in the way. (I briefly had no output from Spy++, until I realised it could only monitor 32-bit applications on my Win7/64 PC; I fixed this by copying the 32-bit version of Notepad.exe across from a Win7 x86 system and monitoring that.)

Here’s the pertinent output, showing the key sequence SHIFT, Down (held down to repeat several times), Up, release Down, release Up.

First, with the keyboard connected via USB:

P WM_KEYDOWN nVirtKey:VK_SHIFT cRepeat:1 Code:2A fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYDOWN nVirtKey:VK_SHIFT cRepeat:1 Code:2A fExtended:0 fAltDown:0 fRepeat:1 fUp:0
P WM_KEYDOWN nVirtKey:VK_SHIFT cRepeat:1 Code:2A fExtended:0 fAltDown:0 fRepeat:1 fUp:0
P WM_KEYDOWN nVirtKey:VK_DOWN cRepeat:1 Code:50 fExtended:1 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYUP nVirtKey:VK_DOWN cRepeat:1 Code:50 fExtended:1 fAltDown:0 fRepeat:1 fUp:1
P WM_KEYDOWN nVirtKey:VK_DOWN cRepeat:1 Code:50 fExtended:1 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYUP nVirtKey:VK_DOWN cRepeat:1 Code:50 fExtended:1 fAltDown:0 fRepeat:1 fUp:1
P WM_KEYDOWN nVirtKey:VK_DOWN cRepeat:1 Code:50 fExtended:1 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYUP nVirtKey:VK_DOWN cRepeat:1 Code:50 fExtended:1 fAltDown:0 fRepeat:1 fUp:1
P WM_KEYDOWN nVirtKey:VK_DOWN cRepeat:1 Code:50 fExtended:1 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYUP nVirtKey:VK_SHIFT cRepeat:1 Code:2A fExtended:0 fAltDown:0 fRepeat:1 fUp:1
P WM_KEYDOWN nVirtKey:VK_UP cRepeat:1 Code:48 fExtended:1 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYUP nVirtKey:VK_UP cRepeat:1 Code:48 fExtended:1 fAltDown:0 fRepeat:1 fUp:1
P WM_KEYUP nVirtKey:VK_DOWN cRepeat:1 Code:50 fExtended:1 fAltDown:0 fRepeat:1 fUp:1

Now the same sequence, using the PS/2 keyboard connected directly to the PS/2 port:

P WM_KEYDOWN nVirtKey:VK_SHIFT cRepeat:1 Code:2A fExtended:0 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYDOWN nVirtKey:VK_SHIFT cRepeat:1 Code:2A fExtended:0 fAltDown:0 fRepeat:1 fUp:0
P WM_KEYDOWN nVirtKey:VK_SHIFT cRepeat:1 Code:2A fExtended:0 fAltDown:0 fRepeat:1 fUp:0
P WM_KEYDOWN nVirtKey:VK_DOWN cRepeat:1 Code:50 fExtended:1 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYDOWN nVirtKey:VK_DOWN cRepeat:1 Code:50 fExtended:1 fAltDown:0 fRepeat:1 fUp:0
P WM_KEYDOWN nVirtKey:VK_DOWN cRepeat:1 Code:50 fExtended:1 fAltDown:0 fRepeat:1 fUp:0
P WM_KEYDOWN nVirtKey:VK_DOWN cRepeat:1 Code:50 fExtended:1 fAltDown:0 fRepeat:1 fUp:0
P WM_KEYDOWN nVirtKey:VK_UP cRepeat:1 Code:48 fExtended:1 fAltDown:0 fRepeat:0 fUp:0
P WM_KEYUP nVirtKey:VK_UP cRepeat:1 Code:48 fExtended:1 fAltDown:0 fRepeat:1 fUp:1
P WM_KEYUP nVirtKey:VK_DOWN cRepeat:1 Code:50 fExtended:1 fAltDown:0 fRepeat:1 fUp:1
P WM_KEYUP nVirtKey:VK_SHIFT cRepeat:1 Code:2A fExtended:0 fAltDown:0 fRepeat:1 fUp:1

There are two significant differences: the USB input seems to repeat keys by continually releasing and re-generating the keystroke (even though I had the Down key held down continually); more significantly, it generates an up-stroke for the Shift key as soon as I press Cursor Up (or indeed any other key, I discovered), before generating the Up keystroke — essentially, the keyboard was not supporting N-key-rollover when connected via USB.

This second point is what was causing the problem, since if you select a block of text using Shift and then press Up on its own, it does indeed cancel the selection.

Okay, so now we have the cause – how to fix it? I knew from previous testing that a genuine USB keyboard didn’t seem to exhibit this problem, so it must be something to do with my PS2 to USB adapter (actually, two different types, both with the same problem). I speculated that it might have something to do with the keyboard repeat speed — perhaps Windows was simulating repeated keys in the USB driver if it thought the attached keyboard couldn’t handle this itself, or perhaps the PS/2 keyboard’s repeated codes were being remapped by the USB converter cable.

Next stop was to Control Panel -> Keyboard -> Speed where I tried setting the keyboard repeat speed to both its slowest and fastest setting. Amazingly, either setting fixed the problem completely! It seems that all you need to do is set the repeat speed to something other than the default; this magically makes things start behaving properly.

To confirm, I repeated my test with Spy++ and sure enough, the USB-connected keyboard is now correctly sending repeated KEY_DOWN codes and no longer sending a KEY_UP for Shift in advance of the Up keystroke being pressed. My guess is that this is a quirk of the built-in Windows USB keyboard driver, rather than something in the device itself, since identical behaviour occurred with two separate PS2 to USB converters.

So problem solved: I had adjusted the keyboard speed setting on some of my PCs, but not on others which is why the problem appeared to be so random.

Syncing sent mail between iPhone and Outlook

Monday 17 Dec 2012, 05:27 PM

I use Outlook 2003 for most of my mail. However, since buying an iPhone last year, I’ve gradually been replying to more and more messages by phone. The convenience of being able to send a quick reply Right Now is great; it’s one less email to deal with when I get back to my desk, and a good use of what would otherwise be dead time.

This creates a problem though: I use POP3 mail with Outlook so it doesn’t see messages sent from my iPhone. If I want to check back on a reply weeks or months later, it can be difficult to locate.

To fix this, I have my iPhone configured to automatically BCC me on any messages or replies I send. This works but the BCC’d messages arrive in my Inbox as new messages which I then need to consciously ignore. They’re also more difficult to find later on since I need to search my entire Inbox instead of just checking my Sent Items.

Today, I finally implemented a really simple, obvious solution I should have come up with months ago: using Outlook’s Rules to automatically move such messages to the Sent Items folder. The trick is to use an obscure Rules feature that lets you check for specific keywords in the message header.

Outlook Rules editor

If you open any message sent from the iPhone in Outlook, and choose View Menu -> Options, you will see the full mail header. iPhone messages always have an X-Mailer header line reading “iPhone Mail (xxxx)”. Outlook can use this to identify iPhone messages automatically and move them to Sent Items.

I don’t want to move messages I receive from other iPhone users though, just messages sent from my iPhone. I also don’t want to move messages sent to me – I often send myself iPhone messages to remind me to do things, or to quickly move photos from my phone to my desktop without having to sync. Outlook can handle both of these conditions by simply checking the To: and From: fields of the message.

Putting it altogether, I created a new Outlook Rule like this. (The steps are for Outlook 2003, but Outlook 2007/2010 should be similar):

  1. Select Rules and Alerts on the Outlook Tools menu
  2. Click to create a New Rule; start from a Blank rule, not a pre-defined template
  3. Turn on these conditions: From people or distribution list, and With specific words in the message header
  4. In the rule description below, edit the People or distribution list to include the address(es) you send iPhone mail from. Also edit the Specific words list to include the phrase iPhone Mail.
  5. Click Next and choose the actions Move it to a specific folder and optionally Flag it with a colored flag. (I move messages to my Sent Items folder, and flag them green to make them stand out, but you could create a folder specifically for iPhone messages if you prefer.)
  6. Click Next, then choose Except if sent only to me from the list of exceptions. This ensures that messages I forward to myself don’t get moved to Sent Items.
  7. Click Next once more to finish creating the rule, give it a sensible rule name (I used iPhone Messages) and then, if you like, run it immediately on the contents of your Inbox. This tidied up all the existing messages I’ve sent from my iPhone over the past year.

Only takes a minute to set up, and now my Inbox feels like it’s back under control again. Better, I can now easily find messages I sent on my iPhone while searching on my desktop.

(Yes, switching from POP3 to IMAP would let me do all this seamlessly, in principle, but there’s something about the simplicity of POP3 that I continue to like.)

Monitoring network downtime with PRTG

Tuesday 20 Nov 2012, 12:40 PM

I’ve been using MRTG for a while to monitor assorted servers, routers, and switches I manage at The Windmill. It’s free, works pretty well, and is quite configurable. The graphs it produces are plain but functional, and they do the job.

Recently, I needed a tool to monitor my home network, primarily because the Cisco 3925 router provided by my Internet supplier, UPC, has had a nasty tendency to lockup every week or so. Now, UPC’s 120 Mb/s Internet service is fantastic value, and performs exceptionally well, but having it randomly interrupted like this is really, really annoying — especially when the router is buried in a small cupboard at the back of our attic, where all the TV wiring is concentrated.

I also have a wireless access point (an old reconditioned Eircom Netopia 2247) which periodically hangs, though on a different schedule to the Cisco. So, I figured it was time to start monitoring both devices to see exactly when they go offline, in the hope that I might be able to correlate it with other network activity.

While MRTG can do this, it’s not the most user friendly of systems to configure. Since I crave nothing more than an easy life, I decided to look around for alternatives.

This brought me to PRTG, a commercial monitoring tool from Paessler that covers some of the same ground. It’s free for up to 10 monitoring points, runs under Windows, and has a nice web-based GUI that makes it easy to configure or review logs from anywhere on my LAN. So, I decided to give it a try.

I’ve been using PRTG for about two months now, and it’s working very well. There are a huge number of built-in sensors: everything from basic PING tests, SNMP polling of routers & switches to Windows system metrics (for any machine on the LAN) to remote website HTTP monitoring. With the 10 free sensors included in the evaluation copy, I was able to add rules for three websites I manage, my Wifi and Internet routers, a separate VPN router I use to access client networks, and also a few of my local machines:

PRTG lets you create sensor dependency trees: for example, I monitor the uptime of this website (www.snoopdos.com) but the monitoring rule says not to try and monitor it if the UPC Cisco router is down, OR if Google’s main DNS server at can’t be reached. This ensures I don’t get an onslaught of website failures in the log just because my Internet connection was interrupted.

PRTG also lets you raise alerts whenever a sensor goes on or offline, or crosses a threshold. For example, if the disk space on C:\ on my main Media Center TV system drops below 1 GB, I can easily have PRTG alert me, either by email or SMS.

I’ve barely scratched the surface of what’s possible so far, but it’s a very capable system. When Paessler emailed me today with an offer to upgrade my free 10-sensor license to 30 sensors in return for some blog coverage, it wasn’t a difficult decision. While I only blog about products I actually like and use, PRTG now falls squarely into that camp. Give it a try and see what you think for yourself.

Why choose Snoopdos?

Monday 5 Dec 2011, 01:50 PM

Like most engineers, technology is my comfort zone. It’s easy to forget that running a successful business needs a sprinkling of sales & marketing, and even (gasp) self-promotion. So for a change, I thought I’d talk a little about Snoopdos itself and why you might want to consider us for your next project.

Wairere Falls, Waikato, New ZealandThere are many reasons for choosing Snoopdos. Our team of experts combines highly communicative people with varied skills in a wide range of sectors which means we have a wealth of knowledge and creativity to offer you. We have collaborated internationally with great success. Our scope spans all kinds of projects for companies of all sizes. We can devise a program with which to achieve your goals. Take your business to the next level with our help!

We offer indepth consultancy services. Typically, we first evaluate your current set up. We do a general evaluation and quickly pinpoint what needs to change and how exactly to do so. We consider what positive ideas are already in place and design ways to make them even more powerful. There is no set program, since all companies differ, so we customize everything down to the details.

Whether you are an artistic start-up company or a big telecommunications operation, whether you have the most basic of sites or a large powerful one like O2 we can show you how to get more out of your online presence.

Don’t underestimate the power of an effective website. An excellent website will not only provide great promotion and attract more clients to your services and products; done right, it can also open another stream of income for you as you select appropriate advertisements and links to display. Take your company international with the reach of an amazing site. We can get you there!

One of our core skills is software development. If your website or indeed other project requires bespoke development, we can deliver. Our team is extremely professional, able to work to deadlines and your specific requirements.

Please fell free to contact us at your earliest convenience so that we can schedule an initial meeting. We can discuss your needs and together decide on the best plan of action. We look forward to helping you accomplish your professional goals. Thank you for considering Snoopdos!

Blog Search
Search the blog archives by entering one or more keywords below:


About  |  Legal Policy  |  Privacy Policy  |  Contact   |  © 2006 Snoopdos Technology Ltd. All rights reserved.