Tutorial by Examples: di

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...
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...
CREATE TABLE MyTableName ( Id INT, MyColumnName NVARCHAR(1000) ) GO INSERT INTO MyTableName (Id, MyColumnName) VALUES (1, N'Hello World!') GO
import shutil source='//192.168.1.2/Daily Reports' destination='D:\\Reports\\Today' shutil.copytree(source, destination) The destination directory must not exist already.
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...
The json_decode() function takes a JSON-encoded string as its first parameter and parses it into a PHP variable. Normally, json_decode() will return an object of \stdClass if the top level item in the JSON object is a dictionary or an indexed array if the JSON object is an array. It will also retur...
The json_encode function will convert a PHP array (or, since PHP 5.4, an object which implements the JsonSerializable interface) to a JSON-encoded string. It returns a JSON-encoded string on success or FALSE on failure. $array = [ 'name' => 'Jeff', 'age' => 20, 'active' => ...
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....
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! */ ...
int x = 0; int y = 5 / x; /* integer division */ or double x = 0.0; double y = 5.0 / x; /* floating point division */ or int x = 0; int y = 5 % x; /* modulo operation */ For the second line in each example, where the value of the second operand (x) is zero, the behaviour is undefine...
To use an accordion, one must have headers and content inside the headers in their HTML. Then one must instantiate the accordion() method of jQuery UI. <script> $(function() { $( "#accordion" ).accordion(); }); </script> In the HTML: <div id="accordion&quot...
$( "#accordion" ).accordion( "destroy" ); This will remove the accordion functionality completely and show default HTML removing all the jQuery-UI elements. This method does not take any arguments.
$( "#accordion" ).accordion( "disable" ); This method will disable the accordion, i.e. the headers are not selectable making the content read only and static. This method does not take any arguments.
$( "#accordion" ).accordion( "enable" ); This method will enable an accordion. This will enable a disabled accordion or simply do nothing on an already enabled accordion. This method does not take any arguments.
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 ...
$( "#accordion" ).accordion( "refresh" ); This method recomputes the height of the accordion panels if headers or content was added or removed in the DOM.
var widget = $( "#accordion" ).accordion( "widget" ); This method returns a jQuery object containing the accordion.
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...
Available in the standard library as defaultdict from collections import defaultdict d = defaultdict(int) d['key'] # 0 d['key'] = 5 d['key'] # 5 d = defaultdict(lambda: 'empty') d['key'] # 'empty' d['key'] = 'full' ...

Page 12 of 164