Posts

Showing posts from December, 2016

How to Setup an FTP Server on Windows 10

Image

Linux Command Line Tutorial For Beginners 29 - find command

Image

Linux Command Line Tutorial For Beginners 28 - Head and Tail Commands

Image

Linux Command Line Tutorial For Beginners 26 - watch command

Image

Linux Command Line Tutorial For Beginners 26 - Viewing Resources (du , d...

Image

Linux Command Line Tutorial For Beginners 25 - .bashrc File

Image

Linux Command Line Tutorial For Beginners 24 - Basic Group Management (g...

Image

Linux Command Line Tutorial For Beginners 23 - userdel command (Removing...

Image
USERDEL(8) System Management Commands USERDEL(8) NAME userdel - delete a user account and related files SYNOPSIS userdel [options] LOGIN DESCRIPTION userdel is a low level utility for removing users. On Debian, administrators should usually use deluser(8) instead. The userdel command modifies the system account files, deleting all entries that refer to the user name LOGIN. The named user must exist. OPTIONS The options which apply to the userdel command are: -f, --force This option forces the removal of the user account, even if the user is still logged in. It also forces userdel to remove the user's home directory and mail spool, even if another user uses the same home directory or if the mail spool is not owned by the specified user. If USERGROUPS_ENAB is defined to yes in /etc/login.defs and if a group exists with...

Linux Command Line Tutorial For Beginners 22 - useradd command (Creatin...

Image
USERADD(8) System Management Commands USERADD(8) NAME useradd - create a new user or update default new user information SYNOPSIS useradd [options] LOGIN useradd -D useradd -D [options] DESCRIPTION useradd is a low level utility for adding users. On Debian, administrators should usually use adduser(8) instead. When invoked without the -D option, the useradd command creates a new user account using the values specified on the command line plus the default values from the system. Depending on command line options, the useradd command will update system files and may also create the new user's home directory and copy initial files. By default, a group will also be created for the new user (see -g, -N, -U, and USERGROUPS_ENAB). OPTIONS The options which apply to the useradd command are: -b, --base-dir BASE_DIR The default bas...

Node.js Tutorial for Beginners 12 - Installing npm packages globally + ...

Image

Node.js Tutorial for Beginners 18 - npm init & package.json File

Image

Node.js Tutorial for Beginners 16 - Node Package Manager (npm)

Image

Node.js Tutorial for Beginners 16 - Basic Routing with node

Image
var fs = require( 'fs' ); var http = require( 'http' ); http.createServer( function (req, res) { console.log( 'requested url : ' + req.url); if (req.url === '/home' || req.url === '/' ) { res.writeHead( 200 , { 'Content-Type' : 'text/html' }); fs.createReadStream( 'index.html' ).pipe(res); } else if (req.url === '/api' ) { res.writeHead( 200 , { 'Content-Type' : 'application/json' }); var jsonObj = { name : 'max' , surname : 'tesar' , age : 26 }; res.end(JSON.stringify(jsonObj)); } else if (req.url === '/about' ) { res.writeHead( 200 , { 'Content-Type' : 'text/html' }); fs.createReadStream( 'about.html' ).pipe(res); } else { res.writeHead( 404 , { 'Content-Type' : 'text/html' }); fs.createReadStream( '404.html' ).pipe(res); }...

Node.js Tutorial for Beginners 15 - Using node.js for serving JSON Data

Image
var fs = require( 'fs' ); var http = require( 'http' ); http.createServer( function (req, res) { // Send the HTTP header // HTTP Status: 200 : OK // Content Type: text/html res.writeHead( 200 , { 'Content-Type' : 'application/json' }); var jsonObj = { name : 'max' , surname : 'tesar' , age : 26 }; res.end(JSON.stringify(jsonObj)); }).listen( 3000 ); // Console will print the message console.log( "server is running on http://127.0.0.1:3000/" )

Node.js Tutorial for Beginners 14 - Using node.js for serving HTML page

Image
var fs = require( 'fs' ); var http = require( 'http' ); http.createServer( function (req, res) { // Send the HTTP header // HTTP Status: 200 : OK // Content Type: text/html res.writeHead( 200 , { 'Content-Type' : 'text/html' }); var readStream = fs.createReadStream( 'index.html' , 'utf8' ); readStream.pipe(res); }).listen( 3000 ); // Console will print the message console.log( "server is running on http://127.0.0.1:3000/" )

Node.js Tutorial for Beginners 13 - pipes

Image
var fs = require( 'fs' ); var http = require( 'http' ); http.createServer( function (req, res) { // Send the HTTP header // HTTP Status: 200 : OK // Content Type: text/plain res.writeHead( 200 , { 'Content-Type' : 'text/plain' }); var readStream = fs.createReadStream( 'file.txt' , 'utf8' ); readStream.pipe(res); }).listen( 3000 ); // Console will print the message console.log( "server is running on http://127.0.0.1:3000/" )

Node.js Tutorial for Beginners 12 - Basics of Streams - Writable Streams

Image
var fs = require( 'fs' ); var readStream = fs.createReadStream( 'file.txt' ); readStream.setEncoding( 'utf8' ); var writeStream = fs.createWriteStream( 'write_file.txt' ); readStream.on( 'data' , function (chunk) { console.log( '------------------------------------------------------------' ); writeStream.write(chunk); }) readStream.on( 'end' , function (chunk) { console.log( '--------------------End----------------------------------------' ); })

Node.js Tutorial for Beginners 11 - Basics of Streams - Readable Stream

Image
var fs = require( 'fs' ); var readStream = fs.createReadStream( 'file.txt' ); readStream.setEncoding( 'utf8' ); var data = '' ; readStream.on( 'data' , function (chunk) { console.log( '------------------------------------------------------------' ); data += chunk; //console.log(chunk); }) readStream.on( 'end' , function (chunk) { console.log(data); console.log( '--------------------End----------------------------------------' ); })

How to Install CentOS 7 on VirtualBox in Windows 8 / Windows 10

Image

How To install MinGW on Windows 10 (GCC & G++)

Image

How to Install Ubuntu 16.04 LTS on VMware in Windows 8 / Windows 10

Image

Node.js Tutorial for Beginners 10 - Node.js Events and EventEmitter

Image
var events = require( 'events' ); var util = require( 'util' ); var Students = function (name) { this .name = name; } util.inherits(Students, events.EventEmitter); var max = new Students( 'max' ); max.on( 'scored' , function (marks) { console.log(max.name + ' scores ' + marks + ' marks' ); }) max.emit( 'scored' , 95 ); var tom = new Students( 'tom' ); tom.on( 'scored' , function (marks) { console.log(tom.name + ' scores ' + marks + ' marks' ); }) tom.emit( 'scored' , 60 );