Category Archives: Platforms

Upgrade of web site from .Net 2 to 4.5 breaks asmx web services

Despite my best Googling, nobody seems to have had quite this problem (and written about it).

I’m migrating a .Net 2 web site to .Net 4.5 (well, 4.5.1 to be precise). Everything seemed to work except browsing to the .asmx (web service) pages, which threw a System.BadImageFormatException: Invalid token error:

Error Stack:System.InvalidOperationException: Failed to handle request. —> System.InvalidOperationException: Unable to handle request. —> System.Configuration.ConfigurationErrorsException: Invalid token. —> System.BadImageFormatException: Invalid token.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
— End of inner exception stack trace —
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
at System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir)
at System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors)
at System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors)
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)
at System.Web.UI.PageParser.GetCompiledPageInstance(VirtualPath virtualPath, String inputFile, HttpContext context)
at System.Web.UI.PageParser.GetCompiledPageInstance(String virtualPath, String inputFile, HttpContext context)
at System.Web.Services.Protocols.DocumentationServerProtocol.GetCompiledPageInstance(String virtualPath, String inputFile, HttpContext context)
at System.Web.Services.Protocols.DocumentationServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
— End of inner exception stack trace —
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
at System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
— End of inner exception stack trace —
at System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath)
at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)| Global.asax:Application_Error()

I tried adjusting the .Net version — turns out it would work fine in 3.5 or lower, but broke in 4 or higher.

My machine itself was okay — creating a new 4.5 web site with just a web service in it worked fine.

In the end the solution was to create a new web site and add the individual pages back into it, leaving out the Bin directory. I rebuilt that by adding references to the various DLLs back one by one. Something in the old Bin directory apparently was throwing it out.

Samsung Galaxy SII doesn’t mount under Linux

unable to mount samsung_android: error initialising camera -1 unspecified error

Screenshot of the error message

Unable to mount SAMSUNG_Android

Error initialising camera: -1 Unspecified error

So this is the error message I get when plugging my Samsung Galaxy S2 into the USB port on my Linux boxen, all running Linux Mint Maya running the MATE desktop (Ubuntu 12.04). 

PTP_transfer_enable The answer is, of course, you need to enable PTP transfers, rather than MTP transfers.  MTP transfers work great for Windows or Mac, but not Linux.  On your phone, drag down the Notifications screen, then under “Ongoing” you’ll find something about “other USB options”.  Select that and you can pick the PTP transfer.

Per the notes on how to take a screenshot on a different phone, I took a screenshot of the final screen. Getting the screenshot onto my computer, that was a whole world of hurt.  Settings | More Settings | USB utilities | USB mass storage needs to be turned on, otherwise the file browsing from Linux shows only the directory structure, no files whatsoever.

Of course, Cathy’s HTC Desire, it Just Works.

New graphics card in the Mac Pro

To recap: I’ve got two old 2008 Mac Pros. Lovely machines. The video card in one went bung (possibly power problems).

As a workaround I’ve been using a friend’s spare ATI Radeon 3870, which only works in Windows, not OS X.

I’ve just bought an upgrade: an nVidia GeForce GTX 480. Very nice. A beast of a card, too, very impressive looking. Got it on eBay from a bloke in NSW selling under the name “Mac PC Parts” for about A$270, which is a bit cheaper than the official Apple upgrade — which is no longer available anyway — and a LOT cheaper than any of the new cards at OWC or other etailers and retailers that I could find.

Mac Pro, video card installed

A note of caution to fellow Mac Pro 2008 users: it appears to be near-impossible to get the card out once plugged-in, due to the placement of the PCIe catch on that model of Mac Pro. It might explain why later models went to a bar thingy which is easier to get to. This also means it’s worth plugging in the two power cables before the card goes in.

Anyway, the card has taken the graphics rating in Windows 7′s Performance index thingy from 5.1 to 7.9. It even seems more responsive for regular web browsing.

There’s a certain amount of geek pride in getting each item, one by one, to the top of the scale.

But given the weak point is now the hard drive, it would seem that the next upgrade needs to be a new hard drive/SSD.

Windows performance index

But the main reason I wanted to get it was to get this computer running OS X again — son the elder is getting familiar with it at uni, and may need to run OS X-specific software again soon.

Alas, plugging in the OS X drive and trying to boot off it got me a “Operating system not found on disk” error. It would seem the Microsoft gremlins got onto it.

The disk doesn’t have anything important on it anyway, so stand by for updates as I figure out how to wipe it and rebuild OS X.

Update: It was easy. Download Mavericks onto a USB, boot it up and use the built-in disk manager to re-partition the OS X drive (I unplugged the Windows drive just to be sure I wouldn’t accidentally wipe it) then install onto it.

