Tutorial by Examples

MD5

Hash functions map binary strings of an arbitrary length to small binary strings of a fixed length. The MD5 algorithm is a widely used hash function producing a 128-bit hash value (16 Bytes, 32 Hexdecimal characters). The ComputeHash method of the System.Security.Cryptography.MD5 class returns the...
using System; using System.Security.Cryptography; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string source = "Hello World!"; using (SHA1 sha1Hash = SHA1.Create()) ...
using System; using System.Security.Cryptography; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string source = "Hello World!"; using (SHA256 sha256Hash = SHA256.Create()) ...
using System; using System.Security.Cryptography; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string source = "Hello World!"; using (SHA384 sha384Hash = SHA384.Create()) ...
using System; using System.Security.Cryptography; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string source = "Hello World!"; using (SHA512 sha512Hash = SHA512.Create()) ...
# this method can be anything and anywhere as long as it is accessible for connection @pyqtSlot() def run_on_complete(): pass # An object containing methods you want to run in a thread class Worker(QObject): complete = pyqtSignal() @pyqtSlot() def a_method_to_run...
A boolean represents the most basic datatype in TypeScript, with the purpose of assigning true/false values. // set with initial value (either true or false) let isTrue: boolean = true; // defaults to 'undefined', when not explicitely set let unsetBool: boolean; // can ...
Like JavaScript, numbers are floating point values. let pi: number = 3.14; // base 10 decimal by default let hexadecimal: number = 0xFF; // 255 in decimal ECMAScript 2015 allows binary and octal. let binary: number = 0b10; // 2 in decimal let octal: number = 0o755; // 493 in de...
Textual data type: let singleQuotes: string = 'single'; let doubleQuotes: string = "double"; let templateString: string = `I am ${ singleQuotes }`; // I am single
An array of values: let threePigs: number[] = [1, 2, 3]; let genericStringArray: Array<string> = ['first', '2nd', '3rd'];
A type to name a set of numeric values: Number values default to 0: enum Day { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday }; let bestDay: Day = Day.Saturday; Set a default starting number: enum TenPlus { Ten = 10, Eleven, Twelve } or assign values: enum MyOddSet { Thre...

Any

When unsure of a type, any is available: let anything: any = 'I am a string'; anything = 5; // but now I am the number 5
If you have no type at all, commonly used for functions that do not return anything: function log(): void { console.log('I return nothing'); } void types Can only be assigned null or undefined.
Array type with known and possibly different types: let day: [number, string]; day = [0, 'Monday']; // valid day = ['zero', 'Monday']; // invalid: 'zero' is not numeric console.log(day[0]); // 0 console.log(day[1]); // Monday day[2] = 'Saturday'; // valid: [0, 'Saturday'] day[3] = fals...
Number formatting, grouping digits according to the localization. const usNumberFormat = new Intl.NumberFormat('en-US'); const esNumberFormat = new Intl.NumberFormat('es-ES'); const usNumber = usNumberFormat.format(99999999.99); // "99,999,999.99" const esNumber = esNumberFormat.form...
Currency formatting, grouping digits and placing the currency symbol according to the localization. const usCurrencyFormat = new Intl.NumberFormat('en-US', {style: 'currency', currency: 'USD'}) const esCurrencyFormat = new Intl.NumberFormat('es-ES', {style: 'currency', currency: 'EUR'}) const u...
Date time formatting, according to the localization. const usDateTimeFormatting = new Intl.DateTimeFormat('en-US'); const esDateTimeFormatting = new Intl.DateTimeFormat('es-ES'); const usDate = usDateTimeFormatting.format(new Date('2016-07-21')); // "7/21/2016" const esDate = esDateT...
import 'dart:convert'; void main() { var jsonString = """ { "cats": { "abysinnian": { "origin": "Burma", "behavior": &qu...
Add one common horizontal line for all categorical variables # sample data df <- data.frame(x=('A', 'B'), y = c(3, 4)) p1 <- ggplot(df, aes(x=x, y=y)) + geom_bar(position = "dodge", stat = 'identity') + theme_bw() p1 + geom_hline(aes(yintercept=5), colour=...
import 'dart:async'; Future main() async { var value = await _waitForValue(); print("Here is the value: $value"); //since _waitForValue() returns immediately if you un it without await you won't get the result var errorValue = "not finished yet"; _waitForValue()...

Page 356 of 1336