Tutorial by Examples: er

Swift: let services = [CBUUID(string: SERVICE1_UUID), CBUUID(string: SERVICE2_UUID)] centralManager.scanForPeripherals(withServices: services, options: nil) Objective C: NSArray *services = @[[CBUUID UUIDWithString:SERVICE1_UUID], [CBUUID UUIDWithString:SERVICE2_UUID]]; [centralManager scanFo...
Swift: var centralManager:CBCentralManager! centralManager = CBCentralManager(delegate: self, queue: nil) Objective C: @property (nonatomic, strong) CBCentralManager *centralManager; centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
Swift: var centralManager:CBCentralManager! centralManager = CBCentralManager(delegate: self, queue: nil, options: [CBCentralManagerOptionRestoreIdentifierKey : "com.companyname.appname.central"]) Objective C: @property (nonatomic, strong) CBCentralManager *centralManager; self....
This simple example will remove the service with name "visualizer": docker service rm visualizer
This example will scale the service to 4 instances: docker service scale visualizer=4 In Docker Swarm Mode we do not stop a service. We scale it down to zero: docker service scale visualizer=0
success and Error : A success callback that gets invoked upon successful completion of an Ajax request. A failure callback that gets invoked in case there is any error while making the request. Example: $.ajax({ url: 'URL', type: 'POST', data: yourData, datat...
“Adapter” as the name suggests is the object which lets two mutually incompatible interfaces communicate with each other. For example: if you buy a Iphone 8 (or any other Apple product) you need alot of adapters. Because the default interface does not support audio jac or USB. With these a...
If you already have access to your Document class from your workspace (Using Workspaces) it is easy to access the root of your Syntax tree. Document document = ... // Get document from workspace or other source var syntaxRoot = await document.GetSyntaxRootAsync();
You can easily navigate the a Syntax Tree using LINQ. For example it is easy to get all the ClassDeclarationSyntax nodes (declared classes), that have a name starting with the letter A: var allClassesWithNameStartingWithA = syntaxRoot.DescendantNodes() .OfType<ClassDeclarationSyntax>()...
The CSharpSyntaxWalker class is out of the box implementation of the Visitor pattern, that we can use to traverse our Syntax Tree. Here is a simple example of a Syntax Walker that collects all the struct-s that have a name, starting with the letter A: public class StructCollector : CSharpSyntaxWa...
Replace operator: The -replace operator replaces a pattern in an input value using a regular expression. This operator uses two arguments (separated by a comma): a regular expression pattern and its replacement value (which is optional and an empty string by default). "The rain in Seattle&quo...
I would like to point out that we rotate left when the shifting value is negative and we rotate right when the value is positive. public static void Main() { int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int shiftCount = 1; Rotate(ref array, shiftCount); ...
var syntaxRoot = await document.GetSyntaxRootAsync(); var semanticModel = await document.GetSemanticModelAsync(); var sampleMethodInvocation = syntaxRoot .DescendantNodes() .OfType<InvocationExpressionSyntax>() .First(); var sampleMethodSymbol = semanticModel.GetSymbolI...
If you package your application in a jar using the maven-jar-plugin or the maven-assembly-plugin, an easy way to get the current pom version is to add an entry in the manifest, which is then available from Java. The secret is to set the addDefaultImplementationEntries flag to true (and the addDefau...
As this documentation explains, Sometimes a resource file will need to contain a value that can only be supplied at build time. To accomplish this in Maven, put a reference to the property that will contain the value into your resource file using the syntax ${<property name>}. The property ...
Simple example from http://search.cpan.org/dist/sapnwrfc/sapnwrfc-cookbook.pod use strict; use warnings; use utf8; use sapnwrfc; SAPNW::Rfc->load_config('sap.yml'); my $conn = SAPNW::Rfc->rfc_connect; my $rd = $conn->function_lookup("RPY_PROGRAM_READ"); my $rc = $rd-&g...
Design Patterns provide solutions to the commonly occurring problems in software design. The design patterns were first introduced by GoF(Gang of Four) where they described the common patterns as problems which occur over and over again and solutions to those problems. Design patterns have four ess...
This exemple shows how you can pass several types in function parameters : static void print_value (Value val) { print ("value-type : %s\n", val.type().name()); print ("value-content : %s\n\n", val.strdup_contents()); } public static void main (string[] args) { ...
In previous example, Value.strdup_contents prints GLib.DateTime as pointer address. You can register functions that will transform value to desired type. First, create a function that will have this signature : static void datetime_to_string (Value src_value, ref Value dest_value) { DateTime ...
The GLib.Task provide low-level API for performing asynchronous operations. var task = new GLib.Task (null, null, (obj, result) => { try { var ret = result.propagate_boolean (); } catch (Error err) { // handler err... } }); Later in a thread or a callback: t...

Page 384 of 417