Tutorial by Examples

var passport = require('passport'); var LocalStrategy = require('passport-local').Strategy; passport.serializeUser(function(user, done) { //In serialize user you decide what to store in the session. Here I'm storing the user id only. done(null, user.id); }); passport.deserializeUser(funct...
In SQL, you use date and time data types to store calendar information. These data types include the time, date, smalldatetime, datetime, datetime2, and datetimeoffset. Each data type has a specific format. Data typeFormattimehh:mm:ss[.nnnnnnn]dateYYYY-MM-DDsmalldatetimeYYYY-MM-DD hh:mm:ssdatetim...
This is a complete example of all the commonly used SQLite related APIs. The aim is to get you up and running really fast. You can also get a runnable PHP file of of this tutorial. Creating/opening a database Let's create a new database first. Create it only if the file doesn't exist and open it f...
Haystack: The string in which given pattern needs to be searched. Needle: The pattern to be searched. Time complexity: Search portion (strstr method) has the complexity O(n) where n is the length of haystack but as needle is also pre parsed for building prefix table O(m) is required for building p...
Callback functions in JavaScript Callback functions are common in JavaScript. Callback functions are possible in JavaScript because functions are first-class citizens. Synchronous callbacks. Callback functions can be synchronous or asynchronous. Since Asynchronous callback functions may be more c...
Question: What is the output of code below and why? setTimeout(function() { console.log("A"); }, 1000); setTimeout(function() { console.log("B"); }, 0); getDataFromDatabase(function(err, data) { console.log("C"); setTimeout(function() { ...
Detailed instructions on getting nuget set up or installed.
When asking Apache Spark related questions please include following information Apache Spark version used by the client and Spark deployment if applicable. For API related questions major (1.6, 2.0, 2.1 etc.) is typically sufficient, for questions concerning possible bugs always use full version ...
Example Data Please try to provide a minimal example input data in a format that can be directly used by the answers without tedious and time consuming parsing for example input file or local collection with all code required to create distributed data structures. When applicable always include ty...
Debugging questions. When question is related to debugging specific exception always provide relevant traceback. While it is advisable to remove duplicated outputs (from different executors or attempts) don't cut tracebacks to a single line or exception class only. Performance questions. Dependin...
Search Stack Overflow for duplicate questions. There common class of problems which have been already extensively documented. Read How do I ask a good question?. Read What topics can I ask about here? Apache Spark Community resources
The Go Playground One little known Go tool is The Go Playground. If one wants to experiment with Go without downloading it, they can easily do so simply by . . . Visiting the Playground in their web browser Entering their code Clicking “Run” Sharing your code The Go Playground also has too...
What is floating point? There are two types of numbers: fixed point where a certain number of digits are available before and after the radix point. floating point where a certain number of digits are available for the mantissa and for the exponent. An example using decimal digits with three...
An example of a configuration function in SQL is the @@SERVERNAME function. This function provides the name of the local server that's running SQL. SELECT @@SERVERNAME AS 'Server' ServerSQL064 In SQL, most data conversions occur implicitly, without any user intervention. To perform any convers...
In your routes/index.js Here user is the model for the userSchema router.post('/login', function(req, res, next) { if (!req.body.username || !req.body.password) { return res.status(400).json({ message: 'Please fill out all fields' }); } passpor...
A common requirement for a Java application is that can be deployed by copying a single file. For simple applications that depend only on the standard Java SE class libraries, this requirement is satisfied by creating a JAR file containing all of the (compiled) application classes. Things are not ...
package main import ( "encoding/gob" "os" ) type User struct { Username string Password string } func main() { user := User{ "zola", "supersecretpassword", } file, _ := os.Create("user.go...
package main import ( "encoding/gob" "fmt" "os" ) type User struct { Username string Password string } func main() { user := User{} file, _ := os.Open("user.gob") defer file.Close() decoder := gob...
package main import ( "encoding/gob" "fmt" "os" ) type User struct { Username string Password string } type Admin struct { Username string Password string IsAdmin bool } type Deleter interface { Delete() } ...
package main import ( "encoding/gob" "fmt" "log" "os" ) type User struct { Username string Password string } type Admin struct { Username string Password string IsAdmin bool } type Deleter interface ...

Page 1107 of 1336