Welcome to NALIN.

An Official and Personal Blog of NALIN ADHIKARI.

This blog includes about my works, activities and achievements. To contact me click here

Let's take a tour and discover about me.

Last but not the least, I have included some programming and technical articles and will include more in the near future.

Stay connected by signning up for email updates.

Thank you !!!

Jetty Application Server

1 comment

How to Install Jetty Application Server

Jetty is an open-source Servlet container and Application Server which is known to be lightweight, portable, robust, flexible, extensible and providing support for various technologies like SPDY, WebSocket, OSGi, JMX, JNDI, and JAAS. Jetty is very convenient for development and also widely used in production environments.

Jetty presents Standalone, Embedded and Jetty Maven Plugin modes of operation.

  • Download Jetty binaries from the Jetty Homepage
  • First we have to extract the zip (or tgz) archive to a convenient directory. After extracting the binaries, have to go inside the root directory of the extracted folder and execute the following command.
    java -jar start.jar
  • If we see similar output like this 2015-11-06 23:00:18.042:INFO:oejs.Server:main: Started @1021ms at the end of the terminal then the Jetty is successfully started.
  • To verify it through the browser, have to navigate to this url http://localhost:8080/ and we will get Error 404 - Not Found page with Jetty Server signature at the end like Powered by Jetty:// 9.3.5.v20151012

Running Web Applications In Jetty

Create a WAR file and drop that file in the webapps folder. We do not even need to restart Jetty. webapps directory is monitored periodically and new applications are deployed automatically.

Changing the Jetty Port

By default, Jetty runs on 8080. In order to change it to some other port, we have to do the following:
  • Open start.ini under Jetty root directory.
  • Add this line jetty.port=7070
  • Save and close the file.

WildFly Server

Leave a Comment
WildFly is an application server which is flexible and lightweight that helps us build amazing application. It is authorized by JBoss and now developed by Red Hat. This application server is written in Java and implements the Java Platform, Enterprise Edition (Java EE) specification and runs on multiple platforms.

Some features of WildFly Server.
  1. Unparalleled Speed
    • Fast Startup
    • Ultimate Web Performance & Scalability
  2. Exceptionally Lightweight
    • Memory Diet
    • Slimable / Customizable Runtime
  3. Powerful Administration
    • Unified configuration & Management
    • Domain & Standalone Management
  4. Supports Latest Standards and Technology
    • Java EE 7
    • Modern Web
  5. Modular Java
    • No more jar
    • Fast Linking & Concurrent Loading
  6. Easily Testable
    • Arquillian
    • Smarter Development

Installation and running process.

  • Download and extract the ZIP or TGZ file from here.
  • Download the mysql driver for WildFly and extract if compressed.
  • Place mysql folder inside wildfly/modules/system/layers/base/com folder.
  • Create an user for deployment. For creating user, run wildfly/bin/add-user.sh. You can use any username and password. You will need this during deployment.
  • Open wildfly/standalone/configuration/standalone.xml and the add following XML snippets in <subsystem xmlns="urn:jboss:domain:datasources:3.0">.
          <driver name="mysql" module="com.mysql">

          <datasource jndi-name="java:jboss/datasources/nalinDS" pool-name="nalinDS"           
           enabled="true" use-java-context="true">
  • To start the project run command "wildfly/bin/standalone.sh".
  • To deploy the project, run command "mvn wildfly:deploy -Dwildfly.user=username -Dwildfly.password=password" in the root path of your project.
If any problem, feel free to comment. I will try to solve them. Regards.

Nepal Constitution 2072 (2015 AD)

Leave a Comment
The new constitution of Nepal (2072) has been finalized and is available for public to view. New constitution of Nepal is shown below.

Features of New constitution of Nepal 2072

  • 8 states in Nepal (Name to be given later with the help of special committee)
  • Discussion to continue on contentious issues and amend of some provision until the final one.
  • Vote of dissents are not a part of the draft but put there for further discussion.
  • Citizenship by Father name or mother name.
  • citizenship to NRN (Non resident Nepalese).
  • 60 percent FPTP and 40 PR in state assemblies as well.
  • Secularism to continue with freedom of any religion.
  • Bicameral legislation (275 Parliament and 45 National assembly members).
  • New Prime Minister, President and Parliament head election to be held within a month after promulgation of new constitution.
  • Five unchangeable provisions.
