|
how to get auto print jasper report in java
thankyou
|
|
|
|
|
What does the "auto" part mean?
If you mean a scheduled report, one that runs every day, for example, at a certain time then you find a scheduler library. And that has nothing to do with the report itself. However it does mean that something (like a service) must be running all the time so that when the appointed time arrives it can detect the time.
|
|
|
|
|
no no.'auto' mean, I want print a report after only click enter button.think about point of sale(POS) system.cashier can print receipt without select printer.I mean how to set my jasper report like that.
|
|
|
|
|
|
how can i change access specifier of actionperformed from private to public in netbeans
|
|
|
|
|
Type the word "public" in front of it.
|
|
|
|
|
which datatype is best in amount(money)java?
which datatype is best in amount(money)MYSQL?
|
|
|
|
|
float or double depend on the range of money
|
|
|
|
|
No, you should never use floating point types for money.
|
|
|
|
|
|
how to improve update in java servlet in easy type.........
|
|
|
|
|
I need to improve performace, which is implementing Multi-Threading.
My problem is:
1. future.get(); is taking too much time.
2. executor.shutdown(); also taking much time.
Below is my piece of code code we are using below code:
Map<String, List<? extends Object>> entirelist = null;
ExecutorService executor = Executors.newFixedThreadPool(maxThread);
entirelist = manageCJObject.populateCS(cJGroup, load
future = executor.submit(new CsThread(clDAO, entirelist, isUpdate, dbList));
try {
if (future != null) {
long startTime = Calendar.getInstance().getTimeInMillis();
String result = future.get();
System.out.println("Total Time in future.get "+ (Calendar.getInstance().getTimeInMillis()-startTime));
}
long startTime1 = Calendar.getInstance().getTimeInMillis();
executor.shutdown();
executor.awaitTermination(
Constants.INT_VALUE_THIRTY,
TimeUnit.MINUTES);
System.out.println("Total Time in exec shutdown "+ (Calendar.getInstance().getTimeInMillis()-startTime1));
}
catch (ExecutionException execp) {
logger.error("Error dering Thread execution :: " + execp.getMessage());
throw new CLException(execp.getMessage());
}
Kindly let me know how to improve performance. And what way we can provide any alternate of future.get() and executor.shutdown()
|
|
|
|
|
Hi
In short to improve future.get() time you need to improve
your submitted task code i.e. CsThread
Future documentation
as for shutdown(), the function is not blocking so search for submitted task into a pool that take long time to complete.
Good luck
|
|
|
|
|
how to generate cristal report in java ?
|
|
|
|
|
plz give me decryption code for following progrm.....
import java.io.*;
import java.util.Scanner;
import java.util.Random;
import java.lang.Math.*;
class Diffie_Hellman{
public static void main(String[] args) {
Random rand = new Random();
Scanner in = new Scanner(System.in);
System.out.println("Enter any prime number");
int n = in.nextInt();
int g1, g2;
int pb1,pb2,pa1,pa2;
int e1, e2;
int i;
int bk1, bk2, ak1, ak2;
System.out.println("Enter valu of g");
g1= in.nextInt();
g2= in.nextInt();
System.out.println("Enter valu of e");
e1= in.nextInt();
e2= in.nextInt();
int na = rand.nextInt(5)+2;
if(na%2!=0)
na=na+1;
int nb = rand.nextInt(5)+2;
if(nb%2!=0)
nb=nb+1;
System.out.println("Private key of Alice: "+ na + " \n Private key Bob " +nb + " ");
//int pa = (na * g)
// int pb = (nb * g)
int p = na/2;
int g11= g1;
int g22= g2;
for(i=1; i<= p ; i++)
{
double m1=(3*g11*g11+ e1);
double m2= 2*g22;
double inverse=0;
inverse = (Math.pow(m2,-1))%n;
double m =(na*(m1*inverse))%n;
double x = (m*m +(n-(2*g11)))%n;
double y= (m*(x+(n-g11))+g22)%n;
g11=(int)x;
g22=(int)y;
}
if(na%2 == 0)
{
pa1=g11;
pa2=g22;
System.out.println("Alice's Public key is :" +pa1+ " " +pa2 );
}
else
{
double m = (g2-g22)/(g1-g11);
double x3 = (m*m+(n-g1)+(n-g11))%n;
double y3 = (m*(x3+(n-g11)) + g22)%n;
pa1= g11+(int)x3;
pa2= g22+(int)y3;
System.out.println("Alice's Public key is :" +pa1+ " " +pa2 );
}
p = nb/2;
g11= g1;
g22= g2;
for(i=1; i<= p ; i++)
{
double m1=(3*g11*g11+ e1);
double m2= 2*g22;
double inverse=0;
inverse = (Math.pow(m2,-1))%n;
double m =(na*(m1*inverse))%n;
double x = (m*m +(n-(2*g11)))%n;
double y= (m*(x+(n-g11))+g22)%n;
g11=(int)x;
g22=(int)y;
}
if(nb%2 == 0)
{
pb1=g11;
pb2=g22;
System.out.println("Bob's Public key is :" +pb1+ " " +pb2 );
}
else
{
double m = (g2-g22)/(g1-g11);
double x3 = (m*m+(n-g1)+(n-g11))%n;
double y3 = (m*(x3+(n-g11)) + g22)%n;
pb1= g11+(int)x3;
pb2= g22+(int)y3;
System.out.println("Bob's Public key is :" +pb1+ " " +pb2 );
}
System.out.println("******Generating shared key for Alice *******");
p = na/2;
g11= pb1;
g22= pb2;
for(i=1; i<= p ; i++)
{
double m1=(3*g11*g11+ e1);
double m2= 2*g22;
double inverse=0;
inverse = (Math.pow(m2,-1))%n;
double m =(na*(m1*inverse))%n;
double x = (m*m +(n-(2*g11)))%n;
double y= (m*(x+(n-g11))+g22)%n;
g11=(int)x;
g22=(int)y;
}
if(na%2 == 0)
{
ak1=g11;
ak2=g22;
System.out.println("Alice's shared key is :" +ak1+ " " +ak2 );
}
else
{
double m = (g2-g22)/(g1-g11);
double x3 = (m*m+(n-g1)+(n-g11))%n;
double y3 = (m*(x3+(n-g11)) + g22)%n;
ak1= g11+(int)x3;
ak2= g22+(int)y3;
System.out.println("Alice's shared key is :" +ak1+ " " +ak2 );
}
System.out.println("*****Generation of shared key for Bob*****");
p = nb/2;
g11= pa1;
g22= pa2;
for(i=1; i<= p ; i++)
{
double m1=(3*g11*g11+ e1);
double m2= 2*g22;
double inverse=0;
inverse = (Math.pow(m2,-1))%n;
double m =(na*(m1*inverse))%n;
double x = (m*m +(n-(2*g11)))%n;
double y= (m*(x+(n-g11))+g22)%n;
g11=(int)x;
g22=(int)y;
}
if(nb%2 == 0)
{
bk1=g11;
bk2=g22;
System.out.println("Bob's shared key is :" +bk1+ " " +bk2 );
}
else
{
double m = (g2-g22)/(g1-g11);
double x3 = (m*m+(n-g1)+(n-g11))%n;
double y3 = (m*(x3+(n-g11)) + g22)%n;
bk1= g11+(int)x3;
bk2= g22+(int)y3;
System.out.println("Bob's shared key is :" +bk1+ " " +bk2 );
}
System.out.println("Enter Your Messgae");
int msg1 = in.nextInt();
int msg2= in.nextInt();
int k= (bk1*bk2)%n;
System.out.println("Value of K is : " +k);
p = k/2;
if(p<0)
p=p*(-1);
g11= msg1;
g22= msg2;
for(i=1; i<=p ; i++)
{
double m1=(3*g11*g11+ e1);
double m2= 2*g22;
double inverse=0;
inverse = (Math.pow(m2,-1))%n;
double m =(na*(m1*inverse))%n;
double x = (m*m +(n-(2*g11)))%n;
double y= (m*(x+(n-g11))+g22)%n;
g11=(int)x;
g22=(int)y;
}
if(na%2 == 0)
{
pa1=g11;
pa2=g22;
System.out.println("C :" +pa1+ " " +pa2 );
}
else
{
double m = (g2-g22)/(g1-g11);
double x3 = (m*m+(n-g1)+(n-g11))%n;
double y3 = (m*(x3+(n-g11)) + g22)%n;
int c1= g11+(int)x3;
int c2=g22+(int)y3;
pa1= (int)c1;
pa2= (int)c2;
System.out.println("C:" +pa1+ " " +pa2 );
}
//decryption code
}
}
|
|
|
|
|
|
Please learn something about finite fields before using them, otherwise fundamentally broken code (as you wrote) results.
|
|
|
|
|
I am trying to decrypt a text that is encrypted using a substitution cipher. It is simple substituion, so a one-to-one mapping. there are no spaces, and only lower caps letters. I am using the jakobsen's algorithm. I followed the algorithm, and I implemented both arrays in which we will compute the distance. However, the code is providing erroneous answers, I don't know why. The Digrams generated from the input text are correctly places. This is the link to the paper that explains the algorithm and provides the digram frequency
http://www.cs.sjsu.edu/~stamp/RUA/homophonic.pdf[^]
|
|
|
|
|
|
Creating the thread inside the constructor is it good practice or not?
If not hen why??
|
|
|
|
|
Not a good practice. Constructors should be used to instantiate an object of a class, not to control the overall application.
|
|
|
|
|
It's fine as long you know what you doing
|
|
|
|
|
Hi everyone. I'm new to this and could use a bit of help. Is it possible to call the "timesTable" method from inside the "main" as its coded so far? I've tried a few things inside the main like timesTable t = new timesTable, and even adding a class name and using "class".timesTable, and so on, but nothing has worked. The code I have so far is:
package timestableapp;
/**
*
* @author
*/
import java.util.Scanner;
public class TimesTableApp {
/**
* @param args the command line arguments
*/
static void timesTable(int x)
{
System.out.println("Multiplication Table of "+ 4);
for(x=0; x<=12; x++)
{
System.out.println(x+" * "+4+" = "+(4*x));
}
}
public static void main(String args[])
{
int n, c;
System.out.println("Enter an integer to print it's multiplication table");
Scanner in = new Scanner(System.in);
n = in.nextInt();
System.out.println("Multiplication table of "+n+" is :-");
for ( c = 0 ; c <= 12 ; c++ )
System.out.println(n+"*"+c+" = "+(n*c));
}
}
|
|
|
|
|
|
Thanks. I try to break my assignment down in separate steps and I'm a stickler for making every attempt to figure it out on my own. But this time (though each step worked) I just couldn't seem to connect them.
|
|
|
|