Moving Visual Studio Cross Platform Development to a new Machine

I upgraded my workstation for the holidays and needed to get things moved over as easily as possible.

In Visual Studio, under the tools menu, there’s an option to be able to Import and Export Settings… which got me an output file that made my new installation look mostly like my old installation.

What it didn’t transfer was the details of my connections to my Raspberry Pi devices. The following image is after I managed to get a working connection. It didn’t have anything displayed under Default Host Name etc.

I’d already run ssh-keygen on my new machine, creating a default security key on the local machine. I’d already connected via ssh to each of the hosts I regularly work on and imported the public key into the authorized_keys file and verified all appeared working.

After entering all of the details in the dialog box I got a rather unhelpful set of red boxes indicating that something had gone wrong. (192.168.0.66 and 192.168.0.67 are the same host, wired and Wi-Fi, on my local network, and I may use them interchangeably for images and text here)

Searching on the web I found that there is a console program that will configure the same thing, and I assumed correctly that I might get more descriptive error messages using the console than I was getting here. https://learn.microsoft.com/en-us/cpp/linux/connectionmanager-reference?view=msvc-170

**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.4.2
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************

C:\Program Files\Microsoft Visual Studio\2022\Enterprise>ConnectionManager.exe add visualstudio@192.168.0.66 --privatekey C:\Users\Wim\.ssh\id_rsa
Enter password (leave blank for no password):
Verifying connection with remote system.
Failed to add connection: Private key is invalid or is encrypted and no passphrase was given

I knew that the keys were good because I was using them to connect via SSH. I did some digging and realized that the physical file sizes on the new machine are larger than on the old machine. Looking at the length of the public keys themselves, I realized that my old keys were 2048 bits long, and the newly generated ones are 3072. I tried explicitly generating a new 2048 bit key with the command ssh-keygen -f id_rsa_2048 -b 2048 and using it, but I got similar results to what I was getting before. Finally, I copied my public and private key from the old machine and renamed them specifically for this usage on this machine.

C:\Program Files\Microsoft Visual Studio\2022\Enterprise>ConnectionManager.exe add visualstudio@192.168.0.66 --privatekey C:\Users\Wim\.ssh\id_rsa_visualstudio
Enter password (leave blank for no password):
Verifying connection with remote system.
The authenticity of host '192.168.0.66' can't be established.
ecdsa-sha2-nistp256 key fingerprint is SHA256:DGa1mVbMm3voQwVwtg06xHkANgs04zST9RP8CMfSoXY.
Are you sure you want to continue connecting (yes/no)? yes
Successfully added connection '1748855142;192.168.0.66 (username=visualstudio, port=22, authentication=PrivateKey)'.

That created the connection properly in Visual Studio. I went back into the Visual Studio interface, Tools->Options->Cross Platform->Connection Manager->Remote Headers Intellisense Manager and updated the headers and everything appears to be working now.

I don’t know why the keys I generated using the software on my new machine didn’t work, even when I specified the same number of bits.

Canon CanoScan LiDE 400

I’ve had a Canon CanoScan LiDE 210 for at least 7 years. One of the deciding factors when I bought it was that it used a single USB cable, with no need for a second power cable.

The 210 used a mini-usb cable, which was sometimes difficult to make sure it was inserted in the correct direction. I occasionally had problems with the software driving losing communication during a scan. I switched lengths of cable at various times, with shorter cables seeming to be more consistent, but never truly conclusive.

Recently the scanner stopped moving the scan bar back to the starting location before each scan. First it would leave the scan bar at the finish location, and move to the beginning position when I would start the next scan, but then that functionality stopped and it would only return to the start position when it was first plugged into the USB port. If I tried to scan a second page without unplugging the USB cable, the movement motor would make a nasty grinding sound as it tried to move the scanner further down the page, and would result in a messy black page in the scan results. It was especially frustrating if I was trying to create a multi page PDF.

