The following C code is valid (and compiles):

#include <stdio.h>

int main(int argc, char *argv[])
   int ‹= 10;

   while (‹)
      printf("Hello World!\n");

Warning: Contains unicode characters.
Also, not tested on gcc, just msvc (which compiles it quite happily).

And as one of my colleagues has just pointed out, more whimsically:

#include <stdio.h>

int main(int argc, char *argv[])
   int ☺ = 10;

   while (☺)
      printf("Hello World!\n");

While happy, print. Excellent.

Netgear switch (specifically GS724T) and LACP/Jumbo Frames

If you’ve got a Netgear Smart switch with the LAG feature (I’ve just got a GS724Tv3), *and* you use jumbo frames on your network, beware of a really nasty gotcha in the switch’s management interface.
When you enable Jumbo frames on the ports in the switch, you enable 9216 as the maximum frame size on all the ports and then set up the LAG.
What you must *also* do is, once the LAG is created, is to go back to the ports page, and hit the LAGS “page” (not exactly obviously signposted as such, but at the top of the ports table, above the “Description” header there’s a LAGS link. Click that, then enable 9216 bytes across the LAG that you created. This is the critical step, and means that although the ports were configured for 9216 byte packets, when the LAG was created it didn’t propagate this frame size to the LAG from both the ports.

If you find this and it helps, you’re welcome.
My Synology NAS (DS412+) works in link aggregation mode with jumbo frames enabled flawlessly, once I’d figured out that the LAG is created as a virtual port and you need to make the non-obvious adjustment.

VirtualBox 4.3 with 64bit guests

For anyone else having issues with Virtualbox guests detecting ony a 32bit CPU (despite having ticked the “I/O APIC” option in Settings->System on the motherboard tab, I had the same problem, until I enabled a couple of options in the VMs settings via the command line. This was on Ubuntu 13.10 host:

sudo VBoxManage modifyvm “Test W7” –acpi on
sudo VBoxManage modifyvm “Test W7” –longmode on

I would guess that it was the second of these commands which made it work, but I present both “just in case”.

It turns out that unless you tell the wizard that you’ve got a 64 bit guest at the time that the VM is created (in this case, I was re-using an old one) then VB doesn’t actually enable 64bit CPUs for the guest. –longmode on (above) is what does the business in this case.

Linux network bridge devices.

When you’re setting up a virtual machine on Linux using KVM/QEMU, you’ll more than likely need to setup a bridged network device.

I’ve done this now a couple of times, and both times the network has “hung” during bootup.  It seems that this is because I’m also enabling an MTU size of 9000 (Gigabit ethernet with jumbo frames) using the mtu stanza in the br0 section of /etc/network/interfaces.

This is Not The Done Thing, by all accounts.  When setting up the MTU on a bridge device, one apparently needs to use the post-up stanza to add the command

ifconfig eth0 9000

to the interface. This sets the mtu on the interface which br0 is bridging – in my case eth0, you’ll need to edit to suit your configuration.

This will solve the long bootup problem, and cause jumbo frames to be enabled at the point the interface is brought up. When connecting to my iSCSI target on the SAN, this makes the transfers no end quicker.

Gah, Damn, Sod It.

Microsoft Visual Studio (up to 2008, don’t have 2010 so can’t test it) don’t support unicode correctly.
They expect to see UTF-16LE encoded text (must have the correct format BOM too).
If you present them with UTF-16BE (with the correct BOM) then they corrupt the file by assuming it’s LE encoded.
This means that a file written using perl with the :encoding(utf-16) will not be read correctly, you’ll get garbage in the editor, and the compiler will emit strange errors.
If the file is output from perl using the :encoding(utf-16le) method, then the file is *still* corrupt. However, this time it’s Perl’s fault as it’s not written out the BOM to the file.
This last point is relatively easily worked-around in perl, but it’s still bad that it’s not standards compliant, just like Visual Studio isn’t.

Gah! We can’t win.

Windows 7 & ipv6

My windows 7 has been native ipv6 (dual stacked with legacy ip addresses) for quite some time. I’ve only just discovered how to get it to use a static IPv6 address over the autoconfigured IPv6 address (the reason is that the statically allocated ipv6 address is way more memorable than the MAC address of the windows 7’s wireless adapter).

Anyway; basically Windows 7 likes to use the autoconfigured ipv6 address in preference; we need to tell the stupid thing that the static one should be the default.
In an administrator command prompt, type:

netsh interface ipv6 show interfaces

And look for the interface name for the adapter that’s currently connecting you to the internet.

Using this name, type in the command:

netsh interface ipv6 set interface "<interface name>" advertise=enable managed=enable

Replace <interface name> with the name you found in step 1.  Keep the quotes, lose the angle brackets.

This will tell windows that you really know what you’re doing, and it can use the ipv6 address in the network connection’s ipv6 static dialog box (which you’d already configured fully, right?) and forget about that monstrousity it auto generated from the MAC address.  Job done.

How to change where Windows 7 looks to find out if it’s got internet access


The link gives all information required to change where windows 7 looks to find out what the status of the currently connected network is.
I wish I’d have thought of doing this earlier – it occurred to me that it *must* be sending probes out somewhere, but I never followed the thought up :(

Testing syntax highlighter

#include <streams>

int main(int argc, char * argv[])
   cout << "Hello World!\n";

Well, that works ok. Except that wordpress seems to insert a space between the stream output operator characters. And also thinks that <stream> is an HTML tag that needs closing. So it’s a bit of a nightmare really. But I think it’s workable. Not that I’m planning to put code up here, of course…
EDIT: Solved. Use the attribute ‘escaped=”true”‘ and use only HTML entities in the source. Coolio. Excellent plugin. WP-Syntax


ADSL2+ has been enabled on my phone line (last night, interrupting a chat with a friend on MSN, grrrrr) so I’m now looking at 13.5Mbit/S download and 1.8Mbit/S upload.  For no extra cost, in fact it works out cheaper as my peak time allowance has been raised by a gigabyte.

I’m a Happy Bunny.

EDIT: The line has now stabilised at 21Mbit/S down.  And I’d misread the “up” figure before.  It’s actually 992Kbit/S.

Why Yahoo! Answers is broken.

The lunatics are in charge of the asylum, that’s why.

Someone asked a question wanting to know which codec they needed to import a music file into their application – they were getting an error “unknown codec”.

So; the choice of answers given:

1) A generic answer which would solve the problem for all people having this error, explaining what a codec was, and how to find out which codec would be needed for any file.

2) An answer that included the lucky guess “Ogg Vorbis”.

Guess which answer was given the “Best Answer”?  Number 2.  Huh???

It’s not an isolated incident, either.  There’s more examples of this kind of lunacy.  That’s not to say that I don’t understand why the answer got rated higher, it afterall solved the questioners problem in a quick and easy manner.  It just didn’t add anything to the value of the site; it’s meant to be a repository of questions and good answers.  Hey Ho.

Oh, and the quality of the questions leaves something to be decided, too.  Half the questioners don’t have a clue about the subject they’re asking about, yet they claim to need a desperately technical answer.  My personal favourite is:

Question Title: Should I use the uniprocessor HAL with a Quad Core (Q6600)?
Question content: Is there an easy way to switch HALs?

Erm. Where to begin? Is there an easy way to switch HALs? Why, yes, there is. It’s dead simple once you’ve read and understood the Windows DDK. Of course once you’ve done that, you’ll not be wanting to swap HALs; there’s absolutely no point, beyond wanting to artificially limit the number of cores that windows will use on the chip. That can be done so much easier with the /onecpu setting in BOOT.INI

But of course, if you put that in an answer, you’re wasting your time, even though it’s actually a pretty good answer to a dumb question.  I suspect that the best answer would be given to someone who answers with:

LOLZ, dude.  K3wln3ss for has changing HALs.  HAL FTW!!!11!!

And the number of people wanting their homework done is utterly outstanding.  I’ve seen a number of multiple choice questions up on there.  How can that not be homework?

Earthquake aftermath

The email wags are at it already.  The best jokey email I’ve received so far is reproduced below for your enjoyment:


At 00:54 on Wednesday the 27th February, an earthquake measuring 5.2 on the Richter scale hit the UK, causing untold disruption and distress – Many were woken well before their Giro arrived. Several priceless collections of mementos from the Balearics and Spanish Costas were damaged. Thousands are confused and bewildered, trying to come to terms with the fact that something interesting has happened in the UK.
One resident, Donna-Marie Dutton, a 17 year old mother-of-seven said: “It was such a shock, little Chantal-Nice Blonde came running into my bedroom crying. My youngest two, Tyler-Morgan and Megan-Storm slept through it. I was still shaking when I was watching Jeremy Kyle the next morning.” Apparently though, begging, thieving, and grovelling has carried on as normal.
The British Red Cross have so far managed to import 4000 crates of Sunny Delight, to help the stricken masses. Rescue workers are still searching through the rubble and have found large quantities of personal belongings including benefit books and jewellery from Elizabeth Duke at Argos.


£2 buys chips, scraps and blue pop for a family of four. £10 can take a family to Stockport for the day, where children can play on an unspoiled canal bank among the national collection of stinging nettles. 22p buys a Biro for filling in a spurious compensation claim.


Simply email us by return with your credit card details and we’ll do the rest! Don’t worry, we bank with a reputable UK bank (Northern Rock) so you know your money is in safe hands. If you prefer to donate cash, there are collection points available at your local branches of Argos, Iceland and Clinton Cards



That was impressive.

At about 12:55am this morning, I was rudely awakened by a massive shaking of the house.  Itonly went on for less than 30 seconds, but was quite scary.  The top floor (I have a loft conversion where I sleep) was moving a good inch or so, probably because the transmission through the house is bound to shake a third floor more than the ground floor.

Anyway, I’ve had a look round, and it appears that there’s no damage been done, which is a bit of a relief.

Doubt I’ll sleep for the rest of the night, though.  Funnily enough, I’m absolutely wide awake now…

This site is not bad for your computer’s health part 2

Well, the site’s now clean (and has been for a number of hours now).
Google has done a sweep, and is telling me that not only is the site clean (bottom of picture) but that the site is still linked to badware (top of picture).
My challenge to google is tell me which one is correct, and if it’s the bottom statement, unblock my site. This is getting beyond a joke.

How not to design a user interface

This site is not bad for your computer’s health

… despite Google telling you that it is.
Google’s not always right, it seems.

Google’s assertion that this site is hosting “badware” (warning – made up word) is at best misleading, and at worst an out-and-out untruth.

My reasoning:

  1. Misleading: The version of WordPress I use to power this blog had a security vulnerability in it, which meant people could maliciously edit posts I’d made and inject content. In all of these cases, the additional material injected was a link to another website.
  2. Untruth: As above, the link on my site was just that – a link to another website. My website had absolutely no “badware” on it at any time. It’s a small distinction to make, but if my business was using wordpress, and the world at large was presented with a page from google saying my site could not be trusted and that it was trying to hack their computers, I think I, like many other business owners, would be upset at the loss of business (short term) and reputation (long term) that this causes.

Things that – in my opinion – Google needs to fix.

  • Correct the warning that users see after clicking on a link. The warning page – as pointed out above – is wrong. It should simply state that Google’s automated tool for protecting the internet community has detected that a link on this site has been found to point to a “badware” distribution site. Even changing the sense of the sentence “Warning – visiting this web site may harm your computer!” into a more passive form, so that the implication that “this web site” is actively trying to do something bad is removed.
  • Provide people who’s websites get infected with at least a count of distinct issues that have been found on their website. At the moment, the Google warning email just says that the website is serving up “badware”. This website actually suffered from two seperate problems, after finding the first, I resubmitted for testing, and they came back with the same – unhelpful – statement; that my website was still hosting “badware”. If I had been told that there were 2 (or however many are found) instances of the problem, I wouldn’t have stopped after finding the first.
    The sheer number of people requesting help on the ‘Stop “badware”‘ group pages is indicative that something is seriously wrong with the reporting mechanism.
  • Speed up their review process. If they are making wild accusations that a website is actively hosting “badware”, then they should be as quick to unblock a site as they are to block it. If an online company gets blocked – as has happened (sorry, can’t find the link to the page that I found before) – then Google will hold their website in the blocked state until a retest is done. This can take a long time, during which time, people cannot access the site from google’s search results, and due to the nature of the wording of the warning, harm is done to the business’ reputation
  • Before the browsers start using this “badware” security alert mechanism to block websites in the browser, the process needs to be streamlined, so that an automatic check can not only condemn a website, but also give it a clean bill of health. The process of freeing a website from purgatory should be near real-time. I do not believe that an automatic check of the website cannot be done within a period of half an hour – Google has a famously large number of servers and bandwidth available to it. If it cannot be done in this realtime manner, I think it is too flawed to be useful.

I would like to point out that this last point, about browsers using the Google “badware” database as a check is, in principle a very good idea; afterall, protecting people from “badware” is something that would make the internet a much nicer place to play.
However, with the caveats listed above, the database becomes even more insidious – without turning the whole security mechanism off, I cannot access my own website, even though it is clean (I know it is, I’ve just finished cleaning it, and upgraded the software so it won’t happen again).
It is this real-time checking of the “badware” database by browsers that is the painful part when the database is too slow to de-list websites.

And don’t think that browsers aren’t going to do this. Firefox 3 Beta 3 has the feature turned on by default.

EDIT: Someone else has had the same problem, and has the same problems with the process: