Monday, August 5, 2013

Web Services and its implementation

There has been lot of talks about developing web services and various ways of doing it for a long time now. But many of us (newbies) who started coding in a year or so are still not familiar with its jargon. In this blog I have tried to link various parts and explain terminology and technologies involved in developing web services.

WebServices : Web service is a method of communication between two electronic device over the world wide web. On a conceptual term, service is a software component provided through a network accessible endpoint.

WebServies can be implemented in various ways, but two most important one are :
(http://docs.oracle.com/javaee/6/tutorial/doc/giqsx.html)
(http://theopentutorials.com/tutorials/web-services/types-of-web-services-big-and-restful/)

  • Big web services - uses XML messages which follows SOAP (Simple Object Access Protocol) standard, an XML language that defines message architecture and message format. It contains machine readable descrtiption of the operations offered by web service, written in WSDL (Web Service Description Language), an XML language for defining interfaces syntactically. In Java 6, JAX-WS provides the functionality of big web services
  • RESTfull Web Services - 


These days RESTfull web services are very famous because of - reason

Java EE 6 provides JAX-RS as the implementation of RESTfull web services. It is a specification for developing rest full web services.

There are various implementations of JAX-RS. Some common ones are :
  1. Jersey - It is a reference implementation.
  2. RestEasy - This is jboss implementation of JAX-RS.















Sunday, June 2, 2013

Dynamic Programming

People are many a times worried about a common platform from where they can get information about Dynamic Programming. It is being often asked in interviews and is helpful in one's job. So here I have collected information, questions and links for you (and me).

Source Quora :

Following questions are the most popular dynamic programming problems for interviews :

  1. Given a matrix consisting of 0's and 1's, find the maximum size sub-matrix consisting of only 1's.
  2. Given an array containing both positive and negative integers, find the contiguous array with the maximum sum.
  3. Longest Increasing Subsequence - Find the length of the longest subsequence of a given sequence such that all the elements are sorted in increasing/non-decreasing order.
    There are many problems which reduce to the this problem such as box stacking and the building bridges. These days the interviewers expect an NLogN solution.
  4. Edit Distance - Given two strings and a set of operations Change (C), insert (I) and delete (D) , find minimum number of edits (operations) required to transform one string into another.
  5. 0/1 Knapsack Problem - A thief robbing a store and can carry a maximal weight of W into their knapsack. There are n items and ith item weigh wi and is worth vidollars. What items should thief take?
  6. Balanced Partition - You have a set of n integers each in the range 0 … K. Partition these integers into two subsets such that you minimize |S1 – S2|, where S1 and S2 denote the sums of the elements in each of the two subsets.
  7. Coin Change - Given a value N, if we want to make change for N cents, and we have infinite supply of each of S = { S1, S2, .. , Sm} valued coins, how many ways can we make the change?
  8. Longest Common Subsequence - Find the longest common subsequence of two strings A and B where the elements are letters from the two strings and they should be in the same order.
  9. Longest Palindromic Subsequence - The question is same as above but the subsequence should be palindromic as well.
  10. Minimum Number of Jumps - Given an array of integers where each element represents the maximum number of steps that can be made forward from that element, find the minimum number of jumps to reach the end of the array (starting from the first element).


Dynamic Programing questions from MIT site :

From geeks for geeks :

Topcoder also has a good collection of DP problems ranging from easy to hard. To gain confidence in DP I would suggest first go through the above links , then try solving the DP problems on Topcoder.


Tuesday, May 28, 2013

Unix Commands


Although I have been using linux for more than 5 years now, I still feel googling for linux command  as fun. And as great people have said, all fun comes to an end, here is my first step in putting this to an end. I am compiling some commonly used linux commands which one should master. I have tried to explain some of them in depth

Reference :
http://www.thegeekstuff.com/2010/11/50-linux-commands/
http://community.linuxmint.com/tutorial/view/778


  1. tar [options] : commonly used options are
    1. x : extract file from archive
    2. c : create a new archive
    3. f : use archive file
    4. t : list the content of an archive
    5. v : verbose
    • Example : 
    • tar xvf   archive.tar  (to extract archive.tar)
    • tar cvf  archive.tar file1 file2 (to create archive.tar from files 1 and 2 )
    • tar tvf  archive.tar (to list content of archive.war)   
  2. grep [options] pattern [filename] : to search strings in a file. if no filename is specified it will search in standard in put. options can be following
    1. -i  : ignore case both for patern and filename
    2. -r : recursively in the folder
    3. -A 3 : also prints 3 more lines are the line matching the pattern
    • Example
    • grep -i "paroksh" winners.txt
    • grep -r "paroksh" myFolder
  3. ps [options]: to see process running. (options are letters which can be grouped together).They are invoked using - options. They can take following values
    1. -e : select all processes
    2. -f : format
    • Example:
    • ps -ef  : to list all processes in formated way
    • ps -ef | grep tomcat  (it feeds result of ps to pipe which is in put to find pattern tomcat)

to be continued ...