Tutorial by Examples: f

Before reading this example, it is highly recommended that you read Introduction to Trie first. One of the easiest ways of implementing Trie is using linked list. Node: The nodes will consist of: Variable for End-Mark. Pointer Array to the next Node. The End-Mark variable will simply denot...
If you want to perform a user input validation of your textfield use the following code snippet: // MARK: - UITextFieldDelegate let allowedCharacters = CharacterSet(charactersIn:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvxyz").inverted func textField(_ textField:...
First, Install gulp and gulp-htmlmin to project directory locally npm install --save-dev gulp gulp-htmlmin Then add the minify-html task to your gulpfile.js var gulp = require('gulp'); var htmlmin = require('gulp-htmlmin'); // Task to minify HTML gulp.task('minify-html', function() { retu...
First, Install gulp and del to project directory locally npm install --save-dev gulp del Then add the clean task to your gulpfile.js var gulp = require('gulp'); var del = require('del'); gulp.task('default', function() { }); // Task to delete target build folder gulp.task('clean', func...
In case of problems, enable the internal logger <nlog internalLogFile="c:\log.txt" internalLogLevel="Trace"> <targets> <!-- target configuration here --> </targets> <rules> <!-- log routing rules --> </rules&gt...
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...
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...
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...
For this example, we want to make sure that any Employee who is marked as a Project Resource also has an appropriate Labor Cost defined. // 1.0, Revealing Module pattern var myNamespace = myNamespace || {}; myNamespace.example = (function () { /** * User Event 1.0 example detailing...
After the record gets stored in the database, we want to inspect what was changed on the record. We'll do this inspection by comparing values between the old and new record instances. // 1.0, Revealing Module pattern var myNamespace = myNamespace || {}; myNamespace.example = (function () { ...
// 1.0 // Revealing Module pattern, structures 1.0 similar to 2.0 var myNamespace = myNamespace || {}; myNamespace.example = (function () { /** @appliedtorecord employee */ var exports = {}; function beforeLoad(type, form, request) { showBonusEligibility(form); ...
The STDIN stream in Julia refers to standard input. This can represent either user input, for interactive command-line programs, or input from a file or pipeline that has been redirected into the program. The readline function, when not provided any arguments, will read data from STDIN until a newl...
Reading numbers from standard input is a combination of reading strings and parsing such strings as numbers. The parse function is used to parse a string into the desired number type: julia> parse(Int, "17") 17 julia> parse(Float32, "-3e6") -3.0f6 The format expec...
Reading strings or bytes Files can be opened for reading using the open function, which is often used together with do block syntax: open("myfile") do f for (i, line) in enumerate(eachline(f)) print("Line $i: $line") end end Suppose myfile exists and its ...
Sometimes we need to collect data from google spreadsheets. We can use gspread and oauth2client libraries to collect data from google spreadsheets. Here is a example to collect data: Code: from __future__ import print_function import gspread from oauth2client.client import SignedJwtAssertionCred...
XPath selectors can be used to select elements with specific attributes, such as class, id, title etc. By Class View: <div class="HakunaMatata"> Hakuna Matata </div> Code: var theLionKing= element(by.xpath('//div[@class="HakunaMatata"]')); expect(theLionKing.g...

Page 326 of 457