|
It can't help me in this error!
|
|
|
|
|
utnqbao wrote: It can't help me in this error!
which error ?
If sun can't help you with Java, I really wonder who can...
|
|
|
|
|
They don't tell this error. So, I can't find the solution of this error. Thanks for your reply!
I've another question. Do know you how to uncheck "Keep temporary files on my computer" by code or script?
|
|
|
|
|
utnqbao wrote: They don't tell this error. So, I can't find the solution of this error
but WHICH error ??!!
you're talking about an error, but I still don't know which.
do you have a message you could post here ?
|
|
|
|
|
Can anyone tell me different between JRE 1.6 and JRE 1.5? And what is "Keep temporary files on my computer" option? When I un-check this option (JRE 1.6.0_03), my applet runs ok. But If I check this option and clear caching, my applet sometimes hangs up at the first time. I get error below:
java.io.FileNotFoundException: http://loadbal1.amr.smtf.ds/netgcontent/NG/Content/NLS_Content/en_US_44003/en_US_44003_Sim2.nll
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at netg.util.nls_v.c(Unknown Source)
at netg.util.nls_u.a(Unknown Source)
at netg.InterNETgBase.c(Unknown Source)
at netg.InterNETgBase.a(Unknown Source)
at netg.nls_g5.actionPerformed(Unknown Source)
at netg.event.nls_bv.actionPerformed(Unknown Source)
at netg.display.nls_ay.a(Unknown Source)
at netg.display.nls_ck.a(Unknown Source)
at netg.display.nls_ay.a(Unknown Source)
at netg.display.nls_ck.a(Unknown Source)
at netg.display.nls_ay.a(Unknown Source)
at netg.display.nls_ck.a(Unknown Source)
at netg.display.nls_ay.a(Unknown Source)
at netg.display.nls_ck.a(Unknown Source)
at netg.display.nls_ay.a(Unknown Source)
at netg.display.nls_ck.a(Unknown Source)
at netg.display.nls_ay.a(Unknown Source)
at netg.display.nls_ck.a(Unknown Source)
at netg.display.nls_bt.a(Unknown Source)
at netg.display.nls_bt.a(Unknown Source)
at netg.display.nls_ay.a(Unknown Source)
at netg.display.nls_ck.a(Unknown Source)
at netg.display.nls_ck.a(Unknown Source)
at netg.display.nls_ck.a(Unknown Source)
at netg.display.nls_ck.a(Unknown Source)
at netg.display.nls_ck.a(Unknown Source)
at netg.display.nls_ck.a(Unknown Source)
at netg.display.nls_bd.a(Unknown Source)
at netg.display.nls_nr.run(Unknown Source)
at netg.util.nls_n.run(Unknown Source)
.............
From the second time, my applet is ok.
So, I guess this error is come by "Keep temporary files on my computer" option. JRE 1.5 doens't have this option. My applet can run ok with JRE 1.5.
Can you please tell me difference between check and un-check "Keep temporary files on my computer" option? Do we have anyway to uncheck it by Javascript or code? I don't know why un-check "Keep temporary files on my computer" option is ok with my Applet.
Thanks!
modified on Thursday, October 23, 2008 11:02 PM
|
|
|
|
|
We have developed a web-based application with JSP as front-end. Recently we observed that after taking one of the Windows Updates, few buttons in our application are not working. If I uninstall this particular update, buttons are working fine. When I say it is not working, it means that onclick action is not taking place.
Windows Update: KB956390
Also, our buttons are developed in VML.
I've given below some code snippets:
JSP
===
<html xmlns:zoniac="ZON">
.............
.............
.............
<zoniac:roundrect class="zoniac_roundButton" arcsize="0.9" fillcolor="#245f91" style='width:95px;cursor:hand' href="javascript:btnLinkClick('accountsNewCompany',document.accfrm)" strokecolor="#245f91" onselectstart="return false">New Account</zoniac:roundrect>
.............
.............
.............
</html>
Also, If I change the above "href" action into "onClick" event, it's working fine. But I want the action to be with href, since I cannot make this kind of change all over my application.
<zoniac:roundrect class="zoniac_roundButton" arcsize="0.9" fillcolor="#245f91" style='width:95px;cursor:hand' onClick="javascript:btnLinkClick('accountsNewCompany',document.accfrm)" strokecolor="#245f91" onselectstart="return false">New Account</zoniac:roundrect>
CSS
===
zoniac\:*
{ behavior: url(#default#VML)
}
.zoniac_roundButton
{ text-align:center;
padding-top:3px;
color:white;
font:bold 11px tahoma;
height:17px;
}
|
|
|
|
|
Anyone know where I can download this? I look on java.sun.com, but I didn't see it.
Everything makes sense in someone's mind
|
|
|
|
|
|
import javax.swing.JOptionPane;
public class MultiplicationTable {
public static void main(String[] args) {
String output = "Kilograms pounds";
output += "\n";
for (int j = 1 ; j <= 9; j+=2)
output += " " + j + "\n";
output += "\n";
for (double i = 2.2 ; i <=6.6 ; i+=4.4)
output += " " + i + "\n";
JOptionPane.showMessageDialog(null, output);
}
}
here is a clearer representation of my question.
im trying to get my second output column under pounds.
does anyone know how this would be done?
|
|
|
|
|
The code is right..
It prints ur second o/p under pounds only...
|
|
|
|
|
Hello,
I am kinda new to java.I was trying to create two text field in the code below with display and display1.But it wont show me two text field on GUI.
I could use some help from u guys.
Thanks and i appreciate it.
public class UserInterface
implements ActionListener
{
private CalcEngine calc;
private boolean showingAuthor;
private JFrame frame;
private JTextField display;
private JTextField display1;
private JLabel status;
/**
* Create a user interface for a given calcEngine.
*/
public UserInterface(CalcEngine engine)
{
calc = engine;
showingAuthor = true;
makeFrame();
frame.setVisible(true);
}
/**
* Make this interface visible again. (Has no effect if it is already
* visible.)
*/
public void setVisible(boolean visible)
{
frame.setVisible(visible);
}
/**
* Make the frame for the user interface.
*/
private void makeFrame()
{
frame = new JFrame(calc.getTitle());
JPanel contentPane = (JPanel)frame.getContentPane();
contentPane.setLayout(new BorderLayout(8, 8));
contentPane.setBorder(new EmptyBorder( 10, 10, 10, 10));
display = new JTextField();
display1 = new JTextField();
contentPane.add(display, BorderLayout.NORTH);
contentPane.add(display1, BorderLayout.EAST);
JPanel buttonPanel = new JPanel(new GridLayout(4, 4));
addButton(buttonPanel, "7");
addButton(buttonPanel, "8");
addButton(buttonPanel, "9");
addButton(buttonPanel, "C");
addButton(buttonPanel, "4");
addButton(buttonPanel, "5");
addButton(buttonPanel, "6");
addButton(buttonPanel, "?");
addButton(buttonPanel, "1");
addButton(buttonPanel, "2");
addButton(buttonPanel, "3");
buttonPanel.add(new JLabel(" "));
addButton(buttonPanel, "0");
addButton(buttonPanel, "+");
addButton(buttonPanel, "-");
addButton(buttonPanel, "=");
contentPane.add(buttonPanel, BorderLayout.CENTER);
status = new JLabel(calc.getAuthor());
contentPane.add(status, BorderLayout.SOUTH);
frame.pack();
}
|
|
|
|
|
Hi, my jsp page uses sun.net.smtp.SmtpClient to send email. It worked fine until the hosted location was moved to another server. Now it generates the sun.net.smtp.SmtpProtocolException and the hosting company can't find what's wrong with it so I'm here hoping somebody can help.
What could cause the SmtpProtocolException? "locahost" was what I used to connect to the smtp server. When it failed, I tried another smtp server like "mail.xxx.com" on another server and it worked but the problem is that this server can't let me send mail to other domains except its own domain.
Thanks
The following is the code responsible for the email:
-------------------------------------------------------------
try
{
client = new SmtpClient(localhost);
client.from(EMAIL_FROM);
client.to(strEmail);
PrintStream message = client.startMessage();
message.println("From: " + EMAIL_FROM);
message.println("To: " + strEmail);
message.println("Subject: " + SUBJECT);
message.println();
...
client.closeServer();
}
catch(IOException e)
{
<div><%=e%></div>
}
|
|
|
|
|
When I compile this, I get an error:
import java.lang.*;
import java.util.Scanner;
public class Test
{
public static void main(String[] args)
{
Scanner console = new Scanner(System.in);
}
}
The error is "Cannot resolve symbol class Scanner".
Anyone know what's wrong here?
Everything makes sense in someone's mind
|
|
|
|
|
don't know how you're compiling your code, but I have absolutely no error with the following code :
package test;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
}
}
|
|
|
|
|
Hi,
First time programming JSP as I have to do it for an uni assignment. Basically I have created a register HTML and JSP page:
<br />
<!-- Register.html --><br />
<html><br />
<head><br />
<title>Register Form</title><br />
</head><br />
<br />
<body><br />
<h1>Hotel Account</h1><br />
<form><br />
<br />
<br />
ACTION="Register" METHOD="POST"><br />
<br />
<pre><br />
Customer Name: <input type="text" name="CustomerName"><br />
Customer No: <input type="text" name="CustomerNo"><br />
Customer Type: <input type="text" name="CustomerType"><br />
Customer Comp: <input type="text" name="CustomerComp"><br />
Customer Address: <input type="text" name="CustomerAddress"><br />
Nationality: <input type="text" name="Nationality"><br />
Passport No: <input type="text" name="PassportNo"><br />
Travel Agency: <input type="text" name="TravelAgency"><br />
Password: <input type="text" name="Password"><br />
</input></input></input></input></input></input></input></input></input></pre><br />
<br />
<input type="SUBMIT" value="Submit"><br />
</input></form><br />
</body><br />
</html><br />
From there what I am trying to do is insert all the data gathered from the inputs into an DB.
Now I have decided to do 4 Java classes and 1 servlet inorder to achieve this.
I have created the account class to use the getter and setter methods:
<br />
<br />
<br />
<br />
public abstract class Account<br />
{<br />
String CustomerName, CustomerType, CustomerComp, CustomerAddress, Nationality, PassportNo, TravelAgency, Password;<br />
int CustomerNo;<br />
<br />
<br />
<br />
public Account()<br />
{<br />
CustomerName = "";<br />
CustomerNo = 0;<br />
CustomerType = "";<br />
CustomerComp = "";<br />
CustomerAddress = "";<br />
Nationality = "";<br />
PassportNo = "";<br />
TravelAgency = "";<br />
Password = "";<br />
<br />
}<br />
<br />
<br />
public Account(String cName, int cNo, String cType, String cComp, String cAdd, String n, String pNo, String tAgency, String pass)<br />
<br />
{<br />
CustomerName = cName;<br />
CustomerNo = cNo;<br />
CustomerType = cType;<br />
CustomerComp = cComp;<br />
CustomerAddress = cAdd;<br />
Nationality = n;<br />
PassportNo = pNo;<br />
TravelAgency = tAgency;<br />
Password = pass;<br />
}<br />
<br />
public void setCustomerName(String cName)<br />
{<br />
CustomerName = cName;<br />
}<br />
<br />
public void setCustomerNo(int cNo)<br />
{<br />
CustomerNo = cNo;<br />
}<br />
<br />
public void setCustomerType(String cType)<br />
{<br />
CustomerType = cType;<br />
}<br />
<br />
public void setCustomerComp(String cComp)<br />
{<br />
CustomerComp = cComp;<br />
}<br />
<br />
public void setCustomerAddress(String cAdd)<br />
{<br />
CustomerAddress = cAdd;<br />
}<br />
<br />
public void setNationality(String n)<br />
{<br />
Nationality = n;<br />
}<br />
<br />
public void setPassportNo(String pNo)<br />
{<br />
PassportNo = pNo;<br />
}<br />
<br />
public void setTravelAgency(String tAgency)<br />
{<br />
TravelAgency = tAgency;<br />
}<br />
<br />
public void setPassword(String pass)<br />
{<br />
Password = pass;<br />
}<br />
<br />
public void setAllAccountData(String cName, int cNo, String cType, String cComp, String cAdd, String n, String pNo, String tAgency, String pass)<br />
{<br />
CustomerName = cName;<br />
CustomerNo = cNo;<br />
CustomerType = cType;<br />
CustomerComp = cComp;<br />
CustomerAddress = cAdd;<br />
Nationality = n;<br />
PassportNo = pNo;<br />
TravelAgency = tAgency;<br />
Password = pass;<br />
}<br />
<br />
public String getCustomerName()<br />
{<br />
return CustomerName;<br />
}<br />
<br />
public int getCustomerNo()<br />
{<br />
return CustomerNo;<br />
}<br />
<br />
public String getCustomerType()<br />
{<br />
return CustomerType;<br />
}<br />
<br />
public String getCustomerComp()<br />
{<br />
return CustomerComp;<br />
}<br />
<br />
public String getCustomerAddress()<br />
{<br />
return CustomerAddress;<br />
}<br />
<br />
public String getNationality()<br />
{<br />
return Nationality;<br />
}<br />
<br />
public String getPassportNo()<br />
{<br />
return PassportNo;<br />
}<br />
<br />
public String getTravelAgency()<br />
{<br />
return TravelAgency;<br />
}<br />
<br />
public String getPassword()<br />
{<br />
return Password;<br />
}<br />
<br />
<br />
public String getAllAccountData()<br />
{<br />
return "CustomerName = " + CustomerName +<br />
"; CustomerNo = " + CustomerNo +<br />
"; CustomerType = " + CustomerType +<br />
"; CustomerComp = " + CustomerComp +<br />
"; CustomerAddress = " + CustomerAddress +<br />
"; Nationality = " + Nationality +<br />
"; PassportNo = " + PassportNo +<br />
"; TravelAgency = " + TravelAgency +<br />
"; Password = " + Password;<br />
}<br />
Then I made an Account DB class to hold customer info:
<br />
<br />
<br />
<br />
import java.sql.*;<br />
<br />
<br />
<br />
<br />
public class AccountDB<br />
{<br />
<br />
static Connection connection;<br />
static final String dbDriver =<br />
"sun.jdbc.odbc.JdbcOdbcDriver";<br />
static final String dbUrl = "jdbc:odbc:HotelDatabase1";<br />
static final String dbName = "HotelDatabase1";<br />
static final String dbUser = " ";<br />
static final String dbPassword = " ";<br />
<br />
<br />
public Connection getConnection()<br />
{<br />
System.out.println("Getting Database driver" );<br />
try<br />
{<br />
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver" );<br />
<br />
}<br />
catch( ClassNotFoundException e )<br />
{<br />
System.err.println(<br />
"Cannot load database driver: for DB2, "<br />
+ "your classpath must include "<br />
+ "SQLLIB\\JAVA12\\DB2JAVA.ZIP." );<br />
}<br />
<br />
<br />
<br />
if ( connection != null )<br />
return connection;<br />
try {<br />
connection = DriverManager.getConnection(<br />
dbUrl, dbUser, dbPassword);<br />
} catch( SQLException e ) {<br />
System.err.println(<br />
"Cannot connect to database: "<br />
+ "check that Access is running and "<br />
+ "the Hotel Database database exists." );<br />
}<br />
return connection;<br />
}<br />
public ResultSet getAllCustomerInfo() {<br />
ResultSet rs = null;<br />
try {<br />
Statement statement =<br />
getConnection().createStatement();<br />
String sql =<br />
"SELECT * FROM Customer";<br />
System.out.println( sql );<br />
statement.executeQuery( sql );<br />
rs = statement.getResultSet();<br />
} catch( SQLException e ) {<br />
System.out.println(<br />
"SQLException " + e.getMessage() );<br />
} finally {<br />
return rs;<br />
}<br />
}<br />
public void addCust( CustomerAccount account )<br />
throws SQLException, DBopException<br />
{<br />
int nrows = 0;<br />
Statement statement = getConnection().createStatement();<br />
String sqlString ="INSERT INTO Customer VALUES ("<br />
+ account.getCustomerName()<br />
+ ",'"<br />
+ account.getCustomerNo()<br />
+ "','"<br />
+ account.getCustomerType()<br />
+ "',"<br />
+ account.getCustomerComp()<br />
+ ",'"<br />
+ account.getCustomerAddress()<br />
+ "','"<br />
+ account.getNationality()<br />
+ "','"<br />
+ account.getPassportNo()<br />
+ "','"<br />
+ account.getPassword()<br />
+ ")";<br />
<br />
<br />
nrows = statement.executeUpdate( sqlString );<br />
if ( nrows != 1 )<br />
{<br />
throw new DBopException(<br />
"Instead of 1 row, "<br />
+ nrows<br />
+ " were inserted." );<br />
}<br />
return;<br />
}<br />
public void updateCust( CustomerAccount account )<br />
throws SQLException, DBopException<br />
{<br />
int nrows = 0;<br />
Statement statement =<br />
getConnection().createStatement();<br />
String sql =<br />
"UPDATE Customer SET "<br />
+ "CustomerName = "<br />
+ account.getCustomerName()<br />
+ ", "<br />
+ "CustomerType = '"<br />
+ account.getCustomerType()<br />
+ "', "<br />
+ "CustomerComp = "<br />
+ account.getCustomerComp()<br />
+ ", "<br />
+ "CustomerAddress = '"<br />
+ account.getCustomerAddress()<br />
+ "', "<br />
+ "Nationality = '"<br />
+ account.getNationality()<br />
+ "', "<br />
+ "PassportNo = '"<br />
+ account.getPassportNo()<br />
+ "', "<br />
+ "Password = '"<br />
+ account.getPassword()<br />
+ " WHERE CustomerNo="+account.getCustomerNo();<br />
<br />
<br />
System.out.println( sql );<br />
nrows = statement.executeUpdate( sql );<br />
if ( nrows != 1 )<br />
{<br />
throw new DBopException(<br />
"Instead of 1 row, "<br />
+ nrows<br />
+ " were updated." );<br />
}<br />
return;<br />
}<br />
}<br />
<br />
A customer account java class for the customer account itself:
<br />
<br />
<br />
<br />
public class CustomerAccount extends Account<br />
{<br />
public CustomerAccount(String cName, int cNo, String cType, String cComp, String cAdd, String n, String pNo, String tAgency, String pass)<br />
{<br />
super(cName, cNo, cType, cComp, cAdd, n, pNo, tAgency, pass);<br />
<br />
}<br />
<br />
<br />
}<br />
<br />
<br />
A DBopexception java class for the exception:<br />
<br />
<br />
<br />
<br />
<br />
public class DBopException extends Exception {<br />
<br />
public DBopException() {<br />
this("Could not complete AccountDB database operation");<br />
}<br />
<br />
public DBopException(String s) {<br />
super(s);<br />
}<br />
}<br />
And finally a register servlet:
<br />
<br />
import java.io.*;<br />
import java.text.*;<br />
import java.sql.*;<br />
import javax.servlet.*;<br />
import javax.servlet.http.*;<br />
import javax.servlet.jsp.*;<br />
<br />
<br />
<br />
public class Register extends HttpServlet<br />
{<br />
private AccountDB accountDB;<br />
private Connection connection;<br />
private Statement statement;<br />
private CustomerAccount customerAccount;<br />
private String query;<br />
<br />
public void init( ServletConfig config ) throws ServletException<br />
{<br />
<br />
accountDB = new AccountDB();<br />
accountDB.getConnection();<br />
}
<br />
protected void doPost( HttpServletRequest request,<br />
HttpServletResponse response )<br />
throws ServletException, IOException<br />
{<br />
response.setContentType( "text/html" );<br />
PrintWriter out = response.getWriter();<br />
<br />
<br />
out.println( "" );<br />
<br />
out.println( " "XHTML 1.0 Strict
"/TR/xhtml1/DTD/xhtml1-strict.dtd\">" );<br />
<br />
out.println(<br />
"<html xmlns="\"http://www.w3.org/1999/xhtml\"">" );<br />
<br />
<br />
<br />
// head section of document<br />
out.println( "<head>" );<br />
<br />
// read response by customer<br />
String CustomerName, CustomerType, CustomerComp, CustomerAddress, Nationality, PassportNo, TravelAgency, Password;<br />
<br />
<br />
CustomerName = request.getParameter( "CustomerName" );<br />
int CustomerNo = Integer.parseInt(request.getParameter("CustomerNo"));<br />
CustomerType = request.getParameter("CustomerType");<br />
CustomerComp = request.getParameter("CustomerComp");<br />
CustomerAddress = request.getParameter ("CustomerAddress");<br />
Nationality = request.getParameter ("Nationality");<br />
TravelAgency = request.getParameter ("TravelAgency");<br />
PassportNo = request.getParameter("PassportNo");<br />
Password = request.getParameter("Password");<br />
<br />
<br />
// attempt to process the account information<br />
try<br />
{<br />
if (CustomerName.equals( "" ) ||<br />
CustomerType.equals( "" ) ||<br />
Password.equals("")) <br />
{<br />
out.println( "<h3> Please click the back " +<br />
"button and fill in all " +<br />
"fields.</h3>" );<br />
out.close();<br />
return;<br />
} <br />
else<br />
{<br />
customerAccount = new CustomerAccount(CustomerName,<br />
CustomerNo,<br />
CustomerType,<br />
CustomerComp,<br />
CustomerAddress,<br />
Nationality,<br />
PassportNo,<br />
TravelAgency,<br />
Password);<br />
accountDB.addCust(customerAccount);<br />
}<br />
out.println( "<title>Thank you!</title>" );<br />
out.println( "</head>" );<br />
<br />
out.println( "<body>" );<br />
out.println( "<p>Thank you account created." );<br />
<br />
// end XHTML document<br />
out.println( "</p></body></html>" );<br />
out.close();<br />
<br />
}<br />
<br />
// if database exception occurs, return error page<br />
catch ( SQLException sqlException )<br />
{<br />
sqlException.printStackTrace();<br />
out.println( "<title>Error</title>" );<br />
out.println( "" );<br />
out.println( "<body><p>SQLException: Database error occurred. " );<br />
out.println( "Try again later.</p></body>" );<br />
out.close();<br />
} <br />
catch(DBopException dbException)<br />
{<br />
dbException.printStackTrace();<br />
out.println( "<title>Error</title>" );<br />
out.println( "" );<br />
out.println( "<body><p>DBopException: Database error occurred. " );<br />
out.println( "Try again later.</p></body>" );<br />
out.close();<br />
}<br />
<br />
} // end of doPost method<br />
<br />
// close SQL statements and database when servlet terminates<br />
public void destroy()<br />
{<br />
// attempt to close statements and database connection<br />
try {<br />
statement.close();<br />
connection.close();<br />
}<br />
<br />
// handle database exceptions by returning error to client<br />
catch( SQLException sqlException ) {<br />
sqlException.printStackTrace();<br />
}<br />
}<br />
<br />
} // end class RegisterServlet<br />
Now the problem is when the project runs and I have inserted all the data once I submit it says SQLException..I have tried other ways but cant find a solution for it..could it be that I have too many classes? IS there a better way to achieve what I want?
Any help would be appreciated.
PS. Ignore the comments in the code as they indicate the wrong things.
|
|
|
|
|
This Post is Way TOO HUGE !!!
|
|
|
|
|
hi, every one....
I done project on core java..for load balancing in a distributed system............
our main goal of the project is to "avoid the network crash".......balancing a load..........
problem statement:"whenever an end point systems are heavily loaded..network may crash..and it wil cause..irreversible damage to the network"
soln..we find out are:..find out the which client..is heavily loaded and which client is having fewer load...the..client..which is havily loaded...that client..process is transfarring..to the client..which is..having..lower load"..........
but..right now i'm facing ..problem is that:...how to transferring a process from one client to another client..if the process trasferred from one process name called:"internetexplorer"...same..process should transffer to the another client...and process should..in same..status...that is:..if any thing downloading from internet..that time..client becomes,..heavily..loded..then the same process can be transffered to the client which is having lower load..again...proces..of "inetrnetexplorer"...remains..same..of..coninuing..downloading..processs"...................please...if any one....know about..the java code..for..this..please...help me!!!!
|
|
|
|
|
hi, every one!!!!
I need a java code for tranfarring the process from one client to another client.....please..any one help me!!!
|
|
|
|
|
hello all,
i am new to java and
I'm trying to add a new library 'hibernate-3.2.4.sp1.tar.zip', to netbeans. I understand that to do so, I click tools;libraries;add new library and then select the folder which contains all the .java files. I've done this, but still when I try to import that library, it the IDE says that it doesn't exist? What's the issue? Either the correct procedure for how to add new libraries or an analysis of my issue from my vague description would be great! Also, when I name the library, do I import the name I give it, or the name of the file? For example, if the name of the file is hibernate, and it contains some files. i write
import org.hibernate.*;
but in org package doesn't exist the hibernate.
Regards!
---------------------
Areff Bahrami(KAVEH)
Areff.HB@Gmail.com
---------------------
|
|
|
|
|
Hi,
I have a Fortran program which I have to convert into Java originally. I have converted the code completely but can't get appropriate resutls. The code contains lot of arithmetic calculations using double precision data type of Fortran.
I believe the data types of Java are based differnt than Fortran. Fortran's double precision type is based on IEEE756. I want to know how to convert these double precision calculations into Java. For example:
double precision d1 = 0.3648564D0;
d1**2
DSIN(d1)
DCOS(d1)
The above are my main concerns which I find very difficult to convert. I use Math.sin & cos for DSIN & DCOS. But Fortran 77 deals somthing differntly with double precision. How to convert/translate that into our java application is what I am looking for.
If you can provide the same for C++ that would also be a plus for me, I will use the code accordingly of Java application.
Please help me out. Am stuck up very badly.
Thanks
Terry
|
|
|
|
|
do you know something called "javadoc" ? just kidding
in java (and in C++), the type double handles such precision.
then, you just have to call the correct functions, which you'll find reference in the online documentation.
in C++, just #include <cmath> and use sin() and cos() like this.
in Java, just call Math.sin() and Math.cos()...
|
|
|
|
|
Hello
i'm just downloaded apache tomcat 6.0 but i can't set it to netbeans 6.0.1 please help me...
|
|
|
|
|
I have this problem too, I don't know how I should use Apache Tomcat 6.0 in my NetBeans, is there anyone that can help?
While (true) { Human.isLearnable = true; }
|
|
|
|
|
I just finished writing this program, what it does is takes your name and assigns each letter a number and adds them up,
ie. Tanner would give you 27
The program then checks to see if the number is one or two digits, which in this case it is two (2 and 7)
It then adds those two digits together. Comments explain everything
What I would like input on is if anyone could give me a couple pointers on how to optimize my code, make it faster or take away some of the writing to reduce it's length
import javax.swing.*;
public class bruce_tanner_A2Q2
{
public static void main (String [] args)
{
int firstNameTotal = 0;
int secondNameTotal, thirdNameTotal;
int currentLetter;
String input = JOptionPane.showInputDialog("Numerology Calculator -\nEnter a Name");
int inputLength = input.length();
for(int i = 0;i < inputLength;i++)
{
currentLetter = (int)input.charAt(i) % 60;
if (currentLetter == 5 || currentLetter == 14 || currentLetter == 23
|| currentLetter == 37 || currentLetter == 46 || currentLetter == 55)
{
firstNameTotal++;
}
else if (currentLetter == 6 || currentLetter == 15 || currentLetter == 24
|| currentLetter == 38 || currentLetter == 47 || currentLetter == 56)
{
firstNameTotal = firstNameTotal + 2;
}
else if (currentLetter == 7 || currentLetter == 16 || currentLetter == 25
|| currentLetter == 39 || currentLetter == 48 || currentLetter == 57)
{
firstNameTotal = firstNameTotal + 3;
}
else if (currentLetter == 8 || currentLetter == 17 || currentLetter == 26
|| currentLetter == 40 || currentLetter == 49 || currentLetter == 58)
{
firstNameTotal = firstNameTotal + 4;
}
else if (currentLetter == 9 || currentLetter == 18 || currentLetter == 27
|| currentLetter == 41 || currentLetter == 50 || currentLetter == 59)
{
firstNameTotal = firstNameTotal + 5;
}
else if (currentLetter == 10 || currentLetter == 19 || currentLetter == 28
|| currentLetter == 42 || currentLetter == 51 || currentLetter == 0)
{
firstNameTotal = firstNameTotal + 6;
}
else if (currentLetter == 11 || currentLetter == 20 || currentLetter == 29
|| currentLetter == 43 || currentLetter == 52 || currentLetter == 1)
{
firstNameTotal = firstNameTotal + 7;
}
else if (currentLetter == 12 || currentLetter == 21 || currentLetter == 30
|| currentLetter == 44 || currentLetter == 53 || currentLetter == 2)
{
firstNameTotal = firstNameTotal + 8;
}
else if (currentLetter == 13 || currentLetter == 22 || currentLetter == 45
|| currentLetter == 54)
{
firstNameTotal = firstNameTotal + 9;
}
}
secondNameTotal = ((firstNameTotal % 10) + (firstNameTotal - (firstNameTotal % 10)) / 10);
thirdNameTotal = ((secondNameTotal % 10) + (secondNameTotal - (secondNameTotal % 10)) / 10);
if(thirdNameTotal == 1)
System.out.println(input + " (1) is ambitious, independent, and self-sufficient");
if(thirdNameTotal == 2)
System.out.println(input + " (2) is supportive, diplomatic, and analytical");
if(thirdNameTotal == 3)
System.out.println(input + " (3) is enthusiastic, optimistic, and fun-loving");
if(thirdNameTotal == 4)
System.out.println(input + " (4) is practical, traditional, and serious");
if(thirdNameTotal == 5)
System.out.println(input + " (5) is adventurous, mercurial, and sensual");
if(thirdNameTotal == 6)
System.out.println(input + " (6) is responsible, careful, and domestic");
if(thirdNameTotal == 7)
System.out.println(input + " (7) is spiritual, eccentric, and a bit of a loner");
if(thirdNameTotal == 8)
System.out.println(input + " (8) is money-oriented, decisive, and stern");
if(thirdNameTotal == 9)
System.out.println(input + " (9) is multi-talented, compassionate, and global");
}
}
|
|
|
|
|
<font color="blue">for</font> (int i = 0;i < inputLength; i++) {
currentLetter = (<font color="blue">int</font>)input.charAt(i) % 60; <font color="green">
currentLetter = input[i]; <font color="green">
<font color="blue">switch</font> (currentLetter) {
<font color="blue">case</font> 'A': <font color="blue">case</font> 'J': <font color="blue">case</font> 'S':
firstNameTotal += 1;
<font color="blue">break</font>;
<font color="blue">case</font> 'B': <font color="blue">case</font> 'K': <font color="blue">case</font> 'T':
firstNameTotal += 2;
<font color="blue">break</font>;
<font color="green">
}
|
|
|
|
|