I read several online reviews, and decided to get another Canon scanner. The reviews recommended saving $20 and getting the less expensive scanner, but from my reading, only the more expensive scanner used the USB C plug, which has the advantage that it can be plugged in either direction.

I found it fascinating how similar the new packaging is to the old packaging. The old box was designed with a carrying handle, while the new box is not. I expect that’s largely due to the predominance of mail order over retail purchase. The dimensions of the new scanner and the box are pretty much the same. The boxes can be stacked 13 high. The temperature range on the old one could go 5° to 35°C while the new one goes from 0° to 40°C. Each scanner lists a maximum 4800 dpi. The 210 reported 10 seconds per page. The 400 reports 8 seconds per page.

The new software is slightly nicer working with the most recent version of windows 10, but still nothing to be too excited about. My biggest issue is that the settings for the Auto button on the scanner will not allow me to specify it will always save a JPG file. I could do that with the old scanner software. Now, to make sure I always get the format I want I much launch the software and initiate the scanning from the PC.

Google Chrome Tab Search Button

Google Chrome recently added a tab search button to the title bar. When it was first enabled, it was possible to disable by going to chrome://flags and finding Enable Tab Search and changing it to Disabled.

A quick search of google will find multiple examples of how to disable it. Unfortunately in more recent versions of the browser, it no longer seems to be an available flag to disable.

I realized that my big issue with the drop down menu is it’s location, which Google has located on the left near the minimize button. Google has chosen to not have the traditional windows system menu on the left side of the title bar. The left side would be an ideal location for the tab management button.

Windows File Recovery from Microsoft

Last week Microsoft released a new command line tool in the Microsoft Store. It requires running Windows Version 2004.

Last year when I was importing pictures from a camera memory card, the import program crashed. It only managed to import a few of the pictures, but it deleted all of the pictures from the memory card.

Because of my long history understanding how file systems work, I knew that the pictures were likely still on the card, just not in the directory system I couldn’t find a tool at the time to recover the files. I’d put a label on the card and set it aside. As soon as I heard about this program I installed it and tried it out on the memory card.

The funny thing is that it recovered several thousand images, going back several years. I ran it in signature mode, looking for jpeg files. In doing that, It’s just looking at all the data blocks on the drive, looking for jpeg files.

This time I used Adobe Lightroom CC to import the images and group them by the embedded EXIF data. Looking at the details, the photos that got deleted by mistake were likely from 10/28/2018. All of the photos attributed to 06/29/2020 are missing exifdata, and are just recorded as the date they were recovered.

This is a good reminder that you probably don’t want to throw away old digital media, even when you think you’ve gotten rid of all incriminating data.

https://storebadge.azureedge.net/src/badge-1.8.4.js mspb(‘9n26s50ln705’, function(badge) { document.getElementById(‘mspb-yfhgln7xadp6’).innerHTML = badge; });

Retrieve Wi-Fi Password in Windows 10

Sometimes I go to a place I’ve been before and my computer remembers the WiFi password while my brain does not. The following Windows PowerShell commands will display most of the remembered passwords.

netsh wlan show profiles

netsh wlan show profiles name=’ProfileToDisplay’ key=clear

The first command displays all of the networks your computer has remembered. It can be rather long if you’ve had your computer for several years and done a reasonable amount of traveling and using WiFi in strange locations.

2019-11-27 (1)

The second command takes the profile name that you retrieved with the first command and displays details of the selected profile. The password is displayed as the Key Content section of the Security settings.

2019-11-27 (2)

Microsoft Surface Pro 4 Screen Flicker

My nearly four year old Microsoft Surface Pro 4 recently developed a screen flicker issue. I’m sure it was some driver update that was installed, but I’m not exactly sure when. The observed activity is that a horizontal section at the bottom of the screen about the same size of the mouse cursor flickers with data that is duplicated from the top of the screen. The rest of the screen appears to be bouncing up and down by one scan line, making the text nearly unreadable.

I searched online, and found references to flicker problems with some cases being purely hardware related and requiring replacement by Microsoft. I also found references to the problem only occurring after the screen data had not changed for a few seconds. This static screen problem matched my problem exactly.

