Associate VS2017 with JSON files

Double-clicking a JSON file to try and open it in Visual Studio 2017 Professional doesn’t work; VS2015 worked fine. This link explains how to fix for the Community edition. The same principle applies for VS2017.

Using regedt32 first find the Visual Studio magic number:

Key: Computer\HKEY_CLASSES_ROOT\.json\OpenWithProgids
Value: VisualStudio.json.a8eb385c

2017-10-19 08_32_54-Registry Editor

 

Then find the associated shell key and create a new sub-key ‘Command’ with the path to devenv.exe as the default value:

Key: Computer\HKEY_CLASSES_ROOT\VisualStudio.json.a8eb385c\shell\Open\Command
Value: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"

2017-10-19 08_34_27-Registry Editor

 

Right-clicking a JSON file and selected Open with now looks like this:

2017-10-19 08_37_22-Sphere

 

Advertisements

VS2015 Update 2 VC.DB git mayhem

So today, after updating Visual Studio 2015 to Update 2, I was committing some changes to a project. Nestled amongst my own changes, deleted files, and new files, was a new VS2015 file, AOX3.VC.db (AOX3 is the name of my solution). This file is the new database engine and replaces (I believe) the SDF file. In Update 1 this was an experimental feature, but as of update 2 it’s official:

The new SQLite-based database engine is now being used by default.

I inadvertently added the file to my local git repository and then committed the changes.(I did the same thing on a couple of other projects, and made several more modifications and commits afterward).

The problem is, this file shouldn’t be in git, especially because it is around 150MB !

I only realised I had a problem when I tried to sync to my online (remote) repository, hosted by VSTS – luckily the attempt failed. The Synchronization panel had the following error message:

Failed to push to the remote repository. See the Output window for more details.

The output window had the following details:

Error encountered while pushing to the remote repository: Error while copying content to a stream.

Inner Exception:

Unable to read data from the transport connection: The connection was closed.

After a bit of googling I found I had to resort to the nuclear option to fix the problem.. deleting the file from the local git commit history.

Here’s what I did:

1. In VS2015 find the first commit that included the file. To do this I went to the Sync panel on the Team Explorer page and found the outgoing commit, then double-clicked it to see the commit details:

 

Screen Shot 2016-03-30 at 20.25.24.png

Screen Shot 2016-03-30 at 20.27.43.png

2. Note the parent commit ID of the first commit that included the new file (shown above, 645faa8c), then close VS2015.

3. Run a git bash shell in the solution folder. Then use the filter-branch command to delete the file from the last two commits. This required specifying a range of commits from the parent of the first commit all the way up the HEAD (the latest commit). This means noting the parent commit ID of the first commit that included the new file – as shown in the above screenshot. Here’s the git session:

jon@DESKTOP-0J37S2C MINGW64 /c/dev/Projects/Amber/AOX3 (dev_jon)
$ git filter-branch --tree-filter 'rm -f AOX3.VC.db' 645faa8c..HEAD
Rewrite 2fa87507296744092c2ac8b0c300b8c5973276ef (1/2) (0 seconds passed, remain
Rewrite 2917e9beea5ec0f546538345e33bd01586d359fb (2/2) (15 seconds passed, remaining 0 predicted)
Ref 'refs/heads/dev_jon' was rewritten

4. Open VS2015 and check the commits.. now the added/modified database file has disappeared from the list of changes:

Screen Shot 2016-03-30 at 20.35.52.png

5. I then edited my .gitignore file and added *.VC.db, then committed this mod and finally checked everything synchronized.. all worked as expected !

 

I guess the moral of the story is: don’t be flippant when adding new files, especially those you don’t recognize as your own. As the filter-branch documentation states:

This occurs fairly commonly. Someone accidentally commits a huge binary file with a thoughtless git add ., and you want to remove it everywhere.

This thoughtless programmer signing off, time to sleep 😉

 

 

JSON editing in Visual Studio 2013 – tip!

Just installed VS2013 on a clean Windows 10 virtual machine, noticed I wasn’t getting the same JSON editing experience I had on my previous VS2013 installation. The colour coding and auto-completion features were missing.

Solved the problem by modifying the installation and including the Microsoft Web Developer Tools:

W10_Dev

Now the editor uses colour coding, auto-completes the various brackets, and highlights errors.

Standing desk (ikea hack)

I’m starting my third week of standing, rather than sitting, at work. There’s been much written on this subject and I’m not 100% sure that it’s the right long term solution but so far I feel more focussed and less like a 12-hour-a-day slob.

My office already had some Ikea Expedit shelves on the wall, and I’d tried converting my table into a simple standing desk. But the table was around 6 inches too low and due to it having just four very extended legs it was also quite wobbly.

2013-12-03 09.15.08

Then I saw this excellent Ikea Hack for an Expedit Standing Desk.

My hack is a variation on the above desk system; I strengthened the front 5*1 unit by retaining the first and last internal panels – this had the advantage of providing a bit more storage as well. The wall shelves came down and formed sides to the desk, and now it’s starting to feel pretty cool (this being day 2 of this configuration).

I modelled the system on Google Sketchup:

i1 i2 i3 i4

Then I built it, and here it is:

2013-12-16 18.37.43 2013-12-16 18.38.12

Once I can lose the bits and bobs on the floor and tidy up the shelves it’s going to be super cool.