Monday, May 19, 2014

How to create a Singly Linked List in Java

I have started revisiting Java Basics during my summer break and currently trying to figure out the famous "Linked List".In this post we will learn about various types of linked list by using code and figures because having a visual always helps in understanding a concept.
Singly Linked List 
The node in a singly linked list comprises of  :-
- info  that stores the text or information about the node
pointer  that stores the reference to the next node.
Each linked list has a head which is usually the first element in the list and a tail which is usually null in case of singly linked list.

Singly Linked  List
The above weird looking figure is the in memory representation of a linked list,where the top part stores the info and the bottom part stores the reference to the next node it points to.Head is the first element in list and tail is usually null.The problem with singly linked list is that it can only be traversed in forward direction so you need to store the reference to its first element in a separate data structure and then traverse it node by node in forward direction by using that data structure.
JAVA CODE FOR CREATING,PRINTING SINGLY LINKED LIST

public class createLinkedList<T>{
/* Node Definition
* data stores the information about the node
* next stores the node to which current node points to
*/
private T data;
private createLinkedList<T> next;

public createLinkedList(T value){
data=value;
}
public createLinkedList<T> next(){
return next;
}
public T getValue() {
return data;
}
/*
* Setter methods for data and next
*/
public void setValue(T data){
this.data=data;
}
public void setNext(createLinkedList<T> next){
this.next=next;
}

public static void main(String[] args) {
createLinkedList<Integer> node1=new createLinkedList<Integer>(12);
createLinkedList<Integer> node2=new createLinkedList<Integer>(3);
createLinkedList<Integer> node3=new createLinkedList<Integer>(-8);
createLinkedList<Integer> node4=new createLinkedList<Integer>(6);
node1.setValue(node1.getValue());
node1.setNext(node2);
node2.setValue(node2.getValue());
node2.setNext(node3);
node3.setValue(node3.getValue());
node3.setNext(node4);
node4.setValue(node4.getValue());
node4.setNext(null);

/*
*Printing linked list
*/
createLinkedList<Integer> referenceToList=node1;
while(referenceToList!=null ){
System.out.println(referenceToList.getValue());
referenceToList=referenceToList.next();

}


}
}

Friday, May 9, 2014

Tools


While writing a computer program a programmer often has to repeat same lines of code again and again,almost always forgets closing a bracket or putting a colon at the end,just little things that always cause a big compilation error.

