Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Nikhil Vasaikar

Greenhorn
+ Follow
since Sep 09, 2003
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 Nikhil Vasaikar

Hi,

I am posting an example of Mediator Pattern. Please feel free to comment. This might also help people who are looking for Java Examples for Patterns.

A Mediator is an object that encapsulates interaction between a set of objects. It promotes loose coupling by keeping the objects from interacting [refering] with each other explicitly.

Hi,

I am posting an example of Observer Pattern. Please feel free to comment. This might also help people who are looking for Java Examples for Patterns.

Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically



The Output
Notifying Observer Jack....
Price - 150.0
Notifying Observer Smith....
Price - 150.0

Regards,
Nikhil
Hi,

I am looking for a download URL of Eclipse Web Tools J2EE plugin.

Regards,

Nikhil
Hi Jeanne,

I agree with you. I have also found a WSAD feature list at the IBM Site. Infact now I can choose the eclipse plugins for the features I require.

Regards,

Nikhil
Hi,

Thanks for the Info. i actually want to know what makes WSAD different from Eclipse. In other words, if I have to choose between the two, which one should i go for and why?

Regards,

Nikhil
Hi,

I request someone to provide information on any better Java based GUI framework other than Swing.

Regards,

Nikhil
17 years ago
Hi,

I request someone to provide information on a comparison between Eclipse and WSAD. I will appreciate links to such info.

Regards,

Nikhil
Is there a better efficient way to write to a file than what i have coded in the above post?
18 years ago
Here's the code snipplet that is doing the IO
FileOutputStream fos = null;

try
{
parentRS = getParentData();
System.out.println("Got parentRS RS");
child1RS = getChild1Data();
System.out.println("Got child1RS RS");
child2RS = getChild2Data();
System.out.println("Got child2RS RS");

/******** Generate the XML Document ************/
fos = new FileOutputStream(filename);
fos.write(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").getBytes());
fos.write("<DATA>".getBytes());
while (parentRS.next())
{
String itId = parentRS.getString(1);
fos.write(("<A V=\"" + parentRS.getString(1) + "\">").getBytes());
fos.write(("<B>" + parentRS.getString(2) + "</B>").getBytes());
fos.write(("<C>" + parentRS.getString(3) + "</C>").getBytes());
fos.write(("<D>" + parentRS.getString(4) + "</D>").getBytes());
fos.write(("<E>" + parentRS.getString(5) + "</E>").getBytes());

while(child1RS.next())
{
if(!itId.equals(child1RS.getString(1)))
{
child1RS.previous();
break;
}
fos.write("<W>".getBytes());

fos.write(("<G>" + child1RS.getString(2) + "</G>").getBytes());
fos.write(("<H>" + child1RS.getString(3) + "</H>").getBytes());
fos.write(("<I>" + child1RS.getString(4) + "</I>").getBytes());
fos.write(("<J>" + child1RS.getString(5) + "</J>").getBytes());
fos.write(("<K>" + child1RS.getString(6) + "</K>").getBytes());
fos.write(("<L>" + child1RS.getString(7) + "</L>").getBytes());
fos.write(("<M>" + child1RS.getString(8) + "</M>").getBytes());

fos.write("</W>".getBytes());
}


while(child2RS.next())
{
if(!itId.equals(child2RS.getString(1)))
{
child2RS.previous();
break;
}
fos.write("<N>".getBytes());

fos.write(("<O>" + child2RS.getString(2) + "</O>").getBytes());
fos.write(("<P>" + child2RS.getString(3) + "</P>").getBytes());
fos.write("<Q>".getBytes());
fos.write(("<R>" + child2RS.getString(4) + "</R>").getBytes());
fos.write("<S>".getBytes());
fos.write(("<T>" + child2RS.getString(5) + "</T>").getBytes());
fos.write(("<U>" + child2RS.getString(6) + "</U>").getBytes());
fos.write(("<V>" + child2RS.getString(7) + "</V>").getBytes());
fos.write(("<W>" + child2RS.getString(8) + "</W>").getBytes());
fos.write(("<X>" + child2RS.getString(9) + "</X>").getBytes());
fos.write(("<Y>" + child2RS.getString(10) + "</Y>").getBytes());
fos.write(("<Z>" + child2RS.getString(11) + "</Z>").getBytes());
fos.write(("<UP>" + child2RS.getString(12) + "</UP>").getBytes());
fos.write("</S>".getBytes());
fos.write("</Q>".getBytes());

fos.write("</N>".getBytes());
}
fos.write("</A>".getBytes());
}
fos.write("</DATA>".getBytes());

}
finally
{
if ( fos!=null ) fos.close();

parent.cleanUp(parentRS);
child1.cleanUp(child1RS);
child2.cleanUp(child2RS);

ConnectionManager.closeConnection();
}
18 years ago
System Memory - 128MB
Three ResultSets-
Second and Third have Child records of First RS
At failure records in teh resultset were
First RS - 4000
Second RS - 8000
Third RS - 70000
Max file size so far created - 16MB
18 years ago
Hi,
I am reading from a muliplte resultset in nested loops and writing to a file. This is a new XML file that i am creating using FileOutputStream and then writing to it. I can write upto 16MB of data and beyond that it gives me an OutOFMemory Error. The sample write statement is as follows
fos.write(("<ITDW>" + mainRS.getString(5) + "</ITDW>").getBytes());
I would appreciate suggestion to write a file upto 100MB which is my requirement.
Thank You
18 years ago
Your suggestion definitely makes sense. I am using DOM to generate XML file from a ResultSet. In doing so i have to hard code the parent chid nesting at multiple levels. If I have a DTD in which all parent child nodes are defined then all I have to do is pick up the nesting from the DTD and generate the XML. This aproach will also help me in maintaining the code, say later on if i wish to change the parent child nesting all I have to do is change the nesting in the DTD. Well, this is just my perception. Correct me if I am wrong.
Can we generate an XML File using a DTD and a ResultSet Object?
I have a deadline for my deliverable. What I am trying to achieve is mentioned in my post which has the multiple nesting of parent child nodes.
[ October 02, 2003: Message edited by: Nikhil Vasaikar ]