Tutorial by Examples: c

SelectorDescription*Universal selector (all elements)divTag selector (all <div> elements).blueClass selector (all elements with class blue).blue.redAll elements with class blue and red (a type of Compound selector)#headlineID selector (the element with "id" attribute set to headline)...
models.py : from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import ( AbstractBaseUser, BaseUserManager, PermissionsMixin) from django.utils import timezone from django.utils.translation import ugettext_lazy as _ class UserManage...
Install gunicorn pip install gunicorn From django project folder (same folder where manage.py resides), run the following command to run current django project with gunicorn gunicorn [projectname].wsgi:application -b 127.0.0.1:[port number] You can use the --env option to set the pat...
Go supports pointers, allowing you to pass references to values and records within your program. package main import "fmt" // We'll show how pointers work in contrast to values with // 2 functions: `zeroval` and `zeroptr`. `zeroval` has an // `int` parameter, so arguments will be ...
What’s a component? A component is basically a directive that uses a simpler configuration and that is suitable for a component-based architecture, which is what Angular 2 is all about. Think of a component as a widget: A piece of HTML code that you can reuse in several different places in y...
OptionSetType is a protocol designed to represent bit mask types where individual bits represent members of the set. A set of logical and/or functions enforce the proper syntax: struct Features : OptionSet { let rawValue : Int static let none = Features(rawValue: 0) static let feature0 = F...
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. []...
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...

Page 94 of 826