Tutorials, tips&tricks, snippets..


VIES: 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.

This service works within the VIES environment (VAT Information Exchange System)

Continue reading “VIES: using European VAT Verification SOAP Service”


How to fix Recovery Pending State in SQL Server Database

This problem happened to me after I killed the connections PID to one of my databases. The single user mode was removed, but I wasn’t able to use the database, since it was in the Recovery Pending mode. How to fix this problem?

Continue reading “How to fix Recovery Pending State in SQL Server Database”

SQL Server: exit single-user mode

My database was in Single User mode. I don’t know how it entered in this mode, but this causes a lot of problem with the database itself. For example, trying to expand the database, you get an error:

The database ‘my_db’ is not accessible.(ObjectExplorer)

Also, when trying to delete it, you get:

Changes to the state or options of database ‘my_db’ cannot be made at this time. The database is in single-user mode, and a user is currently connected to it.

How to fix this?

Continue reading “SQL Server: exit single-user mode”

Sql Server “Saving changes is not permitted”

When you create a table in SQL Server and save it, sometimes, if you try to edit the table design you get this error:

Saving changes is not permitted. The change you have made requires the following table to be dropped and re-created. You have either made changes to a table that can’t be recreated or enabled the option prevent saving changes that require the table to be re-created.

This can happen also if the table is a new empty table, never used.
Continue reading “Sql Server “Saving changes is not permitted””

Create a class from XSD file (and avoid signature error)

It happens to have a XSD file, for example to communicate with an exisisting web service.
I have to create a class (in this case, C# language) starting from a XSD file provived from server side. How to do it?

Continue reading “Create a class from XSD file (and avoid signature error)”

How to create a WCF from WSDL (and prevent errors)

Sometimes you need to create a WCF service starting from a WSDL giving to you the specifications. It is a good practice and quite simple to do.

Continue reading “How to create a WCF from WSDL (and prevent errors)”

SQL Server: check log size

To see how much MB your SQL Server log is, just run this query:

DBCC SQLPERF(logspace)

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.

Powered by

Up ↑