Plugged the Windows drive back in, and installed ReFit again to provide a more visible boot menu. Done.

Diablo I (yes, Diablo 1) LAN play on Vista or Windows 7

- and presumably 8.

There’s various convoluted steps to get LAN play working on more recent versions of Windows.

Mount the ISO on your hard drive, and use the somewhat unstable Microsoft supplied ISO mounting program to fool the program into thinking you CD is in a CD drive.  Install Diablo from here.  This step is not strictly necessary, but it’s so much quicker and cleaner than the alternatives.

Fetch and apply the patch to bring Diablo 1.00 up to version 1.09.  It may also be helpful to pull up the properties of the .exe and enable compatibility mode with WinXP Service Pack x. When fetching patch, get it for the version you’re installing – much confusion is caused if you get the spawned Diablo patch and apply it to the full version.

Go and get IPXWrapper, and per the instructions drop the DLL files into your Diablo directory. If you have a heterogeneous environment, all machines need to use this wrapper – IPXWrapper is a translation layer than transforms IPX into UDP, and without it IPX aware OSes like WinXP won’t see the network traffic of the IPX unaware OSes like Vista.  Punch a hole in your Windows Firewall to allow UDP port 54792.

To fix the palette issue, you might want to wrap the exe in a batch script to kill Windows Explorer whilst you’re playing Diablo.

See?  Easy.  Doesn’t take more than a few hours if you don’t know what you’re doing.

Where did I take that photo?

I couldn’t find anyone extracting out the geolocation geotagging EXIF data from their photographs so they could pull it up on something like Google Maps.  There are stand-alone programs with embedded maps, but the bits and bobs lying around on the average system ought to be enough to just generate a URL to a mapping website.  The following bash script echoes the  URL that geolocates your JPEG.  Because my camera doesn’t emit it, I couldn’t be bothered dealing with the seconds part of a location, but I did detect that you don’t have a camera the same as mine.  Drop a line if you’ve used this and fixed it.

#!/bin/bash
# emit a hyperlink to google maps for the location of a photograph
declare Seconds=""
Seconds=`exif -m --ifd=GPS --tag=0x02 $1 | grep -oP "[\d|\d\.]+$"`
if (( $Seconds=='0' ))
then
  Seconds=`exif -m --ifd=GPS --tag=0x04 $1 | grep -oP "[\d|\d\.]+$"`
fi
if (( $Seconds!='0' ))
then
  echo
  echo "Script does not support seconds being specified"
  exit
fi
echo -n "https://maps.google.com.au/?q="
declare NorthSouth=`exif -m --ifd=GPS --tag=0x01 $1`
if [ "$NorthSouth" == "S" ] 
then
  echo -n "-"
fi
echo -n `exif -m --ifd=GPS --tag=0x02 $1 | grep -oP "^[\d|\d\.]+"`
echo -n "%20"
echo -n `exif -m --ifd=GPS --tag=0x02 $1 | grep -oP "(?<= )[\d|\d\.]+,"`
declare EastWest=`exif -m --ifd=GPS --tag=0x03 $1`
if [ "$EastWest" == "W" ]
then
  echo -n "-"
fi
echo -n `exif -m --ifd=GPS --tag=0x04 $1 | grep -oP "^[\d|\d\.]+"`
echo -n "%20"
echo -n `exif -m --ifd=GPS --tag=0x04 $1 | grep -oP "(?<= )[\d|\d\.]+(?=,)"`
echo

Can’t copy address bar from Google Chrome

I’ve had periodic problems with Google Chrome on Windows (Version 32.0.1700.102 m, but this has also happened occasionally in the past); sometimes it will refuse to copy the address bar.

Instead of copying, it will clear the clipboard.

Copying from other places, such as a web page (content or using Right-click / Copy Link Address) works fine.

Not sure if it’s an environmental issue — only seems to happen on my work machine; I haven’t seen the same at home.

Very odd.

Blogging it here because I can’t see any mentions of it online (which might be because it’s just me). Will post back if I find the solution.

Update 2014-01-31: I uninstalled and reinstalled Chrome… it seems to work again, for now.

Update 2014-02-05: The problem seems to have come back. Very odd.

Update 2014-02-20: Some old posts on a related problem seemed to suggest it might be a Chrome Extension causing issues, so I removed all of mine. The problem seems to still be intermittently occurring.

Installing Pygal into Cygwin

Pygal is a python library for emitting SVG charts. It might do PNGs too; the documentation is… sparse. Okay, there’s no documentation, but they show you several ways to make bar charts, and figure you can follow on from there.  Anyways, the installation instructions don’t work, not under cygwin.

