|
Hi I am ramesh
Please suggest some way to improve the performance?
Actually our project has below mentioned process,
1.load the huge xlsx file and validating that value by using sax parser xml.
2.if validation success then will store into database.
this is the routine process,every day we will load more file.
Currenty using technique:
1.reading large file using Apache poi(XSSF user model api) and validating through xml by using sax parser.
2. then storing into jdbc batch and executing it.
so my question is still any better way is there to improve performance?
please suggest i am waiting for your reply
|
|
|
|
|
|
public class DemoStructurepass {
public int a;
public int b;
public int c;
public int d;
}
public class MainActivity extends Activity {
test clsObj ;
DemoStructurepass dss;
long iS;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
dss = new DemoStructurepass();
clsObj = new test();
iS = clsObj.functionAddcheck(dss);
// public native long functionAddcheck(DemoStructurepass dss);
}
}
Now I need to access the DemoStructurepass structure in JNI(C)
|
|
|
|
|
|
I feel like I could make my own high level language with more logical layouts, where anything heirchy-related actually makes sense.
Here, methods are called towards the top of the page or program, and then written out and stored just below it. So the method has already been processed by the time you get down to where it is written entirely. This completely goes against the concept of a program, "a set or order of instructions to be compiled and executed," not to mention it is confusing.
This initializing of data in classes with their constructors towards the bottom of the page and referencing them from main on top of the program is illogical and ridiculus.
A program should sequentially follow steps from top to bottom, and as simple as this sounds, this concept still needs to apply at more advanced levels of programming
For this opinion that I have, what would be a better language for me to work with?
|
|
|
|
|
I guess you are reading someone else's bad code. Java of itself is a fine language for solving many problems. But like any language it can easily be misused.
|
|
|
|
|
How to replace particular numbers in the series of prime numbers generated with a letter in java?
|
|
|
|
|
|
how to execute java class file in ms-dos. what are tool to use execute java class file in windows os
|
|
|
|
|
Assuming you actually mean in a command prompt window then it is just a matter of running it via the java command.
|
|
|
|
|
class Sort1
{
public static void main(String...avg)
{
int a[][]={{10,50,40},{15,25,10},{25,14,19}};
for(int i=0;i<a.length;i++)
{
for(int j = 0;j<a[i].length;j++)
{
System.out.print(a[i][j]+"\t");
}
System.out.println();
}
int l =a.length;
int b[]=new int[l];
int c=0;
for(int k=0;k<a.length;k++)
{
for(int m=0;m<a[k].length;k++)
{
b[c]=a[k][m];
System.out.print(b[c] +"\t");
c++;
}
}
}
}
|
|
|
|
|
|
yeah, i want to know how to calculate the length of 2d array while converting it into 1d array
when i simply used a.length for my 2d array and put it into my 1d array ,then 1d array will print only first column then exception comes Array index out of bound
|
|
|
|
|
Well I would guess it is the total number of elements in your 2D array. So it is just a question of adding the number of elements in array[0] + array[1] + ...
|
|
|
|
|
yup i got the idea and it works like this
int a[][]={{1,2,3},{4,5,6},{7,2,6}};
int b[] = new int[a.length*a.length];
System.out.print(b.length);
//output is 9
//is this the way of getting length of 2d into 1d array?
|
|
|
|
|
What happens if you have something like:
int a[][]={{1,2,3,7,12},{4,5},{7,2,6,9,9,11,22,33,44,55}};
|
|
|
|
|
yup in that case my logic isn't working
if you can, please tell me the universal logic for calculating the length while converting 2d array into 1d array
|
|
|
|
|
|
ok i got the answer
thanks buddy for help 
|
|
|
|
|
This is showing error
So i solved from my self.....
class Sort1{
public static void main(String...avg)
{
int a[][]={{10,50,40},{15,25,10},{25,14,19}};
int l =a.length;
int b[]=new int[9];
int x=0;
for(int i=0;i<a.length;i++)
{
for(int j = 0;j<a[i].length;j++)
{
System.out.print(a[i][j]+"\t");
b[x]=a[i][j];
x++;
}
System.out.println();
for(int k=0;k<b.length;k++)
{
System.out.print(b[k] +"\t");
}
}
}
|
|
|
|
|
Basically i was trying to do bubble sorting in 2d array with logic
first converted 2d array into 1 d array then sort the elements and again converted back that array into 2d array
class Sort1
{
public static void main(String...avg)
{
int a[][]={{1,2,3,7,12},{4,5},{7,2,6,9,9,11,22,33,44,55}};
//System.out.print(a.length);
int totalelements=0;
for(int x=0;x<a.length;x++)
{
for(int y=0;y<a[x].length;y++)
{
totalelements++;
}
}
//System.out.print(totalelements);
System.out.println("\n"+"unsorted 2d array"+"\n");
for(int i=0;i<a.length;i++)
{
for(int j=0;j<a[i].length;j++)
{
System.out.print(a[i][j]+"\t");
}
System.out.println();
}
System.out.println("\n"+"converted 2d array into 1d array"+"\n");
int b[]=new int[totalelements];
//System.out.print(b.length);
int l=b.length;
int c=0;
for(int k=0;k<a.length;k++)
{
for(int m=0;m<a[k].length;m++)
{
b[c]=a[k][m];
System.out.print(b[c] +"\t");
c++;
}
}
for( int i =1; i<=l-1;i++)
{
for(int j=0; j<l-i;j++)
{
if(b[j]>b[j+1])
{
c =b[j];
b[j]=b[j+1];
b[j+1]=c;
}
}
}
int n=0;
for(int i=0 ; i<a.length ; i++)
{
for(int j=0 ; j<a[i].length ; j++)
{
a[i][j] = b[n];
n++;
}
}
System.out.println("\n"+"\n"+"Sorted 2d array "+"\n");
for(int i=0 ; i<a.length ; i++)
{
for(int j=0 ; j<a[i].length ; j++)
{
System.out.print(a[i][j]+" ");
}
System.out.println();
}
}
}
|
|
|
|
|
Hi!
I am currently coding in JSF, but using Java for the back-end beans. Was wondering if anyone is familiar to JSF, to help get a solution or an idea on how I could proceed.
So, if I have a database with 2 tables - Country & State,
but I don't want to have to make a call into the database in order to reduce the resources used. How would I implement in the Java bean a connection between the country and its related states?
Considering that I have the 2 selections in a dropdown menu.
Thanks!
|
|
|
|
|
If you do not want to use the database then you need to hold all the data in Lists inside the code, which may be just as expensive.
|
|
|
|
|
And if I make a call to the database, then I'm probably looking to use a couple of for-loops
to go through both tables in my back bean?
|
|
|
|
|
Yes, probably. It's a trade off, whichever method you use will have a cost. You need to decide which is the better option for your application.
|
|
|
|