Tutorial by Examples: c

function assign(obj, prop, value) { if (typeof prop === 'string') prop = prop.split('.'); if (prop.length > 1) { var e = prop.shift(); assign(obj[e] = Object.prototype.toString.call(obj[e]) === '[object Object]' ? obj[e] ...
Here is an example of how to import a function that is defined in an unmanaged C++ DLL. In the C++ source code for "myDLL.dll", the function add is defined: extern "C" __declspec(dllexport) int __stdcall add(int a, int b) { return a + b; } Then it can be included into ...
""" ================================================================================ DRAW MULTIPLE LINES IN THE SAME PLOT ================================================================================ """ import matplotlib.pyplot as plt ...
JavaFX 8 The following example demonstrates how to add custom properties that can be styled from css to a custom Node. Here 2 DoublePropertys are added to the Rectangle class to allow setting the width and height from CSS. The following CSS could be used for styling the custom node: StyleableRe...
Objective-C supports a special type called `instancetype that can only be used as type returned by a method. It evaluates to the class of the receiving object. Consider the following class hierarchy: @interface Foo : NSObject - (instancetype)initWithString:(NSString *)string; @end @interf...
UCanAccess is a pure Java JDBC driver that allows us to read from and write to Access databases without using ODBC. It uses two other packages, Jackcess and HSQLDB, to perform these tasks. Once it has been set up*, we can work with data in .accdb and .mdb files using code like this: import java.sq...
You can create and configure build types in the module-level build.gradle file inside the android {} block. android { ... defaultConfig {...} buildTypes { release { minifyEnabled true proguardFiles getDefaultProguar...
Similar to repeaters used in other languages. This binding will allow you to replicate a block of html for each item in an array. <div data-bind="foreach:contacts"> <div class="contact"> <h2 data-bind="text:name"> <p data-bin...
We know that 'best practise' dictates that a range object should have its parent worksheet explicitly referenced. A worksheet can be referred to by its .Name property, numerical .Index property or its .CodeName property but a user can reorder the worksheet queue by simply dragging a name tab or rena...
Add akka-actor dependency (SBT example) libraryDependencies += "com.typesafe.akka" % "akka-actor_2.11" % "2.4.8" Create actor classes: Actor for string output: class OutputActor extends Actor { override def receive: Receive = { case message => p...
When working with multiple open Workbooks, each of which may have multiple Sheets, it’s safest to define and set reference to all Workbooks and Sheets. Don't rely on ActiveWorkbook or ActiveSheet as they might be changed by the user. The following code example demonstrates how to copy a range from...
HTTP Basic Authentication provides a straightforward mechanism for authentication. Credentials are sent in plain text, and so is insecure by default. Successful authentication proceeds as follows. The client requests a page for which access is restricted: GET /secret The server responds with st...
Download your preferred version from Lightbend with curl: curl -O http://downloads.lightbend.com/scala/2.xx.x/scala-2.xx.x.tgz Unzip the tar file to /usr/local/share or /opt/bin: unzip scala-2.xx.x.tgz mv scala-2.xx.x /usr/local/share/scala Add the PATH to ~/.profile or ~/.bash_profile or ...
Case classes provide a copy method that creates a new object that shares the same fields as the old one, with certain changes. We can use this feature to create a new object from a previous one that has some of the same characteristics. This simple case class to demonstrates this feature: case cla...
The idea behind programming to an interface is to base the code primarily on interfaces and only use concrete classes at the time of instantiation. In this context, good code dealing with e.g. Java collections will look something like this (not that the method itself is of any use at all, just illus...
A Subject in RxJava is a class that is both an Observable and an Observer. This basically means that it can act as an Observable and pass inputs to subscribers and as an Observer to get inputs from another Observable. Subject<String, String> subject = PublishSubject.create(); subject.subscr...
PublishSubject emits to an Observer only those items that are emitted by the source Observable subsequent to the time of the subscription. A simple PublishSubject example: Observable<Long> clock = Observable.interval(500, TimeUnit.MILLISECONDS); Subject<Long, Long> subjectLong = Publi...
This example connects to a Wi-Fi access point with WEP encryption, given an SSID and the password. public boolean ConnectToNetworkWEP(String networkSSID, String password) { try { WifiConfiguration conf = new WifiConfiguration(); conf.SSID = "\"" + networkSSID ...
This example connects to a Wi-Fi access point with WPA2 encryption. public boolean ConnectToNetworkWPA(String networkSSID, String password) { try { WifiConfiguration conf = new WifiConfiguration(); conf.SSID = "\"" + networkSSID + "\""; // Please note th...
The example below describes how to declare three different types of direct dependencies in the app/ module's build.gradle file: android {...} ... dependencies { // The 'compile' configuration tells Gradle to add the dependency to the // compilation classpath and inclu...

Page 267 of 826