To help them in avoiding such little errors, computer scientists came up with automated tools which made life a lot easier.Imagine life without Eclipse,Visual Studio,Adobe's various products,Microsoft word,notepad.There are so many tools available nowadays.
For a recent project I came across some new tools that really helped me during the project phases .Some of them were


  • ouCampus for Content Management - This tool helped me a lot in creating web pages for my school project.It made adding text and multimedia very easy.This tool has been awarded (by OmniUpdate's content management)because of its functionality and is incorporated in creation of many universities websites.
  • Prezi for Presentation-I absolutely love this tool,whatever crazy idea you can come up with for the presentation,you can do it using this tool.
  • Google Analytics -Google Analytics can come real handy if you want to know from where the traffic is coming to your website.It gives all the information about page rank,demographics that can help you a lot in monitoring the website and also increasing its page view by tweaking it.
  • Adobe Photoshop for poster creation-Who does not know about the magic Adobe's Photoshop can do to images,text or should i say almost everything.We see it every day in those magazines where not so perfect people are represented as epitome of perfection by the help of Photoshop.We also used photoshop for creation of poster for our project



Some of my favorite tools are:-
  • Microsoft Office - Life would be horrible without Microsoft Office.This product is as important as food for computer savy people like me.
  • Google Apps - Google Apps is a good alternative of Microsoft Office specially for people who can't afford office.Best part of Google Apps is that all the documents are stored in the cloud.So there is less danger of loosing your hard-work in case the system crashes.Recently my friend's laptop got stolen and it had all the data in it(just before the finals),imagine his condition,he would be creating and storing everything on cloud using Google Apps from now on that's for sure.
  • Eclipse Kepler - What to say about eclipse Kepler except Intellisense,no more writing tedious lines of code again and again,no more searching for the corresponding package of the data structure or class you are using,eclipse kindly tells you what package is necessary for the code you are using,just double click on the intellisense and its included in your code(a boon,I would say).
  • Infomatica - Imagine your boss comes up to you and say,"Can you please change the primary key of table Employees?Thanks" which basically means ,"I want this done now".In a situation like this what if, you have no idea what table he is talking about,you just joined the team yesterday(No you can not go up to him and say I don't know how to do it).In this case Informatica comes in handy,it stores the whole work flow of a project,all the tables,primary key,foreign keys and that too with a human understandable visual.Just search your project workflow in meta search and you can easily find the "Employees" table and its keys(Yay...You are safe).By the way the example I gave you is based on my true life.

Usually I don't like tools that are too complicated because instead of trying to figure out how the tool works,I prefer working,so any tool that is self explanatory or has help forum is perfect.
With the advancement of technology tools are becoming better day by day,automation has reached  a new level which is great for people like me that can not memorize everything.

References
http://fc07.deviantart.net/fs71/f/2011/255/3/9/eclipse_a2_by_dj_fahr-d49mizm.png
http://www.itworld.com/sites/default/files/frustration-600x450_0.jpg
Images-
ww.zazzle.com


  

Monday, May 5, 2014

PERL


 PERL(Practical Extraction and Reporting Language)

Perl is a programming language that was created by Larry Wall in 1987 for processing text and generating reports while he was working in Unysis.Slogan of Perl is "There are more than one way to do things"; seems like that is what Lary Wall was thinking while creating Perl because Perl loans it's features from UNIX shell, awk ,sed, C++, Pascal,Lisp and SmallTalk 80(that's a lot of languages) The reason I love Perl is because of its flexibility.For example - As a coder ,it is very frustrating when you get a compilation error because you forgot to parse Integer to float(happens so many times),or when you have to think about whether I should use Integer or short or long to improve the efficiency of my program .. . well ...good news..Perl solves it all.
Just declare a variable like $var=undef;
and forget about its datatype or parsing while assignment operations because Perl does it all for you.
It automatically parses your variable name to the datatype by looking at the value that has been assigned to it and also handles the conversions on its own(Pretty amazing ..Right!!).Some people call Perl as a dirty language because of things like this ,I call it Smart and flexible.
Another feature of Perl that is a boon is CPAN(Comprehensive Perl Archive Network) which is an archive that started in October 1995,where authors like me(fledglings...as of now) and more experienced authors write modules and upload it on CPAN for public use. Example
File Handle Input/Output
Networking Devices
Documentation
Server Damon Utilities
World Wide Web etc
Just download it and use it as your own without fear of copy right issues or anything else.For example Perl "sort" operation implements the  MergeSort module by default hence giving time Complexity O(nlogn) which is as good as it gets without worrying about running complexity for sorting.Even while reading files you don't have to worry about whether it supports UTF-8 ,binary,html,xml encoding; just open a filehandler and read it unlike Scanner class in Java which can be sometimes troublesome with the encoding.
Code for reading a file in perl
open(filehandler,"<Filename");
while($line=<filehandler>){
print $line;
}
Just try this amazing language out,I know you will fall in love with it too.






References-
http://www.perl.org/
http://en.wikipedia.org/wiki/Perl

Beta Testing



Software Development Life Cycle can be divided into various phases - requirement, design, development, testing and implementation.Since Testing is a very important aspect of SDLC,various techniques have been developed over a period of time,for example ,unit testing,black box testing,white box testing,alpha testing,beta testing etc.

Beta Testing can be defined as a test for a computer product prior to commercial release.Beta testing is the last stage of testing,and normally can involve sending the product to test sites outside companies for real world exposure or offering the product for a free trial download over the Internet.

Recently Apple distributed the next update to the company's MAC operating system OS X 10.9.3 for beta testing to users that possessed an Apple ID ,signed up to participate and adhere to a confidentiality agreement associated with Beta testing process.
Similarly there are a lot of companies that give people the opportunity to participate in Beta testing their software like Facebook,Kaspersky,free dictionary even gaming products like XBox.You can go to the company's websites and see if there are any open opportunities for Beta testing,for example,right now Kaspersky needs Beta testers for their product (http://www.kaspersky.com/downloads/beta_testing)
When taking part in the beta testing it is necessary to:a)download and install the product you are interested in testing;b)spend a certain amount of time on familiarizing yourself with the product and testing it;c)prepare and send out bug reports on any errors found;d)provide suggestions on ways to improve the product being tested; and,e)report on compatibility issues (specifically related to your configuration).

References
https://cio.gov/software-development-life-cycle/http://www.pcmag.com/article2/0,2817,2456951,00.asphttp://www.kaspersky.com/downloads/beta_testing





Thursday, April 17, 2014

QR Codes

Recently, I went to a conference where every person had a name tag,on the bottom of the tag was their own personalized QR Code which stored the email id of the person.Before,going to any of the sessions the staff would scan their code and the person would receive an email at the end of the day that presented the list of all the places they went during the conference.Pretty Amazing!! that's the flexibility of QR Code usage.
The above image also known as QR(Quality Response) Code or a matrix bar-code was discovered in 1994 by Denso Wave for  Japanese Automotive Industry mainly to track vehicles during manufacturing by using component scanning.The idea behind the code was to create a square grid with white background and assembly of black boxes that stored some information.The vertical and horizontal black boxes would then be interpreted by using Reed-Solomon  error correction algorithm until the image was interpreted correctly.
The QR Codes mainly stores two things :-
1. Error correction level.
2. BCH Code which is named after initials of creators of this code(Bose,Chaudhari, Hocquenghem).Some of the interpretation are shown in the image below where character 0 is encoded as 00,1 as 01 ,2 as 03 and so on.
Alpha Numeric Character Encoding using BCH 
Various encoding supported by QRCodes-
EncodingMaximum Space Allowed
Numeric Encoding7089 characters
Alpha Numeric Encoding4296 characters
Binary/byte Encoding2953 characters
Kanji/kana Encoding1816 characters
Algorithm used for encryption and decryption of QR Code -
Digital Encryption Algorithm also known as DES is used for encryption and decryption of QR Code.The basic working principle of this algorithm is that  it takes a fixed length string and converts it into cipher text bit string by following a set of complicated operations.The DES also produces a key for decryption of the text,those who have the key can then convert the cipher text to readable string.

