Tutorial by Examples: c

// Basic code for Express Instance var express = require('express'); var app = express(); // Serve static files from directory 'public' app.use(express.static('public')); // Start Express server app.listen(3030);
// Set up Express var express = require('express'); var app = express(); // Serve static assets from both 'public' and 'files' directory app.use(express.static('public'); app.use(express.static('files'); // Start Express server app.listen(3030);
// 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);
Two of the most fundamental higher-order functions included in the standard library are map and filter. These functions are generic and can operate on any iterable. In particular, they are well-suited for computations on arrays. Suppose we have a dataset of schools. Each school teaches a particular...
A lot of example code posted on StackOverflow includes snippets like this: if ("A".equals(someString)) { // do something } This does "prevent" or "avoid" a possible NullPointerException in the case that someString is null. Furthermore, it is arguable that ...
This is a simple trigger function. CREATE OR REPLACE FUNCTION my_simple_trigger_function() RETURNS trigger AS $BODY$ BEGIN -- TG_TABLE_NAME :name of the table that caused the trigger invocation IF (TG_TABLE_NAME = 'users') THEN --TG_OP : operation the trigger was fired IF (TG_O...
// PixelAccessTutorial.cpp : Defines the entry point for the console // Environment: Visual studio 2015, Windows 10 // Assumptions: Opecv is installed configured in the visual studio project // Opencv version: OpenCV 3.1 #include "stdafx.h" #include<opencv2/core/core.hpp> #i...
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 ...
Below is an usage of canny algorithm in c++. Note that the image is first converted to grayscale image, then Gaussian filter is used to reduce the noise in the image. Then Canny algorithm is used for edge detection. // CannyTutorial.cpp : Defines the entry point for the console application. // En...
Taggy-lens allows us to use lenses to parse and inspect HTML documents. #!/usr/bin/env stack -- stack --resolver lts-7.0 --install-ghc runghc --package text --package lens --package taggy-lens {-# LANGUAGE OverloadedStrings #-} import qualified Data.Text.Lazy as TL import qualified Data.Tex...
<cfscript> oneDimensionArray = ArrayNew(1); oneDimensionArray[1] = 1; oneDimensionArray[2] = 'one'; oneDimensionArray[3] = '1'; </cfscript> <cfif IsDefined("oneDimensionArray")> <cfdump var="#oneDimensionArray#"> </cfif>...
Overview Android Studio's built-in update mechanism can be set to receive updates through any one of these four channels: Canary: Bleeding edge, released about weekly. These are early previews released in order to obtain real-world feedback during development. The canary channel will always have...
var person = { name: ko.observable('John') }; console.log(person.name()); console.log('Update name'); person.name.subscribe(function(newValue) { console.log("Updated value is " + newValue); }); person.name('Jane');
Though Go supports ++ and -- operators and the behaviour is found to be almost similar to c/c++, variables with such operators cannot be passed as argument to function. package main import ( "fmt" ) func abcd(a int, b int) { fmt.Println(a," &...
Go to the Microsoft link for the OpenXML SDK download. Click the red download button. On the next screen click the box next to OpenXMLSDKToolV25.msi and click next to begin the download. Once the download is complete, launch the OpenXMLSDKToolV25.msi and follow the instructions on the screen. Th...
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.
Swift Function for loading an animation from a file: func animationFromSceneNamed(path: String) -> CAAnimation? { let scene = SCNScene(named: path) var animation:CAAnimation? scene?.rootNode.enumerateChildNodes({ child, stop in if let animKey = child.animationKeys.first...
There are two types of Active Patterns that somewhat differ in usage - Complete and Partial. Complete Active Patterns can be used when you are able to enumerate all the outcomes, like "is a number odd or even?" let (|Odd|Even|) number = if number % 2 = 0 then Even else Odd N...

Page 586 of 826