Click here to Skip to main content
15,881,715 members
Home / Discussions / Free Tools
   

Free Tools

This forum is for discussing and recommending Free tools for software development. Please post direct links to tools, and not just links to pages that review or list tools.No shareware and no commercial products allowed. Please report spammers by voting to remove their messages and reporting their accounts.

 
GeneralRe: Reverse Debugging? RevDeBug - quite a cool thing Pin
Andreas Saurwein19-Dec-22 2:29
Andreas Saurwein19-Dec-22 2:29 
GeneralBackup / Restore SQL Databases without the need of SMO Pin
Charles T. Blankenship30-Oct-19 7:02
Charles T. Blankenship30-Oct-19 7:02 
GeneralRe: Backup / Restore SQL Databases without the need of SMO Pin
Richard MacCutchan30-Oct-19 7:04
mveRichard MacCutchan30-Oct-19 7:04 
GeneralFree suite to handle video files Pin
phil.o28-Sep-19 22:33
professionalphil.o28-Sep-19 22:33 
GeneralFree NuGet Components Pin
MSBassSinger16-Jul-19 11:16
professionalMSBassSinger16-Jul-19 11:16 
GeneralRe: Free NuGet Components Pin
Richard MacCutchan16-Jul-19 21:26
mveRichard MacCutchan16-Jul-19 21:26 
GeneralRe: Free NuGet Components Pin
MSBassSinger17-Jul-19 1:11
professionalMSBassSinger17-Jul-19 1:11 
AnswerJHelpers README Contents Pin
MSBassSinger17-Jul-19 12:59
professionalMSBassSinger17-Jul-19 12:59 
JHelpers
========

JHelpers is a .NET Standard 2.0 library component that can be used with any .NET
project, whether Core or Standard, on any supported OS to access SQL Server. It
is a library of generally useful methods and functionality that can save a
developer from writing code to accomplish these mundane tasks – or worse, have
several versions of a method that does the same thing written in multiple
places. JHelpers is used in my JDAC and JLogger NuGet packages for that very
reason.

ContextMgr
----------

ContextMgr is a thread-safe singleton that can be used to store data in a single
place accessible from anywhere, and any thread, in the application. One typical
use is to store settings and other runtime values so their sources (file,
database, etc.) only have to be read once. Anything that can be defined as a
unique String name and a value or reference type of any kind can be kept there.
Values are added as a String key name (which must be unique) and any value or
reference type, boxed as a dynamic type.

ContextMgr has no initialization, and as a singleton, does not use “new” to be
created. The actual instance is dynamically created on the first reference in
the code.

Code Example

C#
Boolean retVal = false;
ContextMgr.Instance.ContextValues.Add("Computer Name", Environment.MachineName);
ContextMgr.Instance.ContextValues.Add("Startup Time", DateTime.Now);
IPAddress[] ips = Dns.GetHostAddresses("BubbaComputer");
ContextMgr.Instance.ContextValues.Add("IP Addresses", ips);
dynamic machineName = "";
retVal = ContextMgr.Instance.ContextValues.TryGetValue("Computer Name", out machineName);
dynamic startupTime = "";
retVal = ContextMgr.Instance.ContextValues.TryGetValue("Startup Time", out startupTime);
dynamic hostAddresses = null;
retVal = ContextMgr.Instance.ContextValues.TryGetValue("IP Addresses", out hostAddresses);

In your application’s shutdown code, I recommend adding this line so the
ContextMgr disposes of its resources without waiting on the .NET garbage
collector.

C#
ContextMgr.Instance.Dispose();


CommonHelpers
-------------

This is a static class with a number of useful static methods.

### Extension Methods

C#
String GetFullExceptionMessage(this Exception ex2Examine, Boolean getDataCollection, Boolean getStackTrace)

This Exception object extension returns error messages from the parent exception
and any exceptions down the stack, and optionally, the data collection. The
Exception.Data collection is used to store name-value pairs that typically
record runtime values or other significant data for debugging.

C#
Boolean Contains(this String source, String toCheck, StringComparison strComp)

This String object extension allows string comparison type on the string to
check. The extension method returns true if it the toCheck string is in the
source string, false if not.

C#
Int32 ContainsHowMany(this String source, String toCheck, Boolean ignoreCase = false)

This String object extension gets the count of how many times a give string
occurs within another string. The extension method returns a Count of 0 to n
occurrences.

C#
Boolean ConvertToBoolean(this String valueToExamine, out Boolean isBoolean)

This String object extension to convert a string, assumed to be in a format that
can be converted, to a Boolean value. Recognizes as true (case insensitive)
true, on, yes, up, ok, good, 1, -1. Recognizes as false (case insensitive):
false, off, no, down, not ok, bad, 0. If the conversion fails, false is
returned. Check the isBoolean out value to see if the conversion detected a
Boolean value. If it is false, the value was not converted.

