Tutorial by Examples: au

Composer generates a vendor/autoload.php file. You might simply include this file and you will get autoloading for free. require __DIR__ . '/vendor/autoload.php'; This makes working with third-party dependencies very easy. You can also add your own code to the Autoloader by adding an autoload ...
The second step to creating a subscription for a user is to create and execute a billing agreement, based on an existing activated billing plan. This example assumes that you have already gone through and activated a billing plan in the previous example, and have an ID for that billing plan to refer...
Optionals must be unwrapped before they can be used in most expressions. if let is an optional binding, which succeeds if the optional value was not nil: let num: Int? = 10 // or: let num: Int? = nil if let unwrappedNum = num { // num has type Int?; unwrappedNum has type Int print(&quo...
In addition to named imports, you can provide a default export. // circle.js export const PI = 3.14; export default function area(radius) { return PI * radius * radius; } You can use a simplified syntax to import the default export. import circleArea from './circle'; console.log(circle...
collections.defaultdict(default_factory) returns a subclass of dict that has a default value for missing keys. The argument should be a function that returns the default value when called with no arguments. If there is nothing passed, it defaults to None. >>> state_capitals = collections.d...
Many databases allow to make the primary key value automatically increment when a new key is added. This ensures that every key is different. MySQL CREATE TABLE Employees ( Id int NOT NULL AUTO_INCREMENT, PRIMARY KEY (Id) ); PostgreSQL CREATE TABLE Employees ( Id SERIAL PRIMARY...
UIButtons can be initialized in a frame: Swift let button = UIButton(frame: CGRect(x: x, y: y, width: width, height: height) Objective C UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(x, y, width, height)]; A specific type of UIButton can be created like this: Swift let but...
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...
By default, local variables that are not explicitly specified in the capture list, cannot be accessed from within the lambda body. However, it is possible to implicitly capture variables named by the lambda body: int a = 1; int b = 2; // Default capture by value [=]() { return a + b; }; // OK;...
Steam has a games under $10 section of their store page. Somewhere deep in the heart of their systems, there's probably a query that looks something like: SELECT * FROM Items WHERE Price < 10
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' ...
This example shows the usage of the ILGenerator by generating code that makes use of already existing and new created members as well as basic Exception handling. The following code emits a DynamicAssembly that contains an equivalent to this c# code: public static class UnixTimeHelper { priva...
Using the Java-SDK 3.0.1 CountDownLatch lock = new CountDownLatch(1); SpeechToText service = new SpeechToText(); service.setUsernameAndPassword("<username>", "<password>"); FileInputStream audio = new FileInputStream("filename.wav"); RecognizeOpti...
This example shows how to use the IBM Watson Speech to Text service to recognize the type of an audio file and produce a transcription of the spoken text in that file. This example requires Speech to Text service credentials and Node.js Install the npm module for the Watson Developer Cloud N...
Normally, a Docker container persists after it has exited. This allows you to run the container again, inspect its filesystem, and so on. However, sometimes you want to run a container and delete it immediately after it exits. For example to execute a command or show a file from the filesystem. Dock...
SELECT * FROM Employees WHERE ManagerId IS NULL This statement will return all Employee records where the value of the ManagerId column is NULL. The result will be: Id FName LName PhoneNumber ManagerId DepartmentId 1 James Smith 1234567890 NULL 1 SEL...
The "default" for constructors is that they do not have any arguments. In case you do not specify any constructor, the compiler will generate a default constructor for you. This means the following two snippets are semantically equivalent: public class TestClass { private String tes...
In Google Chrome, you can pause execution without needing to place breakpoints. Pause on Exception: While this button is toggled on, if your program hits an unhandled exception, the program will pause as if it had hit a breakpoint. The button can be found near Execution Controls and is useful for ...
To create a UIImageView programmatically, all you need to do is create an instance of UIImageView: //Swift let imageView = UIImageView() //Objective-C UIImageView *imageView = [[UIImageView alloc] init]; You can set the size and position of the UIImageView with a CGRect: //Swift imageView...
You can assign an image to a UIImageView during initialization, or later using the image property: //Swift UIImageView(image: UIImage(named: "image1")) UIImageView(image: UIImage(named: "image1"), highlightedImage: UIImage(named: "image2")) imageView.image = UII...

Page 3 of 37