Tutorial by Examples

create-react-app is a React app boilerplate generator created by Facebook. It provides a development environment configured for ease-of-use with minimal setup, including: ES6 and JSX transpilation Dev server with hot module reloading Code linting CSS auto-prefixing Build script with JS, CSS ...
Bad Example: var location = dbContext.Location .Where(l => l.Location.ID == location_ID) .SingleOrDefault(); return location; Since the above code is simply returning an entity without modifying or adding it, we can avoid tracking cost. Good Ex...
One problem often seen in code is loading all the data. This will greatly increase the load on the server. Let's say I have a model called "location" that has 10 fields in it, but not all the fields are required at the same time. Let's say I only want the 'LocationName' parameter of that...
Let's take an example of a function which receives two arguments and returns a value indicating their sum: def two_sum(a, b): return a + b By looking at this code, one can not safely and without doubt indicate the type of the arguments for function two_sum. It works both when supplied with ...
The .info file is a static text file for defining and configuring a theme. Each line in the .info file is a key-value pair with the key on the left and the value on the right, with an "equals sign" between them (e.g. name = my_theme). Semicolons are used to comment out a line. Some keys u...
Django comes with a number of builtin management commands, using python manage.py [command] or, when manage.py has +x (executable) rights simply ./manage.py [command] . The following are some of the most frequently used: Get a list of all available commands ./manage.py help Run your Django ser...
The cmath module is similar to the math module, but defines functions appropriately for the complex plane. First of all, complex numbers are a numeric type that is part of the Python language itself rather than being provided by a library class. Thus we don't need to import cmath for ordinary arith...
Erlang modules are available as atoms. For example, the Erlang math module is available as :math: iex> :math.pi 3.141592653589793
Use module_info on Erlang modules you wish to inspect: iex> :math.module_info [module: :math, exports: [pi: 0, module_info: 0, module_info: 1, pow: 2, atan2: 2, sqrt: 1, log10: 1, log2: 1, log: 1, exp: 1, erfc: 1, erf: 1, atanh: 1, atan: 1, asinh: 1, asin: 1, acosh: 1, acos: 1, tanh...
Inline expansion can be disabled with the go:noinline pragma. For example, if we build the following simple program: package main func printhello() { println("Hello") } func main() { printhello() } we get output that looks like this (trimmed for readability): $ go ...
Debugging with IEx.pry/0 is quite simple. require IEx in your module Find the line of code you want to inspect Add IEx.pry after the line Now start your project (e.g. iex -S mix). When the line with IEx.pry/0 is reached the program will stop and you have the chance to inspect. It is like a ...
This example shows how to configure multiple environments with different Dependency Injection configuration and separate middlewares in one Startup class. Alongside of public void Configure(IApplicationBuilder app) and public void ConfigureServices(IServiceCollection services) methods one can use C...
The __info__/1 function takes one of the following atoms: :functions - Returns a keyword list of public functions along with their arities :macros - Returns a keyword list of public macros along with their arities To list the Kernel module’s functions: iex> Kernel.__info__ :functions [...
Often times you will want to have events for your objects. function spanOver(d,i){ var span = d3.select(this); span.classed("spanOver",true); } function spanOut(d,i){ var span = d3.select(this); span.classed("spanOver", false); } var div = d3.select('#divID')...
Detailed instructions on getting websphere-mq set up or installed.
Use keyword lists for 'options'-style parameters that contains multiple key-value pairs: def myfunc(arg1, opts \\ []) do # Function body end We can call the function above like so: iex> myfunc "hello", pizza: true, soda: false which is equivalent to: iex> myfunc("he...
assert ['cat', 'dog', 'fish']*.length() == [3, 3, 4] Note that when mixing types in the collection if the method not exists on some of the elements, a groovy.lang.MissingMethodException could be thrown: ['cat', 'dog', 'fish',3]*.length() // it throws groovy.lang.MissingMethodException: No sign...
class Vector { double x double y } def points = [ new Vector(x: 10, y: -5), new Vector(x: -17.5, y: 3), new Vector(x: -3.3, y: -1) ] assert points*.x == [10, -17.5, -3.3] Note: The * is optional. We could also write the above statement as in the below line and Groov...
To run a command in a shell, in which you required buffered output (i.e. it is not a stream), use child_process.exec. For example, if you wanted to run the command cat *.js file | wc -l, with no options, that would look like this: const exec = require('child_process').exec; exec('cat *.js file | w...
If you are looking to run a file, such as an executable, use child_process.execFile. Instead of spawning a shell like child_process.exec would, it will directly create a new process, which is slightly more efficient than running a command. The function can be used like so: const execFile = require(...

Page 345 of 1336