Tutorial by Examples

Sometimes when working with linear regression we need to check for non-linearity in the data. One way to do this is to fit a polynomial model and check whether it fits the data better than a linear model. There are other reasons, such as theoretical, that indicate to fit a quadratic or higher order ...
This example demonstrates how pointers can be used for C-like access to C# arrays. unsafe { var buffer = new int[1024]; fixed (int* p = &buffer[0]) { for (var i = 0; i < buffer.Length; i++) { *(p + i) = i; } } } The unsafe keyw...
Addition and subtraction in pointers works differently from integers. When a pointer is incremented or decremented, the address it points to is increased or decreased by the size of the referent type. For example, the type int (alias for System.Int32) has a size of 4. If an int can be stored in add...
In C and C++, the asterisk in the declaration of a pointer variable is part of the expression being declared. In C#, the asterisk in the declaration is part of the type. In C, C++ and C#, the following snippet declares an int pointer: int* a; In C and C++, the following snippet declares an int ...
C# inherits from C and C++ the usage of void* as a type-agnostic and size-agnostic pointer. void* ptr; Any pointer type can be assigned to void* using an implicit conversion: int* p1 = (int*)IntPtr.Zero; void* ptr = p1; The reverse requires an explicit conversion: int* p1 = (int*)IntPtr.Ze...
C# inherits from C and C++ the usage of the symbol -> as a means of accessing the members of an instance through a typed pointer. Consider the following struct: struct Vector2 { public int X; public int Y; } This is an example of the usage of -> to access its members: Vector2...
The criteria that a type must satisfy in order to support pointers (see Remarks) cannot be expressed in terms of generic constraints. Therefore, any attempt to declare a pointer to a type provided through a generic type parameter will fail. void P<T>(T obj) where T : struct { T* p...
So, you have completed installation it's time now to Run you program with it. Netbeans has created a shortcut to your desktop, "Double click" that to open the IDE. To Create a new project 1. Click this button OR Goto: files >> New Project then this window will popup Select...
Digital hardware is built from two types of hardware primitives: Combinatorial gates (inverters, and, or, xor, 1-bit full adders, 1-bit multiplexers...) These logic gates perform a simple boolean computation on their inputs and produce an output. Each time one of their inputs changes, they st...
This example is the second of a series of 3. If you didn't yet, please read the Block diagram example first. With a block diagram that complies with the 10 rules (see the Block diagram example), the VHDL coding becomes straightforward: the large surrounding rectangle becomes the VHDL entity,...
This example is directly derived from John Cooley’s design contest at SNUG’95 (Synopsys Users Group meeting). The contest was intended to oppose VHDL and Verilog designers on the same design problem. What John had in mind was probably to determine what language was the most efficient. The result...
Implementation of IDatabaseInitializer that is used in EntityFramework by default. As the name implies, it creates the database if none exists. However when you change the model, it throws an exception. Usage: public class MyContext : DbContext { public MyContext() { Database.SetIni...
This implementation of IDatabaseInitializer drops and recreates the database if the model changes automatically. Usage: public class MyContext : DbContext { public MyContext() { Database.SetInitializer(new DropCreateDatabaseIfModelChanges<MyContext>()); } }
This implementation of IDatabaseInitializer drops and recreates the database everytime your context is used in applications app domain. Beware of the data loss due to the fact, that the database is recreated. Usage: public class MyContext : DbContext { public MyContext() { Database.S...
You can create your own implementation of IDatabaseInitializer. Example implementation of an initializer, that will migrate the database to 0 and then migrate all the way to the newest migration (usefull e.g. when running integration tests). In order to do that you would need a DbMigrationsConfigur...
An implementation of IDatabaseInitializer that will use Code First Migrations to update the database to the latest version. To use this initializer you have to use DbMigrationsConfiguration type too. Usage: public class MyContext : DbContext { public MyContext() { Database.SetInitial...
A complex type allows you to map selected fields of a database table into a single type that is a child of the main type. [ComplexType] public class Address { public string Street { get; set; } public string Street_2 { get; set; } public string City { get; set; } public string...
CREATE TABLE [dbo].[MemOptimizedTemporalTable] ( [BusinessDocNo] [bigint] NOT NULL, [ProductCode] [int] NOT NULL, [UnitID] [tinyint] NOT NULL, [PriceID] [tinyint] NOT NULL, [SysStartTime] [datetime2](7) GENERATED ALWAYS AS ROW START NOT NULL, [SysEndTime] [datetime2](7...
This class enables a programmer to create an object and protect its confidentiality with a cryptographic algorithm. Given any Serializable object, one can create a SealedObject that encapsulates the original object, in serialized format (i.e., a "deep copy"), and seals (encrypts) its seri...
SignedObject is a class for the purpose of creating authentic runtime objects whose integrity cannot be compromised without being detected. More specifically, a SignedObject contains another Serializable object, the (to-be-)signed object and its signature. //Create a key KeyPairGenerator keyGen...

Page 772 of 1336