in.linkedin.com/in/amitkumar0110 Twitter: https://twitter.com/VigilDBest" /> in.linkedin.com/in/amitkumar0110 Twitter: https://twitter.com/VigilDBest" />

Technology

Create Basic HTTP Server with Node.js

Like other languages(Java, php), we do not need to set up any Apache HTTP server. With Node, things are a bit different, with Node.js, we not only implement our application, we also implement the whole HTTP server. In fact, our web application and its web server are basically the same. Lets create a basic Node HTTP server. First let's...

10-May-2013

Technology

How to implement Inheritance in js2

We are assuming that you have installed js2 in your system, in case if you have not installed js2, first install js2. First of all create a InheritanceTest.js2 file in scr directory with the content given below: [js] class Person { // Parent class var firstName; var lastName; function initialize(firstName, lastName)...

18-Feb-2013

Technology

Getting started with js2

We are assuming that you have installed node.js in your system, in case if you have not installed node.js, first install node.js. To install js2 run the command given below: [bash] npm install js2 [/bash] Let’s create a simple Hello World project, but first let’s create a project directory structure: [bash] mkdir...

16-Feb-2013

Technology

“this” keyword in JavaScript

There are four patterns of invocation in JavaScript: 1. The method invocation pattern. 2. The function invocation pattern. 3. The constructor invocation pattern. 4. The apply invocation pattern. 1. The Method Invocation Pattern: When a function is stored as a property of an object, we call it a method. When a method is invoked,...

20-Dec-2012

Grails

MetaProgramming with MetaClass

As we all know that groovy is a dynamic programming language, so we can add any method to any class at runtime. First, let’s see a small and simple example of metaProgamming given below, in which we are adding a method (isEvent) into an Integer class. [groovy] Integer.metaClass.isEven = { -> // only (->) sign indicates that...

24-Sep-2012

Grails

Grails pageProperty tag

In my current project, I tried to call a javascript function on onload event of body tag of gsp page: [html] ... [/html] But this onload event was not fired, because Grails picks the body tag from layout and not from the view. So I added the following line in body tag of my layout [html] ... [/html] In above example...

24-Sep-2012

Grails

What is Delegate ??

Suppose a scenario, where User and Account classes are linked as below: [groovy] class Account { String email String password // ... other fields } class User { Account account String name String address // ... other fields } [/groovy] At the time of creating a new User, and accessing the user...

25-Aug-2012

Grails

Login with Twitter

This application saves user’s time for registration by providing a way through which user can login into application with its twitter credentials. Application will get the user details from his corresponding twitter account and will do the registration programmatically, so user can easily manage account through his twitter account. ...

24-Aug-2012

Grails

Manage Multiple Log File

Different Levels of Logging to Different Appenders or Files: When a project is running, then lot of log messages (all type of log messages e.g. Error, Fatal, Warning, Info, Debug etc.) are logged into a single log file. Many times we try to find the error messages only, instead of debugging the complete application. In that case we...

24-Aug-2012

Grails

Send Mail via Log4j with SMTP Appender

Grails supports sending all log messages(error,fatal etc.) to a support team or to yourself, by email (gmail account), via log4j with SMTP Appender. 1. For this we have to do some configration in Config.groovy as shown below: [groovy] // import SMTPAppender and Log4j Lever classes import org.apache.log4j.net.SMTPAppender import...

13-Aug-2012