C#
Boolean IsBoolean(this String valueToExamine)

This String object extension tests a string, assumed to be in a format that can
be converted, to a Boolean value. Recognizes as true (case insensitive) true,
on, yes, up, ok, good, start, 1, -1. Recognizes as false (case insensitive):
false, off, no, down, not ok, bad, stop, 0. If the conversion fails, false is
returned. Otherwise, true is returned.

C#
Boolean IsOnlyDigits(this String testString, Boolean includePeriod = false)

This String object extension checks for all characters being digits. Conversion
functions to test numbers may translate letters as Hex values. includePeriod is
set to true if the one and only period is to be treated as being a number, so
that decimal number strings can be handled properly.

C#
String GetOnlyDigits(this String testString, Boolean includePeriod = false)

This String object extension gets all digits in a string and ignores any
non-digits. If includePeriod is true, then the first period in the string will
be included in the results.

C#
String GetOnlyLetters(this String testString, Boolean includeSpace = false)

This String object extension gets all letters in a string and ignores any
non-letters. However, if includeSpace is true, then any spaces found are
included in the return value.

C#
String GetOnlyLettersAndDigits(this String testString, Boolean includePeriodAndSpace = false)

This String object extension gets all letters and digits in a string, and
ignores all else, with the exception of periods and spaces when
includePeriodAndSpace is true.

C#
Boolean IsOnlyLetters(this String testString, Boolean includeSpace = false)

This String object extension checks for all characters being letters. If
includeSpace is true, then spaces are accepted as if they were letters.

C#
Boolean IsOnlyLettersAndOrDigits(this String testString, Boolean includePeriodAndSpace = false)

This String object extension checks for all characters being only letters and
numbers. If includePeriodAndSpace is true, then all periods and spaces are
treated as if they are letters.

C#
Boolean IsEmailFormat(this String email)

This String object extension checks the string to see if it is a valid email
format. It does not check whether it is a valid, working email.

C#
DateTime GetDateTime(this String dateString, DateTime dateDefault)

This String object extension converts string to date, or returns the default
value.

C#
Decimal GetDecimal(this String numberString, Decimal decimalDefault)

This String object extension converts string to decimal value, or returns the
default value.

C#
Int32 GetInt32(this String numberString, Int32 integerDefault)

This String object extension converts string to an Int32 value, or returns the
default value.

C#
Int64 GetInt64(this String numberString, Int64 integerDefault)

This String object extension converts string to an Int64 value, or returns the
default value.

C#
Object GetDefaultValue(this Type t)

Generic extension method that returns a default value for the type, if one
exists. This is useful in generic instances where default\<t\> may not work.

### Helper Functions and Properties

#### Enum

C#
DistanceUnitsOfMeasureEnum
Unassigned = 0,
Miles = 1,
Kilometers = 2,
Feet = 3,
Meters = 4


This is used with geolocation to specify the units of measure for distance.

#### Class

C#
AddressGeoData
Double Latitude1
Double Longitude1
Double Altitude1
Double Latitude2
Double Longitude2
Double Altitude2
Double LinearDistance (value is calculated, not set)
DistanceUnitsOfMeasureEnum UnitsOfMeasure;

##### Class Constructor

C#
AddressGeoData(Double pLatitude1, Double pLongitude1, Double pAltitude1, Double pLatitude2, Double pLongitude2, Double pAltitude2, DistanceUnitsOfMeasureEnum pUnitsOfMeasure)


##### Class Methods

C#
void SetUnitsOfMeasure(DistanceUnitsOfMeasureEnum lngUnitsOfMeasure)
void SetLinearDistance(Double dDistance)

This class is used to store two geolocations specifying the latitude, longitude,
and altitude. The units of measure determine the units corresponding to the
LinearDistance value. Altitude may be 0 if not known or not wanted.

C#
String RowDelimiter
(Get only)
This value can be applied to the value for a constant. RowDelimiter is the same
non-printable ASCII character used in teletypes and other devices to indicate a
new row, and not likely to be seen in string data.

C#
String ColumnDelimiter
(Get only)
This value can be applied to the value for a constant. ColumnDelimiter is the
same non-printable ASCII character used in teletypes and other devices to
indicate a new column, and not likely to be seen in string data.

C#
String TableDelimiter
(Get only)
This value can be applied to the value for a constant. TableDelimiter is the
same non-printable ASCII character used in teletypes and other devices to
indicate a new table of data, and not likely to be seen in string data.

