Rakesh Bagaria

Greenhorn
+ Follow
since Sep 06, 2009
Merit badge: grant badges
For More
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 Rakesh Bagaria

<PROJECT_NAME NAME="POSTPAID_GLB">
<DB_PROFILE PROFILE="UAT19">
<DB_CONNECT_CODE CONNECT_CODE="USAGE1">
<DB_HOST>indlin537</DB_HOST>
<DB_INSTANCE>GLBABP2</DB_INSTANCE>
<DB_PORT>1521</DB_PORT>
<DB_USER>GLBDB19</DB_USER>
<DB_PASSWORD>GLBDB19</DB_PASSWORD>
</DB_CONNECT_CODE>[size=9] [/size]
<DB_CONNECT_CODE CONNECT_CODE="USAGE2">
<DB_HOST>indlin537</DB_HOST>
<DB_INSTANCE>GLBABP2</DB_INSTANCE>
<DB_PORT>1521</DB_PORT>
<DB_USER>GLBDB19</DB_USER>
<DB_PASSWORD>GLBDB19</DB_PASSWORD>
</DB_CONNECT_CODE>
<DB_CONNECT_CODE CONNECT_CODE="USAGE3">
<DB_HOST>indlin537</DB_HOST>
<DB_INSTANCE>GLBABP2</DB_INSTANCE>
<DB_PORT>1521</DB_PORT>
<DB_USER>GLBDB19</DB_USER>
<DB_PASSWORD>GLBDB19</DB_PASSWORD>
</DB_CONNECT_CODE>
</DB_PROFILE>
<DB_PROFILE PROFILE="UAT17">
<DB_CONNECT_CODE CONNECT_CODE="USAGE1">
<DB_HOST>indlin007</DB_HOST>
<DB_INSTANCE>GLBABP7</DB_INSTANCE>
<DB_PORT>1528</DB_PORT>
<DB_USER>DB17</DB_USER>
<DB_PASSWORD>DB17</DB_PASSWORD>
</DB_CONNECT_CODE>
</DB_PROFILE>
</PROJECT_NAME>


I want to write a parser like i will have PROFILE name and CONNECT_CODE as input and function should parse corresponding tags .
like for profile "UAT19" and CONNECT_CODE "USAGE1"

below should get parser
<DB_PROFILE PROFILE="UAT19">
<DB_CONNECT_CODE CONNECT_CODE="USAGE1">
<DB_HOST>indlin537</DB_HOST>
<DB_INSTANCE>GLBABP2</DB_INSTANCE>
<DB_PORT>1521</DB_PORT>
<DB_USER>GLBDB19</DB_USER>
<DB_PASSWORD>GLBDB19</DB_PASSWORD>
</DB_CONNECT_CODE>

like for USAGE2

DB_CONNECT_CODE CONNECT_CODE="USAGE2">
<DB_HOST>indlin537</DB_HOST>
<DB_INSTANCE>GLBABP2</DB_INSTANCE>
<DB_PORT>1521</DB_PORT>
<DB_USER>GLBDB19</DB_USER>
<DB_PASSWORD>GLBDB19</DB_PASSWORD>
</DB_CONNECT_CODE>


please help i know little bit about SAX parser.



//class with private constructor

class A
{
static int count =0;

//constructor
private A()
{
count=count+1;
}


//count function for object created
static void countfun(int n)
{

A ob[]=new A[n];
System.out.println("Number of Object created is "+count);

}
}


//main class

class PrivCons
{
public static void main(String args[])
{

A.countfun(5);


}
}
13 years ago
class A
{
static int k=10;

A getvalue(int a)
{ A ob = new A();
ob.k=a;
return ob;
}

}

class B
{

static A showVal(int a)
{
A ob = new A();
ob.k=50;

return ob;
}


}

class obRet
{
public static void main(String args[])
{
A ob1=new A();
ob1=new B().showVal();
System.out.println("k="+ob1.k);
}
}
13 years ago

A case of Effective Packing!
“Boxes Unlimited” is a company founded by Mr. Dibba Hoshiyar that specializes in manufacturing cartons of all sizes that are used for packing purposes. All cartons are rectangular (cuboid) in shape but vary in the three dimensions namely, the length, breadth & height. Whenever Mr. Dibba deals with potentially large orders, he sends samples of these cartons to the prospective company to help secure his order. Mr. Dibba makes sure that he sends as many cartons of various sizes as requested by the prospective company but at the same time, wants to keep the shipping cost to a minimum. To do this, Mr. Dibba packs the cartons within one another: the smallest carton is put placed inside a slightly larger carton, which is in turn is placed in a slightly larger carton and so on. He also has the option of packing as many small cartons as possible into a single large carton without them being inside one another. Eventually, the outermost carton is closed, sealed and shipped, thus paying shipping cost for just one carton (the outermost one). It may be noted that while a smaller carton is packed inside a bigger carton, the smaller carton may not fit inside the bigger one in all orientations, but only in certain orientations. For example, a 3x4x5 carton would fit inside a 5x6x4 carton, but not in all orientations.

