Tuesday, June 3, 2014

Microsoft HTTPAPI/2.0 use Port 80 – Cannot Start WAMP Apache

Stop the SQL Server Reporting Services

How to check if a byte array is a valid image?

public static bool IsValidImage(byte[] bytes)
{
    try
    {
        using (MemoryStream ms = new MemoryStream(bytes))
            System.Drawing.Image.FromStream(ms);
    }
    catch (ArgumentException)
    {
        return false;
    }
    return true;
}

Convert int to guid in C# and SQL Server

C#
public static Guid Int2Guid(int value)

{
    byte[] bytes = new byte[16];
    BitConverter.GetBytes(value).CopyTo(bytes, 0);
    return new Guid(bytes);
}
SQL Server

CAST(CONVERT(BINARY(16), REVERSE(CONVERT(BINARY(16), 13))) AS uniqueidentifier)

How to change screen orientation in android emulator?

Ctrl+F12  or Num 7 is the keyboard shortcut.