Tutorial by Examples: and

If all you need is serializing mongo results into json, it is possible to use the json module, provided you define custom handlers to deal with non-serializable fields types. One advantage is that you have full power on how you encode specific fields, like the datetime representation. Here is a ha...
This example shows how you can install and run WSO2 API Manager in your machine. For this example API Manager 2.1.0 version is used. You can install WSO2 API Manager in two ways. Download the API Manager product from product website. Checkout the source code from GitHub, build the source code ...
Copying files copy copies the source file in the first argument to the destination in the second argument. The resolved destination needs to be in a directory that is already created. if (copy('test.txt', 'dest.txt')) { echo 'File has been copied successfully'; } else { echo 'Failed to ...
List can contain n number of items. The items in list are separated by comma >> a = [1,2,3] To access an element in the list use the index. The index starts from 0 >> a[0] >> 1 Lists can be nested. >> nested_list = [ [1,2,3], ['a','b','c'] ] >> nested_list...
Calling C code from Go package main /* // Everything in comments above the import "C" is C code and will be compiles with the GCC. // Make sure you have a GCC installed. int addInC(int a, int b) { return a + b; } */ import "C" import "fmt" func ma...
(From this answer) The example below adds an enumerated type to a postgres database. First, edit the migration file (created with mix ecto.gen.migration): def up do # creating the enumerated type execute("CREATE TYPE post_status AS ENUM ('published', 'editing')") # creating a...
NSE functions should be used in interactive programming. However, when developping new functions in a new package, it's better to use SE version. Load dplyr and lazyeval : library(dplyr) library(lazyeval) Filtering NSE version filter(mtcars, cyl == 8) filter(mtcars, cyl < 6) filter(mtca...
A simple way to catch unhandled errors (exceptions) in a VFP application is to use the ON ERROR command near the beginning of your main program. The following ON ERROR command calls a method in the current program called "errorHandler". The values returned by ERROR (the VFP Error Number),...
While the JCE secures cryptographic operations and key generation, it is up to the developer to actually manage their keys. More information needs to be provided here. One commonly-accepted best practice for handling keys at runtime is to store them only as byte arrays, and never as strings. This i...
Needs content For most applications, the java.utils.Random class is a perfectly fine source of "random" data. If you need to choose a random element from an array, or generate a random string, or create a temporary "unique" identifier, you should probably use Random. However, m...
More information needed. A cryptographic hash function is a member of a class of functions with three vital properties; consistency, uniqueness, and irreversibility. Consistency: Given the same data, a hash function will always return the same value. That is, if X = Y, f(x) will always equal f(y) ...
navigator.mediaDevices is the common method adapted in Chrome and FF to getUserMedia as of now. A promised based call back which returns local stream on success navigator.mediaDevices.getUserMedia({ audio: true, video: true }) .then(stream => { // attach this stream to window obje...
This example uses Icarus and GTKWave. Installation instructions for those tools on OSx are provided elsewhere on this page. Lets begin with the module design. This module is a BCD to 7 segment display. I have coded the design in an obtuse way simply to give us something that is easily broken and...
$data = array( array( 'id' => 'sku_123ABC', 'qty' => 1, 'price' => 39.95, 'name' => 'T-Shirt', 'options' => array('Size' => 'L', 'Color' => 'Red') ), array( 'id' =>...
func sampleWithCompletion(completion:@escaping (()-> ())){ let delayInSeconds = 1.0 DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + delayInSeconds) { completion() } } //Call the function sampleWithCompletion { print("after on...
enum ReadResult{ case Successful case Failed case Pending } struct OutpuData { var data = Data() var result: ReadResult var error: Error? } func readData(from url: String, completion: @escaping (OutpuData) -> Void) { var _data = OutpuData(data: Data(), ...
Eclipse can generate basic getters and setters for you. Right click in you class file and go to Source - Generate Getters and Setters (ALT+SHIFT+S). This will open a dialog where you can choose which fields you would like to have getters and setters generated for.
QtCreator is, at the moment, the best tool to create a Qt application. In this example, we will see how to create a simple Qt application which manage a button and write text. To create a new application click on File->New File or Project: Then choose the Projects->Application->Qt Widge...
Commands: expdp <bkpadmin>/<bkp123> parfile=<exp.par> *Please replace the data in <> with appropriate values as per your environment. You can add/modify parameters as per your requirements. In the above example all the remaining parameters are added in parameter files as...
Prerequisite: Prior to user import it is a good practice to drop the schema or table imported. Commands: impdp <bkpadmin>/<bkp123> parfile=<imp.par> *Please replace the data in <> with appropriate values as per your environment. You can add/modify parameters as per...

Page 133 of 153