Tutorial by Examples: cas

This uses the SwiftyDropbox library to upload a file from a NSFileHandle to the Dropbox account using upload sessions, handling every error case: import UIKit import SwiftyDropbox class ViewController: UIViewController { // filled in later in doUpload: var fileHandle : NSFileHandle?...
Attribute Image capitalizes all characters of enumeration literals. The function Case_Rule_For_Names applies upper case for the first character and makes the rest lower case. with Ada.Text_IO; use Ada.Text_IO; with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants; with Ada.Strings.Fixed...
You might have realized that $emit is scoped to the component that is emitting the event. That's a problem when you want to communicate between components far from one another in the component tree. Note: In Vue1 you coud use $dispatch or $broadcast, but not in Vue2. The reason being that it doesn'...
A test case or test script is a more or less formal description of the actions needed to prove that a requirement is met. It has a descriptive title, may start off with some preparation and ends with an expected result. Usually the test cases for a system under test are organised into test suites. ...
If we are using method sendStickyBroadcast(intent) the corresponding intent is sticky, meaning the intent you are sending stays around after broadcast is complete. A StickyBroadcast as the name suggests is a mechanism to read the data from a broadcast, after the broadcast is complete. This can be ...
First create a BroadcastReceiver class to handle the incoming Location updates: public class LocationReceiver extends BroadcastReceiver implements Constants { @Override public void onReceive(Context context, Intent intent) { if (LocationResult.hasResult(intent)) { ...
It is possible to send a message or data to all avaible connections. This can be achieved by first initializing the server and then using the socket.io object to find all sockets and then emit as you normally would emit to a single socket var io = require('socket.io')(80) // 80 is the HTTP port io...
It is possible to emit a message or data to all users except the one making the request: var io = require('socket.io')(80); io.on('connection', function (socket) { socket.broadcast.emit('user connected'); });
Let's pick as an example a function that takes 2 Map and return a Map containing every element in ma and mb: def merge2Maps(ma: Map[String, Int], mb: Map[String, Int]): Map[String, Int] A first attempt could be iterating through the elements of one of the maps using for ((k, v) <- map) and so...
# 1. Login Azure by admin account Add-AzureAccount # # 2. Select subscription name $subscriptionName = Get-AzureSubscription | Select -ExpandProperty SubscriptionName # # 3. Create storage account $storageAccountName = $VMName # here we use VMName to play the storage account name and create...
Let's say we have multiple data sources which include database, file, prompt and argumentList. Depending on chosen source we change our approach: def loadData(dataSource: Symbol): Try[String] = dataSource match { case 'database => loadDatabase() // Loading data from database case 'file =&g...
[TestCase(0, 0, 0)] [TestCase(34, 25, 59)] [TestCase(-1250, 10000, 8750)] public void AddNumbersTest(int a, int b, int expected) { // Act int result = a + b; // Assert Assert.That(result, Is.EqualTo(expected)); }
Run repair on a particular partition range. nodetool repair -pr Run repair on the whole cluster. nodetool repair Run repair in parallel mode. nodetool repair -par
Python Code import numpy as np import cv2 #loading haarcascade classifiers for face and eye #You can find these cascade classifiers here #https://github.com/opencv/opencv/tree/master/data/haarcascades #or where you download opencv inside data/haarcascades face_cascade = cv2.CascadeClassi...
We would be creating mongodb as a replica set having 3 instances. One instance would be primary and the other 2 instances would be secondary. For simplicity, I am going to have a replica set with 3 instances of mongodb running on the same server and thus to achieve this, all three mongodb instances...
[TestCase(0, 0, 0)] [TestCase(34, 25, 59)] [TestCase(-1250, 10000, 8750)] public void AddNumbersTest(int a, int b, int expected) { // Act int result = a + b; // Assert Assert.That(result, Is.EqualTo(expected)); }
The showcase of Primefaces components you can find here and documentation is here Frontend needs to be saved as a XHTML file. This file can contain JSF, JSTL, JSP, HTML, CSS, jQuery, javaScript and its framework and more front-end technologies. Please, do not mix JSF and JSP technologies together....
Java Code import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.highgui.Highgui; import org.opencv.highgui.VideoCapture; import org.opencv.objdetect.CascadeClassifier; publ...
T qobject_cast(QObject *object) A functionality which is added by deriving from QObject and using the Q_OBJECT macro is the ability to use the qobject_cast. Example: class myObject : public QObject { Q_OBJECT //... }; QObject* obj = new myObject(); To check whether obj is a my...
This is a basic example of a Selenium testcase using the python Unittest library from selenium import webdriver import unittest class SeleniumTest(Unittest.testcase): def setUp(self): self.driver = webdriver.Chrome() self.driver.implicitly_wait(30) def te...

Page 10 of 14