Tutorial by Examples

To authenticate to Watson services, you need credentials for each service that you plan to use. Depending on the service, you will need to pass a username and password with Basic Authentication, or you will need to pass an API key in a parameter for each request you make. How to get credentials for...
For any file operations, you will need the filesystem module: const fs = require('fs'); Reading a String fs.readFileSync behaves similarly to fs.readFile, but does not take a callback as it completes synchronously and therefore blocks the main thread. Most node.js developers prefer the asynch...
In this tutorial we're going to learn how to set up the PayPal Android SDK to process a simple payment via either a PayPal payment or a credit card purchase. At the end of this example, you should have a simple button in an application that, when clicked, will forward the user to PayPal to confirm a...
C++11 A std::unique_ptr is a class template that manages the lifetime of a dynamically stored object. Unlike for std::shared_ptr, the dynamic object is owned by only one instance of a std::unique_ptr at any time, // Creates a dynamic int with value of 20 owned by a unique pointer std::unique_pt...
If you need to create a JSONObject and put data in it, consider the following example: // Create a new javax.json.JSONObject instance. JSONObject first = new JSONObject(); first.put("foo", "bar"); first.put("temperature", 21.5); first.put("year", 2016);...
If you need to get data from a JSONObject, consider the following example: String json = "{\"foo\":\"bar\",\"temperature\":21.5,\"year\":2016,\"message\":{\"Hello\":\"world\"},\"months\":[\"January\",\&qu...
JSONObject and JSONArray have a few methods that are very useful while dealing with a possibility that a value your are trying to get does not exist or is of another type. JSONObject obj = new JSONObject(); obj.putString("foo", "bar"); // For existing properties of the corre...
Overview Attribute selectors can be used with various types of operators that change the selection criteria accordingly. They select an element using the presence of a given attribute or attribute value. Selector(1)Matched elementSelects elements...CSS Version[attr]<div attr>With attribute a...
Overview SelectorDescriptiondiv spanDescendant selector (all <span>s that are descendants of a <div>)div > spanChild selector (all <span>s that are a direct child of a <div>)a ~ spanGeneral Sibling selector (all <span>s that are siblings after an <a>)a + spanA...
There are two ids you will need from your plivo account. Replace authid and authtoken in this snippet with those values. The src value should also be a valid number assigned to your account. dst can be any number you want, or multiple seperated by <. notification sms { post = https://authid:a...
To send email notifications you need to add the following settings to your config file: #Using a company SMTP server (note only one can be define) smtpHost = mail.example.com:25 emailFrom = [email protected] #Using Gmail with TLS and username/password smtpHost = smtp.gmail.com:587 emailFrom ...
Bosun notifications are assigned to alert definitions using warnNotification and critNotification and indicate where to send the rendered alert template when a new incident occur. Notifications can be sent via email or use HTTP GET/POST requests. There also is a Print notification that just adds inf...
#Post to a slack.com chatroom via their Incoming Webhooks integration notification slack{ post = https://hooks.slack.com/services/abcdefg/abcdefg/abcdefghijklmnopqrstuvwxyz body = {"text": {{.|json}}} } #To customize the icon and user use: # body = {"text": {{.|js...
Alert incidents can be sent to other system using HTTP GET or HTTP POST requests. You can either send the rendered alert directly (using markdown in the template perhaps) or use body = ... {{.|json}} ... and contentType to send the alert data over as part of a JSON object. Another approach is to onl...
Top-level extension methods are not contained within a class. fun IntArray.addTo(dest: IntArray) { for (i in 0 .. size - 1) { dest[i] += this[i] } } Above an extension method is defined for the type IntArray. Note that the object for which the extension method is defined (cal...
The extension method to be called is determined at compile-time based on the reference-type of the variable being accessed. It doesn't matter what the variable's type is at runtime, the same extension method will always be called. open class Super class Sub : Super() fun Super.myExtension()...
A stub is a light weight test double that provides canned responses when methods are called. Where a class under test relies on an interface or base class an alternative 'stub' class can be implemented for testing which conforms to the interface. So, assuming the following interface, public inter...
The terms Mock and Stub can often become confused. Part of the reason for this is that many mocking frameworks also provide support for creating Stubs without the verification step associated with Mocking. Rather than writing a new class to implement a stub as in the "Using a stub to supply c...
Mocks are used when it is necessary to verify the interactions between the system under test and test doubles. Care needs to be taken to avoid creating overly brittle tests, but mocking can be particularly useful when the method to test is simply orchestrating other calls. This test verifies that ...
CREATE TABLE MyTableName ( Id INT, MyColumnName NVARCHAR(1000) ) GO INSERT INTO MyTableName (Id, MyColumnName) VALUES (1, N'Hello World!') GO

Page 73 of 1336