Tutorial by Examples: o

A computed column is computed from an expression that can use other columns in the same table. The expression can be a noncomputed column name, constant, function, and any combination of these connected by one or more operators. Create table with a computed column Create table NetProfit ( Sa...
You can overload a def if the signature is different: def printValue(x: Int) { println(s"My value is an integer equal to $x") } def printValue(x: String) { println(s"My value is a string equal to '$x'") } printValue(1) // prints "My value is an integer equal ...
There are a few ways to inspect the contents of a zipfile. You can use the printdir to just get a variety of information sent to stdout with zipfile.ZipFile(filename) as zip: zip.printdir() # Out: # File Name Modified Size ...
Strings in Julia are delimited using the " symbol: julia> mystring = "Hello, World!" "Hello, World!" Note that unlike some other languages, the ' symbol cannot be used instead. ' defines a character literal; this is a Char data type and will only store a single Unico...
Multiple comparison operators used together are chained, as if connected via the && operator. This can be useful for readable and mathematically concise comparison chains, such as # same as 0 < i && i <= length(A) isinbounds(A, i) = 0 < i ≤ length(A) # same as Set...
We will look at how to implement custom comparisons by implementing a custom type, ordinal numbers. To simplify the implementation, we will focus on a small subset of these numbers: all ordinal numbers up to but not including ε₀. Our implementation is focused on simplicity, not speed; however, the i...
Julia supports a very large set of comparison operators. These include All of the following unicode sequences: > < >= ≥ <= ≤ == === ≡ != ≠ !== ≢ ∈ ∉ ∋ ∌ ⊆ ⊈ ⊂ ⊄ ⊊ ∝ ∊ ∍ ∥ ∦ ∷ ∺ ∻ ∽ ∾ ≁ ≃ ≄ ≅ ≆ ≇ ≈ ≉ ≊ ≋ ≌ ≍ ≎ ≐ ≑ ≒ ≓ ≔ ≕ ≖ ≗ ≘ ≙ ≚ ≛ ≜ ≝ ≞ ≟ ≣ ≦ ≧ ≨ ≩ ≪ ≫ ≬ ≭ ≮ ≯ ≰ ≱ ≲ ≳ ≴ ≵ ≶ ≷ ≸ ≹ ≺ ...
In languages such as C, the @goto statement is often used to ensure a function cleans up necessary resources, even in the event of an error. This is less important in Julia, because exceptions and try-finally blocks are often used instead. However, it is possible for Julia code to interface with C ...
Sometimes, one wants to run some initialization code once before testing a condition. In certain other languages, this kind of loop has special do-while syntax. However, this syntax can be replaced with a regular while loop and break statement, so Julia does not have specialized do-while syntax. Ins...
If you implement or create a listener in an Activity, always pay attention to the lifecycle of the object that has the listener registered. Consider an application where we have several different activities/fragments interested in when a user is logged in or out. One way of doing this would be to h...
% set mypath /home/tcluser/sources/tcl/myproject/test.tcl /home/tcluser/sources/tcl/myproject/test.tcl % set dir [file dirname $mypath] /home/tcluser/sources/tcl/myproject % set filename [file tail $mypath] test.tcl % set basefilename [file rootname $filename] test % set extension [file exte...
Consider the following code snippet: // Print the sum of the numbers 1 to 10 int count = 0; for (int i = 1; i < 010; i++) { // Mistake here .... count = count + i; } System.out.println("The sum of 1 to 10 is " + count); A Java beginner might be surprised to know that the...
context.globalCompositeOperation = 'source-atop' source-atop compositing clips new image inside an existing shape. // gold filled rect ctx.fillStyle='gold'; ctx.fillRect(100,100,100,75); // shadow ctx.shadowColor='black'; ctx.shadowBlur=10; // restrict new draw to cover existing pixels ct...
Jumping out of nested loops would usually require use of a boolean variable with a check for this variable in the loops. Supposing we are iterating over i and j, it could look like this size_t i,j; for (i = 0; i < myValue && !breakout_condition; ++i) { for (j = 0; j < mySecondVa...
A lot of people who are new to multi-threading think that using threads automatically make an application go faster. In fact, it is a lot more complicated than that. But one thing that we can state with certainty is that for any computer there is a limit on the number of threads that can be run at ...
When programming in Prolog it is not always possible, or desirable, to create predicates which unify for every possible combination of parameters. For example, the predicate between(X,Y,Z) which expresses that Z is numerically between X and Y. It is easily implemented in the cases where X, Y, and Z ...
Immediately continue reading on invalid input or break on user request or end-of-file: #include <stdlib.h> /* for EXIT_xxx macros */ #include <stdio.h> /* for printf() and getchar() */ #include <ctype.h> /* for isdigit() */ void flush_input_stream(FILE * fp); int main(v...
You can take a look at the full code in this working Plunker. In this example I use a shared service to handle the communication between the pages inside the tab (child pages) and the tab container (the component that holds the tabs). Even though you probably could do it with Events I like the shar...
Gloss is easily installed using the Cabal tool. Having installed Cabal, one can run cabal install gloss to install Gloss. Alternatively the package can be built from source, by downloading the source from Hackage or GitHub, and doing the following: Enter the gloss/gloss-rendering/ directory and ...
In Gloss, one can use the display function to create very simple static graphics. To use this one needs to first import Graphics.Gloss. Then in the code there should the following: main :: IO () main = display window background drawing window is of type Display which can be constructed in two ...

Page 592 of 1038