Tutorial by Examples: dac

An atomic type can be used to safely read and write to a memory location shared between two threads. A Bad example that is likely to cause a data race: #include <thread> #include <iostream> //function will add all values including and between 'a' and 'b' to 'result' void add(int...
The format of the struct statement is this: struct [structure tag] { member definition; member definition; ... member definition; } [one or more structure variables]; Example: declare the ThreeFloats structure: typedef struct { float x, y, z; } ThreeFloats; @inter...
The code sample below shows one way to retrieve records from an MSSql Server in a background thread using FireDAC. Tested for Delphi 10 Seattle As written: The thread retrieves data using its own TFDConnection and TFDQuery and transfers the data to the form's FDQuery in a call to Sychronize...
It is sometimes required for a process to concurrently write and read the same "data". The ReadWriteLock interface, and its ReentrantReadWriteLock implementation allows for an access pattern that can be described as follow : There can be any number of concurrent readers of the data. If...
Due to very specific way of actor instantiation, injecting dependencies into an actor instance is not trivial. In order to intervene in actor instantiation and allow Spring to inject dependencies one should implement a couple of akka extensions. First of those is an IndirectActorProducer: import ak...
Pair allows us to treat two objects as one object. Pairs can be easily constructed with the help of template function std::make_pair. Alternative way is to create pair and assign its elements (first and second) later. #include <iostream> #include <utility> int main() { std::p...
#include <SPI.h> #define CSPIN 1 void setup() { pinMode(CSPIN, OUTPUT); // init chip select pin as an output digitalWrite(CSPIN, 1); // most slaves interpret a high level on CS as "deasserted" SPI.begin(); SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MO...
Get all documents in the collection 'myCollection' and print them to the console. const MongoClient = require('mongodb').MongoClient; const url = 'mongodb://localhost:27017/test'; MongoClient.connect(url, function (err, db) { if (err) throw new Error(err); var cursor = db.collection('my...
CREATE TYPE MyUniqueNamesType as TABLE ( FirstName varchar(10), LastName varchar(10), CreateDate datetime default GETDATE() PRIMARY KEY (FirstName,LastName) )
There are frequent behavior patterns that can result in a lot of boilerplate code. By declaring a method that takes a Closure as a parameter, you can simplify your program. As an example, it is a common pattern to retrieve a database connection, start a transaction, do work, and then either commit ...
If the Control has rows. TextBox tb = GridView1.Rows[i].FindControl("TextBox1") as TextBox; Or if it has items. TextBox tb = Repeater1.Items[i].FindControl("TextBox1") as TextBox;
# imports import weka.core.converters.ConverterUtils.DataSource as DS import weka.classifiers.trees.J48 as J48 import os # load data data = DS.read(os.environ.get("MOOC_DATA") + os.sep + "anneal.arff") data.setClassIndex(data.numAttributes() - 1) # configure classifier...
This: class Foo extends Dynamic { // Expressions are only rewritten to use Dynamic if they are not already valid // Therefore foo.realField will not use select/updateDynamic var realField: Int = 5 // Called for expressions of the type foo.field def selectDynamic(fieldName: String) = ...
Slightly counterintuitively (but also the only sane way to make it work), this: val dyn: Dynamic = ??? dyn.x(y) = z is equivalent to: dyn.selectDynamic("x").update(y, z) while dyn.x(y) is still dyn.applyDynamic("x")(y) It is important to be aware of this, or else...
The example builds a string from the name of the parent record, the name of this record, and the memo of this record. {createdfrom} || ' ' || {name} || ' ' || {memo}
At the very core, your entity main DAC must have GUID column (NoteID) to reference CSAnswers table and must have field that identify the class of the Entity. We will make use of Order Type to define list of attributes to gather particular order type-specific information. Create a Graph Extension f...
Progress supports one dimensional arrays, but they are called EXTENTS. /* Define a character array with the length 5, and display it's length */ DEFINE VARIABLE a AS CHARACTER EXTENT 5 NO-UNDO. DISPLAY EXTENT(a). Individual positions i the array is accessed using "standard" c-style b...
A lambda needs a handler, which will serve as the entry point to your application. Every handler needs to implement interface RequestHandler<I, O> where I is the input type and O is the output type. The input type is then passed to the handleRequest() method and the method returns the output t...
A lambda needs a handler, which will serve as the entry point to your application. In the simplest case, you get your input from the context and pass the result using the callback() function: exports.handler = (event, context, callback) => { callback(null, 'You sent ' + event.number); };
If you have successfully deployed the Lambda, you can also test it directly in the GUI. When you click the blue Test button for the first time, it presents you with a creation of a new test event. If you are testing the Java code from the Basic Lambda code in Java example, delete the whole body and...

Page 2 of 3