Tutorial by Examples: ect

// Set up Express var express = require('express'); var app = express(); // Serve files from the absolute path of the directory app.use(express.static(__dirname + '/public')); // Start Express server app.listen(3030);
// Set up Express var express = require('express'); var app = express(); /* Serve from the absolute path of the directory that you want to serve with a */ virtual path prefix app.use('/static', express.static(__dirname + '/public')); // Start Express server app.listen(3030);
It's also possible to use selectors together. This is done by using the OpenQA.Selenium.Support.PageObjects.ByChained object: element = driver.FindElement(new ByChained(By.TagName("input"), By.ClassName("class")); Any number of Bys can be chained and are used as an AND type ...
preserveAspectRatio is an attribute that indicates whether the image should be scaled uniformly. This attribute only works if the <svg> element also has a viewBox. The default value is xMidYMid, which maintains the aspect ratio and centers the path inside the SVG container: <!-- when not ...
To set up a default SceneKit project you can use the Game Template.
The HTTP response status code 301 Moved Permanently is used for permanent URL redirection, meaning current links or records using the URL that the response is received for should be updated. The new URL should be provided in the Location field included with the response. The 301 redirect is consider...
Sometimes it may be required to find out which directory consuming how much disk space especially when you are used df -h and realized your available disk space is low. du: du command summarizes disk usage of the set of FILEs, recursively for directories. It's often uses with -sh option: -s, --s...
First, ensure you have installed mongodb and express via npm. Then, in a file conventionally titled db.js, use the following code: var MongoClient = require('mongodb').MongoClient var state = { db: null, } exports.connect = function(url, done) { if (state.db) return done() M...
A frequent reason why your read operation may not work is because your security rules reject the operation, for example because you're not authenticated (by default a database can only be accessed by an authenticated user). You can see these security rule violations in the JavaScript console of you...
Jersey (2) uses HK2 as its dependency injection (DI) system. We can use other injection systems, but its infrastructure is built with HK2, and allows us to also use it within our applications. Setting up simple dependency injection with Jersey takes just a few lines of code. Let say for example we ...
Introduction Texas Instruments' (TI) CC26XX series SoCs are readily available wireless MCUs targeting Bluetooth Low Energy (BLE) applications. Along with the MCUs, TI offers a full-fledged software stack that provides necessary API and sample codes to help quickly get developers started with the to...
The preserveAspectRatio attribute has an optional parameter: meet | slice. The default behavior is meet which stretches the content in both the x and y dimension until it fills either the width or height of the viewBox. The alternative - slice preserves the aspect ratio of the content but scales up ...
For BLE slave devices to do any useful work, the GPIOs of the wireless MCU are almost always involved. For instance, to read temperature from an external sensor, the ADC functionality of GPIO pins may be required. TI's CC2640 MCU features a maximum of 31 GPIOs, given different packaging types. In t...
It crops the images in square shape. This cordova project uses two plugins: Cordova Camera Plugin -- https://github.com/apache/cordova-plugin-camera Cordova Crop Image Plugin -- https://github.com/jeduan/cordova-plugin-crop The Camera plugin is combined with the Crop Image Plugin by ...
Objects that are not built-in To print the source code of a Python object use inspect. Note that this won't work for built-in objects nor for objects defined interactively. For these you will need other methods explained later. Here's how to print the source code of the method randint from the ran...
Given an interface: public interface Logger { void log(String message); } Rather than usage: public void doJob(Logger logger) { if (logger != null) { logger.log("[doJob]:Step 1"); } // ... if (logger != null) { logger.log("[doJob]:Step 2&q...
This function gets existing item form cache, and if the item don't exist in cache, it will fetch item based on the valueFetchFactory function. public static TValue GetExistingOrAdd<TValue>(string key, double minutesForExpiration, Func<TValue> valueFetchFactory) { ...
Mixins can be passed a block of SASS compliant code, which then becomes available within the mixin as the @content directive. @mixin small-screen { @media screen and (min-width: 800px;) { @content; } } @include small-screen { .container { width: 600px; } } And this wou...
Format: [command] [> | >>] [filename] > saves the output of [command] into [filename]. >> appends the output of [command] into [filename]. Examples: echo Hello World > myfile.txt saves "Hello World" into myfile.txt echo your name is %name% >> myfi...
Format and Usage: echo %cd% %cd% is a system variable that contains the current directory path

Page 72 of 99