Tutorial by Examples: ect

SELECT e.Fname, e.LName FROM Employees e The Employees table is given the alias 'e' directly after the table name. This helps remove ambiguity in scenarios where multiple tables have the same field name and you need to be specific as to which table you want to return data from. SELECT e.Fname,...
A VectorDrawable should consist of at least one <path> tag defining a shape <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24.0" android:viewpor...
An AnimatedVectorDrawable requires at least 3 components: A VectorDrawable which will be manipulated An objectAnimator which defines what property to change and how The AnimatedVectorDrawable itself which connects the objectAnimator to the VectorDrawable to create the animation The following...
While partial function are often used as convenient syntax for total functions, by including a final wildcard match (case _), in some methods, their partiality is key. One very common example in idiomatic Scala is the collect method, defined in the Scala collections library. Here, partial functions ...
To detect whether a parameter is a primitive string, use typeof: var aString = "my string"; var anInt = 5; var anObj = {}; typeof aString === "string"; // true typeof anInt === "string"; // false typeof anObj === "string"; // false If you ev...
This demonstrates how to print each element of a Map val map = Map(1 -> "a", 2 -> "b") for (number <- map) println(number) // prints (1,a), (2,b) for ((key, value) <- map) println(value) // prints a, b This demonstrates how to print each element of a list val l...
Because collections are typically covariant in their element type*, a collection of a subtype may be passed where a super type is expected: trait Animal { def name: String } case class Dog(name: String) extends Animal object Animal { def printAnimalNames(animals: Seq[Animal]) = { anima...
When you want a complete copy of an object (i.e. the object properties and the values inside those properties, etc...), that is called deep cloning. 5.1 If an object can be serialized to JSON, then you can create a deep clone of it with a combination of JSON.parse and JSON.stringify: var existing...
If you want to calculate with BigDecimal you have to use the returned value because BigDecimal objects are immutable: BigDecimal a = new BigDecimal("42.23"); BigDecimal b = new BigDecimal("10.001"); a.add(b); // a will still be 42.23 BigDecimal c = a.add(b); // c will be ...
The most simple data structure available in R is a vector. You can make vectors of numeric values, logical values, and character strings using the c() function. For example: c(1, 2, 3) ## [1] 1 2 3 c(TRUE, TRUE, FALSE) ## [1] TRUE TRUE FALSE c("a", "b", "c") ## ...
If there are sections of code that you are considering removing or want to temporarily disable, you can comment it out with a block comment. /* Block comment around whole function to keep it from getting used. * What's even the purpose of this function? int myUnusedFunction(void) { int i =...
To be able to use JDBC you need to have the JDBC driver of your database on the class path of your application. There are multiple ways to connect to a database, but the common ways are to either use the java.sql.DriverManager, or to configure and use a database specific implementation of javax.sql...
Atomic vectors (which excludes lists and expressions, which are also vectors) are subset using the [ operator: # create an example vector v1 <- c("a", "b", "c", "d") # select the third element v1[3] ## [1] "c" The [ operator can also tak...
This checks to see if the given object is null, and then throws RequiredObjectIsNullException if it is. Assert.Required(parameter, "parameter is required.");
In order to inspect an image, you can use the image ID or the image name, consisting of repository and tag. Say, you have the CentOS 6 base image: ➜ ~ docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos centos6 cf2c3...
Exceptions are just regular Python objects that inherit from the built-in BaseException. A Python script can use the raise statement to interrupt execution, causing Python to print a stack trace of the call stack at that point and a representation of the exception instance. For example: >>&gt...
You can perform redirection in Rails routes as follows: 4.0 get '/stories', to: redirect('/posts') 4.0 match "/abc" => redirect("http://example.com/abc") You can also redirect all unknown routes to a given path: 4.0 match '*path' => redirect('/'), via: :get ...
public class Foo { private IBar _iBar; public IBar iBar { set { _iBar = value; } } public void DoStuff() { _iBar.DoSomething(); } } public interface IBar { void DoSomething(); }
public class Foo { private readonly IBar _iBar; public Foo(IBar iBar) { _iBar = iBar; } public void DoStuff() { _bar.DoSomething(); } } public interface IBar { void DoSomething(); }
You can create one table from another by adding a SELECT statement at the end of the CREATE TABLE statement: CREATE TABLE stack ( id_user INT, username VARCHAR(30), password VARCHAR(30) ); Create a table in the same database: -- create a table from another table in the same data...

Page 15 of 99