Thursday, May 18, 2017

mySQL Error Code: 3037 Invalid GIS data provided to function st_geometryfromtext.

If you have been trying to find what's wrong with your geometry objects and why your sql insert statement is failing, check this, which reveals the cause (congrats to all of us who went "as far as completing a BSc degree in computer science" (and how far is that?) and could yet miss this...).

I was startled because, in cloning some tables from one DB schema to another, I was facing this error. But how come values that do exist in one table cannot be inserted (are treated as invalid) in another ?

Later on I heard that this was a change made in later versions of mySQL. So I assume the records were inserted at the time this constraint was not there yet. And they must have kept existing data as valid for backward compatibility.

Tuesday, May 16, 2017

ILMerge errors (exited with code 1, could find dll, assembly has a value for its PeKind flag that is incompatible...)

After leaving very few spots in my head unscratched (I am environment-conscious, there are those who act with a bit less self restrain and throw their computers through the office's window), I came up with the following solution to ILMerge errors of all sorts. ILRepack is being developed to replace our endeared ILMerge, and although I am sure all of you keep deep feelings (feel free to make them public) about it, my solution was to:

  1. backup C:\Program Files (x86)\Microsoft\ILMerge\ILMerge.exe renaming it to, say, _ILMerge.exe 
  2. place a copy of ILRepack.exe 
  3. rename it to ILMerge.exe 
 And that's it. Rebuild your solution.
Yes, you are rid of ILMerge. Unbelievable.

Monday, May 8, 2017

Can't force MSBuild to use a different SDK Tools path

My scenario is: my build server, which uses Jenkins as the CI tool, runs on Windows 2008, which does not support the newer Windows 10 SDK. So I tried playing with both SDKToolsPath and FrameworkOverride msbuild command line parameters, but without success (although not the two together). I ended up trying a hack I thought of while the question from this thread (the link points to this very solution I posted there) - overwriting the lc.exe from SDK 7 with the newer LC.EXE from SDK 10. My build finally succeeded. Did not spot any side effects so far...

Thursday, May 4, 2017

Building VS projects via command line

An important thing to keep in mind when running msbuild providing properties (in the form of /p:[Key]=[Value]) (for instance, a list of properties useful in building clickonce applications can be found here) is (taken from MSDN):
Global properties are properties that are set by using the /property switch on the command line, or properties that are set by the integrated development environment (IDE) before a project is built. These global properties are applied to all projects that are built by using this Engine.
In other words, if you build a solution with 7 projects (1 start-up plus and 6, say, class libraries), and you provide the AssemblyName parameter like /p:AssemblyName=MyAssembly, you will end up with 7 assemblies with the same name, one with an EXE extension (depending on your project template) and the others with DLL. I, for instance, wanted to rename the final EXE file. Doing this using the approach above did not work for me because of the DLL name conflicts. My scenario uses Jenkins as the CI tool, and I ended up adding a Windows Batch command at the end of the process that renames the $PROJECT_NAME exe only.

Sunday, April 30, 2017

.NET built in function to convert string to into Title Case

Although a simple task, I was exposed today (here) to a built in function in the framework that does the job.

string title = "war and peace";

TextInfo textInfo = new CultureInfo("en-US"false).TextInfo;
title = textInfo.ToTitleCase(title); //War And Peace