Using Numbers with JAVA Programming
I'm about to fail JAVA and require expert solution to this problem:
When you take the year of the birth of Bill Clinton and add to it the year he took office plus his age at his last birthday, and then subtract the number of full years he has been in office, you get the number 3986 (or 3985 depending on the time of year in which you calculate). But when you add and subtract the similar figures for the leaders of Britain, and France, you get 3986 (or 3985) in each case! How can I solve this problem! Please help!
I'm about to fail JAVA and require expert solution to
this problem:
When you take the year of the birth of Bill Clinton
and add to it the year he took office plus his age at
his last birthday, and then subtract the number of
full years he has been in office, you get the number
3986 (or 3985 depending on the time of year in which
you calculate). But when you add and subtract the
similar figures for the leaders of Britain, and
France, you get 3986 (or 3985) in each case! How can
I solve this problem! Please help!
hehehe...you are a silly person...
Similar Messages
-
Possible to Get Database backup with java program
Hello
Is it possible to Get or Create Database Backup on runtime with java program using some sql statements
How could i do that
'Cross posted and multi-posted.
Hey jackass why don't you look where I already answered this question.
http://forum.java.sun.com/thread.jspa?threadID=654902&messageID=3849575 -
When using Numbers with iCloud, a new version is created every time I make a change. I do not want all these revised documents. When I change a document, I commit to that change. How do I shut off this multiple-revision feature of Numbers being pushed to iCloud.
Also....
When using Numbers with iCloud, a new version of the spreadsheet is created even when no revisions have been made. Why is this, and how do I make it stop?
My files are growing.Your plugins list shows outdated plugin(s) with known security and stability risks.
# Java Plug-in 1.5.0_11 for Netscape Navigator (DLL Helper)
# Adobe Shockwave for Director Netscape plug-in, version 11.0
Update the [[Java]] and [[Shockwave|Shockwave for Director]] plugin to the latest version.
See
http://java.sun.com/javase/downloads/index.jsp#jdk (you need JRE)
http://www.adobe.com/shockwave/welcome/ -
Only 274 mails are coming when using pop3 with java mail
Only 274 mails are coming from GMAIL when using pop3 with java mail. but there are more than 3000 mails.
I'm not getting the reason, code is given below:
public static void main(String[] args) {
// SUBSTITUTE YOUR ISP's POP3 SERVER HERE!!!
// String host = "pop.bizmail.yahoo.com";
// final String user = "[email protected]";
// final String password = "xxx";
String host = "pop.gmail.com";
final String user = "gauravjlj";
final String password = "xxx";
String subjectSubstringToSearch = "Test E-Mail through Java";
try {
Properties prop = new Properties();
prop.setProperty("mail.pop3.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
prop.setProperty("mail.pop3.socketFactory.fallback", "false");
prop.setProperty("mail.pop3.port", "995");
prop.setProperty("mail.pop3.socketFactory.port", "995");
prop.put("mail.pop3.host", host);
prop.put("mail.store.protocol", "pop3");
Session session = Session.getDefaultInstance(prop);
Store store = session.getStore();
System.out.println("your ID is : "+ user);
System.out.println("Connecting...");
store.connect(host, user, password);
System.out.println("Connected...");
// Get "INBOX"
Folder fldr = store.getFolder("INBOX");
fldr.open(Folder.READ_ONLY);
int count = fldr.getMessageCount();
System.out.println(count + " total messages");
// Message numebers start at 1
for(int i = 1; i <= count; i++) {
// Get a message by its sequence number
Message m = fldr.getMessage(i);
// Get some headers
Date date = m.getSentDate();
Address [] from = m.getFrom();
String subj = m.getSubject();
String mimeType = m.getContentType();
System.out.println(date + "\t" + from[0] + "\t" +
subj + "\t" + mimeType);
// Search for e-mails by some subject substring
String pattern = subjectSubstringToSearch;
SubjectTerm st = new SubjectTerm(pattern);
// Get some message references
Message [] found = fldr.search(st);
System.out.println(found.length +
" messages matched Subject pattern \"" +
pattern + "\"");
for (int i = 0; i < found.length; i++) {
Message m = found;
// Get some headers
Date date = m.getSentDate();
Address [] from = m.getFrom();
String subj = m.getSubject();
String mimeType = m.getContentType();
System.out.println(date + "\t" + from[0] + "\t" +
subj + "\t" + mimeType);
Object o = m.getContent();
if (o instanceof String) {
System.out.println("**This is a String Message**");
System.out.println((String)o);
else if (o instanceof Multipart) {
System.out.print("**This is a Multipart Message. ");
Multipart mp = (Multipart)o;
int count3 = mp.getCount();
System.out.println("It has " + count3 +
" BodyParts in it**");
for (int j = 0; j < count3; j++) {
// Part are numbered starting at 0
BodyPart b = mp.getBodyPart(j);
String mimeType2 = b.getContentType();
System.out.println( "BodyPart " + (j + 1) +
" is of MimeType " + mimeType);
Object o2 = b.getContent();
if (o2 instanceof String) {
System.out.println("**This is a String BodyPart**");
System.out.println((String)o2);
else if (o2 instanceof Multipart) {
System.out.print(
"**This BodyPart is a nested Multipart. ");
Multipart mp2 = (Multipart)o2;
int count2 = mp2.getCount();
System.out.println("It has " + count2 +
"further BodyParts in it**");
else if (o2 instanceof InputStream) {
System.out.println(
"**This is an InputStream BodyPart**");
} //End of for
else if (o instanceof InputStream) {
System.out.println("**This is an InputStream message**");
InputStream is = (InputStream)o;
// Assumes character content (not binary images)
int c;
while ((c = is.read()) != -1) {
System.out.write(c);
// Uncomment to set "delete" flag on the message
//m.setFlag(Flags.Flag.DELETED,true);
} //End of for
// "true" actually deletes flagged messages from folder
fldr.close(true);
store.close();
catch (MessagingException mex) {
// Prints all nested (chained) exceptions as well
mex.printStackTrace();
catch (IOException ioex) {
ioex.printStackTrace();
Please tell me.
ThanksIs it possible that GMail only allows access to untagged emails via POP3? Or only to emails from the last x days?
POP3 is the older email retrieval protocol (IMAP4 is the more current one) and only has very limited support for folders (or anything but a single inbox, really). It's quite common that POP3 only allows access to a subset of all emails stored by a provider. -
How to run sscript shell with java program
Hi everybody,
i want to know how can i do to execute a script shelle (bash) with program java (if it s possible)
for example this script:
#!/bin/bash
echo "hello"
can i run it with java program or i have to make dome modifications .
thank you for your help in advance.Well, if you want to be portable across platforms, you should write as much code in Java as possible and not rely on native scripts (I'm sure your script is more complex than this 'echo' example ;-) ).
Having said that, you can use the java.lang.Runtime class and in particular its various exec() methods.
Try something like this:
Process p;
try {
p = Runtime.getRuntime().exec("myscript.sh");
} catch (IOException ioe) {
}You can then "interact" with the spawned process with the Process object returned by the exec method.
Note you need to have the appropriate security rights.
For more details, look at the API documentation here:
http://java.sun.com/j2se/1.4.2/docs/api/
hth,
-Alexis -
Javascript error on - Help - Learn how to use Numbers with this online...
I am trying to find out more about Numbers. I am using iTunes 9.1.1 on a Vista PC. I get a Javascript error in Internet Explorer 8 when I try to access:
Help - Learn how to use Numbers with this online resource.
http://help.apple.com/numbers/1.0
The link redirects to the following page:
http://help.apple.com/iwork/safari/interface/#tan727163ed
The above page is blank except for boxes for Keynote Help, Pages Help, Numbers help, and a blank input field that seems to do nothing. Here is the Javascript error message from Internet Explorer 8:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
Timestamp: Tue, 1 Jun 2010 20:55:54 UTC
Message: This command is not supported.
Line: 1
Char: 41589
Code: 0
URI: http://help.apple.com/iwork/safari/interface/javascript.jsLink also does not work for me in WIN 7 with IE8. However, it does work in Chrome in WIN 7. It also works in Safari on my G4. Suggest you try Chrome or it may work in another browser like FireFox or Safari in Vista.
-
Using Xerces with Java Web Start
I read that there might be problems using xerces with Java Web Start, because JWS uses Sun's implementation of JAXP internally. My application needs Xerces and I think I am able to get it working using the following settings in the JNLP file:
<resources>
<j2se version="1.3"/>
<jar href="xerces-1.4.3.jar"/>
<property name="javax.xml.parsers.DocumentBuilderFactory" value="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
</resources>Hi,
I have packaged the xerces jar into my code jar and it does work. HTH
Aniruddha -
How to find who is login Portal by using webdynpro with java
Hi Friend
One Supplier( Abc) Login into the portal . How to find it "ABC" user login into portal by using webdynpro with java
My requirement is
One Supplier login in to the portal that supper having one Vendor number ( it is fixed)
Exp: Portal user vijay login his vendor number 12345 like
Suppose u r login into the portal u have one vendor number like this
i have to desine one screen that is find PO'Status Screen, In that Screen, Meterial Group,line number,PO Status and Vendor number is avaliable.
Supplier login in to that portal he is finding some items.
this my Requirement. i m creating this screen ..How to fined user name from portal .once i have to find this user name by using webdybpro with java. I have to assine vendor number
Regards
VijayHello Vijay,
You can wirte the following code to get the logged in user's ID
try {
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
IUser sapUser = wdClientUser.getSAPUser();
IUserAccount[] acct = sapUser.getUserAccounts();
String str = acct[0].getDisplayName();
wdComponentAPI.getMessageManager().reportSuccess("user "+ str);
} catch (WDUMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
You need security api for using it make sure that is present.
Thanks,
Hope this will help
Sarbjeet -
I have a iphone5 and trying to use numbers with it, I use excell 2010, but it will not transfer the dop down boxes on excell 2010. Is this fixable or what?
Welcome to Apple Support Communities
The first Mac with Thunderbolt was the Early 2011 MacBook Pro. If you have got a 2010 MacBook Pro, you have got Mini DisplayPort instead of Thunderbolt, which are the same, but Mini DisplayPort can't be used to connect external disks.
To check which MacBook Pro you have, open > About this Mac > More Info, and you will see the MacBook Pro model. If it's Mid 2010 or older, you haven't got Thunderbolt, so you have to connect the external drive through USB -
To generate a wsdl using JAX-WS in JBOSS with java program but without EJB
Hi,
I am using JAX-WS to generate webservices using JBOSS application server by writing a java program.
My sample java program includes :which takes an i/p name as string and displays out put as "Hello name",with the use of annotations.And,also have written web.xml for it.If I start JBOSS without adding project to it,it is starting.BUt If I add project to it the server is not publishing.Its getting like:"publishing JBOSS 4.2.2....:waiting for virtual machine to exit".
I have followed the link:*http://www.javabeat.net/articles/2007/10/creating-webservice-using-jboss-and-eclipse/3*
to do this,where in it was given that by means of auto build process of eclipse IDE war file generates in default jboss folder.But which is not happening,so that,am unable to generate wsdl file..
Can any body help me?
1) why jboss is not publishing after adding project to it?
2) why war file is not generating in the default jboss folder?
Regards....Yeah sure!!
Overall picture: I wish to expose my OSB services to the third parties using OCSG. For that I've created the Communication services corresponding to each OSB service.
Problem: Integration with the OSB.
At the OSB side I've got JMS queues which interacts with other existing systems in my SOA enviornment. But I'm not getting how to get the OCSG application- triggered request messages in that queue? Please help.
Also I've read about the SOA facades for integration with OSB.Which of the two approaches you will suggest? -
Errors driving me crazy! although compiles fine
I am working on a project for an online class - I am teaching myself really! My last assignment I cannot get to work. I had a friend who "knows" what he is doing help me. Well that didn't work out too well, my class is a beginner and he put stuff in that I never used yet. I am using Jgrasp and Eclipse. I really am trying but, there really is no teacher with this online class. I can't get questions answered in time and stuff goes past due. I am getting this error:
Exception in thread "main" java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:61)
at java.io.InputStreamReader.<init>(InputStreamReader .java:55)
at java.util.Scanner.<init>(Scanner.java:590)
at ttest.main(ttest.java:54)
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
This is my code:
import java.util.*;
import java.io.*;
public class ttest
static Scanner console = new Scanner(System.in);
public static void main(String[] args)throws IOException
FileInputStream fin = null; // input file reference
PrintStream floser = null; // output file references
PrintStream fwinner = null;
Scanner rs; // record scanner
Scanner ls; // line scanner
String inputrec; // full record buffer
int wins; // data read from each record
int losses;
double pctg;
String team;
String best = null; // track best/worst team(s)
String worst = null;
double worst_pctg = 2.0; // track best/worst pctgs
double best_pctg = -1.0;
int winner_count = 0; // counters for winning/losing records
int loser_count = 0;
// should check args.length and if not == 1 generate error
try
Scanner inFile = new Scanner(new FileReader("football.txt"));
catch( FileNotFoundException e )
System.exit( 1 );
try
floser = new PrintStream( new FileOutputStream( "loser.txt" ) );
fwinner = new PrintStream( new FileOutputStream( "winner.txt" ) );
catch( FileNotFoundException e )
System.out.printf( "unable to open an output file: %s\n", e.toString() );
System.exit( 1 );
try
rs = new Scanner( fin );
while( rs.hasNext( ) )
inputrec = rs.nextLine( ); /* read next line */
ls = new Scanner( inputrec ); /* prevents stumble if record has more than expected */
team = ls.next( );
wins = ls.nextInt();
losses = ls.nextInt();
if( wins + losses > 0 )
pctg = ((double) wins)/(wins + losses);
else
pctg = 0.0;
if( pctg > .5 )
if( pctg > best_pctg )
best_pctg = pctg;
best = team;
else
if( pctg == best_pctg )
best += ", " + team;
fwinner.printf( "%10s %2d %2d %5.3f\n", team, wins, losses, pctg );
winner_count++;
else
if( pctg < worst_pctg )
worst_pctg = pctg;
worst = team;
else
if( pctg == worst_pctg )
worst += ", " + team;
floser.printf( "%10s %2d %2d %5.3f\n", team, wins, losses, pctg );
loser_count++;
fin.close( );
floser.close( );
fwinner.close( );
catch( IOException e ) {
System.out.printf( "I/O error: %s\n", e.toString() );
System.exit( 1 );
System.out.printf( "%d teams have winning records; %d teams have losing records\n", winner_count, loser_count );
System.out.printf( "Team(s) with best percentage: %5.3f %s\n", best_pctg, best );
System.out.printf( "Team(s) with worst percentage: %5.3f %s\n", worst_pctg, worst );
The assignment is:
Create a Java program to read in an unknown number of lines from a data file. You will need to create the data file. The contents of the file can be found at the bottom of this document. This file contains a football team's name, the number of games they have won, and the number of games they have lost.
Your program should accomplish the following tasks:
1. Process all data until it reaches the end-of-file. Calculate the win percentage for each team.
2. Output to a file ("top.txt") a listing of all teams with a win percentage greater than .500. This file should contain the team name and the win percentage.
3. Output to a file ("bottom.txt") a listing of all teams with a win percentage of .500 or lower. This file should contain the team name and the win percentage.
4. Count and print to the screen the number of teams with a record greater then .500 and the number of teams with a record of .500 and below, each appropriately labeled.
5. Output in a message box: the team with the highest win percentage and the team with the lowest win percentage, each appropriately labeled. If there is a tie for the highest win percentage or a tie for the lowest win percentage, you must output all of the teams.
Dallas 5 2
Philadelphia 4 3
Washington 3 4
NY_Giants 3 4
Minnesota 6 1
Green_Bay 3 4import java.util.*;
import java.io.*;
public class ttest
static Scanner console = new Scanner(System.in);
public static void main(String[] args)throws IOException
FileInputStream fin = null; // input file reference
PrintStream floser = null; // output file references
PrintStream fwinner = null;
Scanner rs; // record scanner
Scanner ls; // line scanner
String inputrec; // full record buffer
int wins; // data read from each record
int losses;
double pctg;
String team;
String best = null; // track best/worst team(s)
String worst = null;
double worst_pctg = 2.0; // track best/worst pctgs
double best_pctg = -1.0;
int winner_count = 0; // counters for winning/losing records
int loser_count = 0;
// should check args.length and if not == 1 generate error
try
Scanner inFile = new Scanner(new FileReader("football.txt"));
catch( FileNotFoundException e )
System.exit( 1 );
try
floser = new PrintStream( new FileOutputStream( "loser.txt" ) );
fwinner = new PrintStream( new FileOutputStream( "winner.txt" ) );
catch( FileNotFoundException e )
System.out.printf( "unable to open an output file: %s\n", e.toString() );
System.exit( 1 );
try
rs = new Scanner( fin );
while( rs.hasNext( ) )
inputrec = rs.nextLine( ); /* read next line */
ls = new Scanner( inputrec ); /* prevents stumble if record has more than expected */
team = ls.next( );
wins = ls.nextInt();
losses = ls.nextInt();
if( wins + losses > 0 )
pctg = ((double) wins)/(wins + losses);
else
pctg = 0.0;
if( pctg > .5 )
if( pctg > best_pctg )
best_pctg = pctg;
best = team;
else
if( pctg == best_pctg )
best += ", " + team;
fwinner.printf( "%10s %2d %2d %5.3f\n", team, wins, losses, pctg );
winner_count++;
else
if( pctg < worst_pctg )
worst_pctg = pctg;
worst = team;
else
if( pctg == worst_pctg )
worst += ", " + team;
floser.printf( "%10s %2d %2d %5.3f\n", team, wins, losses, pctg );
loser_count++;
fin.close( );
floser.close( );
fwinner.close( );
catch( IOException e ) {
System.out.printf( "I/O error: %s\n", e.toString() );
System.exit( 1 );
System.out.printf( "%d teams have winning records; %d teams have losing records\n", winner_count, loser_count );
System.out.printf( "Team(s) with best percentage: %5.3f %s\n", best_pctg, best );
System.out.printf( "Team(s) with worst percentage: %5.3f %s\n", worst_pctg, worst );
} -
Why an Interface is used in a Java Program
Since we have Classes in Java program
Then what is the need for An Interface in a Java Program
Please explain to me
i'm confusedThese are fair comments as per as interface is concern.... we need interface to declare the methods without implementing the methods. Basically interfaces help implementing classes in a organised way.
Now We got abstract class also, which has got more or less same features like interfaces. In abstract class also we can declare a method without implementation.
If we use abstract class and extend that abstract class, we don't have implement all the abstract methods in that particular class,which would extend the abstract class, but if we implement an interface in a class, we have to define all the methods with their body. Now, can anyone tell me , in a generic way, when do we use interface and when do we use abstract class. I don't need the differences between abstract class and interface...that i know...thanks in advance
take it easy
RD
l -
Help with Java programming project
Hi,
I need help in writing this Java program. The purpose of this program is to read a variable-length stream of 0, 1 characters from an input text file (call it input.txt) one character at a time, and generate the corresponding B8ZS output stream consisting of the +, - , and 0 characters (with appropriate substitutions) one-character-at-a-time into a text file (called output.txt).
The program must use a class called AMIConverter with an object called AMI . Class AMIConverter must have a method called convert which converts an individual input character 0 or 1 into the appropriate character 0 or + or - of AMI.
It first copy the line to file output.txt. Then read the line one character at a time and pass only valid characters (0 or 1) to AMI.convert, which assumes only valid characters. The first 1 in each new 'Example' should be converted to a +.
This is what is read in, but this is just a test case.
0101<1000
1100a1000b00
1201g101
should now produce two lines of output for each 'Example', as shown below:
This should be the output of the output.txt file
Example 1
in :0101<1000
out:0+0-+000
Example 2
in :1100a1000b00
out:+-00+00000
Example 3
in :1201g101
out:+0-+0-
To elaborate more, only 1 and 0 are passed to "convert" method. All others are ignored. 0 become 0 and 1 become either + or - and the first "1" in each new example should be a +.
This is what I have so far. So far I am not able to get the "in" part, the characters (e.g. : 0101<1000 ) out to the output.txt file. I am only able to get the "out" part. And I also can't get it to display a + for the first "1" in each new examples.
import java.io.*;
public class AMIConverter
public static void main (String [] args) throws IOException
AMI ami = new AMI();
try
int ch = ' ';
int lineNum = 1;
int THE_CHAR_0 = '0';
int THE_CHAR_1 = '1';
BufferedReader infile = new BufferedReader(new FileReader("input.txt"));
PrintWriter outfile = new PrintWriter("output.txt");
outfile.write("Example " + lineNum);//prints Example 1
outfile.println();
outfile.write("in :");
outfile.println();
outfile.write("out:");
while ((ch = infile.read()) != -1)
if (ch == '\r' || ch == '\n')
lineNum++;
outfile.println();
outfile.println();
outfile.write("Example " + lineNum);
outfile.println();
outfile.write("in :");
outfile.println();
outfile.write("out:");
else
if (ch == THE_CHAR_0)
int output = ami.convert(ch);
outfile.write(output);
else
if (ch == THE_CHAR_1)
int output = ami.convert(ch);
outfile.write(output);
}//end while
infile.close();
outfile.close();
}catch (IOException ex) {}
}//main method
}//class AMIConverter
This is my AMI class
import java.io.*;
public class AMI
int THE_CHAR_0 = '0';
int THE_CHAR_1 = '1';
int total = '+';
int minus = '-';
int count = 0;
public int convert(int ch)
try
PrintWriter outfile = new PrintWriter("output.txt");
if (ch == THE_CHAR_0)
return ch;
else
if (ch == THE_CHAR_1)
count++;
if (count%2 == 1)
ch = total;
return (ch);
else
ch = minus;
return (ch);
}catch (FileNotFoundException e) {}
return ch;
}//method convert
}//class AMI
Any help would be appreicated.
Thanks!Hi,
I need help in writing this Java program. The purpose of this program is to read a variable-length stream of 0, 1 characters from an input text file (call it input.txt) one character at a time, and generate the corresponding B8ZS output stream consisting of the +, - , and 0 characters (with appropriate substitutions) one-character-at-a-time into a text file (called output.txt).
The program must use a class called AMIConverter with an object called AMI . Class AMIConverter must have a method called convert which converts an individual input character 0 or 1 into the appropriate character 0 or + or - of AMI.
It first copy the line to file output.txt. Then read the line one character at a time and pass only valid characters (0 or 1) to AMI.convert, which assumes only valid characters. The first 1 in each new 'Example' should be converted to a +.
This is what is read in, but this is just a test case.
0101<1000
1100a1000b00
1201g101
should now produce two lines of output for each 'Example', as shown below:
This should be the output of the output.txt file
Example 1
in :0101<1000
out:0+0-+000
Example 2
in :1100a1000b00
out:+-00+00000
Example 3
in :1201g101
out:+0-+0-
To elaborate more, only 1 and 0 are passed to "convert" method. All others are ignored. 0 become 0 and 1 become either + or - and the first "1" in each new example should be a +.
This is what I have so far. So far I am not able to get the "in" part, the characters (e.g. : 0101<1000 ) out to the output.txt file. I am only able to get the "out" part. And I also can't get it to display a + for the first "1" in each new examples.
import java.io.*;
public class AMIConverter
public static void main (String [] args) throws IOException
AMI ami = new AMI();
try
int ch = ' ';
int lineNum = 1;
int THE_CHAR_0 = '0';
int THE_CHAR_1 = '1';
BufferedReader infile = new BufferedReader(new FileReader("input.txt"));
PrintWriter outfile = new PrintWriter("output.txt");
outfile.write("Example " + lineNum);//prints Example 1
outfile.println();
outfile.write("in :");
outfile.println();
outfile.write("out:");
while ((ch = infile.read()) != -1)
if (ch == '\r' || ch == '\n')
lineNum++;
outfile.println();
outfile.println();
outfile.write("Example " + lineNum);
outfile.println();
outfile.write("in :");
outfile.println();
outfile.write("out:");
else
if (ch == THE_CHAR_0)
int output = ami.convert(ch);
outfile.write(output);
else
if (ch == THE_CHAR_1)
int output = ami.convert(ch);
outfile.write(output);
}//end while
infile.close();
outfile.close();
}catch (IOException ex) {}
}//main method
}//class AMIConverterThis is my AMI class
import java.io.*;
public class AMI
int THE_CHAR_0 = '0';
int THE_CHAR_1 = '1';
int total = '+';
int minus = '-';
int count = 0;
public int convert(int ch)
try
PrintWriter outfile = new PrintWriter("output.txt");
if (ch == THE_CHAR_0)
return ch;
else
if (ch == THE_CHAR_1)
count++;
if (count%2 == 1)
ch = total;
return (ch);
else
ch = minus;
return (ch);
}catch (FileNotFoundException e) {}
return ch;
}//method convert
}//class AMIAny help would be appreicated.
Thanks! -
Hi, I am writing a database program, and I decided I should try and use MySQL since many people have told me it is the best way to make a database. Does the java version that Sun provide come with the api to create mysql databases?
Also, I would like to know of a good tutorial that teaches MySQL with java.Hi, I am writing a database program, and I decided I
should try and use MySQL since many people have told
me it is the best way to make a database. Does the
java version that Sun provide come with the api to
create mysql databases?
You are more than a bit confused so please stop here until you understand the following.
JDBC is the API for communicating with relational databases in Java. It is not a database in and of itself but it can communicate with any database that provides JDBC API access in the form of a JDBC driver.
Also, I would like to know of a good tutorial that
teaches MySQL with java.The Sun tutorial on JDBC may be found here http://java.sun.com/docs/books/tutorial/jdbc/index.html
Your using (or not) MySQL is not relevent on this forum and any questions you have regarding MySQL (with the exception of one) are beyond the scope of this forum.
The exception is "Is there a JDBC driver for MySQL and how do I use it". The answer to that question is yes and see this http://www.mysql.com/products/connector/j/ -
Using jce with java 1.3.1
Hi,
I use Java 1.3.1, jce 1.2.2 and eclipse.
To include the packet added it with �Project/Properties/ Add External JARs� but when I compile the program I get the following errors:
compile:
[javac] Compiling 10 source files to D:\MyTemp\ZFProjectView\build\temp\projectviewer
[javac] D:\MyTemp\ZFProjectView\src\projectviewer\DesEncrypter.java:3: package javax.crypto does not exist
[javac] import javax.crypto.*;
[javac] ^
[javac] D:\MyTemp\ZFProjectView\src\projectviewer\DesEncrypter.java:5: package javax.crypto.spec does not exist
[javac] import javax.crypto.spec.*;
[javac] ^
[javac] D:\MyTemp\ZFProjectView\src\projectviewer\DesEncrypter.java:15: cannot resolve symbol
[javac] symbol : class Cipher
[javac] location: class projectviewer.DesEncrypter
[javac] Cipher ecipher;
[javac] ^
Is it necessary to expand the classpath in the build.xml file or something like this?
ThanksI know its too late to answer your query... but just thought if not you there might be other people who may search solution for the same error.
Java 1.3 does not contains these packages... these are included in java 1.4 on wards.
If you want to do some encryption / decryption with java 1.3 i can provide you a link that might be of some help.
http://www.builderau.com.au/program/java/soa/Install-and-utilise-JCE/0,339024620,320264469,00.htm?feed=pt_library
<Happy Coding>
Cheers,
Jags
Maybe you are looking for
-
How can i import the music from my phone on to my itu nes account on a new computer
hello my name is Brandon, my hard drive on my laptop fried out and i am currently stting up my itunes on a different laptop. I want to be able to keep all of my music but everytime i connect my iphone to my laptop it says that all music will be lost
-
Hi All, I have set "Oslo.Master" as the The default Master Page for the site. I have a page with a List View web part and an InfoPath Web Part connected. When the page loads is it displayed correctly. However, when a record is selected and the in
-
24 Inch Intel iMac... may have bad Logic Board
What are my options if the Logic Board is bad? Is this something you can purchase? Dont have an Apple Store anywhere near me. Thanks!
-
Dear All, I'm a new comer and I need to learn about Oracle, I need some reference like Oracle Definition generally, database and application and Migration from Sybase 11 to Oracle 9i (just a simple explanation). Please send to my email address [email
-
SignaExpress Resource Reserved
I am using a cDAQ system with a NI 9205 and NI 9221 modules and SignalExpress 2.0. I need to capture about 9 millisecond period of at 100k Hz. on two channels of the 9205 followed by VDC on 28 other channels of the 9205 and 2 from the 9211 modules at