Tutorial by Examples: c

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...
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...
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')...
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(...
Programs throw errors when for instance wrong input is given. Because of this, one needs to make sure that an error is thrown when actual wrong input is given. Because of that we need to check for an exact exception, for this example we will use the following exception: class WrongInputException(Ex...
In development, you may find that using require() on the same module multiple times always returns the same module, even if you have made changes to that file. This is because modules are cached the first time they are loaded, and any subsequent module loads will load from the cache. To get around ...
Some of the additional attributes are parsed by the npm website like repository, bugs or homepage and shown in the infobox for this packages { "main": "server.js", "repository" : { "type": "git", "url": "git+https:/...
repeat(10) { i -> println("This line will be printed 10 times") println("We are on the ${i + 1}. loop iteration") }
Break and continue keywords work like they do in other languages. while(true) { if(condition1) { continue // Will immediately start the next iteration, without executing the rest of the loop body } if(condition2) { break // Will exit the loop completely } } ...
Polymer prodives a lot of well built elements for you to use in your app. Browse them in their Element Catalog. Let's go through the workflow of using an element by including paper-input (Documentation) Download the Element To Download an element there are two ways: Bower The convinient way is...
We got the following very basic element my-element saved as src/my-element.html <link rel="import" href="bower_components/polymer/polymer.html"> <dom-module id="my-element"> <template> <style> /* local styles go here */ ...
The following example is an introduction to: Template compilation using underscore Accessing variables in a template Creating a view Rendering a view Showing a view <html> <head> <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script> ...
Occasionally, we may want to display dialogs with more than one pane of content. jQuery UI offers tabs that can be used in tandem with a dialog to make this possible. While it may be more common to have tabs within a dialog's content container, this example will demonstrate how to make a list of t...

Page 212 of 826