Tutorials, tips&tricks, snippets..




Using European VAT Verification SOAP Service

EU created a service to obtain confirmation of the validity of the VAT identification number of any specified person. This service works with SOAP and can validate all the EU VAT. You just need to send the state code and the VAT.

Continue reading “Using European VAT Verification SOAP Service”


Traceroute an IP and list the hops using C#

This code snippet perfoms traceroute (“tracert command”) an IP and allow you to know all the hops with some infos, like hostname, reply time address and other stuff.

Below the code.
Continue reading “Traceroute an IP and list the hops using C#”

C#: right pad an array

Here there is a code snippet showing how to right pad an array (in this case, a byte array).

public static byte[] ByteArrayLeftPad(byte[] input, byte padValue, int len)
    var temp = Enumerable.Repeat(padValue, len).ToArray();
    for (var i = 0; i < input.Length; i++)
        temp[i] = input[i];

Here you can find how to left pad an array.

Wait Until A Condition Is True (and not stuck the CPU!!)

Sometimes the need arises to wait for a condition or property to become true, this is especially useful for unit / integration tests. The System.Threading namespace contains SpinWait which will enable use to enter a condition that we want to wait on to see if it becomes true.

Continue reading “Wait Until A Condition Is True (and not stuck the CPU!!)”

HOWTO: close the TCP connection of other process calling Windows API

We know that TCPview, for example, can close the TCP connection for the other process without closing the process. So how to implement it? Suppose there is a process connecting to the a remote ip and port, how to terminate that connection?

Continue reading “HOWTO: close the TCP connection of other process calling Windows API”

Fast and useful hint to analyze your disk usage

Just click here and discover the power of WinDirStat. If you have a full disk to clean up, this will be your savior.

CopyDatabaseWizard version error

This morning I found this annoying message in Event Viewer of my machine where I have a SQL Instance:

Activation context generation failed for “c:\program files (x86)\microsoft sql server\120\Tools\Binn\managementstudio\CopyDatabaseWizard.exe”.Error in manifest or policy file “c:\program files (x86)\microsoft sql server\120\Tools\Binn\managementstudio\CopyDatabaseWizard.exe” on line 8. The value “1.0” of attribute “version” in element “assemblyIdentity” is invalid.

A quick solution is:

Continue reading “CopyDatabaseWizard version error”

What is the difference between Public, Private and Protected?

We always see the Access Modifiers in our code, but do we really know them?

Continue reading “What is the difference between Public, Private and Protected?”

Extension Methods #4: check if object has a property

We have a lot of confortable methods ready to use in our .NET objects and this is wonderful: just think for example the method .toString()! How much do we use it? But, sometimes, these methods aren’t enough and we need to create others on our own.

Continue reading “Extension Methods #4: check if object has a property”

Powered by

Up ↑