Tools

KeePass – A tool to collect your passwords

https://keepass.info/

 

GIT – Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

https://git-scm.com/

 

ConEmu – terminal window where you may host any console application

https://conemu.github.io/

 

RDCMan v2.7 –  tool to manage remote connections

 

Notepad++ – powerfull but simple editor

https://notepad-plus-plus.org/

 

Rider  – IDE for .Net developers

https://www.jetbrains.com/rider/

 

7-Zip

https://7-zip.org.pl/

 

Adobe Acrobat Reader DC

https://get.adobe.com/pl/reader/

 

Ditto – It is an extension to the standard windows clipboard. It saves each item placed on the clipboard allowing you access to any of those items at a later time. Ditto allows you to save any type of information that can be put on the clipboard, text, images, HTML, custom formats, …..

https://ditto-cp.sourceforge.io/

 

SQL Complete – Extenstion to Microsoft SQL Management Studio

https://www.devart.com/dbforge/sql/sqlcomplete/

 

Screenpresso – captures your desktop (screenshots and HD videos) for your training documents, collaborative design work, IT bug reports, and more…

Screenpresso is a NEW Light-weight screen grab tool with built-in image editor, user guide generator and sharing options.

https://www.screenpresso.com/

 

Foxe – It loads big files (multi-megabyte) fast and lets you format XML and edit HTML and any loosely formed XML or other markup. The tree view is editable and customizable for useful navigation.

http://www.firstobject.com/dn_editor.htm

 

Configure mergetool for git – kdiff3

Download kdiff3
Official site
Run the commands in git:


git config --global merge.tool kdiff3
git config --global mergetool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
git config --global mergetool.kdiff3.trustExitCode false

git config –global diff.guitool kdiff3
git config –global difftool.kdiff3.path “C:/Program Files/KDiff3/kdiff3.exe”
git config –global difftool.kdiff3.trustExitCode false

ASP.NET MVC – Custom CheckBox as Solution of “String was not recognized as a valid Boolean”

 

In case when you use Html.CheckBox(“IsNew”) the MVC render the html:

<input checked="checked" id="IsNew" name="IsNew" type="checkbox" value="true" />

<input name="IsNew" type="hidden" value="false" /> 

You can notice that there are two input element with identical name. Internet browsers does not send any value for checkbox if it is not checked. It is the reason why there is hidden input with value false. It work fine when you use POST form, but if you use GET form you see that a redirect url will be looked like this:

www.someurl.com?IsNew=true?IsNew=false 

and some links on a site can generate IsNew params like this:

www.someurl.com?IsNew=true,false

After use this link you can get the exception: String was not recognized as a valid Boolean,  because can not convert “true,false” to bool value. 

To solve the problem you can use the code:

<input type="checkbox"  id="IsNew-checkbox"  checked="checked" />     

<input type="hidden"  id="IsNew" name="IsNew" value="true"  />  

<script language="javascript" type="text/javascript" > 

  $('#IsNew-checkbox').click(function () {

      if ($('#IsNew-checkbox').is(':checked')) {

          $('#IsNew').val('true');

      } else {

          $('#IsNew').val('false');

       }

  });

 

</script>  

I used JQuery library to write the javascript snipet.

The above code you can transform to HTML helper and use it like this:

<%
   1: : Html.CustomCheckBox("IsNew",(bool)  ViewData["IsNew"]) 

%>

The code of the helper:

public static class Helpers

{

       public static MvcHtmlString CustomCheckBox(this HtmlHelper helper, string name,bool selected)

       { 

           string input;

           

           input= string.Format(@"

              <input type=""checkbox""  id=""{0}-checkbox""  {2} />     

                  <input type=""hidden""  id=""{0}"" name=""{0}"" value=""{1}""  />  

               <script language=""javascript"" type=""text/javascript"" >

                     $('#{0}-checkbox').click(function () {{

                         if ($('#{0}-checkbox').is(':checked')) {{

                             $('#{0}').val('true');

                         }} else {{

                             $('#{0}').val('false');

                          }}

                     }});

                 </script>  

               ",

                name,

                selected?"true":"false",

                selected ? "checked=\"checked\"" : "");            

 

           return MvcHtmlString.Create(input);                            

       }

 }

kick it on DotNetKicks.com

How to install WindowsService?

 

To install WindowsService you can use the follow ‘bat’ code:

@ECHO OFF

 

REM The following directory is for .NET 2.0

set DOTNETFOLDER=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727

set PATH=%PATH%;%DOTNETFOLDER%

 

echo Installing your Service...

echo ---------------------------------------------------

InstallUtil /i ServiceFile.exe

echo ---------------------------------------------------

echo Done.

You have to create the .bat file and locate it in your application folder. the “ServiceFile.exe” you have to replace on yours application file name.

IMPORTENT! To run this code on Vista you have to run the code as administrator.

 

The uninstall code look like this:

@ECHO OFF

 

REM The following directory is for .NET 2.0

set DOTNETFOLDER=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727

set PATH=%PATH%;%DOTNETFOLDER%

 

echo Uninstalling your Service...

echo ---------------------------------------------------

InstallUtil /u ServiceFile.exe

echo ---------------------------------------------------

echo Done.

Custom list giving fill in Xaml – WPF

Recently time I wanted to create UserControl with list property. What’s more I wanted to have possibility add elements in Xaml.
It is the solution snippet code:

 

public List<SchoolTypeEnum> Types 

{ 

    get 

    { 

        return 

        (List<SchoolTypeEnum>)(GetValue(SchoolChooser.TypesProperty)); 

    }   

}

 

public static List<SchoolTypeEnum> GetTypes(DependencyObject obj) 

{ 

    return (List<SchoolTypeEnum>)obj.GetValue(TypesProperty); 

}

public static void SetTypes(DependencyObject obj, List<SchoolTypeEnum> value) 

{ 

    obj.SetValue(TypesProperty, value);

}

// Using a DependencyProperty as the backing store for Types. This enables animation, styling, binding, etc... public static readonly 

DependencyProperty TypesProperty = 

    DependencyProperty.RegisterAttached("Types", 

    typeof(List<SchoolTypeEnum>), typeof(SchoolChooser), new 

    UIPropertyMetadata(new List<SchoolTypeEnum>()));

 

 

<c:SchoolChooser > 

    <c:SchoolChooser.Types> 

        <e:SchoolTypeEnum>IZ</e:SchoolTypeEnum> 

        <e:SchoolTypeEnum>UZ</e:SchoolTypeEnum> 

    </c:SchoolChooser.Types> 

</c:SchoolChooser>