Tutorial by Examples

The standard ADB configuration involves a USB connection to a physical device. If you prefer, you can switch over to TCP/IP mode, and connect ADB via WiFi instead. Not rooted device Get on the same network: Make sure your device and your computer are on the same network. Connect the...
You can create an ordered dictionary which will follow a determined order when iterating over the keys in the dictionary. Use OrderedDict from the collections module. This will always return the dictionary elements in the original insertion order when iterated over. from collections import Ordere...
The const keyword declares a global constant binding. const DEADBEEF: u64 = 0xDEADBEEF; fn main() { println("{:X}", DEADBEEF); } This outputs DEADBEEF
The static keyword declares a global static binding, which may be mutable. static HELLO_WORLD: &'static str = "Hello, world!"; fn main() { println("{}", HELLO_WORLD); } This outputs Hello, world!
Array.isArray(obj) returns true if the object is an Array, otherwise false. Array.isArray([]) // true Array.isArray([1, 2, 3]) // true Array.isArray({}) // false Array.isArray(1) // false In most cases you can instanceof to check if an object is an Array. []...
Get the current date. LocalDate.now() Get yesterday's date. LocalDate y = LocalDate.now().minusDays(1); Get tomorrow's date LocalDate t = LocalDate.now().plusDays(1); Get a specific date. LocalDate t = LocalDate.of(1974, 6, 2, 8, 30, 0, 0); In addition to the plus and minus methods, ...
Tensorflow is more than just a deep learning framework. It is a general computation framework to perform general mathematical operations in a parallel and distributed manner. An example of such is described below. Linear Regression A basic statistical example that is commonly utilized and is r...
This technique works even when the container's dimensions are unknown. Set up a "ghost" element inside the container to be centered that is 100% height, then use vertical-align: middle on both that and the element to be centered. CSS /* This parent can be any width and height */ .block...
function themeSlug_enqueue_scripts() { wp_enqueue_style( 'themeSlug-reset', get_template_directory_uri() .'/css/reset.css', '1.0.0' ); wp_enqueue_style( 'themeSlug-style', get_template_directory_uri() .'/style.css', 'themeSlug-reset', '1.0.0'); } add_action('wp_enqueue_scripts', 'themeSl...
In this case style.css is located in root of the theme's folder function themeSlug_enqueue_scripts() { wp_enqueue_style( 'themeSlug-style', get_template_directory_uri() .'/style.css', '1.0.0'); } add_action('wp_enqueue_scripts', 'themeSlug_enqueue_scripts');
In this example we want to include font awesome icon font function themeSlug_enqueue_scripts() { wp_enqueue_style( 'font-awesome', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css'); } add_action('wp_enqueue_scripts', 'themeSlug_enqueue_scripts');
Writing testable code is an important part of building a robust, maintainable, and agile project. Support for PHP's most widely used testing framework, PHPUnit, is built right into Laravel. PHPUnit is configured using the phpunit.xml file, which resides in the root directory of every new Laravel app...
function add(a, b) return a + b end -- creates a function called add, which returns the sum of it's two arguments Let's look at the syntax. First, we see a function keyword. Well, that's pretty descriptive. Next we see the add identifier; the name. We then see the arguments (a, b) these c...
Functions are only useful if we can call them. To call a function the following syntax is used: print("Hello, World!") We're calling the print function. Using the argument "Hello, World". As is obvious, this will print Hello, World to the output stream. The returned value is ...
Creating anonymous functions Anonymous functions are just like regular Lua functions, except they do not have a name. doThrice(function() print("Hello!") end) As you can see, the function is not assigned to any name like print or add. To create an anonymous function, all you hav...
function sayHello(name) print("Hello, " .. name .. "!") end That function is a simple function, and it works well. But what would happen if we just called sayHello()? stdin:2: attempt to concatenate local 'name' (a nil value) stack traceback: stdin:2: in function ...
Functions in Lua can return multiple results. For example: function triple(x) return x, x, x end When calling a function, to save these values, you must use the following syntax: local a, b, c = triple(5) Which will result in a = b = c = 5 in this case. It is also possible to ignore r...
Variadic Arguments
Instance methods are functions that belong to instances of a type in Swift (a class, struct, enumeration, or protocol). Type methods are called on a type itself. Instance Methods Instance methods are defined with a func declaration inside the definition of the type, or in an extension. class Coun...
Views, in an MVC pattern, contain the logic on how to present data to the user. In a web application, typically they are used to generate the HTML output that is sent back to users with each response. By default, views in Laravel are stored in the resources/views directory. A view can be called u...

Page 154 of 1336