For example, if we wanted to grab an entity’s three.js camera object or material object, we could reach into its components
var camera = document.querySelector('a-entity[camera]').components.camera.camera;
var material = document.querySelector('a-entity[material]').components.material.material;
...
For example, consider the following that sets the contents of $@ to the contents of a given variable:
a=(1 2 3)
eval set -- "${a[@]}"
This code is often accompanied by getopt or getopts to set $@ to the output of the aforementioned option parsers, however, you can also use it to creat...
Step 1: Open a Document
Step 2 Option A: Press Alt + F11
This is the standard shortcut to open the VBE.
Step 2 Option B: Developer Tab --> View Code
First, the Developer Tab must be added to the ribbon. Go to File -> Options -> Customize Ribbon, then check the box for developer.
Th...
Blender's viewport is a dynamic, changeable interface composed of many different windows. With the program running by default, the viewport is composed of 5 different windows. Windows can be identified by looking for their small square indicator icons either in the top or bottom-left corner. They ma...
While eval may not be needed for a pop like function, it is however required whenever you use getopt:
Consider the following function that accepts -h as an option:
f()
{
local __me__="${FUNCNAME[0]}"
local argv="$(getopt -o 'h' -n $__me__ -- "$@")"
e...
The volatile keyword tells the compiler that the value of the variable may change at any time as a result of external conditions, not only as a result of program control flow.
The compiler will not optimize anything that has to do with the volatile variable.
volatile int foo; /* Different ways to ...
The function EventEmitter.eventNames() will return an array containing the names of the events currently subscribed to.
const EventEmitter = require("events");
class MyEmitter extends EventEmitter{}
var emitter = new MyEmitter();
emitter
.on("message", function(){ //list...
//Retrieves, but does not remove, the head of the queue represented by this deque
Object headItem = deque.element();
//Retrieves, but does not remove, the first element of this deque.
Object firstItem = deque.getFirst();
//Retrieves, but does not remove, the last element of this deque.
...
The function Emitter.listenerCount(eventName) will return the number of listeners that are currently listening for the event provided as argument
const EventEmitter = require("events");
class MyEmitter extends EventEmitter{}
var emitter = new MyEmitter();
emitter
.on("data"...
OpenCL Kernels can be either executed on the GPU or the CPU. This allows for fallback solutions, where the customer may have a very outdated system. The programmer can also choose to limit their functionality to either the CPU or GPU.
To get started using OpenCL, you'll need a 'Context' and a 'Devi...
$logger = $container->get('logger');
This will fetch the service with the service ID "logger" from the container, an object that implements Psr\Log\LoggerInterface.
Many custom views need to accept user interaction in the form of touch events. You can get access to touch events by overriding onTouchEvent. There are a number of actions you can filter out. The main ones are
ACTION_DOWN: This is triggered once when your finger first touches the view.
ACTION_MO...
Sonim devices have varying by model a lot of different custom buttons:
PTT_KEY
com.sonim.intent.action.PTT_KEY_DOWN
com.sonim.intent.action.PTT_KEY_UP
YELLOW_KEY
com.sonim.intent.action.YELLOW_KEY_DOWN
com.sonim.intent.action.YELLOW_KEY_UP
SOS_KEY
com.sonim.intent.action.SOS_KEY_DOWN
co...
public void setCardColorTran(View view) {
ColorDrawable[] color = {new ColorDrawable(Color.BLUE), new ColorDrawable(Color.RED)};
TransitionDrawable trans = new TransitionDrawable(color);
if(Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
view.setBackgrou...
Gui, +AlwaysOnTop +Disabled -SysMenu +Owner ; +Owner avoids a taskbar button.
Gui, Add, Text,, Some text to display.
Gui, Show, NoActivate, Title of Window ; NoActivate avoids deactivating the currently active window.
In PHP, variable values have an associated "truthiness" so even non-boolean values will equate to true or false. This allows any variable to be used in a conditional block, e.g.
if ($var == true) { /* explicit version */ }
if ($var) { /* $var == true is implicit */ }
Here are some fun...
Suppose you are creating a function that requires no arguments when it is called and you are faced with the dilemma of how you should define the parameter list in the function prototype and the function definition.
You have the choice of keeping the parameter list empty for both prototype and d...