Here’s what you should do:

  1. ensure cygwin has the libs libxml2-devel and libxslt-devel installed
  2. issue the command
    cygwin$ pip install pygal

and you’re done. Getting pip into cygwin is a whole world of hurt, but you will need to go looking for a http (not https) source to download setuptools, then download and run ez_setup.py, followed by using pip to upgrade setuptools. Have fun with that; I know I did.

Nvidia 8800GT nvlddmkm.sys blue screen of death

I’ve got two old Mac Pros, and on one of them, the Nvidia 8800GT video card suddenly started causing weird errors in Windows.

Nvidia crash

Then it started doing the blue screen of death repeatedly, a crash in nvlddmkm.sys.

Nvidia blue screen

I have no idea why it started happening now — the Nvidia drivers don’t appear to have been updated for months, and Windows Update hasn’t installed anything for almost a week.

Oh well.

Boot into Safe Mode With Networking

Download the latest drivers

Install with Clean Option on

Reboot

Seems now to work, touch wood.

Update 2013-11-19 18:45 — No such luck. It seemed fine this morning, but later on started crashing like before. Investigations continue.

Update 2013-11-19 21:00 — After playing around disabling various things, and puzzling over what might have updated itself (since there was nothing recently installed or patched listed by Windows), I think I may have found the culprit: the Steam client beta (which I’m using to get the family sharing trial). Have disabled this, and Windows seems to be stable again. Will try it for a bit longer, then report findings to Steam.

Update 2013-11-20 — It couldn’t be that easy, of course. And I have dissed Steam without justification. The video card is still playing up — now so much so that:

  • a lovely speckly pattern appears when booting
  • Windows proclaims the video card isn’t working, and automatically puts us into Base Video (640×480) mode
  • OS X won’t boot at all — the GUI presumably tries to come up, then it reboots

Oh dear. Trouble in video card land.

The card is an NVidia GeForce 8800 GT, quite a nicely specced card. I suspect it’ll need replacing, dammit.

Update 28/11/2013: As per the comments I found another spare PCIe card (an ATI Radeon 3870) which works… in Windows. Not in OS X. Even the broken card partially works in Windows, but not at all in OS X.

A workmate pointed me to the Tony Mac x86 web site, where I found a good list of graphics cards compatible with OS X.

Thankfully however this specific machine is mostly used for Windows-only, so there’s no tearing rush. In fact Windows performance index thingy rates the ATI card slightly higher than the nVidia one.

One option is to buy the official Apple-supported Mac Pro video upgrade kit, an ATI Radeon HD5770, which is A$299. Despite the Apple site claiming it requires a post-2010 Mac Pro, plenty of sources indicate it’s fine with a 2008.

Update 2014-04-08: New video card bought and successfully installed

Low spec notebooks can’t handle large amounts of RAM

Cathy and I are seeing increasing contention for the grunty computer in the house not dedicated to playing computer games. It’s used for a combination of recreational programming, web surfing and media encoding tasks. We decided to acquire a second, and after comparing the costs decided that the premium for laptop portability wasn’t too great (about $100; in fact that seems to be about the price of the OS we were forced to buy with the hardware). In out usage profile, “grunty” isn’t defined by CPU, but responsiveness which really comes down to how often an arm has to venture out across a spinning sheet of rust. Unfortunately, bottom-end systems (i3 class CPUs) can’t handle our base-level RAM requirement of 16Gb, so yet again a portable computer is the most powerful thing in the house – the new system’s specs are:

Processor: AMD Quad-Core Processor A6-5200 (2.0GHz, 2MB L2 Cache)

25W of power consumption right there. Existing grunty computer pegs its CPU for about ten hours a year, in sustained encoding runs. We weren’t CPU bound, and yet the only way to get that RAM in an i3 lappy was to spend an extra $100 on a Toshiba with worse specs – so we got a quad core.

Memory: 4GB DDR3 1600MHz (max support 16GB)

That 4GB came straight out and was replaced by the most RAM that could be stuffed in there. Existing grunty machine had 8Gb and was paging a lot. Why are web browsers so memory hungry? This upgrade cost $160.

Storage: 500GB (5400RPM) Hard Drive

This came straight out before the machine was even powered up once. It was replaced by a Plextor M5-Pro 128GB SSD; this unit was selected for its fast random write speed, and the common-for-all-SSDs 0.1ms seek time. Back in the day (about ten years ago) I advocated that when building a machine, you should get drives with the fastest seek times and screw everything else, plus all the RAM you could afford – to use as disk cache. How little things change. This upgrade cost $129.

