Tutorial by Examples: c

Not always the enum name is clear enough to be understood. To document an enum, use standard javadoc: /** * United States coins */ public enum Coins { /** * One-cent coin, commonly known as a penny, * is a unit of currency equaling one-hundredth * of a United Sta...
The empty-cells property determines if cells with no content should be displayed or not. This has no effect unless border-collapse is set to separate. Below an example with two tables with different values set to the empty-cells property: The table on the left has empty-cells: show while the one...
Dim array = New Integer() {1, 2, 3, 4} or Dim array As Int32() = {1, 2, 3, 4}
A model can provide a lot more information than just the data about an object. Let's see an example and break it down into what it is useful for: from django.db import models from django.urls import reverse from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compati...
Routing defines a map between HTTP methods and URIs on one side, and actions on the other. Routes are normally written in the app/Http/routes.php file. In its simplest form, a route is defined by calling the corresponding HTTP method on the Route facade, passing as parameters a string that match...
// View to hold the CAGradientLayer. let view: UIView = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 320)) // Initialize gradient layer. let gradientLayer: CAGradientLayer = CAGradientLayer() // Set frame of gradient layer. gradientLayer.frame = view.bounds // Color a...
// View to hold the CAGradientLayer. let view: UIView = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 320)) // Initialize gradient layer. let gradientLayer: CAGradientLayer = CAGradientLayer() // Set frame of gradient layer. gradientLayer.frame = view.bounds // Color at the top of...
// View to hold the CAGradientLayer. let view: UIView = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 320)) // Initialize gradient layer. let gradientLayer: CAGradientLayer = CAGradientLayer() // Set frame of gradient layer. gradientLayer.frame = view.bounds // Color at the top of...
Initialize the UITapGestureRecognizer with a target, self in this case, and an action which is a method that has a single parameter: a UITapGestureRecognizer. After initialization, add it to the view that it should recognize taps in. Swift override func viewDidLoad() { super.viewDidLoad() ...
There are a number of collection types in Python. While types such as int and str hold a single value, collection types hold multiple values. Lists The list type is probably the most commonly used collection type in Python. Despite its name, a list is more like an array in other languages, mostl...
For instance, a computation involving commands to read and write from the prompt: First we describe the "commands" of our computation as a Functor data type {-# LANGUAGE DeriveFunctor #-} data TeletypeF next = PrintLine String next | ReadLine (String -> next) derivin...
Constructor functions are functions designed to construct a new object. Within a constructor function, the keyword this refers to a newly created object which values can be assigned to. Constructor functions "return" this new object automatically. function Cat(name) { this.name = name;...
Each time you use a selector in jQuery the DOM is searched for elements that match your query. Doing this too often or repeatedly will decrease performance. If you refer to a specific selector more than once you should add it to the cache by assigning it to a variable: var nav = $('#navigation'); ...
There are two parts of a class: the interface and the implementation. The interface is the exposed functionality of the class. Its public methods and variables are part of the interface. The implementation is the internal workings of a class. Other classes shouldn't need to know about the implemen...
Encapsulation allows you to make internal changes to a class without affecting any code that calls the class. This reduces coupling, or how much any given class relies on the implementation of another class. For example, let's change the implementation of the Angle class from the previous example: ...
When implementing more than one interface that have methods of the same name that include default implementations, it is ambiguous to the compiler which implementation should be used. In the case of a conflict, the developer must override the conflicting method and provide a custom implementation. ...
Empty array np.empty((2,3)) Note that in this case, the values in this array are not set. This way of creating an array is therefore only useful if the array is filled later in the code. From a list np.array([0,1,2,3]) # Out: array([0, 1, 2, 3]) Create a range np.arange(4) # Out: array(...
Slice syntax is i:j:k where i is the starting index (inclusive), j is the stopping index (exclusive) and k is the step size. Like other python data structures, the first element has an index of 0: x = np.arange(10) x[0] # Out: 0 x[0:4] # Out: array([0, 1, 2, 3]) x[0:4:2] # Out:array([0, 2...
The basics After making changes to your source code, you should stage those changes with Git before you can commit them. For example, if you change README.md and program.py: git add README.md program.py This tells git that you want to add the files to the next commit you do. Then, commit your...
If an object is defined with static, thread, or automatic storage duration, and it has a character type, either: char, unsigned char, or signed char, it may not be accessed by a non-character type. In the below example a char array is reinterpreted as the type int, and the behavior is undefined on e...

Page 98 of 826