Tutorial by Examples: c

Page Objects are similar to Custom Commands; except they are collections of custom commands that are associated with a specific UI component. This works extremely well with modern component based design, such as in React. module.exports = { url: 'http://localhost:3000/login', commands: [{ ...
Suppose we have container "CustomersContainer" which connects a "Customers" dumb component to the Redux store. In index.js: import { Component }, React from 'react'; import { render } from 'react-dom'; import { Provider } from 'react-redux'; import { createStore } from 'redu...
Cgo enables the creation of Go packages that call C code. To use cgo write normal Go code that imports a pseudo-package "C". The Go code can then refer to types such as C.int, or functions such as C.Add. The import of "C" is immediately preceded by a comment, that comment, call...
1 cd my/project/dir 2 git clone git://github.com/zendframework/ZendSkeletonApplication.git 3 cd ZendSkeletonApplication 4 php composer.phar self-update 5 php composer.phar install
We install OpenCV 3.1.0 on Windows and get started. There are two ways to install OpenCV on windows. One is to download the installer and run it. Other is to build from source. This is the easiest way to install OpenCV and get started. OpenCV gives pre-build binaries to install on Windows here. Aft...
To get products from the database, you need to use Magento 2's repository design pattern. Each module can be bundled with it's own repositories, and the Product Catalog module is not any different. You can use dependency injection in your class to access the repository. A working example would look...
Like classes, interfaces can receive polymorphic parameters (aka Generics) too. Declaring Generic Parameters on Interfaces interface IStatus<U> { code: U; } interface IEvents<T> { list: T[]; emit(event: T): void; getAll(): T[]; } Here, you can see that our t...
In this example we use a parameter in the route to specify the page number. We set a default of 1 in the function parameter page=1. We have a User object in the database and we query it, ordering in descending order, showing latest users first. We then use the paginate method of the query object in ...
// An alert dialog $scope.showAlert = function() { var alertPopup = $ionicPopup.alert({ title: 'Don\'t eat that!', template: 'It might taste good' }); alertPopup.then(function(res) { console.log('Hello your first example.'); }); }; });
This example shows how to retrieve an ID of a newly created item using SharePoint REST API. Note : listName - This variable contains name of you list. newItemBody - This will be your request body for adding new item in list. e.g. var newItemBody = { __metadata: { 'type': 'SP.Data.MyListNameIte...
First, we need a custom endpoint builder. public class WSConfigurator extends ServerEndpointConfig.Configurator { @Inject private static Injector injector; @Override public <T> T getEndpointInstance(Class<T> endpointClass) throws InstantiationException { ...
String jsonStr = "{\"name\" : \"Abcd\", \"greeting\": \"Hello\", }"; //Sample Json String Gson gson = new Gson(); // Creates new instance of Gson JsonElement element = gson.fromJson (jsonStr, JsonElement.class); //Converts the json string to Json...
#lang racket (letrec ([sum-of-list (λ (l) (if (null? l) 0 (+ (car l) (sum-of-list (cdr l)))))]) (sum-of-list '(1 2 3 4 5))) ;; => 15 It is possible to write mutually recursive functions with letrec: #lang ...
#lang racket (require mzlib/etc) ((rec sum-of-list (λ (l) (if (null? l) 0 (+ (car l) (sum-of-list (cdr l)))))) '(1 2 3 4 5)) ;; => 15 ;; Outside of the rec form, sum-of-list gives an error: ;; sum-of-list: undefined; ;; cannot reference an identifier befor...
It is common practice to use higher order functions instead of recursion, if there is a higher order function which expresses the right recursion pattern. In our case, sum-of-numbers can be defined using foldl: #lang racket (define (sum-of-numbers l) (foldl + 0 l)) (sum-of-numbers '(1 2 3 4 5)...
Masonry is a library for objective-c but xamarin have created a binding for it and created it as a nuget package https://www.nuget.org/packages/Masonry/. Nuget install Install-Package Masonry This centers a button 100 points below the centre point of the containing view and sets a width between...
To update multiple documents in a collection, set the multi option to true. db.collection.update( query, update, { upsert: boolean, multi: boolean, writeConcern: document } ) multi is optional. If set to true, updates multiple documents that meet the query crit...
You have to add a div with the class .row-height inside the row, and also add .col-height to the columns. If you want to restrict the effect to a certain media query, just use the responsive .row-height and .col-height classes: for example .row-sm-height with .col-sm-height. CSS version: .row-heig...
I find that the examples in the docker inspect documentation seem magic, but do not explain much. Docker inspect is important because it is the clean way to extract information from a running container docker inspect -f ... container_id (or all running container) docker inspect -f ... $(docker p...
import numpy as np #There is a lot of math in neurons, so use numpy to speed things up in python; in other languages, use an efficient array type for that language import random #Initial neuron weights should be random class Neuron: def __init__(self, nbr_inputs, weight_array = None): ...

Page 550 of 826