Tutorial by Examples: and

Class for which you will create unit test case. class Authorization { /* Observer so that mock object can work. */ public function attach(Curl $observer) { $this->observers = $observer; } /* Method for which we will create test */ public function postAuthorization($url, $met...
Formset is a way to render multiple forms in one page, like a grid of data. Ex: This ChoiceForm might be associated with some question of sort. like, Kids are most Intelligent between which age?. appname/forms.py from django import forms class ChoiceForm(forms.Form): choice = forms.CharFie...
Here are a simple example of some common tasks related to developing an API, differentiating between the HTTP Method of the request, accessing query string values and accessing the request body. Resources http.Handler interface http.ResponseWriter http.Request Available Method and Status cons...
Add a :cljsbuild node like the following to your project.clj file. :cljsbuild { :builds { ;;Different target goals should have different names. ;;We have the dev build here :dev { ;;The ClojureScript c...
import cv2 import numpy as np img = cv2.imread('<your_image>') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) cv2.imshow('image', img) cv2.imshow('gray', gray) cv2.waitKey(0) cv2.destroyAllWindows()
Atomic types are the building blocks of lock-free data structures and other concurrent types. A memory ordering, representing the strength of the memory barrier, should be specified when accessing/modifying an atomic type. Rust provides 5 memory ordering primitives: Relaxed (the weakest), Acquire (f...
To open a new WebSocket, simply add something like: var WebSocket = require("ws"); var ws = new WebSocket("ws://host:8080/OptionalPathName); // Continue on with your code... Or to open a server, use: var WebSocketServer = require("ws").Server; var ws = new WebSocketS...
Basic docs can be found here app.get('/path/:id(\\d+)', function (req, res, next) { // please note: "next" is passed if (req.params.id == 0) // validate param return next(new Error('Id is 0')); // go to first Error handler, see below // Catch error on sync operation ...
app.use() and middleware can be used for "before" and a combination of the close and finish events can be used for "after". app.use(function (req, res, next) { function afterResponse() { res.removeListener('finish', afterResponse); res.removeListener('clos...
When required you can tell Docker to execute additional commands on an already running container using the exec command. You need the container's ID which you can get with docker ps. docker exec 294fbc4c24b3 echo "Hello World" You can attach an interactive shell if you use the -it option...
Using the Swift class Mirror works if you want to extract name, value and type (Swift 3: type(of: value), Swift 2: value.dynamicType) of properties for an instance of a certain class. If you class inherits from NSObject, you can use the method class_copyPropertyList together with property_getAttrib...
using NUnit.Framework; namespace MyModuleTests { [TestFixture] public class MyClassTests { [TestCase(1, "Hello", true)] [TestCase(2, "bye", false)] public void MyMethod_WhenCalledWithParameters_ReturnsExpected(int param1, string para...
(Access Code)[https://github.com/vDoers/vDoersCameraAccess]
Prerequisites git clang and clang++ 3.4^ or gcc and g++ 4.8^ Python 2.6 or 2.7 GNU Make 3.81^ Get source Node.js v6.x LTS git clone -b v6.x https://github.com/nodejs/node.git Node.js v7.x git clone -b v7.x https://github.com/nodejs/node.git Build cd node ./configure make -jX su...
This kind of schema will be useful if you want to keep trace of your items by insertion time or update time. var mongoose = require('mongoose'); var Schema = mongoose.Schema; // Creates a User Schema. var user = new Schema({ name: { type: String }, ...
Getters and setters are methods that are behaved like properties. it means they have function structure but when used, they are used same as properties: Structure of getter functions: they should have get keyword after function keyword and before function name, with no argument, a return type spec...
This is an example how to get the play an audio file which you already have on your pc/laptop .First create a new directory under res and name it as raw like this copy the audio which you want to play into this folder .It may be a .mp3 or .wav file. Now for example on button click you want to pl...
Float data type The float data type is a single-precision 32-bit IEEE 754 floating point. Float overflow Maximum possible value is 3.4028235e+38 , When it exceeds this value it produces Infinity float f = 3.4e38f; float result = f*2; System.out.println(result); //Infinity Float Und...
The following-sibling and preceding-sibling axes contain the siblings before or after the context node, and the following and preceding axes contain all nodes in the document before or after the context node, but: None of these axes contain attribute or namespace nodes. The following axis doesn'...
The attribute and namespace axes contain all attribute and namespace nodes of an element. The shortcut @ stands for attribute::, so the following are equivalent: child::div/attribute::class div/@class

Page 95 of 153