Subscribe via RSS

Visual Studio 2017: Error Deploying to Raspberry Pi 3

Any chance you've just opened up sample code to deploy an ARM-based project to a Raspberry Pi and you get this error?

DEP6100 : The following unexpected error occurred during bootstrapping stage 'Connecting to the device 'IP ADDRESS OF PI'.': 
MissingMethodException - 'Microsoft.Tools.Connectivity.RemoteDevice.Ping()'

Did you just install the Windows 10 SDK? My first recommendation is to reboot your machine! ...but actually, you don't really have to do that. Just restart visual studio. And yes, I know you closed it when you were installing the SDK... for some reason even opening it up straight after didn't work. A second restart of just VS2017 worked fine.

Also.. the default screen resolution is wrong on the PI when with a 7" 800x480 LCD. It really screws with the touch-screen input. Thanks to this article, we only have to do the following:

$username = "administrator"
$password = "[YOUR PASSWORD]"
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, $securePassword

$pstimeout = New-PSSessionoption -OperationTimeout (1000*60*5)
Enter-PSSession -computer [IP OF RASPBERRY PI 3] -Credential $cred -ErrorAction Stop -SessionOption $pstimeout

Save the above as a script and run it in the PowerShell ISE.

[IP IF MACHINE]: PS C:\> SetDisplayResolution.exe 800 480
Set Display Resolution and Orientation

replace line: gpu_mem=32                  # Set VC to 32MB, ARM DRAM to (1008-32)MB
append line: hdmi_mode=87
append line: hdmi_cvt=800 480 60 6 0 0 0
append line: lcd_rotate=0
Success! - You now need to reboot the device
use "shutdown -r -t 0"

Reboot!

10May/180

How to convert XML into a class the easy way!

An on-the-side project, that's been going for quite a while now, extracts data from a remote service. For a very long time, this was done via reverse-engineered Java code, of which I then wrapped my own console app around. All worked very well until they changed the login service request format and stopped using the Java altogether.

The new version was just HTML and json and, but the actual payload of the data I cared about was XML. Yes, that's right, XML in a string via JSON. Who would'da thunk? Regardless of the insanity, I was still itching to parse it.

So, the usual Json to C# class generator was used to build the de-serialisable class for the initial packet. I then needed a quick and smart way to convert the XML into a class.

Turns out that there is also an XML to C# converter! Paste in your XML blob and, if correctly formatted, it'll return a class that the XML can be de-serialised into!

And, it worked perfectly. Well, nearly. There was one gotcha! The XML class I was decoding had one field called Text. This is not a valid name inside a deserialised class in C#. So call it a different name in the class but override it via an attribute, as per below.

[XmlRoot(ElementName = "g", Namespace = "http://www.w3.org/2000/svg")]
public class G
{
        [XmlElement(ElementName = "rect", Namespace = "http://www.w3.org/2000/svg")]
        public List<rect> Rect { get; set; }
        [XmlElement(ElementName = "text", Namespace = "http://www.w3.org/2000/svg")]
        public List<textitem> Texts { get; set; }
        [XmlAttribute(AttributeName = "fill")]
        public string Fill { get; set; }
        [XmlAttribute(AttributeName = "stroke")]
        public string Stroke { get; set; }
        [XmlAttribute(AttributeName = "transform")]
        public string Transform { get; set; }
        [XmlAttribute(AttributeName = "text-anchor")]
        public string Textanchor { get; set; }
        [XmlElement(ElementName = "g", Namespace = "http://www.w3.org/2000/svg")]
        public G[] subG { get; set; }
}

Those watching trains on maps in Australia have the above site to thank for the speedy recovery of the service :)

4Apr/180

Resetting Windows 10 Passwords

Sure, this isn't something a normal person should be doing, but this scenario required it. I'd just fixed a friend's laptop, or I thought I had, until I got a call 2 weeks later saying there were password issues again. Instantly I thought I'd screwed the BIOS up, but this time it turned out to be an entirely different error!

