How to start Android Application Development
MEAN stack developer training for VCEW
How to check if Node js is installed and check Node js version
How to check if Node js is installed and check Node js version
Yep, I have had to do this on more than one occasion too. In order to check if you have Node js installed, or how to check your Node js version, follow these steps:
Open your command line tool (as above, Terminal, Command, Git Bash etc.)
Type node -v
This will print a version number if you do have node installed
You can see in this image the line where I’ve typed node -v and then pressed return, and then the subsequent response of the version number. You can use this for any npm package as well by typing packagename -v to find out if it’s installed, and if so, what version you have.
how to check if you have node installed or check your node js version
So to run a node js file in terminal / command / git bash you simply type ‘node‘ followed by the filename and include the .js extension:
node myfilename.js
how to run a node js file in a terminal
how to node js Step by steps
Here are the exact steps I just took to run the "Hello World" example found at http://nodejs.org/. This is a quick and dirty example. For a permanent installation you'd want to store the executable in a more reasonable place than the root directory and update your PATH
to include its location.
- Download the Windows executable here: http://nodejs.org/#download
- Copy the file to C:\
- Create C:\hello.js
- Paste in the following content:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
- Save the file
- Start -> Run... -> cmd
- c:
C:>node hello.js
Server running at http://127.0.0.1:1337/
That's it. This was done on Windows XP.
How to Run Node js Step by Step
Here are the exact steps I just took to run the "Hello World" example found at http://nodejs.org/. This is a quick and dirty example. For a permanent installation you'd want to store the executable in a more reasonable place than the root directory and update your PATH
to include its location.
- Download the Windows executable here: http://nodejs.org/#download
- Copy the file to C:\
- Create C:\hello.js
- Paste in the following content:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
- Save the file
- Start -> Run... -> cmd
- c:
C:>node hello.js
Server running at http://127.0.0.1:1337/
That's it. This was done on Windows XP.
Installation of NodeJS and NPM
Introduction
In this article, I am going to introduce NodeJS with Node Package Module (NPM), step-by-step basic implementation and explanation.
This article covers the following areas of NodeJS.
- Introduction of NodeJS
- Installation of NodeJS and NPM
- Node Package Module (NPM)
- Package.json
- Basic Example
NodeJS
NodeJS is an open-source, cross-platform runtime environment for developing server-side web applications. NodeJS also has an event-driven architecture capable of asynchronous I/O.
NodeJS uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.
Installation of NodeJS and NPM
Installation of NodeJS and NPM is straightforward using the installer package available at NodeJS official web site.
- Download the installer from NodeJS WebSite.
- Run the installer.
- Follow the installer steps, agree the license agreement and click the next button.
- Restart your system/machine.
Now, test NodeJS by printing its version using the following command in Command Prompt:
1> node -v
and test npm by printing its version using command
1> npm -v
Simple way to test nodeJS work in your system is to create a javascript file which print a message.
Lets create test.js file
1/*test.js file*/
2console.log("Node is working");
Run the test.js file using Node command > node test.js
in command prompt.
You are done with installation.
Node Package Module
NPM is the package module which helps javascript developers load dependencies effectively. To load dependencies we just have to run a command in command prompt:
1> npm install
This command is finding a json file named as package.json
in root directory to install all dependencies defined in the file.
What is an internship?
How to run PHP program in Xampp step-by-step?
How to run PHP program in Xampp step-by-step?
- Write this program in a notepad and save it as file.php or any other name.
- After completion of the installation, you can use the XAMPP Control Panel to start/ stop all servers.
- Start Mysql and Apache servers.
- Copy file.php to htdocs (C:/Program Files/XAMPP/htdocs)
- You can also create any folders inside htdocs folder and save our codes over there.
In order to get the dashboard for localhost: search http://localhost in any browser.
- Now to run your code, open localhost/file.php then it gets executed.
With this we come to an end of this article. I hope you have learned about XAMP, the installation of XAMP and how to run a PHP program in Xampp
How to execute PHP Script in Website using XAMPP webserver ?
How to execute PHP Script in Website using XAMPP webserver ?
First we have to install the XAMPP/WAMP webserver in our system. Please follow the link to download and install XAMPP/WAMP server. Link https://www.apachefriends.org/download.html
After successful installation, the steps we should follow are-
Open XAMPP control panel, if you want to link database to your code then start MySQL otherwise you will need to start Filezilla and Apache
Xampp starts
Then open Notepad/Notepad++ or any text editor to write PHP program.
<?php
echo "Geeks for Geeks";
?>
Save you file in path xampp/htdocs/gfg/a.php
Then go to your browser and type localhost/gfg/a.php in URL section. It will display the result.
Note: If there are multiple files in your code similarly then you can put all your files in one folder and can run it.
<?php
// Declare the variable
$x = 20;
$y = 10;
// Evaluate arithmetic operations
$z = $x + $y;
$m = $x - $y;
$p = $x * $y;
$a = $x / $y;
// Addition
echo "Sum: ", $z; // Sum: 30
// Subtraction
echo "Diff: ", $m; // Diff: 10
// Multiplication
echo "Mul: ", $p; // Mul: 200
// Division
echo "Div: ", $a; // Div: 2
?>
Type the URL xampp/htdocs/gfg/code/1.php in the browser, it will display the result.
Create table in XAMPP PHPMyAdmin
To access phpMyAdmin from XAMPP you will need to make sure you have Apache and MySQL running in the XAMPP control panel by clicking the start buttons under the Actions column:
If Apache and MySQL are green then all is well. Then you can click the “Admin” button in the MySQL row and that will launch phpMyAdmin:
You can also access phpMyAdmin by typing in http://localhost/phpmyadmin/ into your browser. The first time you access it, you will need to login using “root” as the username and there will be no password. Once you’ve typed that in, click on “Go”:
Once you are logged in I would recommend changing your password to secure your databases and their settings:
After you’ve done that. You will want to create a new database by clicking here:
You will then be prompted to name the database, do so, and then click on “Create”:
Then you will be asked to create a table with however many columns you want. Once you’ve decided that, click “Go” again:
This will require that you preplan your database a bit. You’ll need to know exactly what you will be storing in it. For this example, we will be storing the user’s name and age. So on the next screen we will put in a names and ages column. We will also need to give them a type, age will be INT (integer/numbers) and names will be VARCHAR (characters/letters). Finally we will need to say how many characters can be in each column. Age will be 3 since I don’t think anyone would live to be older than 999 (: and we will give 100 characters for their name which should be enough. Once we filled in those fields, we would click “Save”:
And there you have it! A new database with a table with two columns in it ready to be filled. Be sure to watch the video at the top of this post if you want to see how to connect to the database using PHP Data Objects (PDO). Also, be sure to check out our if you want to learn more about PHP, databases, and how to use them together. Have an amazing day!
How to Install MySQL and PHPMyAdmin
How to Install MySQL and PHPMyAdmin
1. Install Xampp on your PC.
2. In your Xampp Control Panel, Start Apache and MySQL.
3. Open your browser and enter http://localhost/phpmyadmin.
simple CRUD based Web API using Angular JS as middleware and PHP Core for backend service
In this, tutorial, we are going to create a simple CRUD based Web API using Angular JS as middleware and PHP Core for backend service. This tutorial here aims at explaining how to create AngularJS application utilizing PHP Web Services and MySQL Database. We may skip the basic concept of AngularJS which is not part of this tutorial but you can get those concepts from the official documentation of Angular JS. We may skip the basic concept of AngularJS which is not part of this tutorial but you can get those concepts from the official documentation of AngularJS.
Database in XAMPP
Database setup using XAMPP
XAMPP is an open source package that is widely used for PHP development. XAMPP contains MariaDB, PHP, and Perl; it provides a graphical interface for SQL (phpMyAdmin), making it easy to maintain data in a relational database.
If you have not installed XAMPP, please refer to XAMPP-setup to install and set up XAMPP.
Assuming that you have already set up XAMPP
- Start the database server ("MySQL Database")
- Start the PHP environment ("Apache Web Server")
Note: phpMyAdmin runs on a PHP environment. To use phpMyAdmin to manage databases, Apache Web server must be started.
Reminder: be sure to stop the server when you are done. Leaving the servers running consumes energy and may later prevent the servers from starting (in particular, MySQL server).
Access phpMyAdmin
- Open a web browser, enter a URL http://localhost to access XAMPP dashboard
- Select phpMyAdmin tab
Alternatively, you may access phpMyAdmin via the XAMPP manager / controller, click Go to Application button to access XAMPP dashboard.
The main page should look similar to the following
Add a user account
- On the phpMyAdmin screen, select User accounts tab.
- Select Add user account link.
- Enter user name and password of your choice. Note: do not use any of your official accounts such as UVA account.
- Select Local for Host name
- Check Create database with same name and grant all privileges
- Check Grant all privileges on wildcard name (username\_%)
- Check Check all for Global privileges
- At the bottom-right of the screen. click the Go button
Do not change or update the root account. If you may forget or need to reset your password, you can use the root account to manage users.
To verify that the account has been created, go to User accounts tab. You should see the newly created user account (as shown below).
Create a database
Let's create a guestbook database. To create a database, there are several options.
You may use the Create database feature.- On the phpMyAdmin screen, select the Databases tab. Alternatively, you may click the New link on the left panel.
- Under the Create database, enter a Database name
- Click the Create button
You may run the SQL command to create a database.
- On the phpMyAdmin screen, select the SQL tab
- Enter
CREATE DATABASE guestbook;
Note: SQL commands are not case sensitive. This example uses uppercase and lowercase simply to make it easy to read. - Click the Go button to run the command.
- For Mac users, you may press Control+Enter to run
- For Windows users, you may press Control+Enter to run
Create a table
Let's create a table named entries. To create a table, there are several options.
You may use the Create table feature.- On the phpMyAdmin screen, select the guestbook database.
- Select the Structure tab.
- Under the Create table, enter a table name and the number of columns.
- Click the Go button. This will prompt you to enter the column information.
You may run the SQL command to create a table.
- On the phpMyAdmin screen, select the SQL tab
- Enter the following code
USE guestbook; CREATE TABLE entries (guestName VARCHAR(255), content VARCHAR(255), entryID INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(entryID));
If you already selected the guestbook database (on the left panel), no need to include
USE guestbook
in your SQL to run. - Click the Go button to run the command.
- For Mac users, you may press Control+Enter to run
- For Windows users, you may press Control+Enter to run
Insert data
To insert data into a table, there are several options.
You may use the Insert feature.- On the phpMyAdmin screen, select the guestbook database, select the entries table.
- Select the Insert tab.
- For each record of data to be inserted, enter the value for each column.
- Click the Go button.
You may run the SQL command to insert data.
- On the phpMyAdmin screen, select the guestbook database, select the entries table.
- Select the SQL tab
- Enter the following code
INSERT INTO entries (guestName, content) values ("Humpty", "Humpty's here!"); INSERT INTO entries (guestName, content) values ("Dumpty", "Dumpty's here too!");
- Click the Go button to run the command.
- For Mac users, you may press Control+Enter to run
- For Windows users, you may press Control+Enter to run
Retrieve data
To retrieve data from a table, there are several options.
You may use the Browse feature.- On the phpMyAdmin screen, select the guestbook database, select the entries table.
- Select the Browse tab. This will display all existing records of the table.
You may run the SQL command to retrieve data.
- On the phpMyAdmin screen, select the guestbook database, select the entries table.
- Select the SQL tab
- Enter the following code
SELECT * FROM entries;
- Click the Go button to run the command.
- For Mac users, you may press Control+Enter to run
- For Windows users, you may press Control+Enter to run
Import SQL file
- Create a blank file named friendbook.sql. Paste the following content in the file
CREATE TABLE friends (friendName VARCHAR(255), phone VARCHAR(255), entryID INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(entryID)); INSERT INTO friends (friendName, phone) values ("Humpty", "111-111-1111"); INSERT INTO friends (friendName, phone) values ("Dumpty", "222-222-2222");
- On the phpMyAdmin screen, select the guestbook database
- Select the Import tab
- Choose the .sql file to import
- Click the Go button to run the command.
- For Mac users, you may press Control+Enter to run
- For Windows users, you may press Control+Enter to run
Export SQL file (back up your database)
- On the phpMyAdmin screen, select the guestbook database
- Select the Export tab
- Click the Go button to run the command.
- For Mac users, you may press Control+Enter to run
- For Windows users, you may press Control+Enter to run
Creating MySQL Database with XAMPP
How to install XAMPP on Windows 10
How to install XAMPP on Windows 10
To download and install XAMPP on Windows 10, use these steps:
Click the Download button for the Windows version of XAMPP and save the file on your computer.
Quick note: If you have special version requirements for PHP, download the version you need to install. If you do not have a version requirement, download the oldest version, as it may help you avoid issues trying to install PHP-based software. In addition, these instructions have been tested to work for XAMPP version 8.1.1 and older versions, but you can use this guide for other versions.Double-click the downloaded file to launch the installer.
Click the OK button.
Click the Next button.
XAMPP offers various components that you can install, such as MySQL, phpMyAdmin, PHP, Apache, and more. For the most part, you will be using most of these components, which means that it is recommended to leave the default options.
Click the Next button.
Use the default installed location. (Or choose another folder to install the software in the “Select a folder” field.)
Click the Next button.
Select the language for the XAMPP Control Panel.
Click the Next button.
Clear the Learn more about Bitnami for XAMPP option.
Click the Next button.
Click the Next button again.
Click the Allow access button to allow the app through the Windows Firewall (if applicable).
Click the Finish button.
Once you complete the steps, the XAMPP Control Panel will launch, and you can begin the web server environment configuration.