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 ...
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...
Prerequisites
Intellij IDEA installed (Community or Ultimate edition)
Scala Plugin installed in IntelliJ
A standard Play project, created for instance with Activator (activator new [nameoftheproject] play-scala).
Opening the project
Open IntelliJ IDEA
Go to menu File > Open ... > c...
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...
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...
Debugging is a very powerful way to have a closer look and fix incorrectly working (or non working) code.
Run code step by step
First thing you need to do during debugging is to stop the code at specific locations and
then run it line by line to see whether that happens what's expected.
Breakp...
In VBA, Strings can be declared with a specific length; they are automatically padded or truncated to maintain that length as declared.
Public Sub TwoTypesOfStrings()
Dim FixedLengthString As String * 5 ' declares a string of 5 characters
Dim NormalString As String
Debug.Print Fi...
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 ...
Field-Symbols are ABAP's equivalent to pointers, except that Field-Symbols are always dereferenced (it is not possible to change the actual address in memory).
Declaration
To declare a Field-Symbol the keyword FIELD-SYMBOLS must be used. Types can be generic (ANY [... TABLE]) to handle a wide vari...
Essential for data references is the addition REF TO after TYPE.
Dynamic Creation of Structures
If the type of a structure should be decided on runtime, we can define our target structure as reference to the generic type data.
DATA wa TYPE REF TO data.
To give wa a type we use the statement CR...
It is possible to define a data type with field labels.
data Person = Person { age :: Int, name :: String }
This definition differs from a normal record definition as it also defines *record accessors which can be used to access parts of a data type.
In this example, two record accessors are de...
One of the most common obstacles using classes is finding the proper approach to handle private states.
There are 4 common solutions for handling private states:
Using Symbols
Symbols are new primitive type introduced on in ES2015,
as defined at MDN
A symbol is a unique and immutable data typ...
Data can be exported using copy command or by taking use of command line options of psql command.
To Export csv data from table user to csv file:
psql -p \<port> -U \<username> -d \<database> -A -F<delimiter> -c\<sql to execute> \> \<output filename with path>...
You can use using in order to set an alias for a namespace or type. More detail can be found in here.
Syntax:
using <identifier> = <namespace-or-type-name>;
Example:
using NewType = Dictionary<string, Dictionary<string,int>>;
NewType multiDictionary = new NewType();
/...
Dedicated Workers
A dedicated web worker is only accessible by the script that called it.
Main application:
var worker = new Worker('worker.js');
worker.addEventListener('message', function(msg) {
console.log('Result from the worker:', msg.data);
});
worker.postMessage([2,3]);
worker.j...
You can test for IndexedDB support in the current environment by checking for the presence of the window.indexedDB property:
if (window.indexedDB) {
// IndexedDB is available
}