I found a workaround by enabling the seconds display in the clock in the task bar. This is done by creating a registry entry. If the following is in a “.reg” file it will set the value to show the seconds on the clock.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"ShowSecondsInSystemClock"=dword:00000001

I read that the seconds are not enabled by default because it saves a bit of processing power, which can be important on battery powered devices. For me the difference is minimal and worth not spending more time researching a probable driver issue that may be taken care of automatically in some future windows update.

2019-10-04 (1)2019-10-04

I hope that this helps someone else. The screen flicker/jitter was annoying and I wasn’t able to find the root cause.

 

Access Windows share from Raspberry Pi

I have a shared directory from my windows server that I’d like to read and write from my Raspberry Pi. I want the share to be automatically available on my Raspberry Pi whenever both the Raspberry and the Windows server are running, but I don’t want the system to spend too much time hung up if the windows server is not available. My easy solution is below.

My Windows servername is Acid. The share I want to connect to is Web. The IP address of the server is 192.168.0.12.

sudo echo 192.168.0.12 Acid>>/etc/hosts
sudo mkdir --parents /media/acid/web
sudo echo username=WindowsUsername >/etc/wimsworld.smb.credentials
sudo echo password=WindowsPassword >>/etc/wimsworld.smb.credentials
sudo echo domain=OptionalDomainName >>/etc/wimsworld.smb.credentials
sudo chmod 0600 /etc/wimsworld.smb.credentials
sudo echo //acid/web /media/acid/web/ cifs credentials=/etc/wimsworld.smb.credentials,noauto,x-systemd.automount,x-systemd.idle-timeout=1min,_netdev 0 0>>/etc/fstab

That series of commands, with the correct details in the credentials, and the system automounter will automatically attempt to connect whenever there’s an access under /media/acid/web and then disconnect again after it’s been idle for over a minute.

I needed to add Acid to my local hosts file because the name doesn’t resolve from the DNS server the raspberry pi is using.

I put the windows Username/Password and Domain in a file with only read/write permissions to root so that it wasn’t clear text in the fstab file for anyone on the machine to read.

I did all of this on a machine that had been built from the Raspian Buster Lite image from 2019-07-10. I didn’t explicitly install the cifs-utils package. It might be needed on other distributions.

My new favorite WiFi Analysis Program

I recently came across WinFi Lite, and while it claims to be in beta and for professionals only, it’s currently my favorite WiFi analysis program.  The fact that it was in the Microsoft store gives me the idea that it will uninstall cleanly if I decide to get rid of it later.

2019-09-10

The default view shows details about both 2.4 and 5 GHz networks nearby. The first picture was what it looked like when I ran it in my local Starbucks on my Microsoft Surface 4 Pro.  The next picture was what it looked like when I ran it in my apartment. In my apartment I was connected to my network via wired ethernet, so the Surface WiFi adapter wasn’t being used for my active connection. At Starbucks, I was connected to the WiFi.

2019-09-11 (1)

While I was at Starbucks, the number of networks it could see was 188. That number is visible in the top right of the image. Just to the left of that number are a set of buttons that allow you to look at 2.4GHz, 5GHz, or All available networks.

My apartment showed only 161 networks by comparison, but that number was bouncing around as it rescanned in both locations. I was surprised that the Starbucks had so many visible networks. There are a lot of details available in this tool, and it’s current price makes it an interesting tool to work with. I used to like inSSIDer, but the developers choice to dumb down the free version led me to drift away from it.

iTunes, Microsoft Store, COM Interface Type Library

Several years ago I’d written a program to manipulate data in the iTunes library using the approved Apple COM API. Part of the way this works in a C program is to include a type library in the headers defining all of the function calls. When iTunes is installed in the traditional way, Apple embedded the type library in the executable, and the executable was installed in a traditional location.

#import "C:/Program Files (x86)/iTunes/iTunes.exe"
using namespace iTunesLib;

