Tutorial by Examples: a

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 base_type AS OBJECT ( base_id INTEGER, base_attr VARCHAR2(400), null_attr INTEGER, -- Present only to demonstrate non-default constructors CONSTRUCTOR FUNCTION base_type ( i_base_id INTEGER, i_base_attr VARCHAR2 ...
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 ...
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 ...
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::...
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
""" 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']: ...
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...
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...
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() {...

Page 830 of 1099