Tutorial by Examples

#include opencv2/opencv.hpp> #include vector> using namespace std; using namespace cv; int main() { Mat3b img = imread("test.jpg"); imshow("Original", img); // Cluster int K = 8; int n = img.rows * img.cols; Mat data = img.reshape(1, n); data.convertTo(data, CV_32F); ...
To create a NSUserActivity object, your app must declare the types of activities it supports in its Info.plist file. Supported activities are defined by your application and should be unique. An activity is defined using a reverse-domain style naming scheme (i.e. "com.companyName.productName.ac...
There are three different properties for styling list-items: list-style-type, list-style-image, and list-style-position, which should be declared in that order. The default values are disc, outside, and none, respectively. Each property can be declared separately, or using the list-style shorthand p...
For example without a barrel, a consumer would need three import statements: import { HeroComponent } from '../heroes/hero.component.ts'; import { Hero } from '../heroes/hero.model.ts'; import { HeroService } from '....
import tensorflow as tf # good idea tf.reset_default_graph() # DO MODEL STUFF # Pretrained weighting of 2.0 W = tf.get_variable('w', shape=[], initializer=tf.constant(2.0), dtype=tf.float32) # Model input x x = tf.placeholder(tf.float32, name='x') # Model output y = W*x y = tf.multiply(W,...
public static void main( String[] args ) throws IOException { // good idea to print the version number, 1.2.0 as of this writing System.out.println(TensorFlow.version()); final int NUM_PREDICTIONS = 1; // load the model Bundle try (SavedModelBundle b = SavedModelB...
public enum BookCode { _10A("Simon Haykin", "Communication System"), _42B("Stefan Hakins", "A Brief History of Time"), E1("Sedra Smith", "Electronics Circuits"); private String author; private String title; ...
Here the simplest recursive function over list type. This function only navigate into a list from its start to its end and do nothing more. -spec loop(list()) -> ok. loop([]) -> ok; loop([H|T]) -> loop(T). You can call it like this: loop([1,2,3]). % will return ok. Here the ...
Like list, simplest function over iolist and bitstring is: -spec loop(iolist()) -> ok | {ok, iolist} . loop(<<>>) -> ok; loop(<<Head, Tail/bitstring>>) -> loop(Tail); loop(<<Rest/bitstring>>) -> {ok, Rest} You can call it like this: lo...

Map

Map in Erlang is equivalent of hashes in Perl or dictionaries in Python, its a key/value store. To list every value stored in, you can list every key, and return key/value pair. This first loop give you an idea: loop(Map) when is_map(Map) -> Keys = maps:keys(Map), loop(Map, Keys). loop...
Recursive function use their states to loop. When you spawn new process, this process will be simply a loop with some defined state.
Here 2 examples of recursive anonymous functions based on previous example. Firstly, simple infinite loop: InfiniteLoop = fun R() -> R() end. Secondly, anonymous function doing loop over list: LoopOverList = fun R([]) -> ok; R([H|T]) -> R(T) end. These two func...
This example covers the implementation of ExtentReports in Selenium using TestNG, Java and Maven. ExtentReports are available in two versions, community and commercial. For the ease and demonstration purpose, we will be using community version. 1. Dependency Add the dependency in your Maven pom.x...
This example covers the implementation of Allure Reports in Selenium using TestNG, Java and Maven. Maven Configuration Repository Add following code to configure the jcenter repository <repository> <id>jcenter</id> <name>bintray</name> ...
You can make function passed to test() method async - then you can use await keyword. Your test will wait until Promises resolve and testing asynchronous code becomes easier and more readable. In the following example call that returns a Promise is changeset.validate(). Please notice also wrapping s...
using Newtonsoft.Json.Linq; using System.Collections.Generic; public class JsonFieldsCollector { private readonly Dictionary<string, JValue> fields; public JsonFieldsCollector(JToken token) { fields = new Dictionary<string, JValue>(); CollectFields...
Let's say Joe owns a website that allows you to log on, view puppy videos, and save them to your account. Whenever a user searches on that website, they are redirected to https://example.com/search?q=brown+puppies. If a user's search doesn't match anything, than they see a message along the lines ...
Let's say that Bob owns a social website that allows users to personalize their profiles. Alice goes to Bob's website, creates an account, and goes to her profile settings. She sets her profile description to I'm actually too lazy to write something here. When her friends view her profile, this co...
Let's say that Bob owns a site that lets you post public messages. The messages are loaded by a script that looks like this: addMessage("Message 1"); addMessage("Message 2"); addMessage("Message 3"); addMessage("Message 4"); addMessage("Message 5&qu...
If you don't think that malicious scripts can harm your site, you are wrong. Here is a list of what a malicious script could do: Remove itself from the DOM so that it can't be traced Steal users' session cookies and enable the script author to log in as and impersonate them Show a fake "Yo...

Page 1306 of 1336