Tutorial by Examples: er

The non-null assertion operator, !, allows you to assert that an expression isn't null or undefined when the TypeScript compiler can't infer that automatically: type ListNode = { data: number; next?: ListNode; }; function addNext(node: ListNode) { if (node.next === undefined) { nod...
Once you got a collection object, queries use the same syntax as in the mongo shell. Some slight differences are: every key must be enclosed in brackets. For example: db.find({frequencies: {$exists: true}}) becomes in pymongo (note the True in uppercase): db.find({"frequencies": ...
This approach was introduced in JSR 286. In JSR 168,render parameters set in processAction of a portlet were available only in that portlet.With the Public Render Parameters feature, the render parameters set in the processAction of one portlet will be available in render of other portlets also.In ...
This example assumes that you have already added Fresco to your app (see this example): SimpleDraweeView img = new SimpleDraweeView(context); ImageRequest request = ImageRequestBuilder .newBuilderWithSource(Uri.parse("http://example.com/image.png")) .setProgressiveRende...
A command-line launcher is a handle tool which allows one to open WebStorm using the command-line. It can easily be created by using the menus Tools > Create Command-line Launcher... After selecting the option, you will be presented with the "Create Launcher Script" prompt for a l...
If you want to order by a column using something other than alphabetical/numeric ordering, you can use case to specify the order you want. order by Group returns: GroupCountNot Retired6Retired4Total10 order by case group when 'Total' then 1 when 'Retired' then 2 else 3 end returns: GroupCountTot...
bcadd vs float+float var_dump('10' + '-9.99'); // float(0.0099999999999998) var_dump(10 + -9.99); // float(0.0099999999999998) var_dump(10.00 + -9.99); // float(0.0099999999999998) var_dump(bcadd('10', '-9.99', 20)); // string(22) "0.01000000000000000000&q...
Consider the following test: it('should test something', function() { browser.get('/dashboard/'); $("#myid").click(); expect(element(by.model('username')).getText()).toEqual('Test'); console.log("HERE"); }); In the following test, when the console.log() is ex...
Fibonacci numbers are used as a very common example for teaching recursion. fib 0 = 0 fib 1 = 1 fib n = fib (n-1) + fib (n-2)
public class Main extends JavaPlugin { @Override public void onEnable() { Bukkit.getPluginManager().registerEvents(this, this); } @EventHandler public void yourEvent(Event e) { //... } }
In Laravel documentation, a symbolic link (symlink or soft link) from public/storage to storage/app/public should be created to make files accessible from the web. (THIS PROCEDURE WILL CREATE SYMBOLIC LINK WITHIN THE LARAVEL PROJECT DIRECTORY) Here are the steps on how you can create symbolic lin...
new Error(message) Creates new error object, where the value message is being set to message property of the created object. Usually the message arguments are being passed to Error constructor as a string. However if the message argument is object not a string then Error constructor calls .toString...
Floating point literals provide values that can be used where you need a float or double instance. There are three kinds of floating point literal. Simple decimal forms Scaled decimal forms Hexadecimal forms (The JLS syntax rules combine the two decimal forms into a single form. We treat t...
function addTwo(a, b = 2) { return a + b; } addTwo(3) // Returns the result 5 With the addition of default function parameters you can now make arguments optional and have them default to a value of your choice.
function argumentLength(...args) { return args.length; } argumentLength(5) // returns 1 argumentLength(5, 3) //returns 2 argumentLength(5, 3, 6) //returns 3 By prefacing the last argument of your function with ... all arguments passed to the function are read as an array. In this examp...
function myFunction(x, y, z) { } var args = [0, 1, 2]; myFunction(...args); The spread syntax allows an expression to be expanded in places where multiple arguments (for function calls) or multiple elements (for array literals) or multiple variables are expected. Just like the rest parameters s...
Throwing error means exception if any exception is not handled then the node server will crash. The following line throws error: throw new Error("Some error occurred"); or var err = new Error("Some error occurred"); throw err; or throw "Some error occurred";...
You can pass parameters to the functions in tf.cond() using lambda and the code is as bellow. x = tf.placeholder(tf.float32) y = tf.placeholder(tf.float32) z = tf.placeholder(tf.float32) def fn1(a, b): return tf.mul(a, b) def fn2(a, b): return tf.add(a, b) pred = tf.placeholder(tf....
Different platforms can have separate implementations of the same method. This example also illustrates how build tags and file suffixes can be used together. File main.go: package main import "fmt" func main() { fmt.Println("Hello World from Conditional Compilation Doc!&...
Vue provides event modifiers for v-on by calling directive postfixes denoted by a dot. .stop .prevent .capture .self .once For examples: <!-- the click event's propagation will be stopped --> <a v-on:click.stop="doThis"></a> <!-- the submit event will no...

Page 339 of 417