Tutorial by Examples: er

16#A8# -- hex 2#100# -- binary 2#1000_1001_1111_0000 -- long number, adding (optional) _ (one or more) for readability 1234 -- decimal
type state_t is (START, READING, WRITING); -- user-defined enumerated type
Is raised when you tried to use a variable, method or function that is not initialized (at least not before). In other words, it is raised when a requested local or global name is not found. It's possible that you misspelt the name of the object or forgot to import something. Also maybe it's in anot...
AssertError The assert statement exists in almost every programming language. When you do: assert condition or: assert condition, message It's equivalent to this: if __debug__: if not condition: raise AssertionError(message) Assertions can include an optional message, and you can d...
If all you need is serializing mongo results into json, it is possible to use the json module, provided you define custom handlers to deal with non-serializable fields types. One advantage is that you have full power on how you encode specific fields, like the datetime representation. Here is a ha...
Import a Mongoose Model (See topic "Mongoose Schemas") var User = require("../models/user-schema.js") The findOne method will return the first entry in the database that matches the first parameter. The parameter should be an object where the key is the field to look for and th...
new Vue({ el:"#app", data:{ foo: "bar" }, methods:{ // This is wrong! Arrow functions capture "this" lexically // and "this" will refer to the window. doSomething: () => this.foo = "baz" } })
public class Person { private final String salutation; private final String firstName; private final String middleName; private final String lastName; private final String suffix; private final Address address; private final boolean isFemale; private final boolean isEmployed; private final ...
Another example: a Weapon that shoots out Bullets. The Weapon acts as an object pool for the Bullets it creates. public class Weapon : MonoBehaviour { // The Bullet prefab that the Weapon will create public Bullet bulletPrefab; // This List is our object pool, which starts...
Here counter is a child component accessed by demo which is a parent component using v-model. // child component Vue.component('counter', { template: `<div><button @click='add'>+1</button> <button @click='sub'>-1</button> <div>this is inside the child c...
After spending more than 5 hours, i found this easy solution: -To verify that the system has a CUDA-capable GPU, run the following command: lspci | grep -i NVIDIA You will see output similar to the following example (showing an NVIDIA Tesla K80/M60 card): -Disabling the nouveau driver: sudo...
You might need a v-model on a computed property. Normally, the v-model won't update the computed property value. The template: <div id="demo"> <div class='inline-block card'> <div :class='{onlineMarker: true, online: status, offline: !status}'></div> ...
public class ConvertMapToList { public static void main(String[] args) { Map<Integer, String> map = new HashMap<>(); map.put(10, "apple"); map.put(20, "orange"); map.put(30, "banana"); map.put(40, "w...
Reference types are comprised of both a reference to a memory area, and a value stored within that area. This is analogous to pointers in C/C++. All reference types are stored on what is known as the heap. The heap is simply a managed area of memory where objects are stored. When a new object is ...
Apps written for macOS are usually written with Apple's Frameworks. The frameworks that almost every app will use are: AppKit - for creating and managing UI elements Foundation - for common non-UI objects and operations There are other common frameworks that are used in many, but not all apps...
Install Xcode from the App Store. Install the Xcode developer tools > xcode-select --install This will provide basic command line tools such as gcc and make Install Mac Ports https://www.macports.org/install.php The OSX Sierra install package will provide an open-source method of ...
NSE functions should be used in interactive programming. However, when developping new functions in a new package, it's better to use SE version. Load dplyr and lazyeval : library(dplyr) library(lazyeval) Filtering NSE version filter(mtcars, cyl == 8) filter(mtcars, cyl < 6) filter(mtca...
Numbers have four types in Python. Int, float, complex, and long. int_num = 10 #int value float_num = 10.2 #float value complex_num = 3.14j #complex value long_num = 1234567L #long value
On the machine where you'd like to make the backup, jump to the Redis CLI: redis-cli Password? If your master Redis DB (the one you want to replicate) has a password: config set masterauth <password> Start replication Run the following to begin replication: SLAVEOF <host> <...
A simple way to catch unhandled errors (exceptions) in a VFP application is to use the ON ERROR command near the beginning of your main program. The following ON ERROR command calls a method in the current program called "errorHandler". The values returned by ERROR (the VFP Error Number),...

Page 368 of 417