Nowadays users can create and customize their own codes by using tools like Adobe InDesignCC which can store some of  the  following information - 
1.URL
2.Text ,E-mail Information, Business Cards
3.Code Payments
4.Bank account,Credit Card Information 
Louis Vuitton QR Codes by Takashi Murakami
QR Codes are supported by almost all of the operating systems like Android,Blackberry,Apple iOS,Nokia Symbian Belle.They all provide apps or default QR Code reader that can hard link information to the QR Code,an example of such reader is Google Goggles.
Google Goggles-App for reading QRCodes



References
1.http://hypebeast.com/2009/4/louis-vuitton-qr-codes-by-takashi-murakami
2.http://www.enterakt.com/wp-content/uploads/2011/01/GoogleGoggles.jpg
3.http://en.wikipedia.org/wiki/Google_Goggles
4.http://en.wikipedia.org/wiki/Data_Encryption_Standard
5.http://en.wikipedia.org/wiki/BCH_code




Friday, April 11, 2014

Professional Summary


The description below will provide information regarding some of the skills and knowledge I have acquired through job and academics.
Job -Project was to improve the performance of a previous tool.Since the tool dealt with lot of files and
text validations ;I used my knowledge of file handling,regular expression,text processing in Perl which improved
the speed by 65 Percent.
Tools used for this project were - putty,notepad++,Excel
Protocols used -ftp,sftp,ssh,LDAP
Algorithms used -MergeSort for Sorting,Regular Expression for pattern matching
Languages used -Perl,Unix
Operating System-Linux
Number of Team Members -Development -3,Testing-2,Management-3
Academic
Course name -Information Retrieval
Project Name -Search Engine on Wikipedia(Ongoing)
Protocols used -DOM
Algorithms used -MergeSort,PageRank,Intersection,InvertedIndex,TermDocumentWeighting,External Sorting
Binary Search,Regular Expressions
Tools used -Eclipse Kepler,notepad++
Operating System -Windows 7
Number of team members -2
Languages used -Java,Python
Independent -
Developing a website for San Jose State University using their tool ouCampus and Agile Methodologies.
Also acted as a phase manager for a sprint.
Tools used -ouCampus,Google Docs,Prezi,Google Analytics,Microsoft Access,Qualtrics
Languages used -HTML,JavaScript
Team Members -5
For full time and part time internships mail me at khatri.setu68@gmail.com

Thursday, April 10, 2014

Blogs


Blogs are small articles also known as posts that are used by individuals to express their opinions, thoughts, experiences ,feelings by using text ,multimedia or combination of both .There is no fix categorization when it comes to  blogging.Some people might prefer to write technical blogs concentrating on single technology or field, while others might incorporate multiple topics like food,travel,technical in one single blog,to each his own.
For writing blogs, a person should first create an account on any of the blogging sites like Blogger by Google,Open Diary by Bruce Abelson,Live Journal by Brad Fitzpatrick.
Steps to create Blog on Blogger
1. Login to your Gmail Account
2.Click on the Apps button on the  top right corner of your account.It looks like the leftmost symbol in the picture below
Google Apps button(leftmost)
3.On click of Apps Button multiple options will be displayed in a drop down menu
Menu displayed on click of Apps Button
4.Click on the "More" option displayed at the bottom of the menu being displayed .Something similar to the image displayed below will be shown in your window.
On click of "More" option
5.Click on Blogger tab.
6.After clicking on Blogger tab you will be asked to select a title for your blog,try multiple titles because most of the titles are already taken ,so be creative.
7.After selecting the title,it is time to select a template for the blog,Google provides multiple templates that can be applied to your blog as it is or can also be customized according to individuals creativity.The best part about these templates is that they can be changed anytime you want.
8.Once the template is selected just click on new post,the symbol on the leftmost in the picture below 
New Post(leftmost)
9.Various option that comes up in the main menu is being displayed in the picture below.You can insert images,links,videos,make the font bold,italic by using the options provided.There is also an interesting option called "HTML" in the menu which stores the HTML code of your blog.
Main menu of Post
HTML Code looks like this 
HTML Code
10.Once the post is written click on the  preview button to see how it looks,modify it if you want to make some changes or publish it if you are happy with your work.That's it,you officially have a blog now.

My apologies for the images going out of the screen,but it was difficult to keep them visible and in the window .
References -