After Linux Mint 12.04 Maya (LTS) was installed (consuming 6Gb) there was 110Gb free on the replacement device. Paging has been disabled due to the SSD write limitations, and tmpfs is used for various directories to further minimise our impact on the longevity of the drive.

Graphics Card: Onboard (Integrated)

The contention for the memory bus is troubling, but at least there’s no extra juice being sucked down to power a fancy-pants GPU. This is not a gaming machine, 2D acceleration is useful, 3D not.

Operating System: Windows 8 64 Bit

That went with the rotating media. We’re going to see if we can boot a desktop machine off of it and still have the OS believe everything is okay. The laptop didn’t like the new OS, saying “Selected boot image did not Authenticate. Press Enter to Continue”, but the solution was to disable Secure Boot.

Screen: 15.6-inch diagonal HD BrightView LED-backlit Display (1366×768)

It took some fiddling for Cathy to figure out how to dim the damn thing under Mint. Turned out the answer was to install the proprietary AMD drivers.

Audio: Dual Speakers Stereo DTS Sound+

If you’re using a laptop for A/V reproduction, you’re doing it wrong.

Connectivity: Gigabit LAN (RJ-45 connector), 802.11b/g/n WLAN, Bluetooth

The Toshiba only had 100Mb, in this day and age! The Ralink wireless adapator wasn’t picked up automatically by the installer, so Cathy got down and followed the instructions off AskUbuntu

Built-In Devices: 1x USB 2.0, 2x USB 3.0, HDMI, RJ45 Ethernet, Headphone-out/microphone-in combo jack, SD/SDHC/SDxC Card reader

USB3 was important in picking the unit, as I’ve seem just how much faster it is. HDMI is necessary for twin-monitor development; MSY had a 21.5″ Full HD IPS on sale for $118.

Webcam: HP TrueVision HD Webcam with integrated dual array digital microphone

I’d just paint over it, but there’s a chance that we’ll have a use for videoconferencing. It stays, but it better mind it’s Ps and Qs or else it’s black electrical tape for it.

Optical Drive: DVD Burner

Yeah, like that’s ever getting used.

Weight: 2.33 Kg

I’m more used to computers that weigh 1Kg, not two and a half.

Dimensions: 56cm (L) x 13cm (W) x 34.5cm (D)

This thing has a widescreen display, it’s freaky big compared by my 10” netbook.

Other observations: the keyboard sucks balls, with the trackpad positioned such that you physically can’t touch-type on it because doing so places your palms on the trackpad, moving the mouse and screwing up your input (I think this is happening because gestures have been turned on; they might find themselves getting turned off again). For some messed up reason they’ve included a numeric keypad, so touch-typing is doubly hard – again with the palms. This thing’s going to find itself plugged into a USB hub with a real keyboard and mouse quite a lot I think.

Anyways, the HP Pavilion 15-E001AU was purchased from MLN for the low, low price of $500. Total system cost was $907, and at the end we had a 4GB lappy stick and a 500GB lappy drive laying around.

Mac Pro: RAM Red light

We got a second secondhand Mac Pro recently, and I was mucking about over the weekend with it. At one point, after taking out the RAM to clean inside, I noticed it seemed to think it only had 2Gb instead of 4Gb. (I’ve got another 4Gb on order.)

Then I noticed the flashing red light from where the RAM is plugged-in. PANIC TIME!

No, wait, calm down. But a quick Google found the solution, and I stopped panicking: Switch off, pull out the RAM, unplug the modules and plug them back in, push it back in. Reboot.

All good.

Of course, if it had still been flashing after that, then I’d definitely start panicking.

By the way, I still love the Mac Pro build, and how easily accessible the components are. I wonder if the new Mac Pro will be as good?

Windows Vista: Could not connect to the System Event Notification Service

M's laptop got the above error after rebooting during a Windows Update.

The error itself appears just after entering the username and password. And the big problem is it then doesn’t logon, but just freezes up.

Doing a bit of Googling finds quite a few instances of this error, but usually on Windows 7. One notable thing: the problem means non-Admin users can’t logon, but Admin users can. But the other info around the place didn’t really seem relevant.

So I logged in as an Admin user, and while looking through the Event Log to try and find out what happened, I noticed Windows Update said there were 3 more Important Updates to go.

I let them go in, and then rebooted. Fixed.

Yeah I could keep digging to better identify the cause, but the problem’s resolved for now, and I’ve got better things to do.

So my conclusion (in the absence of any other information) is that this weekend’s Windows Updates somehow require an Admin user to logon to complete… and if not, they leave the SENS service unable to start, possibly as well as other issues that prevent non-Admin users logging on.