Friday, May 21. 2010
Slow Virtual PC network with Windows 7
Ok yet again this is one of those notes to myself blog entries that might help someone else with a problem of network performance with a virtual PC.
Unlike my friend Liam Westley who is now a MVP for virtualization after moving to windows 7 recently I decided that I'd just use the Virtual PC that comes with windows 7 rather than fighting with either Hyper-V or Installing the older Virtual Server family.
I've spent some time looking into a problem where when I uploaded to Windows 2003 server I had running in a VM the upload speed was terrifyingly slow (Using BITS as it happens but UNC connections weren't any better) from my laptop, downloads seem to be OK. Worse still other people who uploaded to the server got the kind of performance figures I was expecting to see.
Anyway turns out the problem is TCP task offloading this kb article 888750 at Microsoft covers how to turn off task offloading and somewhat explains the problem.
Basically you create a DWORD key called DisableTaskOffload in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters and set it to 1 then reboot your PC.
Monday, May 10. 2010
Importing keys for VS2010
Visual studio 2010 has removed the prompt for a password when you use codesigning with a .pfx file. This means you'll often get this error message:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1970,9): error MSB3325: Cannot import the following key file: mykey.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name:
VS_KEY_C0D0ACB5FAE2DFE3 [C:\Source\MyProject.csproj]
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1970,9): error MSB3321: Importing key file "mykey.pfx" was canceled. [C:\Source\MyProject.csproj]
This is down as a connect bug here https://connect.microsoft.com/VisualStudio/feedback/details/524792/importing-key-file-was-canceled?wa=wsignin1.0 and sadly no one gives the correct answer.
This is somewhat cryptic and doesn't actually tell you how to fix the problem. So here for future reference is the answer (obviously change the file name and key to match your error message) run it from the command line:
sn.exe -i mykey.pfx VS_KEY_C0D0ACB5FAE2DFE3
Hope this helps.
Just noticed that you use certmgr.exe for installation of pfx for ClickOnce deployment purposes
Thursday, December 10. 2009
New mobile phone time
So a quick look around the pre-xmas market shows a few phones that look promising (main requirement is 800x480 screen size as a minimum). The phones that made my shortlist are below:
iPhone 3GS - I really can't bring myself to buy one for personal use, tethering costs 10 a month on O2 and the screen is now a little low-res and the lack of easy development (I'd need a mac) and apples attitude really puts me off.
Status - Not for me, but my wife wants one.
HTC HD2 - Well it looks lovely, has all the features that I want BUT it's got Windows Mobile 6.5 as the underlying OS and the play I've had with the emulator didn't inspire me (Although with HTC UI I'm not sure this is a huge problem).
Status - Probably if it was Windows Mobile 7
Acer Liquid A1 - I had this on back order for a while BUT acer don't seem to have delivered just yet and it's running the older Android Donut 1.6 OS (Most of the motorola comments apply here as well) BUT it does have a budget price. Its also somewhat unclear if it will ever get upgrading to eclair.
Status - Might be a dead end phone, if hackers don't crack root (last seen hackers got root).
Motorola Milestone - I cancelled the order for the Acer Liquid and moved over to this once it became available from expansys. It's running Android Eclair and has been billed in the US as an iPhone killer. Problem is the one feature that I absolutely require from a smart phone seems to be missing tethering the phone as a modem for my laptop (I work in police stations where getting internet access is rare). Now there are third party solutions for this but they either cost money OR require root access to the phone. Looking at the US based forums for it's sister phone the Droid this seems to be a trick that no-one has managed yet (there seems to be a part way solution). Finally there is no sync with Outlook unless your running exchange.
Status - Would be a contender but late delivery, no Outlook sync and potential lack of root kills it.
Nokia N900 - This phone is what I ended up getting. It hits several sweet spots for me. Tethering is there out of the box (you do need the nokia PC suite installed) so no messing around trying to get a new kernel with iptables loaded. There is a keyboard which means I'm not relying on a on-screen one it's small and yet again a three line qwerty I'd have preferred a seperate number row, but at least when you enter a phone number it sees the top row as numbers. The killer item for me was that it comes with xterm and vi gotta love any phone with those in box. The only downside is the software still feels a little unfinished in places, for example as I'm typing this my screen brightness keeps changing, I suspect this is flickering sunlight confusing a sensor but who knows.
Status - I like it but probably currently for geeks only. May well improve dramatically with next few firmware releases.
In summary all of these phones have promise and for me the nokia is great fit. For my wife the iPhone is probably a better phone. Both of the android contenders fail at the moment due to lack of true openess (they are very close but the need to hack them to get root isn't a good sign)
Friday, January 9. 2009
Finding the BOM
Michael Kaplan posted a small challenge on his blog to write some small code to find out the Byte Order Marker or BOM in the start of a file. So I kicked up the C# compiler and wrote this little bit of code:
public enum Encoding
{
Unknown = 0, BomBigEndianUcs4, BomUcs4, BomUtf8,
BomUtf16, BomBigEndianUtf16
}
// We use Bit 3 as a end of data marker, true means end
// bit 5 happens to be same value as bit 3
private static byte[] matchData =
{
0x00,0x00,0xF6,0xFF, // 0- 00 00 FE FF Bom UCS4 Big endian
0xF7,0xF6,0x00,0x08, // 4- FF FE 00 00 Bom UCS4 Little endian
0xE7,0xB3,0xBF, // 8- EF BB BF Bom UTF8
0xF7,0xFE, // 12 - FF FE Bom UTF16 Little endian
0xF6,0xFF // 14 - FE FF Bom UTF16 Big endian
};
public static Encoding DetectType(byte[] data)
{
int i = 0;
int offset = 0;
Encoding currentEncoding = Encoding.BomBigEndianUcs4;
while (i < matchData.Length)
{
byte compare = (byte)((matchData[i] & 0xf7) | ((matchData[i] & 0x20) >> 2));
if ((offset >= data.Length) || (data[offset] != compare))
{
offset = 0;
while ((matchData[i] & 0x08) == 0) i++;
currentEncoding++;
}
else
{
if ((matchData[i] & 0x08) == 0x08) return currentEncoding;
offset++;
}
i++;
}
return Encoding.Unknown;
}
Now it's not clear what this will get translated into post JIT so I converted it into C (changing the enum slightly to save a bit of space) and ran that through MSC in assembler output mode and got back a figure of 89 bytes for the code and 14 bytes for the table which I think is pretty good.
typedef enum
{ Unknown = 0, BomBigEndianUcs4=3, BomUcs4=7, BomUtf8=10,
BomUtf16=12, BomBigEndianUtf16=14
} Encoding;
// We use Bit 3 as a end of data marker, true means end
// bit 5 happens to be same value as bit 3
static unsigned char matchData[] =
{
0x00,0x00,0xF6,0xFF, // 0- 00 00 FE FF Bom UCS4 Big endian
0xF7,0xF6,0x00,0x08, // 4- FF FE 00 00 Bom UCS4 Little endian
0xE7,0xB3,0xBF, // 8- EF BB BF Bom UTF8
0xF7,0xFE, // 12 - FF FE Bom UTF16 Little endian
0xF6,0xFF // 14 - FE FF Bom UTF16 Big endian
};
static Encoding DetectType(unsigned char data[],int length)
{
int i = 0;
int offset = 0;
while (i < sizeof(matchData))
{
unsigned char compare = ((matchData[i] & 0xf7) | ((matchData[i] & 0x20) >> 2));
if ((offset >= length) || (data[offset] != compare))
{
offset = 0;
while ((matchData[i] & 0x08) == 0) i++;
}
else
{
if ((matchData[i] & 0x08) == 0x08) return i;
offset++;
}
i++;
}
return Unknown;
}
Following on from that I extended the code to support the detection of all of the stuff in Appendix F of the XML specification.
public enum Encoding
{
Unknown=0,BomBigEndianUcs4,BomUcs4,BomUtf8,
BigEndianUcs4,Ucs4Odd,BigEndianUcs4Odd,
Ucs4,BomUcs4Odd,BomBigEndianUcs4Odd,
BigEndianUtf16,Utf16,Ascii,EBCDIC,
BomUtf16,BomBigEndianUtf16
}
// We use Bit 3 as a end of data marker, true means end
// bit 5 happens to be same value as bit 3
// If we're doing a full appendix F of the XML docs then
// we change this and use bit 6 for the last EBCDIC entry and
// UTF16 Bom Entries
private static byte[] matchData =
{
0x00,0x00,0xF6,0xFF, // 0- 00 00 FE FF Bom UCS4 Big endian
0xF7,0xF6,0x00,0x08, // 4- FF FE 00 00 Bom UCS4 Little endian
0xE7,0xB3,0xBF, // 8- EF BB BF Bom UTF8
0x00,0x00,0x00,0x3c, // 11 - 00 00 00 3c UCS4 Big endian
0x00,0x00,0x34,0x08, // 15 - 00 00 3c 00 UCS4 Odd Little
0x00,0x34,0x00,0x08, // 19 - 00 3c 00 00 UCS4 Odd Big
0x34,0x00,0x00,0x08, // 23 - 3c 00 00 00 UCS4 Little endian
0x00,0x00,0xF7,0xFe, // 27 - 00 00 FF FE Bom UCS4 Odd Little
0xF6,0xF7,0x00,0x08, // 31 - FE FF 00 00 Bom UCS4 Ddd Big
0x00,0x34,0x00,0x3f, // 35 - 00 3c 00 3f UTF16 Big endian
0x34,0x00,0x37,0x08, // 39 - 3c 00 3f 00 UTF16 Little endian
0x34,0x37,0x70,0x6d, // 43 - 3c 3f 78 6d Ascii
0x44,0x67,0xa7,0x9c, // 47 - 4c 6f a7 94 EBCDIC
0xF7,0xFE, // 51 - FF FE Bom UTF16 Little endian
0xF6,0xFF // 53 - FE FF Bom UTF16 Big endian
};
public static Encoding DetectType(byte []data)
{
int i = 0;
int offset = 0;
Encoding currentEncoding = Encoding.BomBigEndianUcs4;
while (i < matchData.Length)
{
byte compare = (byte)((matchData[i] & 0xf7) | (i>=47?((matchData[i]&0x40) >> 3):(matchData[i]&0x20) >> 2));
if ((offset >= data.Length) || (data[offset] != compare))
{
offset = 0;
while ((matchData[i] & 0x08) == 0) i++;
currentEncoding++;
}
else
{
if ((matchData[i]&0x08)==0x08) return currentEncoding;
offset++;
}
i++;
}
return Encoding.Unknown;
}
Which I think isn't too bad a bit of code, if you could live without the EBCDIC detection you can drop the bytes from the table and the ternary statement and I'd guess your code wouldn't be too big.
I'll have a think about alternative methods over the weekend and see if I can beat the 103 bytes of assembler that my first attempt generated.
Saturday, October 18. 2008
server swap
Tuesday, September 2. 2008
Note to self
To get the mouse setup so the touchpad doesn't do "tap clicks" on the "eee" under Mandriva (better than Xandros but still not perfect). Use:
synclient TouchpadOff=2
Or add it to /etc/X11/X11.conf
But something overwrites in there occasionally (plugging in a USB mouse?).
BTW I quite like Mandriva, but the machine got nuked when it went back to Asus and this took me some time to find / remember. At least mono runs it correctly unlike xandros and I even got monodevelop working.
Monday, September 1. 2008
Sandcastle
In the past I've used nDoc to generate documentation and it was starting to get very long in the tooth (I had one of the .net 2.0 versions but it felt a bit like samizdat)
Anyway I've just moved over to Sandcastle (on codeplex) back again after a little argument of which license to use.
Last time I tried to use Sandcastle I gave up and went back to nDoc but now I'm using the excellent SandCastle Help file builder which just plain works and copies the old nDoc interface. I tried to use DocProject but gave up I have a feeling it's designed for someone who wants to be a bit more "professional" than I need.
Anyway recommended if a bit slow still.
Friday, July 11. 2008
ALT.net UK conference
Well I've started a new job (actually I started in feb) working with Body worn video cameras for the police, and I'm just escaping from the post april we must spend our budget panic of installs and upgrades. More on this later but right now I hate Codecs.
Ben Hall has just announced the Alt.net Uk conference is now open for registration. I've booked my place but be warned you'll need an OpenId account to get registered.
Thursday, January 10. 2008
Cargo cult time
Note to readers: This is written by a linux newbie so corrections are welcome, flames are not.
Linux on the eee is NOT ready for the casual user yet. I've been doing cargo-cult programming getting the Eee to talk to my windows mobile 6 phone.
Broadly speaking the steps involved installing a compiler (requires a new repository adding to apt-get), subversion, download the kernel, rebuilding it then FINALLY building the driver I needed. Most of this involved typing in make commands that I'm not sure I needed and finally a bit of magic adding to a system file that I'm not sure is correct.
Having said that it does actually work unlike WMWifiRouter (turns your phone into a router) which works fine for the Vista machine but the Eee can't seem to route correctly via, it sees the phone connects and gets an address over DHCP but gets no further. I have tried it on the Ubuntu VM I have lying around and the situation is somewhat better as I had to install just subversion then the make files just worked.
My big problem here is that I'm typing in stuff that I've googled and found on the web with magic incantations that have no explanation and for some I've no idea why I need to it (why do I need to edit /etc/networks/interfaces) I feel like a cargo cult programmer who just cuts and pastes stuff straight of the web with no understanding of what it does. Worse still since I'll hopefully only ever need to do most of this once it doesn't even make commercial sense to actually spend the time to learn why (it may be worth doing for intellectual curiosity reasons). Someone could have messed with the wikis where I found this stuff and inserted in a 'rm -rf *' (or suitably obfuscated equivalent in perl for example) into the instructions and resulted in me nuking the machine without me having any chance of spotting it.
Sadly according to this interview with Linus TorvaldsI'm not sure the situation is going to get any better here are some choice quotes from Linus:
So, there’s a real reason why we need to be able to have source code which means that to all kernel developers, a binary interface is basically – it is only a bad thing. There is – there are no upsides whatsoever.
....
And this is something you do see in other projects where, yes, they have binary interfaces for one reason or another—quite often because of commercial reasons—and that just means that they cannot fix their fundamental design. They sign up not just the binary interfaces, they also sign up to the exact design they had when they came up with that interface.
....
So, there’s – that’s the second major reason why a stable ABI is not going to make – in fact, that means that we don’t even guarantee a stable API; so, even on a source level we say, “Okay, this is the API and we’ll – if you have external drivers that use this, we’ll help you fix them up when we have to change the API. But we don’t guarantee that the same API will work across versions.” And it doesn’t.
Jim Zemlin: But by opening up, you’d obviously be able to work with those issues.
Linus Torvalds: Right. Immediately when people work with, like, source API and then we can say when somebody complains, “Hey, it doesn’t compile anymore. My external module here depended on that function and now it doesn’t exist anymore,” at that point at least we can fix it for them.
So, that’s not a huge deal. It does mean that people who maintain external modules, even with source available, they can’t assume that they can just recompile unmodified across many different versions.
Sorry Linus this is a huge deal if Linux wants to escape the datacentre and make it over on to the desktop, I can't just go to a manufacturers website and pull down a linux driver, double click on the download hit next a few times and away I go. What you have suceeded in doing is transferring the pain from the kernel developers out to the driver developers (which may explain why you don't see as a problem) and the end users will never be able to cope with the pain. Wireless drivers seem to be a great example where there is a shim layer called ndis-wrapper which wraps windows drivers for linux. Oddly driver manufacturers put effort into their windows drivers where there is a stable interface, not into an environment where they have to release their source code and keep several different variants around in case someone decides to reconfigure the ABI / API. Windows drivers basically fall into four catagories: pre Win32 (Windows 3.11 and friends) Windows 9x, Windows NT and Windows NT 64 bit (ignoring Itanium). In practice as a driver writer today you can get away with writing drivers just for Windows NT and Windows 64bit possibly doing itanium drivers if you feel like it. Certainly the source code for both 32 & 64 bit windows can be the same, the rest is driven by compiler flags.
As an ex hardware engineer (many many years ago) I can well understand why driver manufacturers don't want to release their source code. It could be something embarassing, such as the need to reset a card when it times out sending a packet or it could be something which speeds up the network by 25% via a software hack and you'd like to keep secret.
To be fair to the Linux community on Windows I have the problem that I have no idea what a driver manufacturer will be installing (HP seem bad at installing other crap) but if the driver has been WHQL tested I have a fair idea that it will work and the testing MS perform on drivers has shaken the worst of the bugs out and I can always run DriverVerify myself on a really bad day. The version of 64bit Vista I run on my main machine forces drivers to be signed which can be a pain sometimes but means my system has only crashed when I've had actual hardware faults i.e. the MiniPCI network card in machine or the slot it's plugged into went wrong and brought the machine down.
Part of the problem here is the assumption on the part of the GPL crowd that binary compatibility doesn't matter. For me as the end user of the little Eee it isn't an issue out of the box it has an office suite and a webbrowser so it's probably good enough for most folks, but it doesn't have all the bluetooth bits you need to talk to a phone in place without a bit of compilation (or adding some repositories I think one of the Eee community ones has the bits). It doesn't have the stuff I wanted to talk to a Windows mobile phone either, it's a pure pain point that on windows I solve by finding the manufacturers website (or sticking in the supplied CD) clicking next a few times.
For software vendors binary compatibility IS a big issue, today you can get away with targetting JUST the NT code base (2000, xp, 2003, vista, 2008 and 64 bit variants) and for my current project I'm ignoring 2000 as I want to use WPF for learning purposes. Windows solves this pain point for me and it's where I'll be working for the forseeable future.
Monday, January 7. 2008
Asus eee first thoughts
(Posted from the eee) Santa was good to me and brought me the Asus eee I wanted for christmas I couldn't resist and took a somewhat crap photo of it sitting on the big Rock laptop:

