Tutorial by Examples: cs

Docstrings are - unlike regular comments - stored as an attribute of the function they document, meaning that you can access them programmatically. An example function def func(): """This is a function that does nothing at all""" return The docstring can ...
In Kotlin, classes are final by default which means they cannot be inherited from. To allow inheritance on a class, use the open keyword. open class Thing { // I can now be extended! } Note: abstract classes, sealed classes and interfaces will be open by default.
Dynamic SQL enables us to generate and run SQL statements at run time. Dynamic SQL is needed when our SQL statements contains identifier that may change at different compile times. Simple Example of dynamic SQL: CREATE PROC sp_dynamicSQL @table_name NVARCHAR(20), @col_name NVARCHAR(2...
Given the following CSV-file String,DateTime,Integer First,2016-12-01T12:00:00,30 Second,2015-12-01T12:00:00,20 Third,2015-12-01T12:00:00,20 One can import the CSV rows in PowerShell objects using the Import-Csv command > $listOfRows = Import-Csv .\example.csv > $listOfRows String ...
By default, Import-CSV imports all values as strings, so to get DateTime- and integer-objects, we need to cast or parse them. Using Foreach-Object: > $listOfRows = Import-Csv .\example.csv > $listOfRows | ForEach-Object { #Cast properties $_.DateTime = [datetime]$_.DateTime $...
Merge Sort is a divide-and-conquer algorithm. It divides the input list of length n in half successively until there are n lists of size 1. Then, pairs of lists are merged together with the smaller first element among the pair of lists being added in each step. Through successive merging and through...
The NotifyPropertyChangedBaseclass below defines a generic Set method that can be called from any derived type. public class NotifyPropertyChangedBase : INotifyPropertyChanged { protected void RaisePropertyChanged([CallerMemberName] string propertyName = null) => PropertyChanged?.Invo...
A JavaScript Iterator is an object with a .next() method, which returns an IteratorItem, which is an object with value : <any> and done : <boolean>. A JavaScript AsyncIterator is an object with a .next() method, which returns a Promise<IteratorItem>, a promise for the next value. ...
Consider this CSV data: #id,title,text 1,hello world,"This is a ""blog""." 2,second time,"My second entry." This data can be read with the following code: // r can be any io.Reader, including a file. csvReader := csv.NewReader(r) // Set comment char...
Define the function using the vararg keyword. fun printNumbers(vararg numbers: Int) { for (number in numbers) { println(number) } } Now you can pass as many parameters (of the correct type) into the function as you want. printNumbers(0, 1) // Prints "0&qu...
Assume that we have a system that sends out daily reports over email in the form of attached CSV files and that we want to access these. function getCsvFromGmail() { // Get the newest Gmail thread based on sender and subject var gmailThread = GmailApp.search("from:[email protected] sub...
IronPython enables to use generic classes and methods from the .net framework. Generics can be used with the same syntax as accessing an index. For passing more than one type-parameter, they must be separated with a comma: l = Dictionary[int, str]() That way we create a dictionary where keys on...
This example deals with one of the most fundamental aspects of the VHDL language: the simulation semantics. It is intended for VHDL beginners and presents a simplified view where many details have been omitted (postponed processes, VHDL Procedural Interface, shared variables...) Readers interest...
Everybody loves twitter bootstrap, but some of us don't like it's default design. So here's a simple guide on how to start customizing boostrap's design. Twitter boostrap when cloned provides a set of default css files which we can override. The mail css file that we need to override is the boostra...
public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes);...
Just like you can have a pointer to an int, char, float, array/string, struct, etc. - you can have a pointer to a function. Declaring the pointer takes the return value of the function, the name of the function, and the type of arguments/parameters it receives. Say you have the following function ...
require(['N/search'], function(SEARCHMODULE){ var type = 'transaction'; var columns = []; columns.push(SEARCHMODULE.createColumn({ name: 'internalid' })); columns.push(SEARCHMODULE.createColumn({ name: 'formulanumeric', formula: '{quantity}-{...
Atomic types are the building blocks of lock-free data structures and other concurrent types. A memory ordering, representing the strength of the memory barrier, should be specified when accessing/modifying an atomic type. Rust provides 5 memory ordering primitives: Relaxed (the weakest), Acquire (f...
Spinner It is a type of dropdown input. Firstly in layout <Spinner android:id="@+id/spinner" <!-- id to refer this spinner from JAVA--> android:layout_width="match_parent" android:layout_height="wrap_content"> </Spinner> ...
Consider you want to predict the correct answer for XOR popular problem. You Knew what is XOR(e.g [x0 x1] => y). for example [0 0] => 0, [0 1] => [1] and... #Load Sickit learn data from sklearn.neighbors import KNeighborsClassifier #X is feature vectors, and y is correct label(To train...

Page 14 of 24