Tutorial by Examples

First, install the morgan Middleware in your project npm install --save morgan
Add the following code to your app.js file: var express = require('express') var morgan = require('morgan') var app = express() app.use(morgan('combined')) app.get('/', function (req, res) { res.send('hello, world!') }) Now when you access your website you will see in the console y...
First, install fs and path in your project npm install --save fs path Add the following code to your app.js file: var express = require('express') var fs = require('fs') var morgan = require('morgan') var path = require('path') var app = express() // create a write stream (in append mo...
First, install fs, file-stream-rotator and path in your project npm install --save fs file-stream-rotator path Add the following code to your app.js file: var FileStreamRotator = require('file-stream-rotator') var express = require('express') var fs = require('fs') var morgan = require('morg...
To understand this example, it is recommended to have a brief idea on Bellman-Ford single source shortest path algorithm which can be found here In Bellman-Ford algorithm, to find out the shortest path, we need to relax all the edges of the graph. This process is repeated at most (V-1) times, where...
Write all events with level: debug, info, warn, error and fatal to one file: <?xml version="1.0" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <targets> &lt...
Create one log file for each day. The log files will have the following names (dependent of culture) 2016-06-05.log 2016-06-06.log 2016-06-07.log ... <?xml version="1.0" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://w...
using NLog; using NLog.Config; using NLog.Targets; namespace MyNamespace { [Target("MyFirst")] public sealed class MyFirstTarget: TargetWithLayout //or inherit from Target { public MyFirstTarget() { //set defaults ...
[LayoutRenderer("hello-world")] public class HelloWorldLayoutRenderer : LayoutRenderer { /// <summary> /// I'm option and not required or default /// </summary> public string Config1 { get; set; } /// <summary> /// I'm required option. ...
To understand this example, it is recommended to have a brief idea about Bellman-Ford algorithm which can be found here Using Bellman-Ford algorithm, we can detect if there is a negative cycle in our graph. We know that, to find out the shortest path, we need to relax all the edges of the graph (V-...
declare is an internal command of bash. (internal command use help for displaying "manpage"). It is used to show and define variables or show function bodies. Syntax: declare [options] [name[=value]]... # options are used to define # an integer declare -i myInteger declare -i another...
This would be a basic setup in wich we will send all the log messages to the console and to a log file. Let's start with the libraries. Will use maven for that: <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifact...
Here is an example of a basic page using the Materialize CSS framework which incorporates the grid system and materialboxed. <!DOCTYPE html> <html> <head> <title>Materializecss Example webpage</title> <!--Import Google Icon Font--> <link href="ht...
Adjacency list is a collection of unordered lists used to represent a finite graph. Each list describes the set of neighbors of a vertex in a graph. It takes less memory to store graphs. Let's see a graph, and its adjacency matrix: Now we create a list using these values. This is called adjacen...
Descriptor objects can allow related object attributes to react to changes automatically. Suppose we want to model an oscillator with a given frequency (in Hertz) and period (in seconds). When we update the frequency we want the period to update, and when we update the period we want the frequency ...
use std::ops::Deref; use std::fmt::Debug; #[derive(Debug)] struct RichOption<T>(Option<T>); // wrapper struct impl<T> Deref for RichOption<T> { type Target = Option<T>; // Our wrapper struct will coerce into Option fn deref(&self) -> &Option...
Deref has a simple rule: if you have a type T and it implements Deref<Target=F>, then &T coerces to &F, compiler will repeat this as many times as needed to get F, for example: fn f(x: &str) -> &str { x } fn main() { // Compiler will coerce &&&&&&a...
>>> from sympy.solvers.inequalities import solve_univariate_inequality >>> from sympy import var >>> x=var('x') >>> solve_univariate_inequality(2*x**2-6>1,x,relational=False) (-oo, -sqrt(14)/2) U (sqrt(14)/2, oo) The relational=False parameter simply ind...
Floyd-Warshall's algorithm is for finding shortest paths in a weighted graph with positive or negative edge weights. A single execution of the algorithm will find the lengths (summed weights) of the shortest paths between all pair of vertices. With a little variation, it can print the shortest path ...
// 1.0, Revealing Module pattern var myNamespace = myNamespace || {}; myNamespace.example = (function () { /** * User Event 1.0 example detailing usage of the Submit events * * @appliedtorecord employee */ var exports = {}; function beforeSubmit(type)...

Page 963 of 1336