Tutorial by Examples: l

Player playerToCheck; Player playerSeeing; boolean isVisible = playerSeeing.canSee(playerToCheck); //isVisible returns true if playerSeeing can see playerToCheck and false otherwhise
This can be done by using the event EntityTargetEvent Entities won't target the player if you cancel the event: @EventHandler public void onEntityTarget(EntityTargetEvent e) { Entity target = e.getEntity(); if(target instanceof Player) { Player playerTargetted = (Player) target...
Log in to the AWS Management Console and navigate to AWS Lambda. Click create new function then you will see this window. Select Runtime environment but blueprint (sample code) only for node.js and python There are two example conation for alexa skills kit. You can filter those thing. By s...
Use the d8 shell to run the v8 engine. Use the following pattern to run on a file: /path/to/d8 [flags] [file].js For example: ./d8 --log-gc script.js will run d8 on script.js with garbage collection logging enabled
JSON arrays represent a collection of objects. In JS, theres a bunch of collection functions off of them such as slice, pop, push. Objects have just more raw data. A JSONArray is an ordered sequence of values. Its external text form is a string wrapped in square brackets with commas separating the ...
Type declaration: CREATE OR REPLACE TYPE leaf_type UNDER mid_type ( leaf_attr VARCHAR2(1000), CONSTRUCTOR FUNCTION leaf_type ( i_base_id INTEGER, i_base_attr VARCHAR2, i_mid_attr DATE, i_leaf_attr VARCHAR2 ) RETURN SELF AS RESULT, MEMBER FUNCTION ...
This example shows how to populate report with data returned by a data view delegate. During the exercise, we will develop an inquiry screen showing list of Sales Orders between two dates. Data view delegate will be used to populate Sales Order information. Prerequisites: We start with declara...
The let expressions in scheme are in fact macros. They can be expressed with lambdas. A simple let might look like this: (let ((x 1) (y 2)) (+ x y)) It will return 3 as the value of the last expression of the let body is returned. As you can see, a let-expression is actually executing somethi...
There are times with multiple static objects where you need to be able to guarantee that the singleton will not be destroyed until all the static objects that use the singleton no longer need it. In this case std::shared_ptr can be used to keep the singleton alive for all users even when the static...
You can also make a switch statement switch based on the class of the thing you're switching on. An example where this is useful is in prepareForSegue. I used to switch based on the segue identifier, but that's fragile. if you change your storyboard later and rename the segue identifier, it breaks ...
Parsing files into STL containers istream_iterators are very useful for reading sequences of numbers or other parsable data into STL containers without explicit loops in the code. Using explicit container size: std::vector<int> v(100); std::copy(std::istream_iterator<int>(ifs), std::...
""" usage: sub <command> commands: status - show status list - print list """ import sys def check(): print("status") return 0 if sys.argv[1:] == ['status']: sys.exit(check()) elif sys.argv[1:] == ['list']: ...
You can wait until the next frame. yield return null; // wait until sometime in the next frame You can have multiple of these calls in a row, to simply wait for as many frames as desired. //wait for a few frames yield return null; yield return null; Wait for approximately n seconds. It is ...
import argparse import sys def check(): print("status") return 0 parser = argparse.ArgumentParser(prog="sub", add_help=False) subparser = parser.add_subparsers(dest="cmd") subparser.add_parser('status', help='show status') subparser.add_parser('lis...
public class MyBubbleSort { public static void bubble_srt(int array[]) {//main logic int n = array.length; int k; for (int m = n; m >= 0; m--) { for (int i = 0; i < n - 1; i++) { k = i + 1; if (array[i] > arr...
Dynamically switch beetween multiple components using <component> element and pass data to v-bind:is attribute: Javascript: new Vue({ el: '#app', data: { currentPage: 'home' }, components: { home: { template: "<p>Home</p>" }, about...
Sometimes you want to keep the switched-out components in memory, to make that happen, you should use <keep-alive> element: Javascript: new Vue({ el: '#app', data: { currentPage: 'home', }, methods: { switchTo: function(page) { this.currentPage = page; ...
const process = require('process'); const rl = require('readline').createInterface(process.stdin, process.stdout); rl.pause(); console.log('Something long is happening here...'); var cliConfig = { promptPrefix: ' > ' } /* Commands recognition BEGIN */ var commands = {...
Event stores details for players attempting to log in @EventHandler public void onPlayerLogin(PlayerLoginEvent e) { Player tryingToLogin = e.getPlayer(); //Disallowing a player login e.disallow(PlayerLoginEvent.Result.KICK_FULL , "The server is reserved and is full for you!&q...
Avoid calling methods using strings that can accept methods. This approach will make use of reflection that can slow down your game especially when used in the update function. Examples: //Avoid StartCoroutine with method name this.StartCoroutine("SampleCoroutine"); //Ins...

Page 644 of 861