Monday, February 5, 2018

getLongestStr (javascript)

function getLongestStr(strArray) {
    if (!strArray || !(strArray instanceof Array)) return '';

//create object holding the string lengths as keys and the corresponding host element index in the strings array
var obj = {};
for (var i = 0; i < strArray.length; i++)
var str = strArray[i];
obj[str.length] = i;

//get the max length, use it as the object indexer, getting the strings array element index with the greatest length
var indexOfGreatestString = obj[Math.max(...Object.getOwnPropertyNames(obj))];
return strArray[indexOfGreatestString];

Sunday, February 4, 2018

Adding files and folders to a click once installation

Having trouble in adding specific files to your click once installation ? Morover, you want them to be placed under a specific folder ?

Here are the steps I followed that finally did it:

  1. You need to create the folder/file structure just like you want it to exist in your installation - in your visual studio project. For example, I needed two folders - x86 and x64, and the same  SQLite.Interop.dll under both
  2. Right click in your project, go to the Publish tab, then click in Application Files. Scroll down (they should be showing as the last items) to your added files, and make sure you change the Publish Status from Include (Auto) to Include. 
Should work now.


Thursday, February 1, 2018

Did you change your SVN ip and your Jenkins jobs are now failing? svn: E200015: No credential to try

Did you change your SVN ip and your Jenkins jobs are all failing now, even after your updated any ip references in the job configuration (stored at config.xml) to the new one ?

You may be missing this. This is was the missing bit that solved the problem for me.

In a short:

  1. Make sure you indeed changed all the old ip references in the config.xml to the new one (something I did before finding the article above, meaning this alone will not do it)
  2. Make sure you also update the ip in all credentials referencing the old ip.
  3. Restart jenkins
Your job should successfully complete now.

Saturday, January 20, 2018

Exe icon is missing in custom Build Configurations after Visual Studio build

If you add custom build configurations to your solution, make sure you manually add, for all of them, the ApplicationIcon element with the proper .ico file in the .csproj file of the main project.

  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Development|x86'">

Wednesday, January 10, 2018

C# DateTimePicker ValueChanged event being triggered more than once, without any Value explicit assignments taking place

I spent at least an hour in investigating this issue, even adding a timer object to my form to debug.writeline the value of my datepicker objects periodically so I could have a sense of when the problem occurs.

As I noted [here], in the end my problem was with setting the MaxDate property of both parameters, to the same DateTime object. Noting this down here in case it may be of public help...

Thursday, December 21, 2017

Microsoft web architectures of the day: Web Forms vs MVC vs Web API

I was tasked today with finding out what is the best pick to convert our desktop application into a fully web based one.

Came across the 2 following links, which I found very good, where I think most of the essential topics are covered.

Wednesday, December 6, 2017

Having problems setting 2 panels in a windows form, where one is top-docked and the other fill-docked, but the fill-docked one is overflowing into the top one ?

Play with the panels "send to back" / "bring to front" (mouse right click).