Tutorial by Examples: er

When automating the provisioning of new nodes to a swarm, you need to know what the right join token is for the swarm as well as the advertised address of the manager. You can find this out by running the following commands on any of the existing manager nodes: # grab the ipaddress:port of the mana...
Function pointers are the most basic way of passing functions around, which can also be used in C. (See the C documentation for more details). For the purpose of callable objects, a function pointer can be defined as: typedef returnType(*name)(arguments); // All using name =...
Every class which overloads the operator() can be used as a function object. These classes can be written by hand (often referred to as functors) or automatically generated by the compiler by writing Lambdas from C++11 on. struct Person { std::string name; unsigned int age; }; // Func...
The sample content used here is Tears of Steel, by Blender Foundation. Specifically, we will use the download titled "HD 720p (~365MB, mov, 2.0)". This is a single file that ends with the extension "mov" and will play in just about any modern media player. Note that the download...
Sometimes you want to know the position (index) of the current element while iterating over an enumerator. For such purpose, Ruby provides the with_index method. It can be applied to all the enumerators. Basically, by adding with_index to an enumeration, you can enumerate that enumeration. Index is ...
Sometimes you might want to pass information that has been generated in one form, to another form for additional use. This is useful for forms that display a search tool, or a settings page among many other uses. Let's say you want to pass a DataTable between a form that is already open (MainForm) ...
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...
The most common and flexible way to create a service uses the angular.module API factory: angular.module('myApp.services', []).factory('githubService', function() { var serviceInstance = {}; // Our first service return serviceInstance; }); The service factory function can be ...
Place a file like the following in your top level directory. It defines which components to render for which paths import React from 'react'; import { Route, IndexRoute } from 'react-router'; import New from './containers/new-post'; import Show from './containers/show'; import Index from './c...
# A line used mostly as the first one, imports App class # that is used to get a window and launch the application from kivy.app import App # Casual Kivy widgets that reside in kivy.uix from kivy.uix.label import Label from kivy.uix.button import Button from kivy.uix.boxlayout import BoxLayo...
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()
django-filter is generic system for filtering Django QuerySets based on user selections. The documentation uses it in a function-based view as a product model: from django.db import models class Product(models.Model): name = models.CharField(max_length=255) price = models.DecimalField(...
Salesforce Navigator (Google Chrome) Force.com Logins (Google Chrome, Firefox) Salesforce Developer Tool Suite (Google Chrome) Salesforce Lighting Components Inspector (Google Chrome) Salesforce Developer Tool Suite (Google Chrome) Salesforce Schema Builder Expander (Google Chrome) Boostr fo...
The following procedure is a generic one which will be used to log all errors in an application to a common error log table. CREATE OR REPLACE PROCEDURE log_errors ( p_calling_program IN VARCHAR2, p_error_code IN INTEGER, p_error_description IN VARCHAR2 ) IS PRAGMA AUTONOMOUS_TRANSAC...
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...
Put the following code in functions.php: function themify_custom_excerpt_length( $length ) { return 50; } add_filter( 'excerpt_length', 'themify_custom_excerpt_length', 999 ); Use 999 as the priority to ensure that the function runs after the default WordPress filter, otherwise it would ov...
To do this, put the following code in functions.php: function custom_excerpt_more($more) { return '<a href="'. get_permalink($post->ID) . '">Read More</a>'; } add_filter('excerpt_more', 'custom_excerpt_more'); The results should look like this:
In our functions.php function new_excerpt_more( $more ) { return '.....'; } add_filter('excerpt_more', 'new_excerpt_more'); We should get this:
If you were to hide a link by setting display: none in the CSS then screen readers wouldn’t find it. Instead, we position it absolutely, with clipping. CSS .offscreen { position: absolute; clip: rect(1px 1px 1px 1px); /* for Internet Explorer */ clip: rect(1px, 1px, 1px, 1px); padding: 0; b...
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...

Page 264 of 417