Installing npm in NodeJs

NPM is node package manager for NodeJs, which is written fully in JavaScript. NPM runs on terminal or command line and manages dependencies if needed, when author include on the package.

npm-logo

npm logo

To install package just run the below command in terminal or command line. Continue reading

Installing Nodejs in Windows Operating System

nodejs-darkWhen I was analysing real-time data with PHP, MySQL and JavaScript. I came to know some basic stuff like ajax calls, but its not real because we need to set request based on interval.

For example I need to refresh the data, whenever new data is added or update in database. But ajax calls will refresh the data based on the interval.

After that I came to know its not proper way to go, because refresh data means whenever new data got inserted or updated it should be reflected.

So I switched over to Nodejs for real-time data stuff, before installing Nodejs.
We will have brief discuss about it.

What is Nodejs ?
Nodejs is a platform built on v8 Javascript Engine for easy building fast, scalable network applications. Its non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Continue reading

IMDb & OMDb API

IMDb logoWhen I was thought of posting well know APIs, first in my mind its came IMDB API.  A simple question why ?

Because they having huge volume of data with different languages, year and lots more content about the movie.

Also when I was searching for any content or movie,  I am able to see the link which give way to IMDb from google. So I thought of posting IMDb API first. Continue reading

Working with header refresh using PHP

Now a days most of the website are providing real-time data streaming, when user visit the website they want to display the content without reloading the page, but how ?

there is a simple way to do it, we are going to create simple html with iframe tag which will call the server page to get the content every 5 seconds.

<html>
<head>
<title>Codeasearch.com - Tutorial - Working with header refresh using PHP</title>
</head>
<body>
<iframe src="server-page.php"></iframe>
</body>
</html>

Continue reading

How to access global variable in JavaScript

Accessing global variable in JavaScript, what is global variable where it used.
Global variable is accessible everywhere in the script, for example if you want to access variable which defined in top.

<script language="javascript">
// declaring global variable 
var myVariable = 1;

Its accessible inside the function or outside the function as variable.
there is a method call window.variable which will be same as calling the variable inside the function.

Continue reading