Tutorial by Examples: l

Windows Environment Install XAMPP or WAMP Download and Unzip the package from Codeigniter.com Extract all the document in the server space (htdocs or www directory) Mac Environment Install MAMP Download and Unzip the package from Codeigniter.com Extract all the document in the server sp...
If a name is bound inside a function, it is by default accessible only within the function: def foo(): a = 5 print(a) # ok print(a) # NameError: name 'a' is not defined Control flow constructs have no impact on the scope (with the exception of except), but accessing variable that w...
x and y are extracted from the tuple: val (x, y) = (1337, 42) // x: Int = 1337 // y: Int = 42 To ignore a value use _: val (_, y: Int) = (1337, 42) // y: Int = 42 To unpack an extractor: val myTuple = (1337, 42) myTuple._1 // res0: Int = 1337 myTuple._2 // res1: Int = 42 Note that...
A case class is a class with a lot of standard boilerplate code automatically included. One benefit of this is that Scala makes it easy to use extractors with case classes. case class Person(name: String, age: Int) // Define the case class val p = Person("Paola", 42) // Instantiate a v...
The null coalescing operator makes it easy to ensure that a method that may return null will fall back to a default value. Without the null coalescing operator: string name = GetName(); if (name == null) name = "Unknown!"; With the null coalescing operator: string name = GetN...
enum MyEnum { One, Two, Three } foreach(MyEnum e in Enum.GetValues(typeof(MyEnum))) Console.WriteLine(e); This will print: One Two Three
The FlagsAttribute can be applied to an enum changing the behaviour of the ToString() to match the nature of the enum: [Flags] enum MyEnum { //None = 0, can be used but not combined in bitwise operations FlagA = 1, FlagB = 2, FlagC = 4, FlagD = 8 //you must use pow...
Running the latest Liferay CE is straightforward: Go to https://www.liferay.com/downloads. Choose a bundle among the ones listed. For beginners, the Tomcat bundle is a good choice. Click in "Download." Unzip the download package whenever you find fit. The unzipped directory will...
One of the main differences between lists and tuples in Python is that tuples are immutable, that is, one cannot add or modify items once the tuple is initialized. For example: >>> t = (1, 4, 9) >>> t[0] = 2 Traceback (most recent call last): File "<stdin>", l...
With promises: function doTheThing() { return doOneThing() .then(doAnother) .then(doSomeMore) .catch(handleErrors) } With async functions: async function doTheThing() { try { const one = await doOneThing(); const another = await doAnother(...
You can use a column's number (where the leftmost column is '1') to indicate which column to base the sort on, instead of describing the column by its name. Pro: If you think it's likely you might change column names later, doing so won't break this code. Con: This will generally reduce readabilit...
Requirements: Protractor requires the following dependencies to be installed prior to installation: Java JDK 1.7 or higher Node.js v4 or higher Installation: Download and install Node.js from this URL: https://nodejs.org/en/ To see if the Node.js installation is successfull, you can go an...
HTML <div class="scale"></div> CSS .scale { width: 100px; height: 100px; background: teal; transform: scale(0.5, 1.3); } This example will scale the div to 100px * 0.5 = 50px on the X axis and to 100px * 1.3 = 130px on the Y axis. The center of the...
HTML <div class="translate"></div> CSS .translate { width: 100px; height: 100px; background: teal; transform: translate(200px, 50%); } This example will move the div by 200px on the X axis and by 100px * 50% = 50px on the Y axis. You can also spe...
Content has been moved back to the good 'ol JSF wiki page
Use the begin/rescue block to catch (rescue) an exception and handle it: begin # an execution that may fail rescue # something to execute in case of failure end A rescue clause is analogous to a catch block in a curly brace language like C# or Java. A bare rescue like this rescues Stand...
You can handle multiple errors in the same rescue declaration: begin # an execution that may fail rescue FirstError, SecondError => e # do something if a FirstError or SecondError occurs end You can also add multiple rescue declarations: begin # an execution that may fail rescue ...
Substitutability is a principle in object-oriented programming introduced by Barbara Liskov in a 1987 conference keynote stating that, if class B is a subclass of class A, then wherever A is expected, B can be used instead: class A {...} class B extends A {...} public void method(A obj) {...} ...
Deploying an advanced project template to shared hosting is a bit trickier than a basic one because it has two webroots, which shared hosting webservers don't support. We will need to adjust the directory structure so frontend URL will be http://site.local and backend URL will be http://site.local/a...
Go to Install Neo4j which should detect the OS platform via your web browser, download and follow the usual installation instructions for your OS. Neo4j was created with Java, therefore will run on any platform with Java installed, however the Neo4j team has simplified installation by providing eas...

Page 74 of 861