Tutorial by Examples: ti

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...
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 ...
#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...
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()...
When an API is marked with NS_REFINED_FOR_SWIFT, it will be prefixed with two underscores (__) when imported to Swift: @interface MyClass : NSObject - (NSInteger)indexOfObject:(id)obj NS_REFINED_FOR_SWIFT; @end The generated interface looks like this: public class MyClass : NSObject { publ...
To update a package use the following command: PM> Update-Package EntityFramework where EntityFramework is the name of the package to be updated. Note that update will run for all projects, and so is different from Install-Package EntityFramework which would install to "Default project&q...
PM> Uninstall-Package -ProjectName MyProjectB EntityFramework
Pull properties from an object passed into a function. This pattern simulates named parameters instead of relying on argument position. let user = { name: 'Jill', age: 33, profession: 'Pilot' } function greeting ({name, profession}) { console.log(`Hello, ${name} the ${pr...
This uses the Dropbox Python SDK to create a shared link for a file and also supplies a requested visibility and expiration in the settings: import datetime import dropbox dbx = dropbox.Dropbox("<ACCESS_TOKEN>") expires = datetime.datetime.now() + datetime.timedelta(days=30...
#include <stdio.h> #include <string.h> int main(void) { /* Always ensure that your string is large enough to contain the characters * and a terminating NUL character ('\0')! */ char mystring[10]; /* Copy "foo" into `mystring`, until a NUL character is en...
int* foo(int bar) { int baz = 6; baz += bar; return &baz; /* (&baz) copied to new memory location outside of foo. */ } /* (1) The lifetime of baz and bar end here as they have automatic storage * duration (local variables), thus the returned pointer is not valid! */ ...
Let's say we have two classes, Cat and Dog. class Cat def eat die unless has_food? self.food_amount -= 1 self.hungry = false end def sound puts "Meow" end end class Dog def eat die unless has_food? self.food_amount -= 1 self.hungry = f...
Basics The Reflection API allows one to check the class structure of the code at runtime and invoke code dynamically. This is very powerful, but it is also dangerous since the compiler is not able to statically determine whether dynamic invocations are valid. A simple example would be to get the p...
Syntax for accessing rows and columns: [, [[, and $ This topic covers the most common syntax to access specific rows and columns of a data frame. These are Like a matrix with single brackets data[rows, columns] Using row and column numbers Using column (and row) names Like a list: Wi...
var options = $( "#accordion" ).accordion( "option" ); This will return a PlainObject giving all the options representing the selected accordion. This will contain all the values of the keys that are explained in the Parameters section. This method takes parameters which are ...
var array = [3, 2, 1] Creating a new sorted array As Array conforms to SequenceType, we can generate a new array of the sorted elements using a built in sort method. 2.12.2 In Swift 2, this is done with the sort() method. let sorted = array.sort() // [1, 2, 3] 3.0 As of Swift 3, it has...
py.test is one of several third party testing libraries that are available for Python. It can be installed using pip with pip install pytest The Code to Test Say we are testing an addition function in projectroot/module/code.py: # projectroot/module/code.py def add(a, b): return a + b ...
Annotation types are defined with @interface. Parameters are defined similar to methods of a regular interface. @interface MyAnnotation { String param1(); boolean param2(); int[] param3(); // array parameter } Default values @interface MyAnnotation { String param1() defau...

Page 30 of 505