To make things simpler, let us ignore the thickness of the carton sides. This means that, a 3x4x5 carton would fit inside another 3x4x5 carton (although two cartons of the same dimension will not occur for us). If Mr. Dibba gets a request for sending five sample cartons of the following dimensions: 3x4x5, 5x6x3, 1x4x10, 4x4x4 and 6x6x5, he would have to send these samples in a minimum of 3 cartons. There are several ways to arrive at this solution.
1. Put the 3x4x5 carton into the 5x6x3 which then, is put into the 6x6x5 carton. So the 3 cartons shipped would be 6x6x5, 1x4x10 and 4x4x4.
2. Put the 3x4x5 carton into the 5x6x3 carton and put the 4x4x4 carton into the 6x6x5 carton. In this case, the three cartons shipped would be 5x6x3, 6x6x5 and the 1x4x10.

It should also be noted that more than one carton can be packed within a larger carton without them being inside one another. Take the case of five sample cartons of the following dimensions: 3x3x3, 2x2x2, 3x3x1, 2x3x1 and 2x2x1. In this example, the cartons 2x2x2, 3x3x1, 2x3x1 and 2x2x1 would fit into the 3x3x3 carton and hence, only one carton (which is 3x3x3) needs to be shipped.

Your aim is to help Mr. Dibba find out the minimum number of cartons that needs to be shipped with all the samples of cartons requested (remember, you are helping Mr. Dibba in cutting shipping costs).
Input
The input file may contain multiple test cases. Input to each test case starts with a single integer m (0 < m <= 50) that denotes the number of cartons in that test case. This is followed by m lines, each with three positive integers l b h (each not greater than 100) separated by a single white space between each of them, corresponding to the length, breadth and height of each sample carton. No two cartons would have the exact same dimensions. The end of all test cases (and hence, the input itself) is signified by m having a value of 0.
Output
For each test case, output the number of cartons that would have to be shipped separately.
An example of multiple test cases
Input Output
5
3 4 5
5 6 3
1 4 10
4 4 4
6 6 5
3
3 1 7
5 1 4
2 5 3
5
3 3 3
2 2 2
3 3 1
2 3 1
2 2 1
0 3
3
1
As an example, there are two attachments here (input.txt and output.txt) for you to visualize how the input file would look like and how your program should create the output file.

General Instructions
• Please adhere to the rules document on the Code Mania Portal so that the Automated Solution Validator (ASV) can validate your solution.
• The format of the input and the output files are strictly governed by the ASV. Therefore, you are requested to adhere to the exact formats mentioned above
• The solution submitted is liable to rejection if
o it is found to be copied from the internet or any other source
o the source code has compilation errors
• In case of any dispute, the decision of the judges would be final.
13 years ago
could anybody explaine what is the question here??
13 years ago
when we have FileInputStream Class for input purpose then why we need DataInputStream ?please Explain
14 years ago
hello everyone
i am little confuse about toString(), equal(), hashCode(). please explain properly that when object class function get called when abstract collection class called and so on.
Please Explain with proper diagram and when toString() is used and when valueOf() used in string conversion please Explain . thanks
14 years ago
why should it not showing error when i wrote i=+a*2 at compile time
14 years ago
thanks a lot i got it.
14 years ago
yes i am agree with you instance of B will be created but i want to ask that why I get i=4 both time as first time add() function has called by cunstructer of A , it assigned the value to i and as next time cunstructer of B called add(), the value of i should be updated to 8 as i think but still it is gives i=4 as output. please explain this .
14 years ago
import java.util.*;

class AL
{
static int count;
public static void main(String args[])
{
Vector <Integer> al=new Vector<Integer>();
int i,j,l=0,k=0;
al.add(2);
al.add(4);
al.add(1);
al.add(3);
al.add(5);
al.add(3);
al.add(7);
al.add(8);
al.add(7);
al.add(9);
al.add(7);
al.add(8);
al.add(7);
al.add(3);
al.add(7);
al.add(8);
al.add(7);
al.add(8);
al.add(2);
al.add(4);
al.add(1);
al.add(8);
al.add(5);
al.add(8);
al.add(7);
al.add(8);
al.add(6);
al.add(9);
al.add(6);
al.add(1);

System.out.println(al.size());
Enumeration it=al.elements();
while(it.hasMoreElements())
{
i=(Integer)it.nextElement();
l=al.indexOf(i);
j=10-i;
System.out.println("i="+i+" j="+j);
if (al.contains(j))
{
k=al.indexOf(j);
if(k>l)
{
al.remove(k);
count++;
}

}

}



System.out.println(al.size());
System.out.println(count);

//System.out.println(al);


}
}


i just started learning java above program is for finding number of pairs whose sum is 10. similar concept can be apply for 1 to 50 . any suggetion for me .
14 years ago
i mean
i=i+a;

i=i+a*2;

as i think value of i for second time should be 8 but its not so why please explain
14 years ago
class A
{
int i;
A(int v)
{
add(v);
System.out.println("A");}
void add(int a)
{
i=+a;
System.out.println("A_add");
System.out.println("i="+i);

}

void print()
{
System.out.println("i="+i);
}
}

class B extends A
{

B(int v)
{
super(v);
add(v);}
void add(int a)
{
i=+a*2;
System.out.println("B_add");
System.out.println("i="+i);
}
}

class C
{
public static void main(String args[])
{
B b=new B(2);
//b.print();
}

}



output is B_add
i=4
A
B_add
i=4


why does we getting i = 8 second time please explain ???
14 years ago