Tutorial by Examples: ect

Create Dynamic Web project, provide following information's as stated below Project name : DemoSpringMVCProject Target runtime : set as Apache Tomcat v7.0 server Click on finish, successfully we have created dynamic web project. Now we have to setup Spring-MVC framework : Create web.xml...
SoundEffect.Play() plays the sound effect in a "fire-and-forget" fashion. The sound plays once and its lifetime is managed by the framework. You are not able to change the properties (volume, pan, pitch) of the sound during playback, loop it, position it in 3D or pause it. You can hold a ...
This is a relatively common mistake: You created an rect element, in a bar chart for instance, and you want to add a text label (let's say, the value of that bar). So, using the same variable that you used to append the rect and define its x and y position, you append your text element. Very logic, ...
#include <SPI.h> #define CSPIN 1 void setup() { pinMode(CSPIN, OUTPUT); // init chip select pin as an output digitalWrite(CSPIN, 1); // most slaves interpret a high level on CS as "deasserted" SPI.begin(); SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MO...
Dependencies To install electron you must first install Node.js, which comes with npm. How to install it? Use npm: # Install the `electron` command globally in your $PATH npm install electron -g # OR # Install as a development dependency npm install electron --save-dev
To check if a method was called on a mocked object you can use the Mockito.verify method: Mockito.verify(someMock).bla(); In this example, we assert that the method bla was called on the someMock mock object. You can also check if a method was called with certain parameters: Mockito.verify(som...
Vectors can be used as a 2D matrix by defining them as a vector of vectors. A matrix with 3 rows and 4 columns with each cell initialised as 0 can be defined as: std::vector<std::vector<int> > matrix(3, std::vector<int>(4)); C++11 The syntax for initializing them using initia...
Depending on the device/release version of the system, some API may not be available. You can check which contract is supported by using ApiInformation.IsApiContractPresent() For example, this will return true on phone devices and false on the others ApiInformation.IsApiContractPresent(typeof(Cal...
# example data set.seed(1) n = 1e7 ng = 1e4 DT = data.table( g1 = sample(ng, n, replace=TRUE), g2 = sample(ng, n, replace=TRUE), v = rnorm(n) ) Matching on one column After the first run of a subsetting operation with == or %in%... system.time( DT[ g1 %in% 1:100] )...
There are two approaches for influencing when a memory cleanup is performed. They are influencing how often the automatic process is performed and the other is manually triggering a cleanup. The garbage collector can be manipulated by tuning the collection thresholds which affect the frequency at w...
A few pre-requisites in the build.gradle for vectors to work all the way down to API 7 for VectorDrawables and API 13 for AnimatedVectorDrawables (with some caveats currently): //Build Tools has to be 24+ buildToolsVersion '24.0.0' defaultConfig { vectorDrawables.useSupportLibrary = true ...
$ mkdir backup_download_directory && cd !#:1 mkdir backup_download_directory && cd backup_download_directory This will substitute the Nth argument of the current command. In the example !#:1 is replaced with the first argument, i.e. backup_download_directory.
Connect to MongoDB, print 'Connected!' and close the connection. const MongoClient = require('mongodb').MongoClient; var url = 'mongodb://localhost:27017/test'; MongoClient.connect(url, function(err, db) { // MongoClient method 'connect' if (err) throw new Error(err); console.log(&q...
Get all documents in the collection 'myCollection' and print them to the console. const MongoClient = require('mongodb').MongoClient; const url = 'mongodb://localhost:27017/test'; MongoClient.connect(url, function (err, db) { if (err) throw new Error(err); var cursor = db.collection('my...
Arrow functions do not expose an arguments object; therefore, arguments would simply refer to a variable in the current scope. const arguments = [true]; const foo = x => console.log(arguments[0]); foo(false); // -> true Due to this, arrow functions are also not aware of their caller/ca...
In this example we have only one object but it is shared between/executed on different threads. Ordinary usage of fields to save state would not be possible because the other thread would see that too (or probably not see). public class Test { public static void main(String[] args) { ...
// rectangle objects { x:, y:, width:, height: } // return true if the 2 rectangles are colliding // r1 and r2 are rectangles as defined above function RectsColliding(r1,r2){ return !( r1.x>r2.x+r2.width || r1.x+r1.width<r2.x || r1.y>r2.y+r2.height || ...
// rectangle object: { x:, y:, width:, height: } // circle object: { x:, y:, radius: } // return true if the rectangle and circle are colliding function RectCircleColliding(rect,circle){ var dx=Math.abs(circle.x-(rect.x+rect.width/2)); var dy=Math.abs(circle.y-(rect.y+rect.height/2));...
// var rect={x:,y:,width:,height:}; // var line={x1:,y1:,x2:,y2:}; // Get interseting point of line segment & rectangle (if any) function lineRectCollide(line,rect){ // p=line startpoint, p2=line endpoint var p={x:line.x1,y:line.y1}; var p2={x:line.x2,y:line.y2}; // to...
Tests if an [x,y] point is inside a rectangle. // rectangle objects: {x:, y:, width:, height: } // var rect={x:10, y:15, width:25, height:20} // Return true if the x,y point is inside the rectangle function isPointInRectangle(x,y,rect){ return(x>rect.x && x<rect.x+rect.width...

Page 51 of 99