DSC 0243

Oh shit... who the hell are LizerdSquad? Is that a typo? Not many google results for this cute little hack. I asked my friend if he'd opened any suspicious emails lately and body-language told me 'yes'. Anyway... google to the rescue. Top Password has a good article on using Kali Linux to reset such a password.

I found a blank USB key and created a bootable drive of the base Kali Linux i386 'light' image.

iso2disc

Booting was easy enough... ESC to select the USB key as the boot device.

DSC 0244 DSC 0246 DSC 0247

DSC 0248

Or was it? After choosing 'forensic' mode, the system tried to boot until I was simply presented with a blank screen. Seems my video driver isn't supported? Fail-safe mode worked... but then I didn't have the chntpw command on the terminal! No amount of 'su' or 'sudo' got the tool. Does the 'forensic' mode mount other disks to provide the toolkit?

Trying a different approach...

Keep fighting Kali? Better just use this: A bootable ISO of the chntpw tool. And it worked perfectly! I burned it to the USB key using the 'MBR' option via the same tool as above. From startup, it booted straight into console mode. Whilst loading it even went further to find and diagnose the Windows partition.

DSC 0253 DSC 0254 DSC 0255

This laptop has a single user and a simple windows setup, so the default options were all correct already! Very nicely programmed. I chose through to clear the password and ... bingo!

DSC 0257

Don't worry about the 'tmp' error on the final save.

DSC 0258

Mission accomplished. Rebooting the machine just gave me a 'sign in' button instead of password entry box and we were at the desktop!

14Mar/180

Replacing the BIOS in an HP 250 G5 Laptop

After visiting the flea markets in Melbourne a lot, I've made quite a few friends. These include fellow shoppers and the odd store-holder. One of these store-holders at Oakleigh, in the South East of Melbourne, pulled me aside 3 weeks ago to ask if I was any good at repairing technology.

I hesitated at first... I love repairing (and breaking) my own things... but I am not so sure of destroying other people's equipment. Anyway, the issue was a laptop BIOS password that could not be bypassed. I mean, how hard could it possibly be?

The Laptop

This was to be a slow process. The markets are only held every Sunday and I was pretty busy during the week, so I could only pick the unit up the next weekend. Turns out the problem child was a run-of-the-mill HP laptop which, as soon as powered on, asked for a Power On Password.

DSC02317

DSC02318 DSC02319 DSC02320

A quick google showed that a visit to BIOS Password Recovery for Laptops would help. All I had to do was paste in that magic code (enter three wrong passwords) and receive the master password. Unfortunately, passwords beginning with an 'i' just can't be done like this!

A Call To Support

For all intents and purposes, HP support online is actually fantastic. I was quickly informed that this unit was out-of-warranty and a real call to the telephone support would be required. I quickly tried the 'online chat' support first and the system was actually really helpful. They take in your details and then attempt to throw you to their own KB articles.

Fortunately, my problem was impossible to fix online... otherwise everyone would just be getting past this security measure making it not-so-secure. I was then asked to provide the original invoice, a letter indicating the postal address of the owner and a hand-written note from the owner requesting a formal password reset.

Unfortunately, the owner could not produce the original invoice. The item was purchased online a long time ago and he had been unable to get it printed again. From my point of view, the online retailer was definitely not going to help me. There would be too much back-and-forth... I therefore googled a little further and realised there was another way to solve this problem.

Hardware Hack

This is my specialty. Why bother with the to'ing and fro'ing when you can just crack the machine open and replace the BIOS chip. I mean, usually these things are slotted... so how hard can it be?

DSC02322

Oh shit... It's a tiny 8-pin SMD IC just near the metal shielding and it's nicely soldered in place.

DSC02326

You'll find pre-flashed BIOS chips for sale on eBay. This one came from Latvia and even had the very latest BIOS installed. It came with a great set of instructions too.

