Tutorial by Examples: cs

public class MyObject{ public DateTime? TestDate { get; set; } public Func<MyObject, bool> DateIsValid = myObject => myObject.TestDate.HasValue && myObject.TestDate > DateTime.Now; public void DoSomething(){ //We can do this: if(this.TestDate....
// Example of std::vector as an expanding dynamic size array. #include <algorithm> // std::sort #include <iostream> #include <vector> // std::vector using namespace std; int int_from( std::istream& in ) { int x = 0; in >> x; return x; } ...
Unfortunately as of C++14 there's no dynamic size matrix class in the C++ standard library. Matrix classes that support dynamic size are however available from a number of 3rd party libraries, including the Boost Matrix library (a sub-library within the Boost library). If you don't want a dependenc...

CSS

This binding will apply the supplied CSS class to the element. Static classes are applied when the given conditions are loosely-evaluated to true. Dynamic classes use the value of an observable or computed. page.html <p data-bind="css: { danger: isInDanger }">Checks external expres...
Meteor.call(name, [arg1, arg2...], [asyncCallback]) (1) name String (2) Name of method to invoke (3) arg1, arg2... EJSON-able Object [Optional] (4) asyncCallback Function [Optional] On one hand, you can do : (via Session variable, or via ReactiveVar) var syncCall = Meteor.call("my...
Schema Statics are methods that can be invoked directly by a Model (unlike Schema Methods, which need to be invoked by an instance of a Mongoose document). You assign a Static to a schema by adding the function to the schema's statics object. One example use case is for constructing custom queries:...
What is a Set? A set is a data structure which contains a set of elements with an important property that no two elements in the set are equal. Types of Set: HashSet: A set backed by a hash table (actually a HashMap instance) Linked HashSet: A Set backed by Hash table and linked list, with pre...
Microsoft.CSharp.CSharpCodeProvider can be used to compile C# classes. var code = @" public class Abc { public string Get() { return ""abc""; } } "; var options = new CompilerParameters(); options.GenerateExecutable = false; options.GenerateInMe...
The following command imports CSV files into a MySQL table with the same columns while respecting CSV quoting and escaping rules. load data infile '/tmp/file.csv' into table my_table fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\n' ignore 1...
Let's swap the implementation of methodOne() and methodTwo() in our TestSwizzling class: class TestSwizzling : NSObject { dynamic func methodOne()->Int{ return 1 } } extension TestSwizzling { //In Objective-C you'd perform the swizzling in load(), //but t...
Given a string, strspn calculates the length of the initial substring (span) consisting solely of a specific list of characters. strcspn is similar, except it calculates the length of the initial substring consisting of any characters except those listed: /* Provided a string of "tokens&quo...
You can spec a record as follows: (clojure.spec/def ::name string?) (clojure.spec/def ::age pos-int?) (clojure.spec/def ::occupation string?) (defrecord Person [name age occupation]) (clojure.spec/def ::person (clojure.spec/keys :req-un [::name ::age ::occupation])) (clojure.spec/valid? ...
You can spec a map by specifying which keys should be present in the map: (clojure.spec/def ::name string?) (clojure.spec/def ::age pos-int?) (clojure.spec/def ::occupation string?) (clojure.spec/def ::person (clojure.spec/keys :req [::name ::age ::occupation])) (clojure.spec/valid? ::perso...
Using the Authors table in the Library Database CREATE PROCEDURE GetName ( @input_id INT = NULL, --Input parameter, id of the person, NULL default @name VARCHAR(128) = NULL --Input parameter, name of the person, NULL default ) AS BEGIN SELECT Name + ' is from ' + Country...
emacs-live is another popular emacs starter kit, with an additional focus on live music coding using overtone. You can install it in 2 ways: On *nix (e.g. linux, OSX, etc.) systems, run the following command on the command-line: bash <(curl -fksSL https://raw.github.com/overtone/emacs-l...
A Subject in RxJava is a class that is both an Observable and an Observer. This basically means that it can act as an Observable and pass inputs to subscribers and as an Observer to get inputs from another Observable. Subject<String, String> subject = PublishSubject.create(); subject.subscr...
For added safety we can define the type of object that the array contains: NSArray<NSString *> *colors = @[@"Red", @"Green", @"Blue", @"Yellow"]; NSMutableArray<NSString *> *myColors = [NSMutableArray arrayWithArray:colors]; [myColors addObject:...
Create a file named SCALA_PROJECT/build.gradle with these contents: group 'scala_gradle' version '1.0-SNAPSHOT' apply plugin: 'scala' repositories { jcenter() mavenCentral() maven { url "https://repo.typesafe.com/typesafe/maven-releases" } } dep...
First, Install gulp and gulp-concat plugin to your project localy npm install --save-dev gulp gulp-concat and add gulp-concat task to your gulpfile.js var gulp = require('gulp'); var concat = require('gulp-concat'); gulp.task('default', function() { }); gulp.task('css', function() { ...
First, Install gulp, gulp-clean-css and gulp-rename to project directory localy npm install --save-dev gulp gulp-clean-css gulp-rename Than add following minify-css task to your gulpfile.js var gulp = require('gulp'); var cleanCSS = require('gulp-clean-css'); var rename = require('gulp-rename...

Page 8 of 24