Tutorial by Examples: o

ALTER TABLE fish_data.fish DROP PRIMARY KEY; ALTER TABLE fish_data.fish MODIFY COLUMN fish_id DECIMAL(20,0) NOT NULL PRIMARY KEY; An attempt to modify the type of this column without first dropping the primary key would result in an error.
In Insert mode, press <C-r> and then % to insert the filename. This technique is applicable to all registers. For e.g. if in insert mode, you want to paste the current search pattern, you can type <C-r> and then /.
Formatting a JavaScript date in modern browsers In modern browsers (*), Date.prototype.toLocaleDateString() allows you to define the formatting of a Date in a convenient manner. It requires the following format : dateObj.toLocaleDateString([locales [, options]]) The locales parameter should be...
Fold Right successively applies a two-argument function to every element in a list from left to right starting with a base value: foldr: (a b -> b) b (listof a) -> b > (foldr + 0 (list 1 2 3 4)) 10 > (foldr string-append "" (list "h" "e" "l&quot...
When the first time view is requested, normally Angular makes XHR request to get that view. For mid-size projects, the view count can be significant and it can slow down the application responsiveness. The good practice is to pre-load all the views at once for small and mid size projects. For large...
It is good practice to combine JS files together and minify them. For larger project there could be hundreds of JS files and it adds unnecessary latency to load each file separately from the server. For angular minification it is required to to have all functions annotated. That in necessary for An...
Sometimes it's useful to be able to extend a class with new functions. For example let's suppose that a string should be converted to a camel case string. So we need to tell TypeScript, that String contains a function called toCamelCase, which returns a string. interface String { toCamelCase()...
While running any web application it’s necessary to take loading time into consideration. If your code tries to access any element that is not yet loaded, WebDriver will throw an exception and your script will stop. There are three types of Waits - Implicit Waits Explicit Waits Fluent Waits ...
In explicit wait, you expect for a condition to happen. For example you want to wait until an element is clickable. Here is a demonstration of a few common problems. Please note: In all of these examples you can use any By as a locator, such as classname, xpath, link text, tag name or cssSelector ...
In Racket, we use recursion very frequently. Here is an example of a function that sums all of the numbers from zero to the parameter, n. (define (sum n) (if (zero? n) 0 (+ n (sum (sub1 n))))) Note that there are many helpful convenience based functions used here, such as ...
Standard properties Depending on the type of the property, there are up to 3 methods for a single property. Let <property> denote the name of a property and <Property> the name of the property with an uppercase first letter. And let T be the type of the property; for primitive wrappers ...
The following example shows the declaration of a property (StringProperty in this case) and demonstrates how to add a ChangeListener to it. import java.text.MessageFormat; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.beans.value.Ch...
This example shows how to use a readonly wrapper property to create a property that cannot be written to. In this case cost and price can be modified, but profit will always be price - cost. import java.text.MessageFormat; import javafx.beans.property.IntegerProperty; import javafx.beans.property...
# list gem sources: gem sources -l # remove default gem source: gem sources -r https://rubygems.org/ # add other gem sources: gem sources -a https://ruby.taobao.org/
Overall the easiest way to work with JSON is to have a case class mapping directly to the JSON (same fields name, equivalent types, etc.). case class Person( name: String, age: Int, hobbies: Seq[String], pet: Pet ) case class Pet( name: String, `type`: String ) // these...
It is very easy to pass information between threads using the MVar a type and its accompanying functions in Control.Concurrent: newEmptyMVar :: IO (MVar a) -- creates a new MVar a newMVar :: a -> IO (MVar a) -- creates a new MVar with the given value takeMVar :: MVar a -> IO a -- retrieve...
Summary: MVVM is an architectural pattern that is represented by three distinct components, the Model, View and ViewModel. In order to understand these three layers, it is necessary to briefly define each, followed by an explanation of how they work together. Model is the layer that drives the bus...
The BubbleSort compares each successive pair of elements in an unordered list and inverts the elements if they are not in order. The following example illustrates the bubble sort on the list {6,5,3,1,8,7,2,4} (pairs that were compared in each step are encapsulated in '**'): {6,5,3,1,8,7,2,4} {**5...
qmake is a build automation tool, which is shipped with Qt framework. It does similar job to tools such as CMake or GNU Autotools, but it is designed to be used specifically with Qt. As such it is well integrated with Qt ecosystem, notably Qt Creator IDE. If you start Qt Creator and select File -&g...
The JavaScript coding convention is to place the starting bracket of blocks on the same line of their declaration: if (...) { } function (a, b, ...) { } Instead of in the next line: if (...) { } function (a, b, ...) { } This has been adopted to avoid semicolon insertion ...

Page 455 of 1038