DSC02329

Remove the current chip. I know, I know... I said above that I'm not down with wrecking other people's hardware... but here I got frustrated trying to remove this chip and just cut the legs. It's the easiest method and well... I would've been screwed if it didn't work!

DSC02330

From here, tin the pads and then place the new chip in place in the correct orientation! Then just tap the legs with the soldering iron and set the item in place.

DSC02331 DSC02336 DSC02338

And then... apply power!

DSC02339

Yes yes... as per the instructions, the CMOS settings need to be saved. When past the screen above, his ESC and then F10... set the date/time and then go to the final menu and save.

DSC02341

Well shit... it just worked! Now to clean it up and hand it back.

16Jan/180

Windows 7 doesn’t boot after installing on Hyper-V

Thanks to my fresh windows 10 install, I had to re-install Hyper-V. No real issues... made a new machine and booted a Win7 ISO. All well... installed quick... reboot just gave me a black screen with a flashing cursor.

Googling came up with this link... Lots of rubbish replies... but there was another one of those gems. Those one-liners that save the world.

Boot your installation media and go to command prompt via recovery, it said. Just type the following, it said:

bootsect.exe /nt60 all /force

And, well, shit... it worked perfectly.

2Jan/180

Windows 7 64-Bit to Windows 10 Upgrade Error

New year, new OS install. Windows 10 was lagging badly and took around 20 minutes to boot... sure... it was probably PLEX just trying to checksum 4TB of media, but I was sick of it. So, fresh install of Win7 on that 1TB SSD I installed into my previous Vaio. All went well with Windows 7, apart from crappy installation media... but upgrading to Windows 10 took a lot of effort.

Actually, Windows 7 had enough trouble with its own updates. I think that, nowadays, due to the sheer amount of updates that'll try and download and install (at once) on a fresh Windows 7 installation, it's nearly impossible to have them actually all install and succeed.

Therefore the windows updates process took around 10 reboots, with the progress counter getting to 70% and unwinding with an error... but each time more updates would succeed, so it just seemed that they needed intermittent reboots which aren't automated.

Anyway, once I finally had a Windows 7 desktop with an who-knows-how-successful SP1 install, I did the lovely accessibility Windows 10 update. I am hard of seeing, you see?

I came straight away into this error...

win-10-up-err

The program can't start because api-ms-win-core-libraryloader-l1-1-1.dll is missing from your computer. Try reinstalling the program to fix this problem. Re-installing what program? I'm running an installer! :)

After a large amount of googling... I stumbled across a one-liner in this post. Someone briefly mentions swapping wimgapi.dll from your c:\windows\system32\ folder into the c:\windows10upgrade folder... it then just worked!

win-10-up-ok

Well.. I hope it will... at least it's installing...

15Dec/170

Windows 7 Setup asks for a CD/DVD Drive Device Driver

I have gotten a little sad recently. My Windows 10 machine now takes 10 good minutes to get to a usable desktop. Sure, Plex is trying to wrangle 4TB of media and ... well ... there's 3 other years of crap on the main partition ... but it's now beyond a joke.

To get anywhere near back to normal, I'll need to re-install the licensed version of Windows 7 and follow the standard sneaky upgrade path.

I therefore grabbed the installation disk and booted from it. Not too far in and I was already at a road-block. Excuse the image quality... my ultra-wide screen doesn't like the installers basic 4:3 resolution!

DSC01547

A required CD/DVD drive device driver is missing? Ok.. sure... maybe you don't like the RAID setup in this Dell Precision T3500. I proceeded to kill 20 minutes rebooting to a usable desktop and trying to guess what drivers to download and install... I grabbed a myriad and burned them all to a CD. Rebooting, I swapped this in and tried to load the INFs.

DSC01549

