Corrado's Blog 2.0

Online thoughts of a technology funatic

Learning Git with Visual Studio #8

It’s inevitable, you or someone in your team make some changes and code doesn’t work as it should anymore and so is important to understand what has changed, when it has changed and maybe even who and why he made that change.
Since the team uses Git is easy to compare different commits and visually see what differs between them.
Let’s go to git history, let’s select the commits we want to compare and select Compare Commits…

image

Inside Team Explorer tab we’ll see a detail of what has changed including all files

image

Double clicking any of listed files I can see what has changes inside that file

image

Same result can be reached by selecting the file in solution explorer, right click, View History and then Compare

image

Of course is not necessary to Commit a file in order to compare it, you can compare any modified or staged file by just right clicking it and select Compare with unmodified menu

image

Of course comparison can be done between different branches as well

image

If you want to in deeper detail about changes related to a file, we can use the Blame (annotate) option, let suppose we did some changes to Program.cs  and we want to know who (and what) has changed that file, just select the file and select the menu Blame (Annotate)

image

A new window will open containing the content of the file and on the left the list of commits that changed those lines

image

To know what had been changed in a commit just click the commit, the changes tab inside Team Explorer will open, right click the file and select Compare with previous menu.

image

No rocket science here, but a feature used quite often during normal dev life Smile

Fix Xamarin Form compilation errors

I’ve recentily repaved my development machine and installed Visual Studio 2017 adding nearly all features including, of course, Xamarin and all subsequent updates.
Today I’ve tried to create a blank new Xamarin Forms project targeting .Net Standard for the common part but as soon as I tried to compile it I got a strange sequence of errors on Android project:

error APT0000: 1: error: Error retrieving parent for item: No resource found that matches the given name ‘Theme.AppCompat.Light.Dark
error APT0000: 2: error: Error: No resource found that matches the given name: attr ‘colorAccent’.
error APT0000: 1: error: Error: No resource found that matches the given name: attr ‘colorPrimary’.
error APT0000: 1: error: Error: No resource found that matches the given name: attr ‘colorPrimaryDark’.
error APT0000: 1: error: Error: No resource found that matches the given name: attr ‘windowActionBar’.
error APT0000: 3: error: Error: No resource found that matches the given name: attr ‘windowActionModeOverlay’.
error APT0000: 1: error: Error: No resource found that matches the given name: attr ‘windowNoTitle’.
error APT0000: 3: error: Error retrieving parent for item: No resource found that matches the given name ‘Theme.AppCompat.Light.Dial
error APT0000: 3: error: Error: No resource found that matches the given name: attr ‘colorAccent’.

Totally nonsense for me.
After a chat with my friend Laurent we’ve discovered that problem depends on missing installation of Android SDK 24 (Nugat 7.0) after installing it using the new SDK Manager (via Tools->Android->Android SDK manager) problem was gone.

Cause probably depends on referenced packaged used in default templates that no longer support Android Marshmallow (6.0) the version that gets installed by default by Visual Studio.

Fix “No Internet Connection” issue

A couple of days ago, some applications like Skype, Skype for Business, Outlook stopped working due to a “can’t connect” problem, the only way to make them work was to enable corporate VPN, since I was busy didn’t take care of it and just used the VPN.
This morning, same problem, and so I went to the “VPN trick” to get over it but this time it wasn’t working and after a few minutes I lost the entire interner connectivity on my main machine.
Think you know that no internet connectivity at these days is more or less like a boot disk failure so i started trying nearly everything from reboot, to driver updates, going through wired connection, using tethering etc but got no luck.
I then decided to compare what ipconfig was telling me on two different machines and i discovered a “little difference”, my wifi card was having the Autoconfiguration Ipv4 address set to a weird “169.254.X,Y” no idea of where that address was coming from but I thought that it could be the origin of my problem.

I the started looking for a solution and, voilà, two magic commands solved my headache…

1) Open command prompt as admin
2) type netsh int ip reset +enter
3) type netsh winsock reset + enter
4) reboot your machine

In my case it worked, hope it will be the same for you that you’ve reached this post probably because you have the same problem as me.

Good luck!

Change x:Bind default binding mode

Recent release of Windows 10 introduced Complied Bindings, an type safe alternative to {Binding} syntax that add compile time checking and better performances, it can also be used in place of ElementName to bind to a UI element property.
In order to squeeze performances the default binding mode of compiled bindings is OneTime, this means that any further change of bound property after initial one won’t get propagated to bound UI property, and this, personally, is one of the most annoying things because i often use properties whose value changes and everytime i spend time figuring why they don’t before remembering of this different behavior.

To give you an example, let’s take this simple ViewModel

Page code behind

and page markup

if you try this code you will see that value doesn’t change when you click the button, this is because of default OneTime binding.

While you can change the behavior by adding Mode=OneWay to the Count binding, if you have many bindings and you’re targeting Fall Creators Update you can use the new attibute DefaultBindingMode

The plus of using this attribute is that it changes the default binding mode to all compiled bindings contained in the element where it is applied (and all childrens) saving a lot of time.

Nice! waited a long for this Smile

Joining IBV

image

Effective June 1st, after nearly 14 years as independent consultant I’ve joined the Swiss based company IBV as Senior Software Development Engineer, decision comes from the great work and career opportunity the company offered me just at a time when I was felting the need for new working stimuli.

How this is going to change my life? not much indeed I’ll probably have to visit Switzerland more often and enjoy beautiful landscapes like this while driving to work

image 

and focus more on Natural User Experience (like Surface Hub and Hololens)

image image

The initial days I’ve spent in the near Zurich based office were really enjoyable, I’ve smelt the typical ‘startup’ like energy even if the company is now 35 years old.

Another unexpected surprise was to discover that one of my new colleagues was my good old friend Alessandro Teglia who also joined as Chief Digital Officer.

It was when the company’s boss, just after signing the contract, gave me this talisman, that I realized I did one of the best decision in my life and I thank fate for this.

image

Last but not least, my “boss” (well, sound strange for me to call it “my boss” Smile) Gian Paolo Santopaolo, who is not only a great professional (and MVP like me) but also very great cook, he can do little food masterpieces in minutes.

Regarding my community commitments, nothing changes, I’ll try to blog more about my new job (BTW: follow our company twitter account https://twitter.com/IbvSolutions) and, as usual, I’ll spread my technology passion as I always did in the past.

I wish you all to work in a lovely place as IBV, it’s just there and fate will certainly let you find it, just don’t give up searching.

image

Using Word 2013 as blog post editor

Never been a huge fan of Windows Live Writer, and since there’s no WinRT version yet, I am trying to use Word 2013 as blog post editor.
Having Word full editing power is awesome, and it looks like that it works really well with my WordPress blog.

There is nothing hard to use Word 2013 as editor with WordPress, just use [your blog url]/xmlrpc.php as url together with your credentials and you’re done! J

MVP again!

I’ve been renewed as MVP for 11th year in a row, I still keep the email i got in 2003 when i was awardee for the 1st time, as always, October 1st has become a special day for me.
I wish to thanks Microsoft and my lead Alessandro Teglia (@alead on twitter) for recognizing my efforts in community space.

Welcome to version 2.0

Welcome to my new home, relocation is not yet complete, still missing some pieces of furniture and paintings, but at least it is habitable :)
Ok, let’s keep moving things…