Tutorial by Examples

A switch is a command line argument which takes no value. It can be specified with: desc.add_options() ("hidden", po::bool_switch()->default_value(false), "Hide your name"); And used with: if (vm["hidden"].as<bool>()) std::cout << "Hello ...
Introduction: Swagger is a set of rules/specifications for a format describing REST APIs. It provides a powerful and actively developed ecosystem of tools around this formal specification like code generators and editors. The best part of Swagger is that the documentation of methods, parameters, an...
One useful feature of extension methods is that you can create common methods for an interface. Normally an interface cannot have shared implementations, but with extension methods they can. public interface IVehicle { int MilesDriven { get; set; } } public static class Extensions { ...
print "Hello World" import clr from System import Console Console.WriteLine("Hello World")
Introduces the definition of a union type. // Example is from POSIX union sigval { int sival_int; void *sival_ptr; }; Introduces an elaborated type specifier, which specifies that the following name is the name of a union type. If the union name has been declared alread...
If you're using an icon to add some extra decoration or branding, it does not need to be announced to users as they are navigating your site or app aurally. Additionally, if you're using an icon to visually re-emphasize or add styling to content already present in your HTML, it does not need to be r...
Rather than use clearRect which makes all pixels transparent you may want a background. To clear with a gradient // create the background gradient once var bgGrad = ctx.createLinearGradient(0,0,0,canvas.height); bgGrad.addColorStop(0,"#0FF"); bgGrad.addColorStop(1,"#08F"); ...
This example show you how to trim a bezier. The function trimBezier trims the ends off of the curve returning the curve fromPos to toPos. fromPos and toPos are in the range 0 to 1 inclusive, It can trim quadratic and cubic curves. The curve type is determined by the last x argument x4. If not undef...
An incomplete type; it is not possible for an object to have type void, nor are there arrays of void or references to void. It is used as the return type of functions that do not return anything. Moreover, a function may redundantly be declared with a single parameter of type void; this is equivale...
Given the 4 points of a cubic Bezier curve the following function returns its length. Method: The length of a cubic Bezier curve does not have a direct mathematical calculation. This "brute force" method finds a sampling of points along the curve and calculates the total distance spanne...
PM> uninstall-Package EntityFramework -Version 6.1.2
When writing wrappers for unmanaged resources, you should subclass SafeHandle rather than trying to implement IDisposable and a finalizer yourself. Your SafeHandle subclass should be as small and simple as possible to minimize the chance of a handle leak. This likely means that your SafeHandle imple...
A type qualifier; when applied to a type, produces the volatile-qualified version of the type. Volatile qualification plays the same role as const qualification in the type system, but volatile does not prevent objects from being modified; instead, it forces the compiler to treat all accesses to suc...
Visual Studio Team Services is an hosted version of Microsoft Team Foundation Server. It doesn't require any installation as it's already done by Microsoft itself. In order to start using Visual Studio Team Services you need to create an account here by pressing the Free account button. It will red...
Value-type fields only C++ declaration typedef union { char c; int i; } CharOrInt; C# declaration [StructLayout(LayoutKind.Explicit)] public struct CharOrInt { [FieldOffset(0)] public byte c; [FieldOffset(0)] public int i; } Mixing value-type and reference...
Right click on the solution, Add new project From the Test section, select an Unit Test Project Pick a name for the assembly - if you are testing project Foo, the name can be Foo.Tests Add a reference to the tested project in the unit test project references
MSTest (the default testing framework) requires you to have your test classes decorated by a [TestClass] attribute, and the test methods with a [TestMethod] attribute, and to be public. [TestClass] public class FizzBuzzFixture { [TestMethod] public void Test1() { //arrange...
var serialPort = new SerialPort("COM1", 9600, Parity.Even, 8, StopBits.One); serialPort.Open(); serialPort.WriteLine("Test data"); string response = serialPort.ReadLine(); Console.WriteLine(response); serialPort.Close();
string[] portNames = SerialPort.GetPortNames();
void SetupAsyncRead(SerialPort serialPort) { serialPort.DataReceived += (sender, e) => { byte[] buffer = new byte[4096]; switch (e.EventType) { case SerialData.Chars: var port = (SerialPort)sender; int bytesToRead = p...

Page 747 of 1336