Tutorial by Examples: ce

Many C interfaces such as SDL2 have their own deletion functions. This means that you cannot use smart pointers directly: std::unique_ptr<SDL_Surface> a; // won't work, UNSAFE! Instead, you need to define your own deleter. The examples here use the SDL_Surface structure which should be fre...
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...
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...
Implementations in classes, including abstract declarations, take precedence over all interface defaults. Abstract class method takes precedence over Interface Default Method. public interface Swim { default void backStroke() { System.out.println("Swim.backStroke"); ...
os.access is much better solution to check whether directory exists and it's accesable for reading and writing. import os path = "/home/myFiles/directory1" ## Check if path exists os.access(path, os.F_OK) ## Check if path is Readable os.access(path, os.R_OK) ## Check if path i...
Regular instances require: All instance types must be of the form (T a1 ... an) where a1 ... an are *distinct type variables*, and each type variable appears at most once in the instance head. That means that, for example, while you can create an instance for [a] you can't create an instance f...
The following expressions are sequenced: a && b a || b a , b a ? b : c for ( a ; b ; c ) { ... } In all cases, the expression a is fully evaluated and all side effects are applied before either b or c are evaluated. In the fourth case, only one of b or c will be evaluated. In the l...
C11 The following expressions are unsequenced: a + b; a - b; a * b; a / b; a % b; a & b; a | b; In the above examples, the expression a may be evaluated before or after the expression b, b may be evaluated before a, or they may even be intermixed if they correspond to several instruct...
With this fundamental workflow model, a master branch contains all active development. Contributors will need to be especially sure they pull the latest changes before continuing development, for this branch will be changing rapidly. Everyone has access to this repo and can commit changes right to t...
Lists in Elixir are linked lists. This means that each item in a list consists of a value, followed by a pointer to the next item in the list. This is implemented in Elixir using cons cells. Cons cells are simple data structures with a "left" and a "right" value, or a "he...
We can reference a function without actually calling it by prefixing the function's name with ::. This can then be passed to a function which accepts some other function as a parameter. fun addTwo(x: Int) = x + 2 listOf(1, 2, 3, 4).map(::addTwo) # => [3, 4, 5, 6] Functions without a receiv...
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...
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...
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. ...
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...
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...
You can validate request data using the validate method (available in the base Controller, provided by the ValidatesRequests trait). If the rules pass, your code will keep executing normally; however, if validation fails, an error response containing the validation errors will automatically be se...
Avoid destructive operations on quoted objects. Quoted objects are literal objects. They are possibly embedded in the code in some way. How this works and the effects of modifications are unspecified in the Common Lisp standard, but it can have unwanted consequences like modifying shared data, tryin...
Since C++14, the standard provides the class template template <class T, T... Ints> class integer_sequence; template <std::size_t... Ints> using index_sequence = std::integer_sequence<std::size_t, Ints...>; and a generating metafunction for it: template <class T, T N&g...

Page 16 of 134