CRM 2016 installation

I was needing to prepare a CRM 2016 developer virtual machine, and i followed the instructions in this slideshare: but while installing SQL 2014 i got some alerts about the fact that SQL 2014 should not be installed on a domain controller, and after that no way to install CRM 2016: the setup was not finished and hanged.
So i tried to install SQL 2014 before the promotion of the server to a domain: this time the CRM setup, after the promotion to domain, was finished and the CRM site is working.

Categories: CRM

Windows 10 taskbar problems

Last July i updated my Windows 8.1 to 10, occasionally i noticed that on the taskbar was not present the alimentation icon; when was happening this problem Win 10 was not responding and i resolved the thing with a brute shutdown.
My installation is very slow to start, and i tried some operations; as a last resort yesterday i tried a registry defragmentation but this time the taskbar was dead: clicking on the start menu nothing, i was able to right clic the taskbar and change the properties.
From the other hand , the icons on desktop were working.
Before inserting the Windows 10 DVD and format, i tried to launch from Task Manager (fortunately i was able to right-clic the taskbar) an cmd console (Run New Task) with administrative privileges, and at the prompt:

sfc /scannow

Then i tried to reinstall all using PowerShell , launching powershell and inside the powershell prompt with the command:

Get-AppXPackage -AllUsers | Foreach{Add-AppxPackage -DisableDevelopmentMode -register "$($_.InstallLocation)\AppXManifest.xml"}

Some complains about the fact that some installed software was more recent than the registry version, but my taskbar is now working.
Ok, still slow to start…but my new notebook should be ready this week.

Categories: Uncategorized

String or binary data would be truncated

Doing an INSERT INTO a SQL Server 2014 table from a complex join with UNION i got this error.
There were many fields, very difficult to understand at a first sight where was the problem.
Fortunately in SQL Management Studio right clicking the database with Tasks->Import data i inserted the SQL with UNION in the Data Source, and the destination table in the Destination.
The curious thing: in SQL Management Studio the INSERT INTO failed and no records imported, the same operation in the SQL Server Import and Export Wizard instead succeed but with warnings, which are useful to understand which fields causes truncation:
01-03-2016 14-49-13

Categories: SQL Server, SSIS

Windows 10 Mobile update crash

On my Lumia 925, originally sold with Windows 8.1, i installed the official Windows 10: at a certain point i made an hard reset and the phone automatically downloaded Windows 10.
The hard reset was done when i was not able to install updates on the Windows 10 preview (from Windows Insider); now there were an update for the official Windows 10 ending for 107, if i remember well, but the phone was not able to complete the install.
I noticed that continuously tapping on the screen, in order to avoid the phone standby, the procedure was able to end, but after the reboot the screen showed 2 gears and then a big sad smile , as this ->     : – (
No way to reset hard or soft, at every reboot the gears and then after a few seconds the dreaded smile: i was already thinking to buy a new phone.
But i discovered the Windows Device Recovery Tool, that after the downloading of 1,65 gb installed a working Windows 8.1 on my phone; and then using the Windows Phone Developer Registration 8.1 (installed with Windows Phone SDK 8.1) i re-registered the device in order to publish on it my apps developed with Visual Studio 2013.
Thanks to Google sync i lost nothing of interest, but anyway i will be suspicious about updating the 925 to Windows 10..

Categories: Vs2013, WinPhone

Cannot resolve the collation conflict

Making an UNION between two SQL Server 2014 views i got the error

Cannot resolve the collation conflict between “SQL_Latin1_General_CP1_CI_AS” and “Latin1_General_CI_AS”

There are many fields, a problem.. fortunately there is an easy solution with

SELECT, col.collation_name
sys.columns col
object_id = OBJECT_ID('<yourview>')

With this query we get something as (fields name hidden for privacy):
01-03-2016 16-10-38
I tried with the first view and then with the another view in UNION, here is immediately visible which are the problematic fields (the few ones with another collation, in this case “Latin1_General_CI_AS”) .
Then for these fields we can add the collation, as in this case where there is also an CASE WHEN:

   'Not specified' COLLATE SQL_Latin1_General_CP1_CI_AS
END AS category

and the error is solved.

Categories: SQL Server

Microsoft Xamarin

Microsoft has acquired Xamarin.
Interesting project, but you must have a solid mobile business for each major environment (Ios-Android-Windows Phone): even for MSDN subscribers the editions are still not cheap, Xamarin Business is 799$ for developer.

Categories: Android, WinPhone

Firefox needs UTF8 for GeoXml3

I’m developing an WebAPI2 solution with Angular that receives, from Android devices, GPS points.
So Latitude , Longitude , Speed etc. are saved in a SQL Server 2014 table; from the web site the headquarter would follow the real time navigation.
The chosen approach was to write an KML file from the db data, and show this KML in a GoogleMaps window.
Having local files (not on another domain) the best solution is to use the GeoXml3 library, which is relatively easy to use (examples here and here).
For the javascript part, no problem: there is an simple setTimeout that calls via jQuery an WebAPI2 method that re-write the kml (the name is the record ID), and then adding an random number to the querystring the boss can follow the persons wandering somewhere, seeing the kml line that slowly progress on the map.
But there was an problem: On IE10 , 11, Chrome, Edge all ok; instead on Firefox (Windows or Ubuntu or Android tablet) no kml shown.
Sometimes the things are discovered in a very casual manner…i tried to save the KML with another name using Notepad++ , and change the code in order to not use the API call and instead try to show immediately this second file where i wanted to test some change, in order to understand what was wrong : bingo, KML immediately visible!
This was a real head scratching…the files (the generated from the system, and the one saved from the previous) in Notepad++ was absolutely the same, no visible difference.
So i tried to compare them with WinMerge and surprise, the generated file was full of strange characters before every normal character, immediately i realized “oops, the encoding?” and only after i noticed in Notepad++ that in the Encoding menu the file saved from Notepad++ itself was UTF8 encoded, and the one produced from the C# code was without encoding.
In the WebAPI2 method effectively i used Unicode: so now, all the browsers shows the KML writing the file as:

private async Task WriteTextAsync(string filePath, string text)
    //byte[] encodedText = Encoding.Unicode.GetBytes(text);
    byte[] encodedText = Encoding.UTF8.GetBytes(text);
    using (FileStream sourceStream = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.None, bufferSize: 1048576, useAsync: true))
        await sourceStream.WriteAsync(encodedText, 0, encodedText.Length);

2016, the Cloud era

Categories: Uncategorized

Regex grouping for automatic coding

Sometimes is requested to do ugly and repetitive tasks.
For example there were some .aspx pages where in a DataGrid was written the DataField for monthly columns, but not the HeaderText (i don’t know why..).
Copy & paste, ok only 13 columns: but a lot of .aspx pages.
So i thinked to an substitution using regular expressions.
Tipically we have a string delimited with a double quotation mark, that we can express as




Both are explainable as: the string begin with a ‘ or an ” , there could be an variable amount of chars or numbers and then there is a final ‘ ( or “)
The trick is in the parenthesis () , that isolates an regex group.
I use an old but valid tool, the Rad Software Regular Expressions Designer (the website is no more available), the basilar syntax is
If we introduce an group
We have surrounded with () the [“‘] expression, and there is a group ‘1’ referred to the char “.
The \1 is a regex reference to the first group (if you delete the parenthesis around [“‘] there is an error while evaluating the regex).
By using
We isolate the text between the ” couple.
Using the regex expression $<number> we can refer to these groups, so in Notepad++ i used
And for every DataField with the Replace All is created the HeaderText with the same month name.

Categories: RegEx, VB.NET

Get every new post delivered to your Inbox.