Tutorial by Examples: c

import unittest def addition(*args): """ add two or more summands and return the sum """ if len(args) < 2: raise ValueError, 'at least two summands are needed' for ii in args: if not isinstance(ii, (int, long, float, compl...
Installation npm install forever -g cd /node/project/directory Usages forever start app.js
To use the value stored in a variable, use the dollar sign followed by the variable name enclosed by parentheses or curly braces. x = hello y = $(x) # y now contains the value "hello" y = ${x} # parentheses and curly braces are treated exactly the same If a variable's name is only ...
When defining a recursively-expanded variable, the contents of the right-hand side are stored as-is. If a variable reference is present, the reference itself is stored (not the value of the variable). Make waits to expand the variable references until the variable is actually used. x = hello y =...
Within the context of an individual rule, Make automatically defines a number of special variables. These variables can have a different value for each rule in a makefile and are designed to make writing rules simpler. These variables can only be used in the recipe portion of a rule. VariableDesc...
The ?= operator is an extension that behaves like =, except that the assignment only occurs if the variable is not already set. x = hello x ?= world # $(x) will yield "hello"
This tutorial assumes you already have a working OpenGL environment with all necessary libraries and headers available. #include <GL\glew.h> //Include GLEW for function-pointers etc. #include <GLFW\GLFW3.h> //Include GLFW for windows, context etc. //Impor...
File Structure: pom.xml src/test/java/PlayStoreAutomation.java Launch command: mvn test -Dtest=PlayStoreAutomation PlayStoreAutomation.java import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import io.appium.java_client.android.AndroidDriver; import i...
Before continuing, make sure you've read the Installation chapter and can access your new Symfony app in the browser. Suppose you want to create a page - /lucky/number - that generates a lucky (well, random) number and prints it. To do that, create a "Controller class" and a "con...
The below example widget demonstrates how to format individual cells of a TreeView column conditionally, depending on value of the field in the particular cell. If value of field is negative, then it'll be displayed in red color and minus symbol will be hidden, otherwise it'll be displayed in normal...
Yield true on the stack if currentpoint executes successfully, or false if it signals a /nocurrentpoint error. {currentpoint pop pop} stopped not % bool
The sequence for an error is usually: error is triggered by looking up the error name in errordict and executing this procedure. the errordict procedure calls signalerror, passing it the error name. signalerror takes snapshots of the stacks, saving the snapshots in $error, and then calls stop. ...
Since the final action of the default error handler is to call stop, you can catch errors from operators by enclosing code in a { ... } stopped construct. { 0 array 1 get } stopped { $error /errorname get = } if will print "rangecheck", the error signaled by get when t...
The documentation for docker events provides details, but when debugging it may be useful to launch a container and be notified immediately of any related event: docker run... & docker events --filter 'container=$(docker ps -lq)' In docker ps -lq, the l stands for last, and the q for quiet. Th...
Tests are an excellent way to ensure stable, bug-free applications. They serve as an interactive documentation and allow to modify code without fear to break functionality. D provides a convenient and native syntax for unittest block as part of the D language. Anywhere in a D module unittest blocks ...
If -unittest flag is passed to the D compiler, it will run all unittest blocks. Often it is useful to let the compiler generate a stubbed main function. Using the compile & run wrapper rdmd, testing your D program gets as easy as: rdmd -main -unittest yourcode.d Of course you can also split ...
In the scenario that a controller throws an exception, we can define exception handler methods to build and return specific responses. It is important to note that the defined exception handlers within the given controller will only apply to exceptions that occur within that controller. @Controller...
We're going to build an application that stores POJOs in a database. The application uses Spring Data JPA to store and retrieve data in a relational database. Its most compelling feature is the ability to create repository implementations automatically, at runtime, from a repository interface. Main...
Hash function h() is an arbitrary function which mapped data x ∈ X of arbitrary size to value y ∈ Y of fixed size: y = h(x). Good hash functions have follows restrictions: hash functions behave likes uniform distribution hash functions is deterministic. h(x) should always return the same v...
The replica set is a group of mongod instances that maintain the same data set. This example shows how to configure a replica set with three instances on the same server. Creating data folders mkdir /srv/mongodb/data/rs0-0 mkdir /srv/mongodb/data/rs0-1 mkdir /srv/mongodb/data/rs0-2 Starting ...

Page 528 of 826