Home » C# Tips

C# equivalent to VB val() function

Although VB had it’s limitations, it was damn easy to filter an input string for a numerical value. Here is how to do it in C#. You’ll need to use System.Text.RegularExpressions in the header private static int VBVal(string…

Read More »

Image Editing in C# – Contrast

When attempting to get machines to process images you sometimes run into noise problems. Filters are regularly applied first to clean them up. Editing the contrast of an image changes its dynamic range. In its most basic form,…

Read More »

Image Editing in C# – Greyscale

I’m in the process of writing some code to detect the stars in astromical images. One of the filters I need to apply to an image is to convert it to greyscale. Conversion to greyscale is relatively straightforward…

Read More »

TLEs – Calculation of the Julian Day Number (JDN)

This post is part of a series on understanding the meaning behind the values contained in a Two Line Element set, or Keplerian Elements. The main article is here. Calculation of the Julian Day Number (JDN) Julian day…

Read More »

Code: Shortest distance between any two line segments

I recently needed to find the shortest distance between any two line segments in 3D space. I managed to find some C++ code online at http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm which I converted to C#. It’s fairly easy to use. If you…

Read More »

SHA256 and higher in SQL Server

As part of a new project I’m doing, I needed to use hashes. A good source of information on hashes is available from wikipedia. SQL has the built in function HASHBYTES but this only supports up to the…

Read More »