C#
String FullComputerName
(Get only)
Gets the full computer name that DNS will recognize in any domain

C#
String GetDNSName(String pComputerName = "")

Gets the DNS host entry table name for a given computer name. Pass in any
computer name. If left blank or null, the current computer name will be used.

C#
String CurDir
(Get/Set)
Gets or sets the fully qualified path of the current working directory. For
services, the current directory via normal means shows the Windows System32
directory because the service runs under an exe located there. This property
accounts for that by using one method call for running in the IDE, and another
for running compiled.

C#
Boolean AmIRunningInTheIDE
(Get only)
This method will return true if this project, or any project that calls this
component as compiled code, is running under the IDE. This method returns false
if no IDE is being used.

C#
Boolean IsInDomain()

Returns true if the computer running the code is in a domain. False if it is
not.

C#
String GetComputerDomainName()

Returns the Domain which the computer is joined to. Note: if user is logged in
as local account the domain of computer is still returned. Returns a String with
the domain name if it's joined, or an empty String if it isn't.

C#
String GetFullComputerDomainName()

Returns the full domain name instead of the alias.

C#
Boolean IsDaylightSavingsTime(DateTime dtmToTest)

True if the datetime supplied falls within the period of Daylight Savings.

C#
Boolean IsDaylightSavingsTime()

True if it is currently daylight savings time.

C#
String CurrentTimeZoneDaylightName
(Get only)
Name of the current time zone for daylight savings.

C#
String CurrentTimeZoneName
(Get only)
Name of the current time zone, regardless of daylight savings.

C#
Int32 Asc(String strChar)

Same functionality as the VB6 ASC function - give it a character, get back the
ASCIII decimal number.

C#
String Hex(Int32 lngValue)

Same as the VB6 function. Converts a 32 bit integer to a String hex value.

C#
Int32 GetCurrentCPUUsage()

Gets the current % processor time

C#
Int32 AvailableRAMinMB()

Returns available RAM MBs

C#
PingReply Ping(String strHostName, Int32 lngTimeout)

Pings the specified server. Returns a PingReply instance indicating whether or
not the operation was successful.

C#
void GetLinearDistances(ref List<AddressGeoData> objAddressList)

This function uses the Haversine formula to calculate linear distance between
two sets of latitude and longitude, with an adjustment for the earth's radius
based on the latitude. Haversine is used instead of Vincenty’s formula to keep
the computation simpler and less processor intensive. This function takes a List
of address geo data instances and processes them, updating the individual class
instances in the List for the linear distance property.

C#
Double GetLinearDistance(double Latitude1, double Longitude1, double Altitude1, double Latitude2,
double Longitude2, double Altitude2, DistanceUnitsOfMeasureEnum lngUnitsOfMeasure)

This function uses the Haversine formula to calculate linear distance between
two sets of latitude and longitude, with an adjustment for the earth's radius
based on the latitude. Haversine is used instead of Vincenty’s formula to keep
the computation simpler and less processor intensive. This overload allows the
caller to specify what units of measure is desired for the return value.

C#
Double GetLinearDistance(Double Latitude1, Double Longitude1, Double Altitude1, Double Latitude2, Double Longitude2, Double Altitude2, Boolean UseMiles)

This function uses the Haversine formula to calculate linear distance between
two sets of latitude and longitude, with an adjustment for the earth's radius
based on the latitude. Haversine is used instead of Vincenty’s formula to keep
the computation simpler and less processor intensive. This overload allows the
user to choose between miles and kilometers (UseMiles param)

C#
Double GetLinearDistance(Double Latitude1, Double Longitude1, Double Latitude2, Double Longitude2,
DistanceUnitsOfMeasureEnum UnitsOfMeasure)

This function uses the Haversine formula to calculate linear distance between
two sets of latitude and longitude, but without providing altitude (all
calculations assume linear over the curve of the earth at sea level) with an
adjustment for the earth's radius based on the latitude. Haversine is used
instead of Vincenty’s formula to keep the computation simpler and less processor
intensive. This overload allows the user to choose what unit of measure.

C#
Double RadianToDegree(Double Coordinate)

Converts radians to degrees

C#
Double CelciusToFahrenheit(Double DegC)

Converts Celsius to Fahrenheit

C#
Double FahrenheitToCelsius(Double DegF)

Converts Fahrenheit to Celsius

C#
String StringToBase64(String String2Convert)

Convert String to Base64

C#
String Base64ToString(String ByteString64)

Convert Base64String to String

C#
List<ManagementObject> GetNetworkPrinters()

Gets a list of network printers using one ManagementObject instance per printer
in a List object.

C#
void SetIntBitValue(ref Int32 intValue, Int32 bitPlaceValue, Boolean setBitOn)