So far I've been medium impressed with the default linux install on the machine, I've had a few problems following an update I ran into the same Firefox segmentation fault that Tim Anderson did which was a disappointment. Also synaptic seems to fall over with great regularity (I'm getting to be a dab hand with apt-get from the command line now) as detailed in the the eeeuser wiki here sometimes it works, sometimes it doesn't.
Also a lot of the dialogs on programs aren't correctly sized for the screen which means lots of dragging by holding down the alt key. I tried to like "easy" mode but I've cracked and gone to the advanced mode desktop.
While in Edinburgh I met up with my old friend Rupert Goodwins for a quick drink and Karen (plus other half) from zdnet joined us to escape the rain. Her other half is a travel writer and while Karen failed to buy an eee for him before christmas I think its safe to say it is a hit as a present even for the non-geek in your family.
Overall I like the machine BUT I do feel desktop Linux has some way to go before it's ready to take over the world and for a machine like the eee where the hardware is pretty standard a bit more work is required on the vendors part.
I couldn't make the wireless stuff talk to my phone with WMWifiRouter which turns a windows mobile phone into a wireless router, the eee didn't seem to get a DHCP address correctly and if I fudged that dns lookups didn't seem to work. Sadly neither Rupert or I could persuade it to work with "internet connection sharing" and bluetooth dongle either (although the Rock doesn't have a problem)
For me once I'd got back from Edinburgh to the home network downloaded advanced mode, erlang and gcc I felt a lot happier with the final result. Now I have small machine that I can take out and about and use without being tethered to mains electricity.
Overall:
Hardware 8/10 - Good for it's size and cost but could be better in the screen department, more flash memory and a longer battery life would be nice.
Software 6/10 - Nearly there, good enough for older kids but granny might struggle with some dialog boxes and toileting my webbrowser with an upgrade is poor.
Note these are scoring against something which from everyother vendor would cost three times as much so I'd still recommend it.
Wednesday, October 24. 2007
DDD6 is open
Mirroring SQL servers with no domain
At the SQLBITS conference I bumped into Liam Westley who kindly 'volunteered' me for one of the Grok talks. Since Barry Dorrans is now an MVP (congrats Barry) he had also been 'volunteered' into organising the Grok talks so I went along and filled in some space on his flip chart and gave a quick talk on SQL mirroring without using a domain controller (which means you can save having two domain controllers if you want resilience).
Finally I have had some free time to convert the notes Liam and I made at a previous gig into a standalone word document which you can download here. This was a bit of a rushed talk on the day since I hadn't been planning to do a Grok talk but I think it gave folks a flavour on the day of why you would want to do this (Liam somewhat unfairly had done some preparation on his talks).
Now back to getting to grips with WPF for a talk I'm planning for DDD7.
Note to: Barry / Ian yes I will come along and do dry runs to the nxtgenug / London DNUG before then, but I want the finest MSDN socks available to humanity, I want them here, and I want them now.
Wrong about Silverlight
Tuesday, September 11. 2007
BBC iPlayer and Moonlight
I think it's been interesting to see the free software crowd moaning about the lack of support for iPlayer on Linux. Sadly given the DRM rights requirements of broadcasters which in the BBCs case are forced on them by both the content producers and the repeat fees for talent we aren't likely to ever see content which doesn't require DRM. I have spoken to senior BBC folks about this and their view is that currently content without DRM is a non starter much as some of them would like to it happen.
The current state of play is that beeb saying that there will eventually be a version of iPlayer for Linux but that for the next year or so it will be Windows and Mac only. The w3c.org website stats at http://www.w3counter.com/globalstats.php?date=2007-08-30 only show Linux having a 1.34% share of the browser market so the beeb are going at this in the right order.
This means that potentially one of the more interesting bits of the moonlight annoucements is in Miguel de Icazas blog where he talks about codecs and where he says that Microsoft are going to be supplying binary codecs for Moonlight.
Sounds to me like this is a means to deliver the iPlayer on Linux for the BBC without having to get too entangled with the GPL if you're Microsoft and the GPL certainly isn't friendly to DRM.
So the somewhat lame responses the BBC trust are giving back to the online petitions are both understandable and correct.
Tuesday, August 14. 2007
64bit Vista on a D900K
Well for some reason the big Rock Xtreme64 decided to go into thrash the hard disc mode under 64bit Vista. I suspect it was down to an interaction between some MS beta software and windows update. So I decided to reboot in XP grab the stuff from the Vista partition I needed and reformat.
The Rock xtreme64 is based on a D900K chassis and makes a nice (if heavy) Vista laptop and by now most of the driver issues have been sorted out (last week the webcam finally appeared on windows update). There are a few things you will need drivers for which windows update won't find:
D90K_MSBT_X64 Bluetooth driver
D90K_MS6833B_X64 Wireless network card
D90K_AP-KEY_X64 AP keyboard driver
I have decided to host these (click here to download) as I no longer remember which manufacturers website I found them on and at least this way they're stored offsite if I need them. Also I downloaded the latest mouse pad driver from synaptics. Since they are 64 bit drivers they should be signed and I would recommend you check them if you download them from here. You'll need the wireless driver as at some point Vistas problem resolution system says that there won't be a driver for the network card.
The gentoo wiki says that this model has also been branded as an alienware Aurora M7700, Sager 9750 (or NP9750) VoodoPC Envy u:709 and various other names incorporating D900K
This of course was followed by the obligatory full day reinstalling various bits of software getting all the updates etc but this time I remembered to install a second mixed mode authentication instance of MS SQL server 2005 before I applied the service pack (an older app I work with requires this).
One final thought I don't run a lot of games on this machine so I use the out of box GeForce Go 7800 driver which you have to hand select from the driver browse dialogs in Vista using the "show me all the drivers" check box. You may want to get an updated laptop driver from http://www.laptopvideo2go.com/ if you do.
Calendar
|
|
July '10 | |||||
| Mon | Tue | Wed | Thu | Fri | Sat | Sun |
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 | |
Categories
Syndicate This Blog
Blog Administration
NeighBlogs
Top Exits
www.amaxo.com (3)
www.itwriting.com (1)