This is a good news for every citizen of Nepal that after a long waiting period draft of constitution has been released by constitutional assembly. We all Nepalese hope for peace, prosperous, united Nepal. Lets hope the new constitution of Nepal 2072 will be on favor of Nepal which can economically, politically boost Nepal. The draft constitution is yet to be finalized and CA members are committed to release the constitution of new nepal 2072 by the month of Shrawan.

Some photos on the day of declaration of new constitution of Nepal (2072).

You can drop down your views regarding new constitution of Nepal in the comment section below.

Click HERE to download a copy of Constitution of Nepal 2072.

Weird Facts

Leave a Comment
Hello there, today I am going to list some of the weird facts that I have encountered while surfing some social networking sites. The following facts are awesome and amazing. May be some of them you have already known but may be most of them are very new and jaw dropping to you.

  • The world's shortest commercially available flight takes place between the two Orkney Islands, Westray and Papa Westray, just north of Scotland, separated by a distance of only 1.7 miles. It is only 2 minutes long, and can be as short as 47 seconds in ideal conditions.
  • When Gangnam Style surpassed 2.15 billion views on YouTube, the View Counter went negative, causing YouTube to release a statement saying "We never thought a video would be watched in numbers greater than a 32-bit integer (=2,147,483,647 views), but that was before we met PSY.
  • The reason why we hate the recorded sound of our voice is because our skull changes the resonance of our voice from within and creates more bass. When we hear a digital recording of our voice, although slightly unfamiliar to ourselves, it's exactly how other people hear it.
  • Due to increased brain activity, people with higher intelligence tend to have a harder time falling asleep at night.
  • Chocolate can help fight against bacteria in the mouth and stop dental decay. Surprisingly, it can be good for your teeth.
  • When Katherine Johnson was little, she loved to count things. By the age of 10, she was in high school. In 1961, she calculated the trajectory of NASA's first trip into space/ She was so consistently accurate that when NASA began to use computers, they had her check the calculations to make sure they were correct.
  • A cat named Simon served on a Royal Navy ship in 1949, and received a medal for raising morale, killing off a rat infestation and surviving cannon shells during his service. Hundreds attended his funeral when he died from infected wounds.
  • There exists a variation of soccer where 3 teams face each other at the same times.
  • Did you know that when a dog sees it's owner, its brain secretes the same substances as ours when we are in love?
  • The reflex that causes people to sneeze when looking at the sun is called Autosomal-dominant Compelling Helio-Ophthalmic Outbrusr Syndrome, which abbreviates to ACHOO.
  • A cat has been the mayor of a town in Alaska for over 15 years. His name is Mr. Stubbs and every afternoon, he goes to a nearby restaurant and drinks water out of a wineglass laden with catnip.
  • Chinese government takes its officials and members of their families on prison tours on a regular basis to give officials an introduction to what awaits them if they should engage in corruption. The tours include meet-and-greets with former government officials who were caught for corruption.
  • A homeless man in NYC who would regularly order an expensive dinner at a restaurant and refuse to pay for it in order to be sent to prison where he would receive a meals a day and a clean bed. He refused to commit more serious crimes to get longer sentences as he did not want to hurt anyone.
  • Sitting straight upright in your chair is bad for your back. You should instead slouch at an angle of 135 degrees.
  • According to a legend in Iceland, if you don't get new clothes on Christmas you will be eaten by a giant cat.
  • Iceland has one of the largest gun ownership rates in the world and yet has one of the lowest crime rates in the world.
  • The first ever speeding fine was given to Walter Arnold of Kent, UK, in January 1896. His speed was 8mph in a 2mph zone. He was caught by a policeman on a bicycle.

Ten Reasons to Teach Coding

Leave a Comment
What is coding? Why to code? How to code? Which language is easy to code? Which language is best to code? These are some questions that will come at least once across the student's mind. In simple way, we can say that coding is simply writing code in any programming language to solve some problem. Without any problem, there is no meaning of writing code. Actually, in the coding universe, there is always at least a problem to solve that the programmer solve using his/her logic in programming language. Coding is syntax specific. That is, every programming language has it's own syntax that we should follow while writing code. Also, we should choose language to code according to the nature of problem.

