Tutorial by Examples

In this example we're going to look at testing webhook notifications in sandbox, using ngrok to provide a tunnel for our Node HTTP listener, running on localhost, to the internet. For this example, we're going to be using Node to set up notification webhooks for payment events (such as a payment bei...
Occasionally you will find the need to encode binary data as a base64-encoded string. For this we can use the DatatypeConverter class from the javax.xml.bind package: import javax.xml.bind.DatatypeConverter; import java.util.Arrays; // arbitrary binary data specified as a byte array byte[] bi...
Java SE 5 public enum Singleton { INSTANCE; public void execute (String arg) { // Perform operation here } } Enums have private constructors, are final and provide proper serialization machinery. They are also very concise and lazily initialized in a thread safe manne...
Writing bytes to an OutputStream one byte at a time OutputStream stream = object.getOutputStream(); byte b = 0x00; stream.write( b ); Writing a byte array byte[] bytes = new byte[] { 0x00, 0x00 }; stream.write( bytes ); Writing a section of a byte array int offset = 1; int length = ...
This sample will show you how to update an existing webhook forwarding URL (where the notifications should be POSTed to). To run this, you should have the ID provided back by PayPal when you first created your webhooks. First, add the PayPal SDK and configure the environment (sandbox below). var p...
Since the new line separator varies from platform to platform (e.g. \n on Unix-like systems or \r\n on Windows) it is often necessary to have a platform-independent way of accessing it. In Java it can be retrieved from a system property: System.getProperty("line.separator") Java SE 7 ...
To load a properties file bundled with your application: public class Defaults { public static Properties loadDefaults() { try (InputStream bundledResource = Defaults.class.getResourceAsStream("defaults.properties")) { Properties defaults = new ...
First, establish if the device is capable of accepting Touch ID input. if (context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out AuthError)) If it does then we can display the Touch ID UI by using: context.EvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometri...
HTTPGetJSON performs an HTTP request to the specified URL and returns a jsonq.JsonQuery object for use in the alert template. Example: template example { {{ $ip := 8.8.8.8 }} {{ $whoisURL := printf "http://whois.arin.net/rest/ip/%s" $ip }} {{ $whoisJQ := $.HTTPGetJSON $who...
You can add an image to your message using the parameter media_url. # Download the twilio-python library from http://twilio.com/docs/libraries from twilio.rest import TwilioRestClient # Find these values at https://twilio.com/user/account account_sid = "ACXXXXXXXXXXXXXXXXX" auth_to...
To send your first SMS with Twilio and Python you'll just need the Twilio-Python helper library to get started. # Download the twilio-python library from http://twilio.com/docs/libraries from twilio.rest import TwilioRestClient # Find these values at https://twilio.com/user/account account_si...
To begin, install Node.js on your development computer. Windows: Navigate to the download page and download/run the installer. Mac: Navigate to the download page and download/run the installer. Alternatively, you can install Node via Homebrew using brew install node. Homebrew is a command-line pac...
There are different data types for different purposes. PHP does not have explicit type definitions, but the type of a variable is determined by the type of the value that is assigned, or by the type that it is casted to. This is a brief overview about the types, for a detailed documentation and exam...
Java SE 7 byte[] bytes = { 0x48, 0x65, 0x6c, 0x6c, 0x6f }; try(FileOutputStream stream = new FileOutputStream("Hello world.txt")) { stream.write(bytes); } catch (IOException ioe) { // Handle I/O Exception ioe.printStackTrace(); } Java SE 7 byte[] bytes = { 0x48, ...
Streams provide the most direct access to the binary content, so any InputStream / OutputStream implementations always operate on ints and bytes. // Read a single byte from the stream int b = inputStream.read(); if (b >= 0) { // A negative value represents the end of the stream, normal values ...
Browse to File > New > Solution to bring you up the new project dialog. Select Android App and press Next. Configure your app by setting your app name and organization ID. Select the Target Platform most suited for your needs, or leave it as the default. Press Next: Set your Project name ...
Browse to File > New > Project to bring you up the New Project dialog. Navigate to Visual C# > Android and select Blank App: Give your app a Name and press OK to create your project. Set up your device for deployment, or configure an emulator To run your application, select the Debug...
Here is an example of a Bosun config file used in a development environment: tsdbHost = localhost:4242 httpListen = :8070 smtpHost = localhost:25 emailFrom = [email protected] timeAndDate = 202,75,179,136 ledisDir = ../ledis_data checkFrequency = 5m notification example.notification { ...
The quick start guide includes information about using Docker to stand up a Bosun instance. $ docker run -d -p 4242:4242 -p 80:8070 stackexchange/bosun This will create a new instance of Bosun which you can access by opening a browser to http://docker-server-ip. The docker image includes HBase/O...
With Stream Controller add-on enabled, you can use Channel Groups to subscribe to a 1000's of channels from a single client. You do this by creating a channel group and adding channels to the channel group. We'll assume pubnub variable has been initialized properly with your keys. Create a generic ...

Page 69 of 1336