With the installation of iTunes from the Microsoft store, the iTunes executable no longer lives in that location. Today my application builds properly with the following import command, but it may change mysteriously with version changes and automatic updates via the store.

#import "C:/Program Files/WindowsApps/AppleInc.iTunes_12093.3.37141.0_x64__nzyj5cx40ttqa/iTunes.exe"
using namespace iTunesLib;

My program builds and runs more reliably than it used to, which I’m assuming is in part due to the fact that I appear to now be using a 64 bit version of iTunes, and all the extra work Apple put in to make iTunes more reliable on windows in general.

Finding the iTunes application itself was the hardest part of the transition. I’m happy the API still exists because Apple no longer hosts easy access to the documentation for the API, and http://www.joshkunz.com/iTunesControl/ seems to be the most complete and searchable information.

iTunes, Microsoft Store, Microsoft Surface

Last year, Apple finally worked enough with Microsoft to get the iTunes program for windows available in the Microsoft Online Store. I’d always had problems with upgrading iTunes in windows in the past, requiring me to completely uninstall, reboot, and install the new version each time I wanted to upgrade. Often I had to not just uninstall iTunes, but search for other helper programs that Apple might have installed and uninstall them before rebooting.  I did the complete uninstall before I installed the version from the Microsoft store. Since that time, iTunes has almost magically been up to date on my desktop computer. The Microsoft store updates seem to get installed in downtime on my computer and everything just works.

I’m stuck in my ways a bit as far as music goes. I’ve get a large ripped CD collection, that I keep the originals all in a set of binders including the original paper inserts. My iPhone has 256GB of storage, more than half of which is my music.

I’ve kept my iPhone synchronized with my desktop computer because of the storage requirements of all of the music in the past, but at times have wished I was synchronizing with my Microsoft Surface Pro 4 tablet that I travel with, and use just as much as my desktop. My Surface has 256GB of storage in the internal SSD, and I’ve been using a 256GB micro sd card in the accessible storage slot for the past couple of years. That’s good for movies while traveling, but I didn’t want to allocate over half the space to iTunes.

2019-03-11

The falling price of flash cards recently convinced me to buy a new 512GB flash card to leave in the Surface. I was able to get all of my music transferred over to the SD card and iTunes installed from the Microsoft Store with very little impact on the internal storage on my Surface. I followed the Apple support ducument and had a few issues because my library had never been consolidated from my early MP3 ripping days.

I’ve been running my Surface SSD with between 50 and 70GB free, which from what I’ve read about SSD usage is good for both lifespan and performance. The iTunes directory on my micro SD card consists of 24,169 files and 137,859,861,360 bytes according to a simple dir /s command.

All was looking good until I got around to connecting my iPhone to the new machine and telling it to backup on the new machine. The backup completed correctly, but I then found out that it had used up all the free space on my internal SSD and I was now down to less than 3GB free space.

A quick search on the web led me to this page explaining how to relocate the backups to an external drive in windows. That seemed good, until I realized that the directory described does not exist on my machine. One more change that seems to have happened to iTunes locations in the Microsoft Store move. A search on my machine led me to find the MobileSync directory in my user profile directory. I used robocopy to move the backup directory to an appropriate directory on my flash card, which took a while because it consisted of 58,623 files and 77,743,703,474 bytes. I then created a directory junction from the SSD location to the flash location.

robocopy /COPYALL /E /MOVE C:\Users\Wim\Apple\MobileSync\Backup D:\Wim\Apple\MobileSync\Backup
mklink /J C:\Users\Wim\Apple\MobileSync\Backup D:\Wim\Apple\MobileSync\Backup

After all that had completed I started iTunes and connected my phone, initiating another backup. Everything now appears to be working properly, with iTunes storing both it’s library and device backups on my secondary storage device.

The only drawback I’ve currently run into is that I use Windows Server Essentials 2016 as a home server and it’s device backup feature to backup my machine for emergency file recovery. The microsd card is recognized as removable media, and the backup software doesn’t easily let me include it in the regular backup strategy.