Tutorial by Examples: call

std::call_once ensures execution of a function exactly once by competing threads. It throws std::system_error in case it cannot complete its task. Used in conjunction with std::once_flag. #include <mutex> #include <iostream> std::once_flag flag; void do_something(){ std::ca...
We can create dynamic component and get the instances of component into an array and finally rendered it on template. For example, we can can consider two widget component, ChartWidget and PatientWidget which extended the class WidgetComponent that I wanted to add in the container. ChartWidget.ts ...
# all react callbacks are supported using active-record-like syntax class SomeCallBacks < Hyperloop::Component before_mount do # initialize stuff - replaces normal class initialize method end after_mount do # any access to actual generated dom node, or window behaviors goes ...
this will accept any type with a method named GetLength that takes nothing and returns an int: ((^a : (static member GetLength : int) ()))
The following prints the current caller class. Note that in this case, the StackWalker needs to be created with the option RETAIN_CLASS_REFERENCE, so that Class instances are retained in the StackFrame objects. Otherwise an exception would occur. public class StackWalkerExample { public stat...
When a remote session is created via the New-PSsession cmdlet, the PSSession persists until the current PowerShell session ends. Meaning that, by default, the PSSession and all associated resources will continue to be used until the current PowerShell session ends. Multiple active PSSessions can b...
The first standalone R script Standalone R scripts are not executed by the program R (R.exe under Windows), but by a program called Rscript (Rscript.exe), which is included in your R installation by default. To hint at this fact, standalone R scripts start with a special line called Shebang line, ...
Configuration file contains sections, each section contains keys and values. configparser module can be used to read and write config files. Creating the configuration file:- import configparser config = configparser.ConfigParser() config['settings']={'resolution':'320x240', ...
In the beginning there were callbacks, and callbacks were ok: const getTemperature = (callback) => { http.get('www.temperature.com/current', (res) => { callback(res.data.temperature) }) } const getAirPollution = (callback) => { http.get('www.pollution.com/current', (res) ...
We can call an action result in another action result. public ActionResult Action1() { ViewData["OutputMessage"] = "Hello World"; return RedirectToAction("Action2","ControllerName"); //this will go to second action; } public ActionResult...
By creating multiple properties files for the different environments or use cases, its sometimes hard to manually change the active.profile value to the right one. But there is a way to set the active.profile in the application.properties file while building the application by using maven-profiles. ...
Lets have the following file called library.cmd : @echo off echo -/-/- Batch Functions Library -/-/- :function1 echo argument1 - %1 goto :eof To execute only the :function1 without the code of the rest of the file you should put a label :function1 in the caller bat and use it lik...
General-purpose stopwatch for timing how long a function takes to run: object Benchmark { fun realtime(body: () -> Unit): Duration { val start = Instant.now() try { body() } finally { val end = Instant.now() return Duration.b...
"""PyAudio Example: Play a wave file (callback version).""" import pyaudio import wave import time import sys if len(sys.argv) < 2: print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0]) sys.exit(-1) wf = wave.open(sys.arg...
<?xml version="1.0"?> <openerp> <data noupdate="1"> <function model="*model_name*" name="_configure_sales"/> </data> </openerp> This simple xml file is calls _configure_sales function from model_name ...
function REReplaceCallback(re,str,callback) { /* Thanks to Ben Nadel "Learning ColdFusion 8: REMatch() For Regular Expression Matching" from 2007-06-13 https://www.bennadel.com/blog/769-learning-coldfusion-8-rematch-for-regular-expression-matching.h...
REReplaceCallback('YOUR REGEX GOES HERE','AND YOUR STRING HERE',function(groups) { //now you can access the 'groups' array containing all the captured groups return result; //return whatever you've processed inside });
Upon calling a function there are new elements created on the program stack. These include some information about the function and also space (memory locations) for the parameters and the return value. When handing over a parameter to a function the value of the used variable (or literal) is copied...
If you do not see any logging, you can check if Configure() is called in your application. The easiest way is to add it as an attribute to your assembly: [assembly: log4net.Config.XmlConfigurator(Watch = true)] Then you do not have to add log4net.Config.XmlConfigurator.Configure() anywhere in y...
gradle.taskGraph.whenReady {taskGraph -> if (taskGraph.hasTask(assembleDebug)) { /* when run debug task */ autoIncrementBuildNumber() } else if (taskGraph.hasTask(assembleRelease)) { /* when run release task */ autoIncrementBuildNumber() } }

Page 17 of 18