Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Monday, November 5, 2012

Know about Javascript Family

Hi JavaScript is most commonly used language in web. everybody uses javascript to make project or website more dynamic and realistic . There are so many libraries in JavaScript which I called family of JavaScript . are following .Try to learn these and make it use in your projects and websites for more productivity and enhancement.   

Node.js
Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications.
http://nodejs.org

Backbone.js 
Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
http://backbonejs.org/

Ember.js
ITs again a Framework for creating Web Application.
http://emberjs.com/

Paper.js
Paper.js is an open source vector graphics scripting framework that runs on top of the HTML5 Canvas. It offers a clean Scene Graph / Document Object Model and a lot of powerful functionality to create and work with vector graphics and bezier curves, all neatly wrapped up in a well designed, consistent and clean programming interface.
http://paperjs.org

Railway.js

Railway is the Node.JS MVC framework based on ExpressJS, fully ExpressJS-compatible. It allows you to build web applications in a similar manner as in Ruby On Rails. The main objective of the framework - web development without pain.
http://railwayjs.com/

JqueryUI
jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library. Whether you're building highly interactive web applications
http://jqueryui.com/



Monday, January 16, 2012

JSON



JSON is Javascript object notation . this is also a part of my learning . bcoz Its a popular data interchange format between clients and servers. 

Json is basically a lightweight data interchange format. earlier we used to with XML and HTML and many more .But Json is lightweight , Easy to understand , language independent and self describing.

As we know that Server cannot send any object directly to client . so it need any middleware which can understandable both the side  so through Json, server send any query as a string type and on client side it can easily be parsed as Object .So basically in laymen language json is a string , which can be easily converted into object and also object to string.

lets take a example. 

1.)
{
"student": [
{ "firstName":"tom" , "lastName":"decker" }, 
{ "firstName":"varun" , "lastName":"jain" }, 
{ "firstName":"lexia" , "lastName":"woodhouse" }
]

} 

2.)
'{
"employees": [{ "firstName":"John" , "lastName":"Doe" }, { "firstName":"Anna" , "lastName":"Smith" }, { "firstName":"Peter" , "lastName":"Jones" }]}'

so you can see how both look similar but First one is object and Second one is String. 

so object to string and string to object . 

JSON.stringify(data);  - this convert into string format.

JSON.parse(data);      - this convert into javascript object . 


Tuesday, January 3, 2012

Global Variables

why not to use global variable in javascript ?

JavaScript is not good in dealing with global variables .Global variable is a variable that is visible in every scope. javascript does not support Classes like  C /C++ , But we can use functions to encapsualte data.But use of global variable in a large project is not a good programming practice. it can be easily vulnerable for any large project. because being dependent on global variable degrade the reliability of the program . and can easily access to make changes in whole program . so generally we  avoid the use of global variable in javascript in large projects , it may b use in small programs .

Sunday, January 1, 2012

string reverse

Binary Sort


arr = new Array()
arr[0] = 'Nano';
arr[1] = 'Indica';
arr[2] = 'BMW';
arr[3] = 'Innova';
arr[4] = 'Toyoto';
arr[5] = 'Alto';
arr[6] = 'Maruti';
arr[7] = 'Spark';
arr[8] = 'Chevrolet spark';

function binarySearch(arr, key){
var left = 0;
var right = arr.length - 1;
while (left <= right){
var mid = parseInt((left + right)/2);
if (arr[mid] == key)
return mid;
else if (arr[mid] < key)
left = mid + 1;
else
right = mid - 1;
}
return arr.length;
}
function search(){
var element= binarySearch(arr,'Innova');



document.write("The element you are searching is at the index number: "+ element);
}

Tuesday, December 27, 2011

javascript

 This is my progress log on java Script . I have started learning JavaScript and you can find simple programs created in JavaScript .