Skip to main content

Posts

Node.js Send Email

Node.js Send Email Node.js Nodemailer Module The Nodemailer module allowed you to send an email. Download and Install Nodemailer npm install nodemailer Import nodemailer module npm install upper-case Send an Email var nodemailer = require('nodemailer'); var transporter = nodemailer.createTransport({ service: 'gmail', auth: { user: 'youremail@gmail.com', pass: 'yourpassword' } }); var mailOptions = { from: 'youremail@gmail.com', to: 'myfriend@yahoo.com', subject: 'Sending Email using Node.js', text: 'That was easy!' }; transporter.sendMail(mailOptions, function(error, info){ if (error) { console.log(error); } else { console.log('Email sent: ' + info.response); } }); Please write comments if you find anything incorrect, or you want to share more information about the topic disc...

Node.js NPM

Node.js NPM What is NPM? NPM is a package manager for Node.js packages which hosts thousands of free packages. A package in Node.js contains all the files you need for a module. Download a Package Open terminal and run npm install package-name. npm install upper-case Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.   

UUID Lua

UUID Lua In this post, we will write a UUID generator in lua programming language. local function getUUID() local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' return string.gsub(template, '[xy]', function (c) local v = (c == 'x') and random(0, 0xf) or random(8, 0xb) return string.format('%x', v) end) end Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Node.js HTTP Module

Node.js HTTP Module In this tutorial, we will learn about Node.js HTTP module and understand how out code working that we have written in  Getting started with node.js . Node.js has a built-in module called HTTP, which allows Node.js to transfer data over the http. To include the HTTP module, use the require() function. var http = require('http'); Node.js as a Web Server The HTTP module can create an HTTP server that listens to server ports and gives a response back to the client. we used createServer() method to create an HTTP server. var http = require('http'); //create a server object: http.createServer(function (req, res) { res.write('Hello World!'); //write a response to the client res.end(); //end the response }).listen(3000); //the server object listens on port 3000 Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Node.js Module

Node.js Module In this tutorial, we will learn about Node.js module. Node.js Module You can consider Node.js module as java script library which has a set of function that you want to include in your application.  Built-in Modules Node.js has a set of build-in that you can include in your application with any further installation like http .  Node.js  Include Modules To include Node.js module we used require() function with parameter module name. var http = require('http'); Now our application can use method which is in http module. const http = require('http'); const hostname = '127.0.0.1'; const port = 3000; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World\n'); }); server.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); }); C...

Getting started with Node.js

Getting started with Node.js In this tutorial, We will create first Node.js application that simply return Hello, World! to the client. Create App in Node.js  Once you have installed Node, create a file named app.js, and paste the following code.  const http = require('http'); const hostname = '127.0.0.1'; const port = 3000; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World\n'); }); server.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); }); Run Node.js App Navigate to the folder which contain app.js file and run following command on terminal. node app.js Open your favourite browser and search http://127.0.0.1:3000 Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above...

Install Node.js

Install NodeJs In this tutorial, We will learn how to install Node.js on Ubuntu. Install Node.js v10.x # Using Ubuntu curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash - sudo apt-get install -y nodejs Source :  Node Js Distribution Github Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Numpy Basic

Numpy Basic Create a Numpy Array import numpy as np # create numpy array a = np.array([2,3,4]) print ("***** a *****") print ("value", a) # print array print ("data type", a.dtype) # data type of array print ("shape", a.shape) # size of array in each dimension(m, n) print ("size", a.size) # total number of elements of the array print ("itemsize", a.itemsize) # the size in bytes of each element of the array print ("ndim", a.ndim) print ("data", a.data) # buffer containing the actual elements of the array print ("***** b *****") # number of axes (dimensions) of the array. b = np.array([[1.2, 3.5, 5.1], [1.2, 3.5, 5.1]]) print ("value", b) print ("data type", b.dtype) print ("shape", b.shape) print ("size", b.size) print ("itemsize", b.itemsize) print ("ndim", b.ndim) print ...

Find the smallest number which gives reminder 1, 2 and 3 when divided by 7, 9 and 11?

Find the smallest number which gives reminder 1, 2 and 3 when divided by 7, 9 and 11 respectively?  Answer: 344 Let the number be p P/7 = remainder 1 P/9 = remainder 2 P/11 = remainder 3 and 2P/7 = remainder 2 2P/9 = remainder 4 2P/11 = remainder 6 Now you can see the pattern Notice that if we add 5 to 2P , these equation will become completely divisible by 7,9 and 11 respectively, i.e. remainder becomes 0. So, 2P+5/7 = remainder 0 2P+5/9 = remainder 0 2P+5/11 = remainder 0 this means 2P+5 is divisible by 7,9 & 11. So it will be divisible by 7x9x11=693 2P+5 = 693 2P = 688 P = 344 Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Install Numpy

Install Numpy In this tutorial, we will learn how to install Numpy on Ubuntu. Installing via pip  python - m pip install -- user numpy scipy matplotlib ipython jupyter pandas sympy nose Install system-wide via a Linux package manager sudo apt - get install python - numpy python - scipy python - matplotlib ipython ipython - notebook python - pandas python - sympy python - nose Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.