Monday 14 August 2017

Displaying assemblies used by the application process

Today I am going to show how to print out assemblies used by the running application. This information may be useful for logs and can be collected on application/service start.

System.Diagnostics has Process class that I am going to use to get information about current process and its modules. 


Below is a snippet of the console application that prints out information to console.



Friday 31 March 2017

VB.NET - Validating InputBox Control

If you are working with the system that still uses InputBox control from MS VisualBasic then you may get a situation where the input needs to be validated. InputBox control does not allow any validation checks and in ideal case needs to be replaced with custom WinForms dialog box. This post will show a simple way of validating InputBox by creating InputBoxValidated function and using IStringValidator interface.


As you can see InputBoxValidated function uses IStringValidator interface that can implement any kind of string validations and criteria.


Below is an example of StringValidator class that implements IStringValidator interface and makes use of StringValidator from System.Configuration.


References:





Monday 30 January 2017

Creating self extracting zip EXE under Linux for windows

Recently, I had a need to create a self extracting zip archive, which will open on any windows machine. Because, I am using Linux, I did not want to go through the process of installing the windows with 7z on it just for a sake of creating that archive. I was expecting that the process will be not trivial, as some of internet resources show, but all turned out very simple. Peazip archiver available for Windows as well as Linux, which is able to create self extracting exe archive. I downloaded portable version for 64 bit machine and when creating a new archive you get an option to create self extracting file in a single volume or split by chosen size.



What I found, peazip creates small archives that extract under windows machine just fine. If you need to zip large amount of files say > 1 GB, I would suggest to create normal archive, which can span several files of set size and then use 7zip on windows computer to extract them.

References: