Monthly Archives: May 2016

Serialize Object to JSON in C#

 public static void WriteToJsonFile<T>(string filePath, T objectToWrite, bool append = false) where T : new()
        var contentsToWriteToFile = JsonConvert.SerializeObject(objectToWrite, new JsonSerializerSettings
            Formatting = Formatting.Indented,
        using (var writer = new StreamWriter(filePath, append))

References :

Python UUID

>>> import uuid

>>> # make a UUID based on the host ID and current time
>>> uuid.uuid1()

>>> # make a UUID using an MD5 hash of a namespace UUID and a name
>>> uuid.uuid3(uuid.NAMESPACE_DNS, '')

>>> # make a random UUID
>>> uuid.uuid4()

>>> # make a UUID using a SHA-1 hash of a namespace UUID and a name
>>> uuid.uuid5(uuid.NAMESPACE_DNS, '')

>>> # make a UUID from a string of hex digits (braces and hyphens ignored)
>>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')

>>> # convert a UUID to a string of hex digits in standard form
>>> str(x)

>>> # get the raw 16 bytes of the UUID
>>> x.bytes

>>> # make a UUID from a 16-byte string
>>> uuid.UUID(bytes=x.bytes)

References :

Build libcurl static library on Windows

Download the latest curl generic source from:
Extract the source to a local directory (we’ll be using C:\libcurl)
Open a command prompt
“C:\Program Files (x86)\Microsoft Visual Studio 15.0\VC\bin\vcvars32.bat” To initialize your VC environment variables (adjust your VS 2015 installation directory as needed)
cd C:\libcurl\winbuild

nmake /f mode=static VC=14

The build should appear in C:\libcurl\builds\libcurl-vc14-x86-release-static-ipv6-sspi-winssl

References :