Skip to main content

Posts

Stacks & its Applications

Hi, ๐Ÿ‘‹ everyone, Here is a new important section for the programmers. Data structures. As the first step I would like to discuss about the STACKS. Hope you have heard about stack. When we talk about the stacks the first thing that comes to our mind is, Isn’t it??? Yes! Stack is a kind of data structure which has only one opened end. So, you have to use this opened end when you insert or delete element. That means only the top element can accessible when you are using a stack.   Some examples for stack, Also we can say stack uses LIFO strategy. That means Last In First Out… Here is the list of operations we can done in stack. push(x)      – push/insert an element x to the stack pop()         – pop/delete/remove the top element from the stack top()           – Returns the top most element in the stack. But it does not allow to remove it. isEmpty ()  – Check whether the stack is empty or not isFull()        – Check whether the stack is full or

REST api

Hi  everyone ✋. This is REST api tutorial with a simple web application example. REST api is one of web service architecture. So lets talk about what is a web service . Web service is a collection of open protocols and standards used for exchanging data between clients and servers. The Web services based on REST Architecture are known as RESTful web services. REST stands for:  RE presentational  S tate  T ransfer It uses HTTP Protocol. It is widely using web based architecture  in current industry. Lets see the HTTP client calls before get start on REST api. HTTP calls GET - Read elements PUT - create new element DELETE - Remove elements POST -Update elements So lets learn RESTful web service with simple web example. For this I use NetBeans IDE, Mysql database, Glass fish server and for front end developing HTML. First create the web project using NetBeans IDE. Click finish. Then run the server. 1.Go to the Services tab → Servers →GlassFish serve

Execption Handling in js

Hi every one,๐Ÿ‘‹ Today I’m going to discuss about exceptions occur in java script. This is one of advance topic in java script and really important to have an idea about exception handling in js. First we move on to errors in java script. There are 3 types of errors in programming. Figure 1 Syntax errors occur when we miss any kind of syntax inside the codes. Like, Figure 2 Run time errors occur during execution. It bot because of any syntax errors. It happens like, trying to call a method but that method is not exist. Ex: <script type = “text/javascript”> document.getData(); </scrip> Logical errors are occur due to logical mistakes that happen by programmers. Because of these errors we can’t get the actual result that we need. When there is any run time error (exception) happen in the java script code we can handle them before the execution of the program. There are 3 types of handling ways ·         onerror() method ·   

void in java script

Hi, ๐Ÿ‘‹ this is my 13 th JavaScript tutorial which is describe about void keyword in js. My previous tutorial is about math object in js. You can go through it too.๐Ÿ‘ So I thought to explain about less heavy concept in here. Because last tutorials were so long. (But this is also an important concept) Ok let’s go to the point.๐Ÿ‘‡ So we are going to learn about void keyword in js. What is void???๐Ÿ’ญ It is an important keyword which is not evaluate a return value.  That mean when we use void as java script function signature, then the function does not return any value. So it takes an expression of any type as its operand and returns undefined. OK. Let’s go to an example on js void. <html> <head> <title> java script void </title> </head> <body> <form name= my_form> <a href=”javascript:void (alert(‘Hi this is first void example !!!’))”>Clck here</a> </form> </body> </html>

For in loop in js

Hi so we are going to discuss about another loop statement. That is for in loop statement. You may wonder why I haven’t discussed about for in loop in simultaneously with other for loop. The reason is we must have an idea about objects in java scripts. Ok lets’ go to the lesson. This loop is go through the object properties. So this is very useful loop. The syntax is, for(variablename in object){         statement } So let’s see an example. This prints the web browser’s Navigator object. Figure 1 Figure 2 Let’s try with different object. <script> function myFunction() {     var me = {fname:"Chamini", lname:"Prashakthi"};     var word = "";     var x;     for (x in me) {         word += me[x] + " ";     }     document.getElementById("demo").innerHTML = word; } </script> This will produce output as : Chamini Prashakthi  That is for in loop in js and  Thank you !๐Ÿ‘

math object in java script

Hi, ✋ this is another new tutorial which is explain Math object in java script. Using math object we can access lots of mathematical constants and functions. So, let’s start math object.๐Ÿ‘‡ Think you need to use the cos function. So you just have to type Math.cos(x). It’s simple! Here I have listed some Math properties.       ร€      Math.PI                 = this returns the value of ฯ€. (3.14)       ร€      Math.E                  = this returns the Euler’s constant. (2.718)       ร€      Math.LN2             = this returns the natural logarithm of 2. (0.693)       ร€      Math.LOG2E        = this returns the base 2 logarithm of E. (1.442)       ร€      Math.LOG10E      = this returns the base 10 logarithm of E. (0.434)       ร€      Math.SQRT2        = this returns the square root of 2. (1.414) So we can get the output as above values by using above functions. So, I think it is not necessary to describe more about Math properties. Let’s move to Math methods. I

java script Arrays

Hi everyone.๐Ÿ‘‹ This is my 10 th js tutorial which is explain about Arrays in java script. If we consider an array as an object we can store multiple values of data in same type. This is the syntax for array var myArray = [“dog”,”cat”,”lion”,”monkey”,”tiger”]; or var myArray = new Array (“dog”,”cat”,”lion”,”monkey”,”tiger”); So according to this array elements can identify as myArray[0] = dog๐Ÿถ myArray[1] = cat๐Ÿฑ myArray[2] = lion๐Ÿฆ myArray[3] = monkey๐Ÿต myArray[4] = tiger๐Ÿฏ There are some properties of arrays that we can use them for various conditions. length property      = can get the array size index property       = can get the element that indexes from zero prototype property = this property allows to add properties and methods to any object Figure 1 This is the result: Figure 2 This prototype property is very important property in arrays. We can use it in various places which is used to add new properties to the arrays. Al