Tutorial by Examples: c

The _.each function accepts an array or an object, an iteratee function and an optional context object, the iteratee function is invoked once and in order for each array item The iteratee function provides 3 arguments item - The current iterated object (or value if an object was passed) i - The i...
If you are tired of using long commands in bash you can create your own command alias. The best way to do this is to modify (or create if it does not exist) a file called .bash_aliases in your home folder. The general syntax is: alias command_alias='actual_command' where actual_command is the c...
To switch focus to either main document or first frame of the page. You have to use below syntax. webDriver.SwitchTo().DefaultContent();
The module "struct" provides facility to pack python objects as contiguous chunk of bytes or dissemble a chunk of bytes to python structures. The pack function takes a format string and one or more arguments, and returns a binary string. This looks very much like you are formatting a stri...
for ([declaration-or-expression]; [expression2]; [expression3]) { /* body of the loop */ } In a for loop, the loop condition has three expressions, all optional. The first expression, declaration-or-expression, initializes the loop. It is executed exactly once at the beginning of the lo...
Preconditions These instructions suppose you have any type of Linux, Unix, Mac with bash or Git-bash Windows. Windows: Download and install Git-bash for Windows, then execute 'bash' from command line. Other shells than bash are fine too, just replace the activate command below with activate.csh...
Player playerToCheck; Player playerSeeing; boolean isVisible = playerSeeing.canSee(playerToCheck); //isVisible returns true if playerSeeing can see playerToCheck and false otherwhise
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...
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 ...
CREATE SEQUENCE test_seq START WITH 1001; CREATE TABLE test_tab ( test_id INTEGER, test_obj base_type, PRIMARY KEY (test_id) ); INSERT INTO test_tab (test_id, test_obj) VALUES (test_seq.nextval, base_type(1,'BASE_TYPE')); INSERT INTO test_tab (test_id, test_obj) VALUES (test_...
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 ...
a@coolbox:~/workspace$ express --ejs my-app a@coolbox:~/workspace$ cd my-app a@coolbox:~/workspace/my-app$ npm install a@coolbox:~/workspace/my-app$ npm start
If a function returns a std::vector type, and it is exposed to Python directly like std::vector<float> secondMethod() { return std::vector<float>(); } BOOST_PYTHON_MODULE(CppProject) { boost::python::def("getEmptyVec", secondMethod); } then when the functions...
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...
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 = {...
Cache references to avoid the expensive calls especially in the update function. This can be done by caching these references on start if available or when available and checking for null/bool flat to avoid getting the reference again. Examples: Cache component references change void Update() {...
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 631 of 826