Here, in this post, I am going to present some ten reasons to teach coding to students.

  1. Coding allows students to create content, not just consume it.
  2. Coding empowers students and gives them tools to express themselves in really cool ways.
  3. Coding teaches story telling with games and animations.
  4. Coding is a place for students to take risks and fail safely.
  5. Coding is inclusive and builds self-confidence.
  6. Coding supports many principles of mathematics.
  7. Coding teaches problem-solving and critical / analytical thinking skills.
  8. Coding is a new type of literacy and will be a large part of future jobs.
  9. Coding develops teamwork and collaborative skills.
  10. Coding can help humanity by building human helping devices / machines.

Why is the keyboard layout QWERTY?

Leave a Comment
Why is the keyboard layout Q-W-E-R-T-Y and not simply A-B-C-D-F? Why were computer keyboards designed in the current format not in a alphabetical order. Is there any specific reason or it's just some random convention we are following?

It hasn’t been done randomly or just for fun, it has a very distinct and purposeful reason behind it.

The current format of the keyboard was devised long back in 1870’s by a gentleman named Christopher Sholes for the then typewriter.

Though, it definitely was not the first format to come up, it didn’t take much time to switch to this one.

Starting with lexicographic order i.e. A-B-C-D-E-F, after various trials and errors and taking hundreds of cases, Christopher Sholes gradually reached the Q-W-E-R-T-Y. It was really well received (evident from the fact that we still use it).

When the typewriter was invented, it used a metal bar to hold the character alphabets and the other end of the bar was attached to a linkage carrying a carriage with the coated ink.

When a key was struck, it would emboss its character on the paper placed beneath the carriage. However, when an operator learned to type at a great speed, a certain flaw was noticed.

When two letters were struck in quick succession, the bars of the typewriter would entangle and get jammed.

Christopher Sholes found a way out. He proposed that the letters of frequently used letter pairs should be in different rows. 
 For example, ‘C-H’, ‘S-T’, ’T-H’, ‘W-H’ and more.

He also formulated that to speed up the typing process, there has to be a regular alternation between two hands. So observing thousands of words, he placed the letters in way that most words would make use of both hands.

He also observed that almost every word in the dictionary carries a vowel.

According to him, the most frequently used vowel was ‘A’ and the most frequently used letter (non-vowel) was ‘S’. So he placed ‘A’ and ‘S’ together and chose to keep less common letters like ‘Q’, ‘W’, ‘Z’, ‘X’, ‘C’ around these.

This was complemented by placing fairly common letters like ‘M’, ‘N’, ‘L’, ‘K’, ‘O’, ‘P’ at right extremes to create a perfect alternation between both the hands.

All these factors tested with thousands of trials gave us the format that we still use and perhaps would be using till eternity.

Difference between JSP and Servlets

Leave a Comment
Before I talk about the difference between JSP and Servlets, first of all I would like to talk about what is JSP and what is Servlets. JSP is Java Server Page which is the extension of Servlets. I will discuss about the Servlets in next paragraph. JSP simplify the delivery of dynamic Web content. Web applications programmer can create dynamic content by using the predefined components available in JSP and by interacting with components using server-side scripting.

Now, as talking about Servlets, they are the simply Java programs and they are also capable of creating dynamic web content. Servlets execute on the server side of a Web connection and they also extends the Web server's functionality; i.e. they extends the capabilities of servers that host applications. Those applications can be accessed via a request-response programming model.

Finally, I would like to present a short differences between JSP and Servlets. JSP is a webpage scripting language that can generate dynamic content where as Servlets are the Java programs that are already compiled which also create dynamic web content. JSP executes or run slower compared to Servlets as it takes time to convert JSP to Servlets but unlike JSP, Servlets run faster. Coding is easier in JSP but it's not so easy to write code in Servlets. In Model View Controller (MVC) pattern, JSP act as a view where as Servlets act as a controller. However, JSP is preferred if there is not much processing of data is required but in this case Servlets can handel much huge request/response processing and manipulation. JSP also has advantages, one of the best advantage of JSP over Servlets is that we can define custom tags which can be use to call Java Beans. But there is no concept of custom tags in Servlets. By running JavaScript in client side, we can achieve functionality of JSP but there is no such methods for Servelts.