Tutorial by Examples: ed

In this example, we'll be looking at how to store a credit card using the PayPal vault, then reference that stored credit card to process a credit card transaction for a user. The reason why we would want to use the vault is so that we don't have to store sensitive credit card information on our ow...
This method can be used to convert a formatted string representation of a date into a Date object. /** * Parses the date using the given format. * * @param formattedDate the formatted date string * @param dateFormat the date format which was used to create the string. ...
#include <stdio.h> #define is_const_int(x) _Generic((&x), \ const int *: "a const int", \ int *: "a non-const int", \ default: "of other type") int main(void) { const int i = 1; int j = 1; double...
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...
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 <<...
This uses the Dropbox Python SDK to upload a file to the Dropbox API from the local file as specified by file_path to the remote path as specified by dest_path. It also chooses whether or not to use an upload session based on the size of the file: f = open(file_path) file_size = os.path.getsize(fi...
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...
C++14 Lambdas can capture expressions, rather than just variables. This permits lambdas to store move-only types: auto p = std::make_unique<T>(...); auto lamb = [p = std::move(p)]() //Overrides capture-by-value of `p`. { p->SomeFunc(); }; This moves the outer p variable into th...
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...
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...
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...
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...
In this example, we can use GROUP BY not only determined the sort of the rows returned, but also what rows are returned, since we're using TOP to limit the result set. Let's say we want to return the top 5 highest reputation users from an unnamed popular Q&A site. Without ORDER BY This query ...
This uses the Dropbox .NET SDK to download a file from the Dropbox API at the remote path /Homework/math/Prime_Numbers.txt to the local file Prime_Numbers.txt: using (var response = await client.Files.DownloadAsync("/Homework/math/Prime_Numbers.txt")) { using (var fileStream = File....
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...
Starting with a given list a: a = [1, 2, 3, 4, 5] append(value) – appends a new element to the end of the list. # Append values 6, 7, and 7 to the list a.append(6) a.append(7) a.append(7) # a: [1, 2, 3, 4, 5, 6, 7, 7] # Append another list b = [8, 9] a.append(b) # a: [1, 2, 3, 4, ...
A typical email has three main components: A recipient (represented as an email address) A subject A message body Sending mail in PHP can be as simple as calling the built-in function mail(). mail() takes up to five parameters but the first three are all that is required to send an email (al...
Make sure you see Registering for local notifications in order for this to work: Swift let notification = UILocalNotification() notification.alertBody = "Hello, local notifications!" notification.fireDate = NSDate().dateByAddingTimeInterval(10) // 10 seconds after now UIApplication.sh...

Page 8 of 145