Tutorial by Examples

When an exception object is created (i.e. when you new it), the Throwable constructor captures information about the context in which the exception was created. Later on, this information can be output in the form of a stacktrace, which can be used to help diagnose the problem that caused the excep...
To join all of an array's elements into a string, you can use the join method: console.log(["Hello", " ", "world"].join("")); // "Hello world" console.log([1, 800, 555, 1234].join("-")); // "1-800-555-1234" As you can see in ...
SELECT 'Hello world!' FROM dual; In Oracle's flavor of SQL, "dual is just a convienence table". It was originally intended to double rows via a JOIN, but now contains one row with a DUMMY value of 'X'.
To see the log with changes inline, use the -p or --patch options. git log --patch Example (from Trello Scientist repository) ommit 8ea1452aca481a837d9504f1b2c77ad013367d25 Author: Raymond Chou <[email protected]> Date: Wed Mar 2 10:35:25 2016 -0800 fix readme error link diff ...
For JavaScript, here is the code we recommend for generating, persisting and retrieving a UUID. This could be wrapped in a function can called directly from the PUBNUB.init function rather than the two step inline solution below. // get/create/store UUID var UUID = PUBNUB.db.get('session') || (fun...
For Android, here is the code we recommend for generating, persisting and retrieving a UUID. There is not constructor that accepts the UUID as a parameter, so you must instantiate Pubnub object first then use the setter to provide the UUID. // creating the Pubnub connection object with minimal args...
You can overload all basic arithmetic operators: + and += - and -= * and *= / and /= & and &= | and |= ^ and ^= >> and >>= << and <<= Overloading for all operators is the same. Scroll down for explanation Overloading outside of class/struct: //operator...
You can overload the 2 unary operators: ++foo and foo++ --foo and foo-- Overloading is the same for both types (++ and --). Scroll down for explanation Overloading outside of class/struct: //Prefix operator ++foo T& operator++(T& lhs) { //Perform addition return lhs; } ...
You can overload all comparison operators: == and != > and < >= and <= The recommended way to overload all those operators is by implementing only 2 operators (== and <) and then using those to define the rest. Scroll down for explanation Overloading outside of class/struct: ...
You can overload type operators, so that your type can be implicitly converted into the specified type. The conversion operator must be defined in a class/struct: operator T() const { /* return something */ } Note: the operator is const to allow const objects to be converted. Example: struct ...
You can even overload the array subscript operator []. You should always (99.98% of the time) implement 2 versions, a const and a not-const version, because if the object is const, it should not be able to modify the object returned by []. The arguments are passed by const& instead of by value...
You can overload the function call operator (): Overloading must be done inside of a class/struct: //R -> Return type //Types -> any different type R operator()(Type name, Type2 name2, ...) { //Do something //return something } //Use it like this (R is return type, a and b a...
The assignment operator is one of the most important operators because it allows you to change the status of a variable. If you do not overload the assigment operator for your class/struct, it is automatically generated by the compiler: the automatically-generated assignment operator performs a &qu...
Overloading the bitwise NOT (~) is fairly simple. Scroll down for explanation Overloading outside of class/struct: T operator~(T lhs) { //Do operation return lhs; } Overloading inside of class/struct: T operator~() { T t(*this); //Do operation return t; } Note...
The operators << and >> are commonly used as "write" and "read" operators: std::ostream overloads << to write variables to the underlying stream (example: std::cout) std::istream overloads >> to read from the underlying stream to a variable (example: s...
Using the following code with the format string yyyy/MM/dd hh:mm.ss, we will receive the following output 2016/04/19 11:45.36 // define the format to use String formatString = "yyyy/MM/dd hh:mm.ss"; // get a current date object Date date = Calendar.getInstance().getTime(); //...
Sourcing a file is different from execution, in that all commands are evaluated within the context of the current bash session - this means that any variables, function, or aliases defined will persist throughout your session. Create the file you wish to source sourceme.sh #!/bin/bash export A=...
Bosun alerts are defined in the config file using a custom DSL. They use functions to evaluate time series data and will generate alerts when the warn or crit expressions are non-zero. Alerts use templates to include additional information in the notifications, which are usually an email message and...
This method can be used to convert a formatted string representation of a date into a Date object. /** * Parses the date using the given format. * * @param formattedDate the formatted date string * @param dateFormat the date format which was used to create the string. ...
The base keyword is used to access members from a base class. It is commonly used to call base implementations of virtual methods, or to specify which base constructor should be called. Choosing a constructor public class Child : SomeBaseClass { public Child() : base("some string for th...

Page 67 of 1336