Skip to main content

Posts

How to merge Objects in Javascript

 let person = {     firstName: 'Rocky',     lastName: 'g',     age: 23 }; let job = {     jobTitle: 'Angular Developer',     location: 'UK' }; let employee = {     ...person,     ...job }; console.log(employee);

Chicken Balls | చికెన్ ముట్టిలు

how to make fish curry

క్యారెట్ ఊరగాయ | carrot pickle

దోసకాయ పూర్ణం | cucumber curry

bottle gourd shale Pickle

javascript filter Array of objects

Description: filtering the array with the conditions return into the new Array Ex: var obj = { 'homes' : [{ "home_id" : "1" , "price" : "120" , "sqft" : "100" , "beds" : "3" , "baths" : "2.0" , }, { "home_id" : "2" , "price" : "1425" , "s qft" : "100" , "beds" : "2" , "baths" : "2.0" , } ] }; var newArray = obj. homes . filter ( function ( el ) { return el. price <= 1000 && el. sqft >= 500 && el. num_of_beds >= 2 && el. num_of_baths >= 2 }); console . log (newArray); Output [ { "home_id" : "1" , "price"...

javascript hoisting

Javascript hoisting: In JavaScript, Hoisting is the default behavior of moving all the declarations at the top of the scope before code execution. Basically, it gives us an advantage that no matter where functions and variables are declared, they are moved to the top of their scope regardless of whether their scope is global or local We can call as all the declaration variable going to top while executing the application. Above image assigning x=1 and it is not declared, after creating the alert then declaring the variable. Here it is not throwing any error while executing javascript declarations are going to top. Here var x: is going to top then assigning x=1: Code snippet: // program to display value var a = 6; function greet() { b = 'hi'; console.log(b); // hi var b; } greet(); // hi console.log(b); Output : Hi Uncaught ReferenceError: b is not defined

Javascript Web worker

Web worker is a powerful concept in javascript, which is used to improving performance of applications and it is running as Asynchronously. A web worker is a JavaScript that runs in the background, independently of other scripts, without affecting the performance of the page . Usages for real-time: If you are doing the complex operation in DOM, sometimes you feel like browser freezing or non functional. Such case you can use Web workers Coding: <!DOCTYPE html> <html> <body> <p>Count numbers: <output id="result"></output></p> <button onclick="startWorker()">Start Worker</button> <button onclick="stopWorker()">Stop Worker</button> <p><strong>Note:</strong> Internet Explorer 9 and earlier versions do not support Web Workers.</p> <script> var w; function startWorker() { if(typeof(Worker) !== "undefined") { if(typeof(w) == "undefined...

global functions in Javascript

var SomeName = function() {      var function1 = function (number) {       return number+1;      }  var anotherFunction = function (number) {      return number+2;       }  return {  function1: function (number) {     return function1(number);      },  function2: function (number) {    return anotherFunction(number);     }   }  }(); ............... Console.log(SomeName.function1(1)); //logs 2 console.log(SomeName.function2(1)); //logs 3

Javascript Array map methods

 The map() method is used to get a modified version of the array or a reduced value using callback functions. map() applies a function to each array element and creates a new array of the returned values Example :1  const listArray = [1,2,3,4,5] const listArray = listArray.map(Item => {     return item * 2; }) console.log(listArray); Output  : [2,4,6,8,10]

struts framework tutorial for beginners

Introduction To Struts Framework Let us see the quick and brief introduction to struts 2 framework, struts is an open source framework given by Apache software foundation under one of its projects called Jakarta. Struts are the framework, used to develop web applications for java with mvc2 architecture. Actually struts 1 was introduced in 2004 and this framework is failed to satisfy the needs of customers in today’s worlds, finally, Apache joined with OpenSymphony and created struts2.x. struts 2 = webwork2 + struts 1 webwork2 is the framework from OpenSymphony, java based mvc2. You know what, struts 2 is not an extension of struts 1, its the combination of struts 1 and webwork2 some features are taken from struts1 and some from webwork2 and finally released this struts2 framework. Types of frameworks Frameworks are divided into 2 types, Invasive Non-Invasive Invasive means, it will force the programmers to create their classes by extending or implementing from per...

Java Servlets Part 5

Q) What are the steps involved in the development of a Java Web Application? Pre-Requisites • JDK 7(above version 5) • Eclipse IDE for Java EE Developers • Apache Tomcat 7.x • Servlet 2.5 (3.x is the latest version) Configure Apache Tomcat in eclipse IDE Step1: Open Eclipse IDE in Java EE perspective and in “Servers” area, right click -> New -> Server. Step 2: Here we will see a list of servers that can be configured in the installed Eclipse IDE version. You will find Tomcat v6.0 Server under “Apache” folder as shown below. Select “Tomcat v6.0 Server” and click Next. Step 3: Configure Apache Tomcat installation location. Select the Tomcat Root folder and click Next Previous Next

Java Servlets Part 4

Q) Explain about initialization phase of a servlet? • Servlet Container calling the init method of the user defined servlet is nothing but its initialization phase. • Initialization also happen's only once in the life time of a servlet. • During the initialization phase, Servlet Engine does two things. 1.) Creates ServletConfig object 2.) Calls init method by supplying • ServletConfig object reference as an argument. • Any resources required for the servlet to attend the client request are provided in init method. Q) Explain about servicing phase of a servlet? • Servlet Engine calling the service method of a user-defined servlet is nothing but its servicing phase. • Servlet Engine calls service method for every client request. • Servlet Container does two things during the servicing phase of a servlet. 1.) Creating ServletRequest object andServletResponse object 2.) Calling service method by supplying ServletRequest object referenceandServletResponse object...