top of page

Search Results

737 results found with an empty search

  • Node.js - Express Framework

    What is Express ? Express is a fast, assertive, essential and moderate web framework of Node.js. You can assume express as a layer built on the top of the Node.js that helps manage a server and routes. It provides a robust set of features to develop web and mobile applications. Express is a minimal and flexible Node.js web application framework that provides a robust set of features to develop web and mobile applications. It facilitates the rapid development of Node based Web applications. Features of Express framework Some of the core features of Express framework: It can be used to design single-page, multi-page and hybrid web applications. It allows to setup middlewares to respond to HTTP Requests. It defines a routing table which is used to perform different actions based on HTTP method and URL. It allows to dynamically render HTML Pages based on passing arguments to templates. Installing Express To install the Express framework globally using NPM so that it can be used to create a web application using node terminal. $ npm install express --save The above command saves the installation locally in the node_modules directory and creates a directory express inside node_modules. You have to install the following important modules along with express: body-parser: This is a node.js middleware for handling JSON, Raw, Text and URL encoded form data. cookie-parser: Parse Cookie header and populate req.cookies with an object keyed by the cookie names. multer: This is a node.js middleware for handling multipart/form-data. $ npm install body-parser --save $ npm install cookie-parser --save $ npm install multer --save Hello World Express Here, we will learn with an example of Express app which starts a server and listens on port 8012 for connection. This app responds with Hello World!!! for requests to the homepage. For every other path, it will respond with a 404 Not Found. var express = require('express'); var app = express(); app.get('/', function (req, res) { res.send('Hello World!!!'); }) var server = app.listen(8012, function () { var host = server.address().address var port = server.address().port console.log("You are listening app at http://%s:%s", host, port) }) We will save the above code in a file and name it server.js and then run it by using the following command: $ node server.js You can see the following output: You are listening app at http://0.0.0.0:8012 You have to open http://127.0.0.1:8081/ in any browser to see the following result. IMAGE Request & Response Express application uses a callback function whose parameters are request and response objects. app.get('/', function (req, res) { // -- }) Request Object: The request object represents the HTTP request and has properties for the request query string, parameters, body, HTTP headers, and so on. Response Object: The response object represents the HTTP response that an Express app sends when it gets an HTTP request. One can print req and res objects which provide a lot of information related to HTTP request and response including cookies, sessions, URL, etc. Basic Routing We have seen a basic application which serves HTTP request for the homepage. Routing refers to determining how an application responds to a client request to a particular endpoint, which is a URI (or path) and a specific HTTP request method (GET, POST, and so on). Now, we will add some more codes in our Hello World program to handle more types of HTTP requests. var express = require('express'); var app = express(); // This responds with "Hello World" on the homepage app.get('/', function (req, res) { console.log("Got a GET request for the homepage"); res.send('Hello GET'); }) // This responds a POST request for the homepage app.post('/', function (req, res) { console.log("Got a POST request for the homepage"); res.send('Hello POST'); }) // This responds a DELETE request for the /del_user page. app.delete('/del_user', function (req, res) { console.log("Got a DELETE request for /del_user"); res.send('Hello DELETE'); }) // This responds a GET request for the /list_user page. app.get('/list_user', function (req, res) { console.log("Got a GET request for /list_user"); res.send('Page Listing'); }) // This responds a GET request for abcd, abxcd, ab123cd, and so on app.get('/ab*cd', function(req, res) {    console.log("Got a GET request for /ab*cd"); res.send('Page Pattern Match'); }) var server = app.listen(8012, function () { var host = server.address().address var port = server.address().port console.log("You are listening app at http://%s:%s", host, port) }) We will save the above code in a file and then name it server.js and then run it with the following command: $ node server.js We can see the following output: Example app listening at http://0.0.0.0:8012 Now we can try different requests at http://127.0.0.1:8012 to see the output generated by server.js. Serving Static Files Express provides a built-in middleware express.static to serve static files, such as images, CSS, JavaScript, etc. We can simply need to pass the name of the directory where we keep our static assets, to the express.static middleware to start serving the files directly. For example, if we have kept our images, CSS, and JavaScript files in a directory named public, we can do this: app.use(express.static('public')); We can also keep a few images in public/images sub-directory as follows: node_modules server.js public/ public/images public/images/logo.png If you have any queries regarding this blog or need any help you can contact us on: contact@codersarts.com Node.js Coders, Node.js Experts, Node.js Tutors, Node.js Specialists, Node.js Programmers, Node.js Coding Help, Node.js Programming Help, Node.js Assignment Help, Node.js Engineers, Node.js Consultants, Node.js Development Company, Node.js Express Server

  • MySQL Practice Example: Part-1 | MySQL Assignment Help

    Querying data Using MySQL “SELECT” “SELECT” statement is used to read data from one or more table. Syntax: SELECT select_list FROM table_name; Below the “Employee” table which has four data columns It contains the following records Selecting Single column(first name) from Employee table Query: SELECT LastName FROM Emoloyee; Selecting multiple columns(first name, last name) Query: SELECT LastName, FirstName FROM Emoloyee; Selecting all data(using *) from table Query: SELECT * FROM Emoloyee; Sorting data Using MySQL “ORDER BY” clause When you use the SELECT statement to query data from a table, the result set is not sorted. It means that the rows in the result set can be in any order. Syntax: SELECT select_list FROM table_name ORDER BY column1 [ASC|DESC], column2 [ASC|DESC], ... You use ASC to sort the result set in ascending order and DESC to sort the result set in descending order Example: SELECT FirstName,LastName FROM Employee ORDER BY FirstName; By default(If not use any ASC and DESC ) it sorted in ascending order Sort In Descending order Example: SELECT FirstName,LastName FROM Employee ORDER BY FirstName DESC; Sort In Ascending order Example: SELECT FirstName,LastName FROM Employee ORDER BY FirstName ASC; Using MySQL ORDER BY to sort a result set by an expression Let suppose new database table “order” Syntax: SELECT orderNumber, Order_Line, quantityOrdered * price FROM Order ORDER BY quantityOrdered * price DESC; Filtering Data Using MySQL “WHERE, AND, OR, IN, etc” clause "Where” Clause: The WHERE clause allows you to specify a search condition for the rows returned by a query. Syntax: SELECT select_list FROM table_name WHERE search_condition; Let we working with the Employee table which is given below It contains the following records Query: SELECT LastName, FirstName FROM employees WHERE JobTitle = 'Sales'; Using MySQL WHERE clause with AND operator Query: SELECT LastName, FirstName FROM employees WHERE JobTitle = 'Sales' AND employeeNumber = 1001; Using MySQL WHERE clause with OR operator Query: SELECT LastName, FirstName FROM employees WHERE JobTitle = 'Sales' OR employeeNumber = 1001; Using MySQL WHERE with BETWEEN operator example Query: SELECT LastName, FirstName FROM employees WHERE employeeNumber BETWEEN 1001 AND 1003; Using MySQL WHERE with the LIKE operator example Query: SELECT LastName, FirstName FROM employees WHERE LastName LIKE ‘%tz’; Using MySQL WHERE clause with the IN operator example Query: SELECT LastName, FirstName FROM employees WHERE employeeNumber IN (1001, 1002, 1003); Using MySQL WHERE clause with comparison operators Query(not(<>)) SELECT LastName, FirstName FROM employees WHERE JobTitle <> ‘Sales’; If you are a student or database developer, administrator or someone with a basic understanding of the features of MySQL Hire us and Get your projects done by MySQL expert or learn If you have project or assignment files, You can send at contact@codersarts.com directly

  • Node.js Assignment Help

    Hire a Vue.js Programmers Looking for an expert to provide you help with Node.js Assignment or Node.js Project. We are here to solve all your problems at one place, from assisting you to understand the language to helping you complete the project. At Codersarts we offer solutions of all aspect for Node.js, experts will help you with all your needs. You can avail the experts (developers  and programmers) by hiring them. We can help you irrespective of the size of the project/assignment/homework you have. We provides solutions for college/university assignments as well as for the company. We can also guide you to develop your project and can help you to understand the basics of the framework. Why choose us? Codersarts is a top rated website for students and individuals who are looking for online Assignment Help, Homework help, Coursework Help at all levels whether it is school, college, university or company. Hire us and Get your projects done by expert developer or you can also learn from the experts with team training & coaching experiences. We work in a way that the code looks good, which will help you to understand the code easily. We also add the comments required to understand the code. Commenting the code also helps for future reference.with neat and clean coding and with required comments. Node.js Overview Node.js is intended to run on a dedicated HTTP server and to employ a single thread with one process at a time. Node.js applications are event-based and run asynchronously. Code built on the Node platform does not follow the traditional model of receive, process, send, wait, receive. Instead, Node processes incoming requests in a constant event stack and sends small requests one after the other without waiting for responses. This is a shift away from mainstream models that run larger, more complex processes and run several threads concurrently, with each thread waiting for its appropriate response before moving on. One of the major advantages of Node.js, according to its creator Ryan Dahl, is that it does not block input/output (I/O). Some developers are highly critical of Node.js and point out that if a single process requires a significant number of CPU cycles, the application will block and that the blocking can crash the application. Proponents of the Node.js model claim that CPU processing time is less of a concern because of the high number of small processes that Node code is based on. Node.js Introduction Node.js is a tool for JavaScript framework, it is used for developing server-based applications. Node.js is an open source server environment. It allows you to run JavaScript on the server. A Node.js app run in a single process, without creating a new thread for every request. Node.js Prerequisites Before proceeding, one should have a basic understanding of JavaScript. As we are going to develop web-based applications using Node.js, it will be good if you have some understanding of other web technologies such as HTML, CSS, AJAX, etc What is Node.js ? Node.js is a server-side platform built on Google Chrome's JavaScript Engine (V8 Engine). Node.js was developed by Ryan Dahl in 2009 and its latest version is v0.10.36. The definition of Node.js as supplied by its official documentation is as follows − Node.js is a platform built on Chrome's JavaScript runtime for easily building fast and scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. Node.js is an open source, cross-platform runtime environment for developing server-side and networking applications. Node.js applications are written in JavaScript, and can be run within the Node.js runtime on OS X, Microsoft Windows, and Linux. Node.js also provides a rich library of various JavaScript modules which simplifies the development of web applications using Node.js to a great extent. Node.js = Runtime Environment + JavaScript Library Why Node.js ? Following are some of the important features that make Node.js the first choice of software architects. Asynchronous and Event Driven: All APIs of Node.js library are asynchronous, that is, non-blocking. It essentially means a Node.js based server never waits for an API to return data. The server moves to the next API after calling it and a notification mechanism of Events of Node.js helps the server to get a response from the previous API call. Very Fast: Being built on Google Chrome's V8 JavaScript Engine, Node.js library is very fast in code execution. Single Threaded but Highly Scalable: Node.js uses a single threaded model with event looping. Event mechanism helps the server to respond in a non-blocking way and makes the server highly scalable as opposed to traditional servers which create limited threads to handle requests. Node.js uses a single threaded program and the same program can provide service to a much larger number of requests than traditional servers like Apache HTTP Server. No Buffering: Node.js applications never buffer any data. These applications simply output the data in chunks. License: Node.js is released under the MIT license. Where to Use Node.js? Following are the areas where Node.js is proving itself as a perfect technology partner. I/O bound Applications Data Streaming Applications Data Intensive Real-time Applications (DIRT) JSON APIs based Applications Single Page Applications Why consider Node.js for the project ? Performance: Node.js is simply… fast, faster than other JS languages; moreover, as a runtime language it has enhanced JavaScript with new capabilities Versatilit:: From back-end, to front-end apps, to clips to… pretty much everything in between, Node.js enables you to build any kind of project that you have in mind; as long as it’s written in JavaScript, of course Agility: regardless of your/your team’s level of JavaScript expertise, Node.js empowers you to kick-start your project, to get it up and running in no time; it’s developer productivity-oriented (just think same language for both back-end and front-end!!!), with a low learning curve What do we include in Node.js Assignment Help Rich comment for code Solved  by Industry Pros Self-Paced understandable code Learn HTML5, CSS3, and Responsive WebSite Design Node.js Completely and With Confidence ​ If you have any queries regarding this blog or need any help you can contact us on: contact@codersarts.com Node.js Coders, Node.js Experts, Node.js Tutors, Node.js Specialists, Node.js Programmers, Node.js Coding Help, Node.js Programming Help, Node.js Assignment Help, Node.js Engineers, Node.js Consultants, Node.js Development Company

  • MySQl Installation, Creating Database and Tables, Inserting Records| My SQL Assignment Help

    First, go to the below link and download it: Link http://dev.mysql.com/downloads/installer/. Double-click on the MySQL installer file and follow the steps below: Step 1: Install MySQL Installer Step 2: Click on Install MySQL Products Step 3: Download latest product by clicking on the “Find latest products” after check all the checkbox and click on “Execute” Step 4: Now clicking on “Next” button Step 5: Choose the setup type after clicking on “Full” checkbox and clicking on “Next” Step 6: Installation Step 7: Installation, click on “Execute”, the new window is open for the installation process Step 8: When the download is completed click on the “Next” button Step 9: Configuration After completing all installation click on “Next” button for configuration Select MySQL password and click on next Now configuration started: After all, completion click on “Finish” After completing Installation we can be creating the database and tables as per the following query: Now Open MySQL Terminal And Start to Run the queries After installation is complete everything is in: C:\mysql. Now open C:\mysql and go to the mysql server which is probably C:\mysql\bin Type "mysql" C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql You can see: mysql> To show databases you can type: mysql> SHOW DATABASES; +----------+ | Database | +----------+ |   mysql  | |   test   |  +----------+ 2 rows in set (0.13 sec) Now you can set the username and password using below command : mysql> mysqladmin -u root password "new_password"; After setting up the password you can type the below command: mysql> mysql -u root -p Enter password:******* Creating Database Syntax: mysql> CREATE DATABASE databasename; Now if we want to deal with multiple databases then use below query: Mysql> CREATE DATABASE IF NOT EXISTS EmployeeDatabase; After this if you want to show database then use the below query: Mysql> SHOW DATABASES; Now choose the database to create the tables Syntax: mysql> use database_name; Example: mysql> use EmployeeDatabase; Creating Table Using MySQL: In this section we will learn how to create a database table and insert record init: Syntax: CREATE TABLE [IF NOT EXISTS] `TableName` (`fieldname` dataType [optional parameters]) ENGINE = storage Engine; Example: DROP TABLE IF EXISTS emp; CREATE TABLE emp ( empno decimal(4,0) NOT NULL, ename varchar(10) default NULL, job varchar(9) default NULL, mgr decimal(4,0) default NULL, hiredate date default NULL, sal decimal(7,2) default NULL, comm decimal(7,2) default NULL, deptno decimal(2,0) default NULL ); DROP TABLE IF EXISTS dept; CREATE TABLE dept ( deptno decimal(2,0) default NULL, dname varchar(14) default NULL, loc varchar(13) default NULL ); INSERT INTO emp VALUES ('7369','SMITH','CLERK','7902','1980-12-17','800.00',NULL,'20'); INSERT INTO emp VALUES ('7499','ALLEN','SALESMAN','7698','1981-02-20','1600.00','300.00','30'); INSERT INTO emp VALUES ('7521','WARD','SALESMAN','7698','1981-02-22','1250.00','500.00','30'); INSERT INTO emp VALUES ('7566','JONES','MANAGER','7839','1981-04-02','2975.00',NULL,'20'); INSERT INTO emp VALUES ('7654','MARTIN','SALESMAN','7698','1981-09-28','1250.00','1400.00','30'); INSERT INTO emp VALUES ('7698','BLAKE','MANAGER','7839','1981-05-01','2850.00',NULL,'30'); INSERT INTO emp VALUES ('7782','CLARK','MANAGER','7839','1981-06-09','2450.00',NULL,'10'); INSERT INTO emp VALUES ('7788','SCOTT','ANALYST','7566','1982-12-09','3000.00',NULL,'20'); INSERT INTO emp VALUES ('7839','KING','PRESIDENT',NULL,'1981-11-17','5000.00',NULL,'10'); INSERT INTO emp VALUES ('7844','TURNER','SALESMAN','7698','1981-09-08','1500.00','0.00','30'); INSERT INTO emp VALUES ('7876','ADAMS','CLERK','7788','1983-01-12','1100.00',NULL,'20'); INSERT INTO emp VALUES ('7900','JAMES','CLERK','7698','1981-12-03','950.00',NULL,'30'); INSERT INTO emp VALUES ('7902','FORD','ANALYST','7566','1981-12-03','3000.00',NULL,'20'); INSERT INTO emp VALUES ('7934','MILLER','CLERK','7782','1982-01-23','1300.00',NULL,'10'); INSERT INTO dept VALUES ('10','ACCOUNTING','NEW YORK'); INSERT INTO dept VALUES ('20','RESEARCH','DALLAS'); INSERT INTO dept VALUES ('30','SALES','CHICAGO'); INSERT INTO dept VALUES ('40','OPERATIONS','BOSTON'); Performing Some queries On these tables Query1: MySQL Query to select “Sal” and “comm” where sal<5000 Solution: select * from (select sal as salary, comm as commission from emp) x where salary < 5000; How to Use “case”: select ename, sal, case when sal <= 2000 then 'underpaid' when sal >= 4000 then 'overpaid' else 'ok' end as status from emp; If you are a student or database developer, administrator, or someone with a basic understanding of the features of MySQL Hire us and Get your projects done by different Programming Language experts. If you have project or assignment files, You can send at contact@codersarts.com directly

  • Shell scripts Assignment Help | System Programming

    If you have project or assignment and looking for shell scripts experts. Contact us for this shell scripts assignment Solutions by Codersarts Specialist who can help you mentor and guide foe such shell scripts assignment, homework and project. You can directly send us at contact@codersarts.com  directly Get help from shell scripts experts at Codersarts. If you have projects that requires shell scripts experts then we are open to solve your problems ASAP. Submit an Inquiry to shell scripts Experts for free.We can help you with your project. What is shell scripting Shell scripting is programming like activity used to interact with System hardware or Operating system. This is part of system programming and you might have heard this term lots of times where you were learning linux or ubuntu. Shell scripts allow us to program commands in chains and have the system execute them as a scripted event, just like batch files. They also allow for far more useful functions, such as command substitution. You can invoke a command, like date, and use it's output as part of a file-naming scheme. Systems programming involves the development of the individual pieces of software that allow the entire system to function as a single unit.Systems programming involves many layers such as the operating system(OS), firmware, and the development environment

  • Data Analysis Using Pyspark In Machine Learning | Codersarts

    Assignment Task This assignment consists of two deliverables, being: One code implementation (40%). The code file in Jupyter Notebook format and the relevant data set files should be contained within a folder named: Task 3_YourName_StudentNumber, the folder is then to be zipped and uploaded to blackboard. A report (60%). The report must be uploaded as a separate file. Part I - PySpark source code Important Note: For code reproduction, your code must be self-contained. That is, it should not require other libraries besides PySpark environment we have used in the semester. The data files are packaged properly with your code file. In this component, we need to utilise Python 3 and PySpark to complete the following data analysis tasks: 1. Exploratory data analysis 2. Recommendation engine 3. Classification You need to choose a dataset from Kaggle (https://www.kaggle.com/datasets) to complete these tasks. Remember to include the data set file in your source code submission. Note: In your notebook, please use Heading 1 Markdown cell to separate each subtask. Task 1.1: Exploratory data analysis This subtask requires you to explore your dataset by telling its number of rows and columns, doing the data cleaning (missing values or duplicated records) if necessary selecting 3 columns, and drawing 1 plot (e.g. bar chart, histogram, boxplot, etc.) for each to summarise it Task 1.2: Recommendation engine This subtask requires you to implement a recommender system on Collaborative filtering with the Alternative Least Squares Algorithm. You need to include Model training and predictions Model evaluation using MSE Task 1.3: Classification This subtask requires you to implement a classification system with Logistic regression. You need to include Logistic Regression model training Model evaluation Part II –Report You are required to write a report with the following content: Provide a high-level survey on the advances of data science in the past 2 years. Explain how Spark fits into the field of data science. Compare Spark with its competitors. Explain your design and implementation of the machine learning parts in your code, including the following topics: 1. Background of your selected data set 2. For each task, which learning algorithm is used and what are its key parameters and how you set them up 3. For each task, provide comments/evaluation for the model learned Your report should use the following template: Table of Contents 1.0 Advancement of Data Science (550 words) 2.0 Spark in Data Science (200 words) 3.0 Machine Learning Implementation (250 words) 3.1 Data set 3.2 Collaborative filtering Features of the model, key parameters and configuration Evaluation 3.3 Logistic regression Features of the model, key parameters and configuration Evaluation Feel free to contact us and take the advantages of Machine Learning assignment help services offered by us. We are the best assignment writing service provider and to solve all your academic worries. You can easily connect with us through phone, e-mail, or live chat. You can contact us anytime; our experts are always available for your help. Besides this, We will also provide CONSULTANCY for your app for FREE! so, if you are still reading this and have an app idea, drop us a message, we can surely talk and discuss your project and get things done!. You are just one step away to get it done.

  • What is UI/UX Design?

    It’s becoming a popular term now-a-days. It is basically understanding the customer and providing him/her the best experience he/she wants from his app, website, product design, etc that cover various expect such as Understanding their requirement What they see? What they experience? Understanding all their senses, is essentially the Usex Experience. The UI or User interface is a touch part of User experience. Which is basically what a user sees or touches. It is a way of communicating what a brand or service wants from users to understand or feel. Applications of UI/UX?? Usually, every company has a digital interface, and the minute you have a digital interface the requirement of a Ux or Ui designer arises. As the competition is increasing in the tech field the programmer or developer is evolving from the basic design to either increase their sale or increase the number of downloads. The people are understanding that a Ui/Ux designer can enhance the business. Search for any type of apps on play store you will 100s of alternatives that do the same function but what makes them different is the design, the typography, the way it interacts, and many such things. A calculator will calculate but how minimalistic its function makes it more profitable and friendly to use. Contact us for this UX/UI Web product design assignment Solutions by Codersarts Specialist who can help you mentor and guide for such machine learning assignments. If you have project or assignment files, You can send at contact@codersarts.com directly

  • Node.js File System

    Node implements File Input/Output using a simple wrappers around its standard POSIX functions. The Node File System (fs) module is imported by the following syntax: var fs = require("fs") Synchronous vs Asynchronous Every method in the fs module has synchronous as well as asynchronous forms. Asynchronous methods take the last parameter as the completion function callback and the first parameter of the callback function as error. It is better to use an asynchronous method instead of a synchronous method, as an asynchronous method never blocks a program during its execution, whereas a synchronous method does. Example: Create a text file named sample.txt with the following content: We want to learn Node.js File System in an easy and understandable way!! Let us create a js file named sample.js with the code: var fs = require("fs"); // Asynchronous read fs.readFile('sample.txt', function (err, data) { if (err) { return console.error(err); } console.log("Asynchronous read: " + data.toString()); }); // Synchronous read var data = fs.readFileSync('input.txt'); console.log("Synchronous read: " + data.toString()); console.log("Program Ended"); Now run the sample.js to see the result − $ node main.js Output. Synchronous read: We want to learn Node.js File System in an easy and understandable way!! Program Ended Asynchronous read: We want to learn Node.js File System in an easy and understandable way!! Now we are going to learn the major File I/O methods. 1. Open a File Syntax: Following is the syntax of the method to open a file in asynchronous mode − fs.open(path, flags[, mode], callback) Parameters: Here is the description of the parameters used: path: This is the string having file name including path. flags: Flags indicate the behavior of the file to be opened. All possible values have been mentioned below. mode: It sets the file mode (permission and sticky bits), but only if the file was created. It defaults to 0666, readable and writeable. callback: This is the callback function which gets two arguments (err, fd). Flags Flags for read/write operations are: r: Open file for reading. An exception occurs if the file does not exist. r+: Open file for reading and writing. An exception occurs if the file does not exist. rs: Open file for reading in synchronous mode. rs+: Open file for reading and writing, asking the OS to open it synchronously. See notes for 'rs' about using this with caution. w: Open file for writing. The file is created (if it does not exist) or truncated (if it exists). wx: Like 'w' but fails if the path exists. w+: Open file for reading and writing. The file is created (if it does not exist) or truncated. wx+: Like 'w+' but fails if path exists. a: Open file for appending. The file is created if it does not exist. ax: Like 'a' but fails if the path exists. a+: Open file for reading and appending. The file is created if it does not exist. ax+: Like 'a+' but fails if the the path exists. Example: Let us create a js file named sample.js having the following code to open a file sample.txt for reading and writing. var fs = require("fs"); // Asynchronous - Opening File console.log("Going to open file!"); fs.open('input.txt', 'r+', function(err, fd) {    if (err) {       return console.error(err);    } console.log("File opened successfully!");      }); Now run the sample.js to see the result: $ node sample.js Output. Going to open file! File opened successfully! 2. Get File Information Syntax: Following is the syntax of the method to get the information about a file − fs.stat(path, callback) Parameters: Here is the description of the parameters used: path: This is the string having file name including path. callback: This is the callback function which gets two arguments (err, stats) where stats is an object of fs.Stats type. 3. Writing a File Syntax: Following is the syntax of one of the methods to write into a file − fs.writeFile(filename, data[, options], callback) This method will over-write the file if the file already exists. If you want to write into an existing file then you should use another method available. Parameters: Here is the description of the parameters used: path: This is the string having the file name including path. data: This is the String or Buffer to be written into the file. options: The third parameter is an object which will hold {encoding, mode, flag}. By default. encoding is utf8, mode is octal value 0666. and flag is 'w' callback: This is the callback function which gets a single parameter err that returns an error in case of any writing error. Example: Let us create a js file named sample.js having the code: var fs = require("fs"); console.log("Going to write into existing file"); fs.writeFile('sample.txt', 'Simple Easy Learning!', function(err) {    if (err) {       return console.error(err);    } console.log("Data written successfully!"); console.log("Let's read newly written data"); fs.readFile('sample.txt', function (err, data) {       if (err) {          return console.error(err);       } console.log("Asynchronous read: " + data.toString());    }); }); Now run the sample.js to see the result: $ node sample.js Output. Going to write into existing file Data written successfully! Let's read newly written data Asynchronous read: Simple Easy Learning! 4. Reading a File Syntax: Following is the syntax of one of the methods to read from a file: fs.read(fd, buffer, offset, length, position, callback) This method will use file descriptor to read the file. If you want to read the file directly using the file name, then you should use another method available. Parameters: Here is the description of the parameters used: fd: This is the file descriptor returned by fs.open(). buffer: This is the buffer that the data will be written to. offset: This is the offset in the buffer to start writing at. length: This is an integer specifying the number of bytes to read. position: This is an integer specifying where to begin reading from in the file. If position is null, data will be read from the current file position. callback: This is the callback function which gets the three arguments, (err, bytesRead, buffer). Example: Let us create a js file named sample.js with the code var fs = require("fs"); var buf = new Buffer(1024); console.log("Going to open an existing file"); fs.open('sample.txt', 'r+', function(err, fd) {    if (err) {       return console.error(err);    } console.log("File opened successfully!"); console.log("Going to read the file"); fs.read(fd, buf, 0, buf.length, 0, function(err, bytes){       if (err){ console.log(err);       } console.log(bytes + " bytes read");       // Print only read bytes to avoid junk.       if(bytes > 0){ console.log(buf.slice(0, bytes).toString());       }    }); }); Now run the sample.js to see the result: $ node sample.js Output. Going to open an existing file File opened successfully! Going to read the file 97 bytes read We want to learn Node.js File System in an easy and understandable way!! 5. Closing a File Syntax: Following is the syntax to close an opened file: fs.close(fd, callback) Parameters: Here is the description of the parameters used: fd: This is the file descriptor returned by file fs.open() method. callback: This is the callback function No arguments other than a possible exception are given to the completion callback. Example: Let us create a js file named sample.js having the following code: var fs = require("fs"); var buf = new Buffer(1024); console.log("Going to open an existing file"); fs.open('sample.txt', 'r+', function(err, fd) {    if (err) {       return console.error(err);    } console.log("File opened successfully!"); console.log("Going to read the file"); fs.read(fd, buf, 0, buf.length, 0, function(err, bytes) {       if (err) { console.log(err);       }       // Print only read bytes to avoid junk.       if(bytes > 0) { console.log(buf.slice(0, bytes).toString());       }       // Close the opened file. fs.close(fd, function(err) {          if (err) { console.log(err);          }  console.log("File closed successfully.");       });    }); }); Now run the main.js to see the result: $ node main.js Output. Going to open an existing file File opened successfully! Going to read the file We want to learn Node.js File System in an easy and understandable way!! File closed successfully. 6. Truncate a File Syntax: Following is the syntax of the method to truncate an opened file: fs.ftruncate(fd, len, callback) Parameters: Here is the description of the parameters used fd: This is the file descriptor returned by fs.open(). len: This is the length of the file after which the file will be truncated. callback: This is the callback function No arguments other than a possible exception are given to the completion callback. 7. Delete a File Syntax: Following is the syntax of the method to delete a file: fs.unlink(path, callback) Parameters: Here is the description of the parameters used: path: This is the file name including path. callback: This is the callback function No arguments other than a possible exception are given to the completion callback. If you have any queries regarding this blog or need any help you can contact us on: contact@codersarts.com Node.js, Node.js Assignment, Node.js Assignment Help, Node.js Project, Node.js File System, Node.js Modules, Node.js Examples

  • Data Modelling In Machine Learning | Machine Learning Homework Help | Codersarts

    Introduction This assignment focuses on data modelling, a core step in the data science process. You will need to develop and implement appropriate steps, in IPython, to complete the cor- responding tasks. This assignment is intended to give you practical experience with the typical 5th and 6th steps of the data science process: data modelling, and presentation and automation. The \Practical Data Science" Canvas contains further announcements and a discussion board for this assignment. Please be sure to check these on a regular basis { it is your responsibility to stay informed with regards to any announcements or changes. Login through https://rmit.instructure.com/. Coding Environment Please develop your code by using Anaconda (with Python 3 or above version). Academic integrity and plagiarism (standard warning) Academic integrity is about the honest presentation of your academic work. It means acknowledging the work of others while developing your own insights, knowledge, and ideas. You should take extreme care that you have: Acknowledged words, data, diagrams, models, frameworks and/or ideas of others you have quoted (i.e. directly copied), summarised, paraphrased, discussed or mentioned in your assessment through the appropriate referencing methods Provided a reference list of the publication details so your reader can locate the source if necessary. This includes material taken from Internet sites. If you do not acknowledge the sources of your material, you may be accused of plagiarism because you have passed o the work and ideas of another person without appropriate referencing, as if they were your own. RMIT University treats plagiarism as a very serious offense constituting misconduct. Plagiarism covers a variety of inappropriate behaviors, including: Failure to properly document a source Copyright material from the internet or databases Collusion between students For further information on our policies and procedures, please refer to the following: https://www.rmit.edu.au/students/student-essentials/rights-and-responsibilities/ academic-integrity. General Requirements This section contains information about the general requirements that your assignment must meet. Please read all requirements carefully before you start. You must do all modelling in IPython or Jupyter Notebook (in Anaconda). You must include a plain text le called \readme.txt" with your submission. This file should include your name and student ID, and instructions for how to execute your submitted script les. This is important as automation is part of the 6th step of the data science process, and will be assessed strictly. Parts of this assignment will include a written report, this must be in PDF format. Please ensure that your submission follows the le naming rules speci fied in the tasks below. File names are case sensitive, i.e. if it is speci fied that the le name is gryphon, then that is exactly the fi le name you should submit; Gryphon, GRYPHON, griffin, and anything else but gryphon will be rejected. Task 1: Retrieving and Preparing the Data This assignment will focus on data modelling, and you can choose to focus on one ap- approach: Classi cation or Clustering. For this assignment, you need to select one dataset from the following options, and then work on it: Activity Recognition from Single Chest-Mounted Accelerometer Data Set. More details can be found from the following UCI webpage about this dataset: https://archive.ics.uci.edu/ml/datasets/Activity+Recognition+from+Single+ Chest-Mounted+Accelerometer BLE RSSI Dataset for Indoor localization and Navigation Data Set. More details can be found from the following UCI webpage about this dataset (Please just use the labeled dataset, and ignore the unlabeled dataset): https://archive.ics.uci.edu/ml/datasets/BLE+RSSI+Dataset+for+Indoor+localization+ and+Navigation Mice Protein Expression Data Set. More details can be found from the following UCI webpage about this dataset (This dataset is provided in xls format, and please covert it to csv format by using Microsoft Excel, which can be obtained from RMIT Mydesktop:https:\mydesktop.rmit.edu.au/vpn/index.html): https://archive.ics.uci.edu/ml/datasets/Mice+Protein+Expression Being a careful data scientist, you know that it is vital to set the goal of the project, then thoroughly pre-process any available data (each attribute) before starting to analyse and model it. In your report in Task 4, You need to clearly state the goal of your project, and the design/steps of pre-processing your data. Please ensure you understand the data you selected, including the meaning of each attribute. Task 2: Data Exploration Explore the selected data, carrying out the following tasks: Explore each column (or at least 10 columns if there are more than 10 columns), using appropriate descriptive statistics and graphs (if appropriate). For each explored column, please think carefully and report in your report in Task 4): 1) the way you used to explore a column (e.g. the graph); 2) what you can observe from the way you used to explore it. (Please format each graph carefully, and use it in your final report. You need to include appropriate labels on the x-axis and y-axis, a title, and a legend. The fonts should be sized for good readability. Components of the graphs should be coloured appropriately, if applicable.) Explore the relationship between all pairs of attributes (or at least 10 pairs of attributes, if there are more in the data), and show the relationship in appropriate graphs. You may choose which pairs of columns to focus on, but you need to generate a visualization graph for each pair of attributes. Each of the attribute pair should address a plausible hypothesis for the data concerned. In your report, for each plot (pair of attributes), state the hypothesis that you are investigating. Then, briefly discuss any interesting relationships (or lack of relationships) that you can observe from your visualization. Please note you do not need to put all the graphs in your report, and you only need to include the representative ones and/or those showing signifi cant information. Task 3: Data Modelling Model the data by treating it as either a Classification or Clustering Task, depending on your choice. You must use two different models (i.e. two Classification models, or two Clustering models), and when building each model, it must include the following steps: Select the appropriate features Select the appropriate model (e.g. DecisionT ree for classification) from sklearn. If you choose to do a Classifi cation Task, Train and evaluate the model appropriately. Train the model by selecting the appropriate values for each parameter in the model. You need to show how you choose these values and justify why you choose it. If you choose to do a Clustering Task, Train the model by selecting appropriate values for each parameter in the model. -----> Show how do you choose this value, and justify why you choose it (for example, k in the k-means model). Determine the optimal number of clusters, and justify Evaluate the performance of the clustering model by: -----> Checking the clustering results against the true observation labels ----->Constructing a \confusion matrix" to analyze the meaning of each cluster by looking at the majority of observations in the cluster. (You can do this by using a pen and a piece of paper, as we did in Practical Exercise; if you prefer, you can also explore how to do this step directly in IPython.) After you have built two Classification models, or two Clustering models, on your data, the next step is to compare the models. You need to include the results of this comparison, including a recommendation of which model should be used, in your report (see next section). Contact us for this machine learning assignment Solutions by Codersarts Specialist who can help you mentor and guide for such machine learning assignments. If you have project or assignment files, You can send at contact@codersarts.com directly

  • Node.js NPM

    What is Node.js NPM ? NPM stands for Node Package Manager. NPM provides two main functionalities − Online repositories for node.js packages/modules which are searchable on search.nodejs.org Command line utility to install Node.js packages, do version management and dependency management of Node.js packages. NPM comes bundled with Node.js installables after v0.6.3 version. To verify the same, open console and type the following command and you will see the result: $ npm --version 2.7.1 If you are running an old version of NPM then it is quite easy to update it to the latest version. You just have to use the following command from root: $ sudo npm install npm -g /usr/bin/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js npm@2.7.1 /usr/lib/node_modules/npm Installing Modules using NPM There is a simple syntax to install any Node.js module: $ npm install For example, the command to install a famous Node.js web framework module called express is: $ npm install express Now you can use this module in your js file as: var express = require('express'); Global vs Local Installation By default, NPM installs any dependency in the local mode. Here local mode refers to the package installation in node_modules directory lying in the folder where Node application is present. Locally deployed packages are accessible via require() method. For example, when we installed express module, it created node_modules directory in the current directory where it installed the express module. $ ls -l total 0 drwxr-xr-x 3 root root 20 Mar 17 02:23 node_modules Alternatively, you can use npm ls command to list down all the locally installed modules. Globally installed packages/dependencies are stored in system directory. Such dependencies can be used in CLI (Command Line Interface) function of any node.js but cannot be imported using require() in Node application directly. Now let's try installing the express module using global installation. $ npm install express -g This will produce a similar result but the module will be installed globally. Here, the first line shows the module version and the location where it is getting installed. express@4.12.2 /usr/lib/node_modules/express ├ merge-descriptors@1.0.0 ├ utils-merge@1.0.0 ├ cookie-signature@1.0.6 ├ methods@1.1.1 ├ fresh@0.2.4 ├ cookie@0.1.2 ├ escape-html@1.0.1 ├ range-parser@1.0.2 ├ content-type@1.0.1 ├ finalhandler@0.3.3 ├ vary@1.0.0 ├ parseurl@1.3.0 ├ content-disposition@0.5.0 ├ path-to-regexp@0.1.3 ├ depd@1.0.0 ├ qs@2.3.3 ├ on-finished@2.2.0 (ee-first@1.1.0) ├ etag@1.5.1 (crc@3.2.1) ├ debug@2.1.3 (ms@0.7.0) ├ proxy-addr@1.0.7 (forwarded@0.1.0, ipaddr.js@0.1.9) ├ send@0.12.1 (destroy@1.0.3, ms@0.7.0, mime@1.3.4) ├ serve-static@1.9.2 (send@0.12.2) ├ accepts@1.2.5 (negotiator@0.5.1, mime-types@2.0.10) └ type-is@1.6.1 (media-typer@0.3.0, mime-types@2.0.10) You can also use the following command to check all the modules installed globally − $ npm ls -g Using package.json package.json is present in the root directory of any Node application/module and is used to define the properties of a package. Let's open package.json of express package present in node_modules/express/ { "_from": "express@^4.17.1", "_id": "express@4.17.1", "_inBundle": false, "_integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", "_location": "/express", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "express@^4.17.1", "name": "express", "escapedName": "express", "rawSpec": "^4.17.1", "saveSpec": null, "fetchSpec": "^4.17.1"   }, "_requiredBy": [ "#USER", "/"   ], "_resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", "_shasum": "4491fc38605cf51f8629d39c2b5d026f98a4c134", "_spec": "express@^4.17.1", "_where": "C:\\Users\\Sharad\\register", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca"   }, "bugs": { "url": "https://github.com/expressjs/express/issues"   }, "bundleDependencies": false, "contributors": [     { "name": "Aaron Heckmann", "email": "aaron.heckmann+github@gmail.com"     },     { "name": "Ciaran Jessup", "email": "ciaranj@gmail.com"     },     { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com"     },     { "name": "Guillermo Rauch", "email": "rauchg@gmail.com"     },     { "name": "Jonathan Ong", "email": "me@jongleberry.com"     },     { "name": "Roman Shtylman", "email": "shtylman+expressjs@gmail.com"     },     { "name": "Young Jae Sim", "email": "hanul@hanul.me"     }   ], "dependencies": { "accepts": "~1.3.7", "array-flatten": "1.1.1", "body-parser": "1.19.0", "content-disposition": "0.5.3", "content-type": "~1.0.4", "cookie": "0.4.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "~1.1.2", "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "etag": "~1.8.1", "finalhandler": "~1.1.2", "fresh": "0.5.2", "merge-descriptors": "1.0.1", "methods": "~1.1.2", "on-finished": "~2.3.0", "parseurl": "~1.3.3", "path-to-regexp": "0.1.7", "proxy-addr": "~2.0.5", "qs": "6.7.0", "range-parser": "~1.2.1", "safe-buffer": "5.1.2", "send": "0.17.1", "serve-static": "1.14.1", "setprototypeof": "1.1.1", "statuses": "~1.5.0", "type-is": "~1.6.18", "utils-merge": "1.0.1", "vary": "~1.1.2"   }, "deprecated": false, "description": "Fast, unopinionated, minimalist web framework", "devDependencies": { "after": "0.8.2", "connect-redis": "3.4.1", "cookie-parser": "~1.4.4", "cookie-session": "1.3.3", "ejs": "2.6.1", "eslint": "2.13.1", "express-session": "1.16.1", "hbs": "4.0.4", "istanbul": "0.4.5", "marked": "0.6.2", "method-override": "3.0.0", "mocha": "5.2.0", "morgan": "1.9.1", "multiparty": "4.2.1", "pbkdf2-password": "1.2.1", "should": "13.2.3", "supertest": "3.3.0", "vhost": "~3.0.2"   }, "engines": { "node": ">= 0.10.0"   }, "files": [ "LICENSE", "History.md", "Readme.md", "index.js", "lib/"   ], "homepage": "http://expressjs.com/", "keywords": [ "express", "framework", "sinatra", "web", "rest", "restful", "router", "app", "api"   ], "license": "MIT", "name": "express", "repository": { "type": "git", "url": "git+https://github.com/expressjs/express.git"   }, "scripts": { "lint": "eslint .", "test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/ test/acceptance/", "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/ test/acceptance/", "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/ test/acceptance/", "test-tap": "mocha --require test/support/env --reporter tap --check-leaks test/ test/acceptance/"   }, "version": "4.17.1" } Attributes of Package.json name: name of the package version: version of the package description: description of the package homepage: homepage of the package author: author of the package contributors: name of the contributors to the package dependencies: list of dependencies. NPM automatically installs all the dependencies mentioned here in the node_module folder of the package. repository: repository type and URL of the package main: entry point of the package keywords: keywords Uninstalling a Module To uninstall a module in Node.js we have to use the following command: $ npm uninstall express Once NPM uninstalls the package, you can verify it by looking at the content of /node_modules/ directory or you can simply type the following command: $ npm ls Updating a Module To update package.json and change the version of the dependency you have to run the following command: $ npm update express Search a Module To search a package name using NPM. $ npm search express Create a Module Creating a module requires package.json to be generated. Let's generate package.json using NPM, which will generate the basic skeleton of the package.json. $ npm init Press ^C at any time to quit. name: (webmaster) You will need to provide all the required information about your module. You can take help from the above-mentioned package.json file to understand the meanings of various information demanded. Once package.json is generated, use the following command to register yourself with NPM repository site using a valid email address. $ npm adduser Username: mcmohd Password: Email: (this IS public) mcmohd@gmail.com It is time now to publish your module − $ npm publish If everything is fine with your module, then it will be published in the repository and will be accessible to install using NPM like any other Node.js module. If you have any queries regarding this blog or need any help you can contact us on: contact@codersarts.com Node.js, Node.js Assignment, Node.js Assignment Help, Node.js Project, Node.js NPM, Node.js Modules, Node.js Package.json

  • Predictive Analytics for Social Media Marketing | Machine Learning Assignment Help | Codersarts

    Predictive analytics It is the use of data, statistical algorithms, and machine learning techniques to identify the likelihood of future outcomes based on historical data. Its history may date back to at least 650 BC. Some early examples include the Babylonians, who tried to predict short-term weather changes based on cloud appearances and halos: Weather Forecasting through the Ages, NASA. Medicine also has a long history of needing to classify diseases. The Babylonian king Adad-apla-iddina decreed that medical records be collected to form the Diagnostic Handbook. Some predictions in this corpus list treatments based on the number of days the patient had been sick, and their pulse rate (Linda Miner et al., 2014). One of the first instances of bioinformatics! Many organizations are turning to predictive analytics to increase their bottom line and competitive advantage. Why now? Growing volumes and types of data, and more interest in using data to produce valuable insights. Faster, cheaper computers. Easier-to-use software. Tougher economic conditions and a need for competitive differentiation. Organizations are turning to predictive analytics to help solve difficult problems and uncover new opportunities. Common uses include: Detecting fraud. Combining multiple analytics methods can improve pattern detection and prevent criminal behavior. Optimizing marketing campaigns. Predictive analytics are used to determine customer responses or purchases, as well as promote cross-sell opportunities. Improving operations. Many companies use predictive models to forecast inventory and manage resources. Reducing risk. Credit scores are used to assess a buyer’s likelihood of default for purchases and are a well-known example of predictive analytics. How many businesses are actively using predictive analytics? According to research from Dresner Advisory Services, about 23%, a figure essentially unchanged from the previous years. Interest, however, exceeds implementation. The same research suggests that 90% of businesses “attach, at minimum, some importance to advanced and predictive analytics.” Types of Data Analysis Predictive MODELLING 4 Stages of Predictive Modelling Descriptive analysis on the Data – 50% time Data treatment (Missing value and outlier fixing) – 40% time Data Modelling – 4% time Estimation of performance – 6% time What is Time Series Data? -Analysis comprising of methods for analyzing time series data in order to extract meaningful statistics and other characteristics of the data. Time series forecasting is the use of a model to predict future values based on previously observed values. Usage: Non-stationary data, economic, weather, stock price & retail sales Contact us for this machine learning assignment Solutions by Codersarts Specialist who can help you mentor and guide for such machine learning assignments. If you have project or assignment files, You can send at contact@codersarts.com directly

  • Find Orders Between Age Range Using SQL | SQL Assignment Help | Codersarts

    Objective: A company sells SubscriptionX to its customers. To guide their efforts in a marketing campaign, one of the company’s stakeholders would like to understand which age group represents their most sticky customers. They have come to you asking for counts of sticky customers by age group over the past year. Definitions / Database Design: A sticky customer is defined as a customer who had at least two subscription-related transactions to SubscriptionX in the past year. You write a SQL query that outputs this data: Challenge: How would you query these tables to produce the resulting data set? (You may use any SQL variant you are most familiar with (PostgreSQL, MySQL, etc.) Solution SQL QUERY: select case when user.age <20 then '<20' when user.age between 20 and 29 then '20-29' when user.age between 30 and 39 then '30-39' when user.age between 40 and 49 then '40-49' when user.age between 50 and 59 then '50-59' when user.age between 60 and 69 then '60-69' when user.age <=70 then '<=70' END as age_group, Count(*) as user_quantity from user inner join orders on user.user_id = orders.user_id group by age_group ORDER BY CASE age_group WHEN '<20' THEN 1 WHEN '20-29' THEN 2 WHEN '30-39' THEN 3 WHEN '40-49' THEN 4 WHEN '50-59' THEN 5 WHEN '60-69' THEN 6 WHEN '<=70' THEN 7 ELSE 8 END Contact us for this machine learning assignment Solutions by Codersarts Specialist who can help you mentor and guide for such machine learning assignments. If you have project or assignment files, You can send at contact@codersarts.com directly

bottom of page