Helper method to set bit value of an Int on/off.

C#
Boolean GetIntBitValue(Int32 intValue, Int32 bitPlaceValue)

Helper method to get the state of a bit value of an Int.

C#
String GetStackInfo()

This gets the module, function, line number, and column number info in a String.
This is useful when logging and creating exceptions to define exactly where
something occurred.

C#
String GetStackInfo(Exception ex)

This gets the module, function, line number, and column number info in a String
based on an exception. This is useful when logging and creating exceptions to
define exactly where something occurred.

C#
String GetFullDateTimeStampForFileName(DateTime dtmDate)

This returns a String with a consistent datetime format for a filename.

C#
Boolean IsFileText(out Encoding lngEncoding, String strFileName, Int32 lngNumCharactersToRead)

Detect if a file is text and detects the encoding.

C#
Int32 GetTotalHDDFreeSpace(String pDriveName)

Returns MB of free disk space

C#
Int32 GetTotalHDDSize(String pDriveName)

Returns MB of total space

C#
Int32 GetMinPasswordLength()

Returns the minimum password length from a domain, if one exists. If no domain
exists, -1 is returned.

C#
Boolean IsIPAddress(String pValue, out IPAddress pIPValue)

Checks to see if a string is an IPv4 or IPv6 address, and returns an IPAddress
object as an out parameter.

C#
String AssemblyTitle
(Get only)
Title of the .NET assembly.

C#
String AssemblyVersion
(Get only)
Version of the .NET assembly.

C#
String AssemblyDescription
(Get only)
Description of the .NET assembly.

C#
String AssemblyProduct
(Get only)
Product description of the .NET assembly.

C#
String AssemblyCopyright
(Get only)
Copyright string used by the .NET assembly.

C#
String AssemblyCompany
(Get only)
Company that owns the .NET assembly.

C#
Boolean WriteToLog(String logFileName, String mainMessage, String secondMessage)

Method that performs a log write where the file is tab delimited and has a
column header line.
GeneralRe: JHelpers README Contents Pin
Richard MacCutchan17-Jul-19 21:19
mveRichard MacCutchan17-Jul-19 21:19 
AnswerJLoggers README Content Pin
MSBassSinger17-Jul-19 13:34
professionalMSBassSinger17-Jul-19 13:34 
AnswerJDAC README Contents Pin
MSBassSinger17-Jul-19 14:26
professionalMSBassSinger17-Jul-19 14:26 
GeneralVisual studio image library Pin
HumourStill10-Jul-19 18:38
HumourStill10-Jul-19 18:38 
GeneralRe: Visual studio image library Pin
Andreas Saurwein7-Jan-20 21:53
Andreas Saurwein7-Jan-20 21:53 
GeneralLooking for Recent Article on Backup Utility Pin
Patrick Skelton9-Jul-19 21:37
Patrick Skelton9-Jul-19 21:37 
GeneralRe: Looking for Recent Article on Backup Utility Pin
Simon_Whale14-Jul-19 21:56
Simon_Whale14-Jul-19 21:56 
GeneralRe: Looking for Recent Article on Backup Utility Pin
Patrick Skelton14-Jul-19 22:46
Patrick Skelton14-Jul-19 22:46 
GeneralRe: Looking for Recent Article on Backup Utility Pin
Simon_Whale14-Jul-19 22:48
Simon_Whale14-Jul-19 22:48 
GeneralRe: Looking for Recent Article on Backup Utility Pin
Nelek17-Jul-19 10:46
protectorNelek17-Jul-19 10:46 
GeneralRe: Looking for Recent Article on Backup Utility Pin
Patrick Skelton17-Jul-19 22:00
Patrick Skelton17-Jul-19 22:00 
NewsAsmSpy: Your Next Must-Have Tool If You Write in C#, VB, or F# Pin
David A. Gray2-Jul-19 5:00
David A. Gray2-Jul-19 5:00 
GeneralLooking for timer tool that works with TFS 2018 Pin
May16892-Jul-19 1:02
May16892-Jul-19 1:02 
QuestionRe: Looking for timer tool that works with TFS 2018 Pin
Maciej Los2-Jul-19 5:52
mveMaciej Los2-Jul-19 5:52 
AnswerRe: Looking for timer tool that works with TFS 2018 Pin
May16892-Jul-19 10:00
May16892-Jul-19 10:00 
GeneralStackblitz: do web dev in your browser, free Pin
raddevus24-Jun-19 4:27
mvaraddevus24-Jun-19 4:27 
GeneralRe: Stackblitz: do web dev in your browser, free Pin
Richard MacCutchan24-Jun-19 4:56
mveRichard MacCutchan24-Jun-19 4:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.