Tutorial by Examples: an

For Android, here is the code we recommend for generating, persisting and retrieving a UUID. There is not constructor that accepts the UUID as a parameter, so you must instantiate Pubnub object first then use the setter to provide the UUID. // creating the Pubnub connection object with minimal args...
Sometimes we will need to run commands against a lot of files. This can be done using xargs. find . -type d -print | xargs -r chmod 770 The above command will recursively find all directories (-type d) relative to . (which is your current working directory), and execute chmod 770 on them. The -...
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...
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...
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...
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 ...
All instances of Preferences are always thread-safe across the threads of a single Java Virtual Machine (JVM). Because Preferences can be shared across multiple JVMs, there are special methods that deal with synchronizing changes across virtual machines. If you have an application which is supposed...
CASE's shorthand variant evaluates an expression (usually a column) against a series of values. This variant is a bit shorter, and saves repeating the evaluated expression over and over again. The ELSE clause can still be used, though: SELECT Id, ItemId, Price, CASE Price WHEN 5 THEN 'CHEAP' ...
Classes are identifiers for the elements that they are assigned to. Use the class attribute to assign a class to an element. <div class="example-class"></div> To assign multiple classes to an element, separate the class names with spaces. <div class="class1 class2&...
The ID attribute of an element is an identifier which must be unique in the whole document. Its purpose is to uniquely identify the element when linking (using an anchor), scripting, or styling (with CSS). <div id="example-id"></div> You should not have two elements with th...
To add an image to a page, use the image tag. Image tags (img) do not have closing tags. The two main attributes you give to the img tag are src, the image source and alt, which is alternative text describing the image. <img src="images/hello.png" alt="Hello World"> Yo...
C++11 for loops can be used to iterate over the elements of a iterator-based range, without using a numeric index or directly accessing the iterators: vector<float> v = {0.4f, 12.5f, 16.234f}; for(auto val: v) { std::cout << val << " "; } std::cout <<...
Useful for simple animations, the CSS transition property allows number-based CSS properties to animate between states. Example .Example{ height: 100px; background: #fff; } .Example:hover{ height: 120px; background: #ff0000; } View Result By default, hovering over an...
When creating animations and other GPU-heavy actions, it's important to understand the will-change attribute. Both CSS keyframes and the transition property use GPU acceleration. Performance is increased by offloading calculations to the device's GPU. This is done by creating paint layers (parts of...
For multi-stage CSS animations, you can create CSS @keyframes. Keyframes allow you to define multiple animation points, called a keyframe, to define more complex animations. Basic Example In this example, we'll make a basic background animation that cycles between all colors. @keyframes rainbow...
Suppose we have a plain object called prototype: var prototype = { foo: 'foo', bar: function () { return this.foo; } }; Now we want another object called obj that inherits from prototype, which is the same as saying that prototype is the prototype of obj var obj = Object.create(prototype); N...
This example uses the Dropbox .NET library to try to get the metadata for an item at a particular path, and checks for a NotFound error: try { var metadata = await this.client.Files.GetMetadataAsync("/non-existant path"); Console.WriteLine(metadata.Name); } catch (Dropbox.Api.A...
> mysqldump -u username -p [other options] Enter password: If you need to specify the password on the command line (e.g. in a script), you can add it after the -p option without a space: > mysqldump -u username -ppassword [other options] If you password contains spaces or special chara...
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...

Page 18 of 307