Tutorial by Examples

To create a pure JSON table you need to provide a single field with the type JSONB: CREATE TABLE mytable (data JSONB NOT NULL); You should also create a basic index: CREATE INDEX mytable_idx ON mytable USING gin (data jsonb_path_ops); At this point you can insert data in to the table and que...
Taking a complex JSON document in a table: CREATE TABLE mytable (data JSONB NOT NULL); CREATE INDEX mytable_idx ON mytable USING gin (data jsonb_path_ops); INSERT INTO mytable VALUES($$ { "name": "Alice", "emails": [ "[email protected]", ...
Creation of a Button is simple: Button sampleButton = new Button(); This will create a new Button without any text or graphic inside. If you want to create a Button with a text, simply use the constructor that takes a String as parameter (which sets the textProperty of the Button): Button samp...
The current stable version of scikit-learn requires: Python (>= 2.6 or >= 3.3), NumPy (>= 1.6.1), SciPy (>= 0.9). For most installation pip python package manager can install python and all of its dependencies: pip install scikit-learn However for linux systems it is recomm...
The D programming language's standard compiler DMD can run on all major platforms. To install DMD see here. To install by command line you may run the command (found on the D website): curl -fsS https://dlang.org/install.sh | bash -s dmd Package Managers Arch Linux pacman -S dlang Chocolate...
Ruby can inject an array of values into a string by replacing any placeholders with the values from the supplied array. "Hello %s, my name is %s!" % ['World', 'br3nt'] # => Hello World, my name is br3nt! The place holders are represented by two %s and the values are supplied by the...
Problem: Create a String containing n repetitions of a String s. The trivial approach would be repeatedly concatenating the String final int n = ... final String s = ... String result = ""; for (int i = 0; i < n; i++) { result += s; } This creates n new string instances ...
SWI-Prolog Windows and Mac: Download SWI-Prolog at the official website Simply install by following the installer instructions. Linux (PPA): Add the PPA ppa:swi-prolog/stable to your system’s software sources (developers may choose for ppa:swi-prolog/devel) : Open a terminal (Ctrl+...
Returns unique values from an IEnumerable. Uniqueness is determined using the default equality comparer. int[] array = { 1, 2, 3, 4, 2, 5, 3, 1, 2 }; var distinct = array.Distinct(); // distinct = { 1, 2, 3, 4, 5 } To compare a custom data type, we need to implement the IEquatable<T> i...
If you don't have any RubyGems installed, there is still the pre-gem approach to getting software, doing it manually: Download from RubyGems Unpack into a directory and cd there Install with: ruby setup.rb (you may need admin/root privilege) sudo ruby setup.rb For more details...
Every case class defines an extractor that can be used to capture the members of the case class when pattern matching: case class Student(name: String, email: String) def matchStudent1(student: Student): String = student match { case Student(name, email) => s"$name has the following...
Strings in JavaScript can be enclosed in Single quotes 'hello', Double quotes "Hello" and (from ES2015, ES6) in Template Literals (backticks) `hello`. var hello = "Hello"; var world = 'world'; var helloW = `Hello World`; // ES2015 / ES6 Strings can be created...
If your string is enclosed (i.e.) in single quotes you need to escape the inner literal quote with backslash \ var text = 'L\'albero means tree in Italian'; console.log( text ); \\ "L'albero means tree in Italian" Same goes for double quotes: var text = "I feel \"high\&quot...
You can require a generic type to extend multiple upper bounds. Example: we want to sort a list of numbers but Number doesn't implement Comparable. public <T extends Number & Comparable<T>> void sortNumbers( List<T> n ) { Collections.sort( n ); } In this example T must...
Swift textView.text = "Hello, world!" Objective-C: textView.text = @"Hello, world!";
// Modify some of the attributes of the attributed string. let attributedText = NSMutableAttributedString(attributedString: textView.attributedText!) // Use NSString so the result of rangeOfString is an NSRange. let text = textView.text! as NSString // Find the range of each element to modif...
Swift textView.textAlignment = .left Objective-C textView.textAlignment = NSTextAlignmentLeft;
Responding to Editing Notifications textViewShouldBeginEditing(_:) textViewDidBeginEditing(_:) textViewShouldEndEditing(_:) textViewDidEndEditing(_:) Responding to Text Changes textView(_:shouldChangeTextIn:replacementText:) textViewDidChange(_:) Responding to URL textView(_: UITe...
Swift //System Font textView.font = UIFont.systemFont(ofSize: 12) //Font of your choosing textView.font = UIFont(name: "Font Name", size: 12) Objective-C //System Font textView.font = [UIFont systemFontOfSize:12]; //Font of your choosing textView.font = [UIFont fontWithName:...
Swift textView.textColor = UIColor.red Objective-C textView.textColor = [UIColor redColor];

Page 126 of 1336