Wait... Windows Setup can see the hard drives it's supposedly missing? Wait... it can also see the DVD drive?... wait... what's going on here? What's it actually complaining about? Ohhhhhhhhh... it hates the installation media? Why didn't you just say that the first time?

I then re-burnt the DVD at a slower speed (as per instructions) and got a little further...

DSC01553

Finally... I found a real DVD (DL RW Disc)... burnt it... all worked. Moral of the story? Use proper DVDs. Maybe DVD+R as the DVD-Rs that I burnt above were totally unreliable!

30May/173

MINI VGA2HDMI Converter Issues

I bought this converter on eBay to get my Dreamcast plugged into my new TV which does not have VGA input. All worked really well during the first fortnight of usage.

DSC00026

4+ weeks into usage saw really bad performance from the device: screen distortion, black screens, incorrect resolutions and really crappy sound.

DSC00027 DSC00028 DSC00030

Wiggling plugs had minimal effect, so it was time to pop it open. There isn't much to these things as it's all SMD and on a single board. I couldn't see any (overly) bad soldering or problem spots, so I guessed it would be heat causing the issues.

DSC00032

I improvised a makeshift heatsink and the device started operating perfectly once more.

DSC00035

It actually occurred to me that, since I was powering the device off the TV's USB port, the device had been powered up each time the TV was on; not just when the Dreamcast was on. I assume these things just aren't built rugged enough to be used 100% of the time?

Anyway... I can only recommend to all that you pop open your devices and put heatsinks inside them for stable usage!

28Mar/170

Javascript numbers with leading zeroes

Here is yet another public service announcement. I've recently been coding times for this post to track train timetables. Whilst doing so, I had the times in my array fully padded out to make everything easier to read.

i.e. for the southbound passenger timetable, I had the following:

var southbound_pax = [
    0530,0611,0633,0703,0714,0725,0733,0743,0752,0808,0823,
    0830,0841,0859,0917,0928,0944,1006,1029,1053,1109,1128,
    1148,1209,1230,1251,1309,1327,1348,1409,1427,1448,1512,
    1532,1550,1607,1618,1631,1651,1709,1726,1737,1754,1808,
    1818,1831,1844,1902,1915,1925,1937,1955,2014,2029,2050,
    2102,2121,2143,2208,2227,2255,2349
];

All of my testing had been done after 10am, so everything worked fine. This morning I get in and check the timings and it's all really wrong. I whipped up a quick test as I'd seen strange values in the arrays.

> var number_array = [0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, 0008, 0009, 0010, 0011, 0012];

> number_array
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 9, 10]

Wait, what?... we're good until 0009. Then it goes nuts? A heavy bit of googling produced this warning on w3schools:

Never write a number with a leading zero (like 07).
Some JavaScript versions interpret numbers as octal if they are written with a leading zero.

Ohh.... riiiight... some... Did anyone else know of this feature?
Effectively, if it's octal, then 0009 should throw an error, right? Not just silently work and then flip back to '8' at 0010. Grrr...

7Mar/170

Burning M27C256B EPROMs with a Willem

This is another public service announcement. I've just wasted around 3 weeks trying to burn an EPROM which shouldn't've taken more than 1 minute. I purchased a Willem Parallel Port 5.0 PCB burner from eBay (cheap, I know) and although I could happily read chips, I couldn't write them.

The settings were correctly configured for the M27C256B chips. You need 6.2v to write and 12.75v external. This means you can't use the USB to power. This PCB 5.0 is dual power, so it should've selected the correct source.

Every time I tried to burn I got the following error: Error at 0x000000 chip = 0xFF buffer = 0x58. Note that all three of those values would change, a lot. 0x24 and 0x46 were frequently seen yelling at me.

eprom burner

Turns out that the 'latest and greatest' version of the software doesn't select the correct power source. Downgrading to 0.97ja (as per the screenshot above works fine.)

So if you're getting the errors as I was above, then use the 'alternate' version that should be on the driver CD that you were provided with.