pranay jha

Greenhorn
+ Follow
since Feb 03, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by pranay jha

Hi,

The problem with me was multiple versions of the jars present in the classpath.
I just used the jars from an already deployed projects and it just started working.
I guess it was due to jee jars or spring jars. I didn't really bother to look once it started working.
Anyways I don't know if this will help or not, but still, I am attaching a screen shot of the jars that I
bluntly copied. half of them were never utilized in my project. And also this project that I tried to
recreate was 2 yrs old.

Regards
Pranay
10 years ago
Hi,

I just resolved the problem.
It was with my jars.
I changed my jars and it started working.
I have some other issues coming up with the command object.
But i think i'll research first and if i still don't find an answer then i'll come back and haunt you.

Thanks again!!
10 years ago
Hi,

sorry for the late reply...
but, i got the concept through your post and finally got the "self referential" concept right.
and implemented lot of linked list and tree and search codes....
Thanks a lot ... i guess i have a better understanding of self referential types..
and i now know how to use "code" tool too..
10 years ago
Hi,

Tomcat is configured in my Eclipse runtime.
Or shall i say that i have configured tomcat and added this project to the server, like I always do while creating a webapp.

10 years ago
Hi,

I am a Spring beginner and have just started creating an application.
I have created small spring applications, but this time i started getting issues in my web.xml.
I am using Eclipse ganymede and am working on a live project which works fine on this IDE.
This new small app started giving trouble.
i am using:
1. tomcat 6.0.29

as i start the server I get the following error "java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener"
i have checked few forums but haven't found a concrete solution.
I don't understand whether its a classpath issue or spring issue or my code.
Because in Helios the server starts but the application fails to run (ie. my index.jsp)

here is my contextLoaderListener in my web.xml file:





============================

kindly suggest..


Regards
Pranay

10 years ago
Hi,

I have been trying to re-create the infamous singly linked list code, implemented using C, with the help of core java.
I am trying to incorporate the functionality, like
1. create a node
2. insert a node,
2.1. at the beginning of the list
2.2. at the end of the list
2.3. in between the list
3. remove
4. modify
5. print the list

and sadly am stuck at inserting in-between the list.

what i am trying to do is to take data and link as int, if i want to insert in between then find the node whose link is same as that of the incoming node and increment the link of the nodes with link value greater than the incoming link.
and yes there is headCount to keep track of the number of elements
whew!!!

here is the piece of code i have created,
--------------------------------------------------------------------------
class Node.java
public class Node {

public Node head, nextNode;
public Node newNode;
public int data, link;
public static int headCount=0;

public Node(int data, int link){
this.link=link;
this.data=data;
}
public void setLink(int link){
this.link= link;
}
public void printList(){
System.out.println("{"+data+","+link+"}");
}
}

class Operations.java

public class Operations {

public Node firstNode, lastNode;
public Node currentNode;
public Operations(){
firstNode=null;
// nextNode=null;
currentNode=null;
lastNode=null;
}
public void insert(int data, int link){

// entry values are 0, -ve or greater than the accepted value
if(link<=0 || link>Node.headCount+1){
System.out.println("invalid entry, cannot be 0, -ve or greater than "+(Node.headCount+1));
}
if(link>0){
// element entering at location 1
if(link==1){
//first element
if(Node.headCount==0){
Node newNode= new Node(data, link);
firstNode=newNode;
lastNode=newNode;
newNode.nextNode=null;
lastNode.nextNode=null;
Node.headCount++;
System.out.println("{"+newNode.data+","+newNode.li nk+"}");

}

// Beginning of the list
if(Node.headCount==1){
Node newNode= new Node(data, link);
firstNode.link=(firstNode.link+1);
currentNode=firstNode;
lastNode=currentNode;
newNode.nextNode=lastNode;
newNode=firstNode;
lastNode.nextNode=null;
currentNode=null;
}
Node.headCount++;
}

// at the end of the list
if(link>1 && link==(Node.headCount+1)){
Node newNode= new Node(data, link);
lastNode.nextNode=newNode;
newNode=lastNode;
newNode.nextNode=null;
Node.headCount++;
}

//In-between
if(link>1 && link<(Node.headCount+1)){
Node newNode= new Node(data, link);
currentNode.link= newNode.link;
//temp.nextNode=currentNode;

while(currentNode.nextNode != null){
currentNode.link=(currentNode.link+1);
currentNode=currentNode.nextNode;
}
}

}


}
// the print functionality is incomplete, but i am posting it anyway
public void printList(){
Node curr= firstNode;
while(curr != null){
curr.printList();
curr=curr.nextNode;
}
}
}

class Test.java
public class Test {
public static void main(String[] args) {
Operations operate= new Operations();
operate.insert(10, 1);
operate.insert(20, 1);

}

}
10 years ago