Program problem
I can not send email from my phone. Everything else works fine. After hitting the send command the phone attempts to send the message for 3-5 sec. and then a red X appears next to the unsent message in the message box. How do I fix????
Hi there,
Start off by doing a battery pull - while the device is on, remove the battery for 15-30 seconds, then reinsert and wait for the device to reboot. If that doesn't help, then go to your Email Settings (may be in the Setup folder), log in if required, press the BB Menu button and select Service Books. Resend your service books and you should be set.
If that still doesn't work, let us know.
If you want to thank someone for their comment, do so by clicking the Thumbs Up icon.
If your issue is resolved, don't forget to click the Solution button on the resolution!
Similar Messages
-
Hi all,
I was looking for this java programming problem which had to do with a large building and there was some gallons of water involved in it too somehow and we had to figure out the height of the buiding using java. This problem is also in one of the java books and I really need to find out all details about this problem and the solution. NEED HELP!!
Thanks
macYes, it will. The water will drain from the bottom of
the tank until the pressure from the water inside the
tank equals the pressure from the pipe. In other
words, without a pump, the water will drain out until
there is the same amount of water in the tank as in
the pipe The water pressure depends on the depth of the water, not the volume. So once the depth of the water inside the pipe reaches the same depth as the water inside the tank it will stop flowing. This will never be above the height of the tank.
I found this applet which demonstrates our problem. If you run it you can drag the guy up to the top, when water in his hose reaches the level of the water in the tank it will stop flowing out. -
Subject:
programming problem
Date:
Sun, 10 Mar 2002 19:48:34 +0800
From:
LibraryPublicStation <[email protected]>
Organization:
Hong Kong University of Science and Technology
Newsgroups:
hkust.cs.class.201
Hi, I have some problems on the following code:
The code has no compiling error. but
Why I can't get the RGB value of my image since I can get the width and
height of the image.
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.Graphics.*;
import java.awt.event.*;
import javax.swing.*;
import java.lang.*;
import java.awt.color.*;
import com.sun.image.codec.jpeg.*;
import java.awt.geom.*;
public class Sun
public static void main(String args[])
double[][] database_graph=new double[0][900];
// put the image in a row with 900 column
Toolkit toolkit = Toolkit.getDefaultToolkit();
Image image1 = new ImageIcon("imges.jpg").getImage();//load the image to
image1
BufferedImage buffer;//Buffer the image to get the RGB value
buffer = new BufferedImage(image1.getWidth(null),image1.getHeight(null),
BufferedImage.TYPE_INT_ARGB);
ColorModel a=buffer.getColorModel();
System.out.println(a);
for(int j=0;j<buffer.getWidth();j++)
for(int k=0;k<buffer.getHeight();k++)
int rgb=buffer.getRGB(j,k);//get the red,green,blue value of the graph
int red = ((rgb&0xff0000)>>16);
int green = ((rgb&0xff00)>>8);
int blue = rgb&0xff;
database_graph[0][buffer.getHeight()*j+k] = (red + green + blue)/3;
System.out.println(database_graph[0][buffer.getHeight()*j+k]+" "+red+"
"+green+" "+blue);
} // change back to gray scaleTry this :
ImageIcon icon = new ImageIcon("imges.jpg");
Image image1 = icon.getImage();
BufferedImage buffer = new BufferedImage(icon.getIconWidth(),icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
...But I think, in your problem, you want to get the image in a BuffererdImage ?
ImageIcon icon = new ImageIcon("imges.jpg");
BufferedImage buffer= (BufferedImage)icon.getImage();
...Denis -
Coldfusion server problem or programming problem?
Hello experts,
I have been experiencing problems when accessing this website using Mac (and Parallels/WinXP).
http://tinyurl.com/3yh3d8l
Because there is no problem when using Windows PC, the programmer suggested that it might be a CF server problem, but one of my IT said it's programming issue (basically he said the web programmer is wrong). I have very limited access to PC at work but I need the data from that website. I'd like to give input to the webprogrammer but I don't know what to say. Could you please give me some suggestions? Thank you.hi Adam,
Just tested in Mac, the site works in FireFox. But Safari won't load it at all. Progress bar keep spinning but screen doesn't change.
So is this something to do with the programming problem or Safari is being picky? I can use FireFox during presentation but I'd like the option to be able to use Safari (iPad?). -
dear sirs, i work with forms 6i
i have programming problem and i want to solve it
the problem is
i have table contain the following fields
AREA_CODE NOT NULL NUMBER(8)
AREA_NAME NOT NULL VARCHAR2(30)
EAREA_NAME VARCHAR2(30)
UP_AREA_CODE NUMBER(8)
AREA_TYPE NUMBER(1)
AREA_LEVEL NUMBER(15)
transfer_fees number(15,3)
i want to get the value of transfer_fees, depend on the area code which i want, but if transfer_fees is null i should get the other transfer_fees of the up_area_code as the up level of area code, and if also null then get the value of transfer_fees of the up level of area code and so on.
please help me urgently
YasserHi yasser
it's not precise for me , It needs a lot of details but according to the existing information
Now we have 3 options
Option1 : Get the transfer_fees according to AREA_CODE -- i don't know how not clear for me
Option 2 : IF transfer_fees IS NULL then get it's value from up_area_code (then i am assuming that up_area_code has a value currently during the user input so all we have is to think that we can get it's value from a simple assign statement in WHEN-VALIDATE-ITEM trigger of transfer_fees item as ...
IF :transfer_fees IS NULL THEN
:transfer_fees :=:up_area_code;
END IF;and so on...
Hope this helps...
Regards,
Amatu Allah -
I'm new to Ubuntu & Linuz OS. I've started to see a pop-up window that says: System Program Problem Detected- Do you want to report the problem. When I click yes, I'm asked to enter my password to access problem reports of system programs. Should I be asked for my password ???
I am fairly new to Ubuntu, but that does not sound unexpected. Ubuntu tends to have everyone use a limited account that needs to ask for a password before carrying out operations like installing software.
-
Forms Service verification program problem
I have a java verification program that is run from a HPUX server cron job to check
the status of my 9.0.2.12.2 Oracle 9iAS Forms Services running on a
Windows 2000 server. The program determines if the Forms Services
restarted after a cold, off-hours backup by retrieving and reading
base.htm.
I have 3 windows servers with "identical" configurations of 9iAS Forms
Services. The java verification program works when running against the dev and
test Forms servers but not against the production Forms server. It
did work against the production Forms server until I upgraded to
9.0.2.12.2 a few months ago. The only way to reproduce the problem
against the test Forms server is to rename base.htm so the program
can't find it. default.env,forms90.conf,formsweb.cfg all appear to be
identical. Paths and other environmental variables are identical on
the windows Forms servers. The java program fails or succeeds
consistently on 3 different HPUX servers both in cron and from the
command line.
The error message is: java.io.IOException: Server returned HTTP
response code: 500 for URL:
http://productionserver:7778/forms90/f90servlet
Java is 1.3.1 on all environments.
import java.io.*;
import java.net.*;
public class auRLTest
public auRLTest()
try {
System.out.println("Starting...");
URL url = new URL("http://productionserver:7778/forms90/f90servlet");
System.out.println("Opening URL connection ("+url+")");
URLConnection uc = url.openConnection ();
System.out.println("Connecting to URL");
uc.connect();
System.out.println("Opening input stream.");
BufferedReader in = new BufferedReader(
new InputStreamReader( uc.getInputStream() ) );
System.out.println("Reading file...");
System.out.println("==========================================================================");
String inputLine = in.readLine();
while (inputLine != null)
System.out.println(inputLine);
inputLine = in.readLine();
System.out.println("==========================================================================");
System.out.println("Closing file.");
in.close();
System.out.println("Production Form Server is UP");
catch( java.net.ConnectException connectException ) {
System.out.println("***PRODUCTION FORM SERVER IS DOWN***.");
catch( Exception exception ) {
System.out.println(exception);
public static void main(String[] args)
auRLTest uRLTest = new auRLTest();
Accessing "http://productionserver:7778/forms90/f90servlet" from IE works fine.
Any clues or ideas are appreciated.
ThanksI went through the same thing. Look at Appendix II "Case Study" at http://rootshell.be/~yong321/freeware/ckweb.html. Basically, the forms servlet needs some more HTTP headers you didn't pass.
Yong Huang -
When trying to open ITunes, I got an error message of msvcr80.dll can not be found.
Assuming that it was an iTunes file, I reinstalled iTunes.
Trying to open again, I got an error message of an appication is trying to open a library file incorrectly.
How do I resolve this problem.
Neither my PC with Vista nor my my laptop with windows 7 will work?
ThanksHello Msvcr80.dll,
Thanks for using Apple Support Communities.
For more information on this, take a look at:
iTunes 11.1.4 for Windows: Unable to install or open
http://support.apple.com/kb/TS5376
Check for .dll files
Go to C:\Program Files (x86)\iTunes and C:\Program Files\iTunes and look for .dll files.
If you find QTMovie.DLL, or any other .dll files, move them to the desktop.
Reboot your computer.
Note: Depending on your operating system, you may only have one of the listed paths.
Uninstall and reinstall iTunes
Uninstall iTunes and all of its related components.
Reboot your computer. If you can't uninstall a piece of Apple software, try using the Microsoft Program Install and Uninstall Utility.
Re-download and reinstall iTunes 11.1.4.
Best of luck,
Mario -
When i create a payment proposal today with posting date in the future and the items that have to be paid are in foreign currency the payment run program (that executed in the future date) create postings with exchange rate the rate of proposal creation date and not the posting date.
Is there any solution to this problem?
Version 4.6C
Thanks in advance
EliasElias
There are loads of SAP Notes about this. You'll have to search for the specific one for your system.
try http://service.sap.com/notes -
Beginner with a programming problem
I am getting quite frustrated trying to figure out how to proceed with a Java program I've been assigned. I'm hoping that my problem is not too amorphous to warrant assistance.
The program is an exercise in Swing and creating GUI's, and at this stage, I only need to create an array of dice objects which can paint themselves on a JPanel. The instructor has given us two files -- one extending JPanel and containing a main method to test the classes, and another which represents a die.
Some issues are
1) I don't know where to call repaint.
2) When the overridden paintComponent method is called, it wipes out
the background color on my panel, which I set in the constructor.
3) I got null pointer exceptions when I ran the instructor 's main method... I moved the setVisible up in the chain and they went away (Though he stated not to alter the main method, I don't know enough about Java Graphics to know if it's his mistake or mine)
4) I'd just like to see some something appear.
I should add that I rewrote this whole thing in one file (without using an array) and was able to get the graphics to paint.
Sorry for posting copious amounts of code, but hopefully it will clear up what I'm trying to do. If anyone could just give me some pointers in the right direction, I would greatly appreciate it. Thank you for your time.
// File: DicePanel.java
public class DicePanel extends JPanel
private int number_of_dice = 0;
private DiceDrawn [] dice;
/** The x,y coordinates where the first die is drawn */
private int xCoordinate = 5; //default
private int yCoordinate = 5; //default
/** Constructor with default properties */
public DicePanel()
this.setSize(getPreferredSize());
this.setBackground(Color.blue);
// set size and color
/* Set the Dice array */
public void setDice(DiceDrawn[] d)
}// end setDice
/** Return xCoordinate */
public int getXCoordinate()
return xCoordinate;
/** Set a new xCoordinator */
public void setXCoordinate(int x)
xCoordinate = x;
/** Return yCoordinator */
public int getYCoordinate()
return yCoordinate;
/** Set a new yCoordinator */
public void setYCoordinate(int y)
yCoordinate = y;
/** Paint the Dice Panel */
protected void paintComponent(Graphics g)
super.paintComponent(g);
for (int i = 0; i < dice.length; i++ )
dice.drawDie(g, xCoordinate, yCoordinate);
setXCoordinate(getXCoordinate() + 41);
// draw each die using default start coordinates,
// moving right each time
/** Override get method for preferredSize */
public Dimension getPreferredSize()
return new Dimension(200, 50);
// the main method to test DicePanel and DiceDrawn
// do not change this method.
public static void main(String [] args)
JFrame f = new JFrame();
// f.setVisible(true);
f.setTitle("Draw Dice");
f.setSize(500,400);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container cp = f.getContentPane();
// show 6 dice initially
DiceDrawn [] dice = new DiceDrawn [6];
for(int i = 0; i < dice.length; i++)
dice[i] = new DiceDrawn(i+1);
DicePanel dicePanel = new DicePanel();
dicePanel.setDice(dice);
System.out.println(dice.length);
cp.add(dicePanel, BorderLayout.NORTH);
f.setVisible(true);
// show only one die for the rest of the program
dice = new DiceDrawn [1];
System.out.println("Dice Drawn Class Test");
int i = Io.readInt("Enter an integer between 1 and 6");
while( i > 0 )
dice[0] = new DiceDrawn(i);
dice[0].setSelected( i%2 == 0 ? true : false);
dicePanel.setDice(dice);
i = Io.readInt("Enter an integer between 1 and 6");
System.exit(0);
// File: DiceDrawn.java
public class DiceDrawn
private final int SIZE = 36;
private final int QUARTER = SIZE/4;
private int face; // face value
private boolean selected; // pressed = true
public DiceDrawn( int f)
setFace(f);
setSelected(true);
}// end DiceDrawn
public void setSelected( boolean s )
selected = s;
public boolean isSelected()
return selected;
public void setFace(int i)
face = i;
public int getFace()
return face;
// Draw a die starting at the given coordinates
public void drawDie(Graphics g, int xcoor, int ycoor)
g.setColor(Color.WHITE);
g.fillRect(xcoor,ycoor, SIZE, SIZE);
g.setColor(Color.BLACK);
switch(face)
case 1:
g.fillOval((xcoor-4)+(2*QUARTER), (ycoor-4)+(2*QUARTER), SIZE/8, SIZE/8);
break;
case 2:
g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + QUARTER, SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+(3*QUARTER), (ycoor-4)+(3*QUARTER), SIZE/8, SIZE/8);
break;
case 3:
g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + QUARTER, SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+(3*QUARTER), (ycoor-4)+(3*QUARTER), SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+(2*QUARTER), (ycoor-4)+(2*QUARTER), SIZE/8, SIZE/8);
break;
case 4:
g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + QUARTER, SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+(3*QUARTER), (ycoor-4)+(3*QUARTER), SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + (3*QUARTER), SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+ (3*QUARTER), (ycoor-4)+ QUARTER, SIZE/8, SIZE/8);
break;
case 5:
g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + QUARTER, SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+(3*QUARTER), (ycoor-4)+(3*QUARTER), SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + (3*QUARTER), SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+ (3*QUARTER), (ycoor-4)+ QUARTER, SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+(2*QUARTER), (ycoor-4)+(2*QUARTER), SIZE/8, SIZE/8);
break;
case 6:
g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + QUARTER, SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+(3*QUARTER), (ycoor-4)+(3*QUARTER), SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+ QUARTER, (ycoor-4)+(2*QUARTER), SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+ (3*QUARTER), (ycoor-4)+(2*QUARTER), SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + (3*QUARTER), SIZE/8, SIZE/8);
g.fillOval((xcoor-4)+ (3*QUARTER), (ycoor-4)+ QUARTER, SIZE/8, SIZE/8);
break;
// draw a die using a rectangle of 36 by 36 pixels
// at the coordinates given.
// use a switch statement to draw the appropriate face.
}// end DrawDie
}// end DiceDrawnOnce you get beyond your initial problems, you'll find that there is another problem. When it displays the dice corresponding to the numbers you select, the x coordinate eventually becomes greater than the frame width. You need to make a change to the paintComponent method so it looks like:
/** Paint the Dice Panel */
protected void paintComponent(Graphics g)
super.paintComponent(g);
for (int i = 0; i < dice.length; i++ )
dice.drawDie(g, xCoordinate, yCoordinate);
if(dice.length > 1)
setXCoordinate(getXCoordinate() + 41);
// draw each die using default start coordinates,
// moving right each time
Note that I have added an if above the setXCoordinate so that it will only add to the X coordinate when it is displaying the 6 dice initially. It won't add anything when it is displaying the single dice. -
HTTP Client/Server program problems
Hi all,
I am doing an exercise in which I create a Client and Server program. I send a GET request but nothing seems to happen. There is obviously something I'm missing. Could it be a badly formed request? The code is below. Any help is appreciated.
Client program.....
import java.io.*;
import java.net.*;
import java.util.StringTokenizer;
public class HTTPClient{
String host, path;
int port;
public static void main (String argv[]){
new HTTPClient(argv[0]);
public HTTPClient(String url){
try{
URL myURL = new URL(url);
host = myURL.getHost();
port = myURL.getPort();
System.out.println("Port = " + port);
if (port == -1) port = 30280;;
path = myURL.getPath();
if (path.equals("")) path = "/";
Socket s = new Socket(InetAddress.getByName(host), port);
sendRequest(s.getOutputStream());
printResponse(s.getInputStream());
s.close();
catch(MalformedURLException murl){
System.out.println("Badly formatted URL " + murl.getMessage());
catch(IOException e){
System.out.println("Problem initialising socket " + e.getMessage());
public void sendRequest(OutputStream out){
StringBuffer buf = new StringBuffer();
buf.append("GET /AC095.html HTTP/1.1\r\n");
buf.append("Host: http://students.odl.qmul.ac.uk\r\n\r\n");
try{
out.write(buf.toString().getBytes("US-ASCII"));
catch (IOException e) {System.out.println(e.getMessage());
public void printResponse(InputStream in){
try{
while (in.available() <= 0)
Thread.sleep(500);
while (in.available() > 0)
System.out.print((char) in.read());
System.out.println ("");
catch (IOException e) {
System.out.println(e.getMessage());
catch (InterruptedException ie) {
System.out.println("Error waiting for response " + ie.getMessage());
/* Read in the response from the HTTP server and print it out */
}Server code......
import java.io.*;
import java.net.*;
import java.util.*;
public class HTTPServer{
String version = null;
public String httpVer;
public static void main(String argv[]){
new HTTPServer(Integer.parseInt(argv[0]));
public HTTPServer(int port){
boolean listening = true;
try{
ServerSocket ss = new ServerSocket(port);
System.out.println("HTTP Server running and listening for requests...");
while (listening){
Socket mySocket = ss.accept();
InputStream in = mySocket.getInputStream();
readHeaders(in);
String response = getResponse();
OutputStream out = mySocket.getOutputStream();
out.write(response.getBytes("US-ASCII"));
out.flush();
mySocket.close();
catch(Exception e){System.out.println(e.getMessage());}
private String getResponse(){
StringBuffer responseBuf = new StringBuffer();
responseBuf.append (httpVer + " 200 OK\r\n");
responseBuf.append ("Content-type: text/html\r\n");
responseBuf.append ("Content-length: 119\r\n");
responseBuf.append ("<HTML>\r\n");
responseBuf.append ("<TITLE> My served web document </TITLE>\r\n");
responseBuf.append ("</HEAD>\r\n");
responseBuf.append ("<BODY>\r\n");
responseBuf.append ("<H1> Hello from the server! </H1>\r\n");
responseBuf.append ("</BODY>\r\n");
responseBuf.append ("</HTML>\r\n\r\n");
String responseStr = responseBuf.toString();
responseStr = responseStr.trim();
return "";
private void readHeaders(InputStream in) throws IOException {
StringBuffer sbuf = new StringBuffer();
int ch;
String clientStr;
//This loop reads in all of the input until there is nothing left to read.
//All of the characters are appended to the string buffer.
while ((ch = in.read()) != -1) {
sbuf.append((char) ch);
//clientStr will hold string in string buffer without any leading or
//trailing white space.
clientStr = sbuf.toString();
clientStr = clientStr.trim();
//Split clientStr into substrings and store them in an array.
String [] tokens = clientStr.split(" ");
//Obtains HTTP version
httpVer = tokens [2];
}Cheers,
ChrisI've written out.flush() in the server program. When I attempt to connect to the server it just hangs. I've modified the code locally to request a webpage from elsewhere and it works so it can't be the format of my GET request. I assume that the problem has to be in the Server program. Is it not reading in and understanding the /r/n properly?
-
Employee payroll program problems
I have done good so far but now im stuck and lost on how to take my program to the next step, kids got sick and i missed like a week of school so im behind. I am suppose to modify the Payroll Program so that it uses a class to store and retrieve the employee?s name, the hourly rate, and the number of hours worked. Use a constructor to initialize the employee information, and a method within that class to calculate the weekly pay. Once stop is entered as the employee name, the application should terminate. I am lost on the bold part..
here is what I have:
//Calculates weekly pay for an employee
import java.util.Scanner; // program uses class Scanner
public class BeemansPayroll
private double rate;
private double hours;
private String name;
//Used to save info
public BeemansPayroll(String Name, double PayRate, double Hours)
String name = Name;
double rate = PayRate;
double hours = Hours;
private static void Quit()
System.out.println("Thank You for using Beeman's Payroll");
System.exit(0);
// main method begins execution of Java application
public static void main(String args[])
// create Scanner to obtain input from command window
Scanner input = new Scanner(System.in);
String name = "";
do {
System.out.print("Enter Employee Name or stop to quit: ");
// prompt for name
name = input.next(); // get name
if (name.equals("stop"))
System.out.println("Thank You for using Beeman's Payroll");
Quit();
} //end if
else
double PayRate;
double Hours;
double Pay;
System.out.print("Please enter Employee payrate:$ "); // prompt
PayRate = input.nextDouble(); // read first number from user
while (PayRate <= 0)
System.out.println ("Invalid amount, Payrate must be positive");
System.out.print("Please enter valid payrate:$ ");
PayRate = input.nextDouble();
} //end if
System.out.print("Please enter Employee hours: "); // prompt
Hours = input.nextDouble(); // read second number from user
while (Hours <= 0)
System.out.println ("Invalid amount, Hours must be positive");
System.out.print("Please enter hours worked: ");
Hours = input.nextDouble();
} //end if
Pay = PayRate * Hours; // multiply numbers
System.out.printf("Employee Pay for the week %s, is $%.2f\n", name,
(PayRate * Hours)); // display product
} //end else
}while (!name.equals("stop"));
Quit();
} // end method main
} // end class Beeman's Payrolljohn774077 wrote:
Like I said, I am lost, with all that is going on I have done the reading 4 times , Then try reading a different source such as the Sun Java tutorials. They are excellent and there is no substitute to your reading and learning. We can help you debug an error in your code, but we are not a tutorial service nor a homework production service. Note also that we are all volunteers.
on top of kids getting sick and taking three algebra all at once. I advice you to not go on and on about this. This is not our problem and won't affect how or if someone helps you. If anything continued mention of this will turn many away who would otherwise help you.
How or where do I go about breaking it down?You are redeclaring the variables in your constructor, i.e.,:
String name = Name; // don't do thisDon't do this because you'll never change the class's name variable this way. Instead in the constructor do something like this for each variable:
name = Name;or
this.name = Name;Later you will need to read up on Java naming conventions.
As for creating the method, you should read up on method creation in your text book or tutorial. That'll give you a better explanation than we can, I think. -
A Programming problem with PXI 8461
I use PXI-8461 CAN Card.
The subvi READ_AI's function is to aquire data,and save datas to database.
And Process.vi dynamicly calls READ_AI twice,and a Main.vi calls Process.vi for every step.
Every step lasts 10 seconds,and has 10 seconds interval.
step1: from 0s->10s, aquire data;
delay 10s;
step2: from 20s->30s,aquire data;
I find that ,step2's data is from 10s->30s!
What is the problem ? Is there any error in CAN's use ?
Here is my vi. thank you.
Attachments:
READ_AI.vi 80 KB
Process.vi 44 KBIt displayed that error message because it reached the end of the file before your program was complete. For example, remember when last Thursday when you
Hey, did you notice how the last sentence up there just stopped before the sentence was really done? Your program does the same thing.
Read some tutorials about Java; they'll have plenty of examples of complete programs. -
Fraction program problem.
Hi, ive done a program to compute two fractions, but im getting wierd results, and I know its because I stuffed up the logic in equals(), add(), and isZero(). Its saying some fractions are equal to 0 when they are not, and when it does add two fractions they turn out to be fairly large.
Any help to tell me what parts I did wrong would be great.
Thankyou.
//Accessor class
public class Fraction {
private int num1, den1, num2, den2, resultNum, resultDen;
public void readIn() {
System.out.println("\nTime to enter the first fraction.");
System.out.print("\nEnter the numerator: ");
num1 = SavitchIn.readLineInt();
System.out.print("Enter the denominator: ");
den1 = SavitchIn.readLineInt();
System.out.println("\nTime to enter the second fraction");
System.out.print("\nEnter the numerator: ");
num2 = SavitchIn.readLineInt();
System.out.print("Enter the denominator: ");
den2 = SavitchIn.readLineInt();
public boolean errorCheck() {
if ((den1 == 0)||(den2 == 0)) {
System.out.println("\nError: The fraction is invalid is its denominator is 0, Halting!");
return false;
else
return true;
public boolean isZero() {
int result = num1 / den1;
if (result == 0) {
System.out.println("The first fraction equals 0, Halting Program!");
return false;
else
return true;
public boolean equals() {
if (num1*den2 == den1*num2)
return true;
else
return false;
public void add() {
int tempNum = (num1*den2) + (den1*num2);
int tempDen = den1*den2;
int d = simplify(tempNum, tempDen);
resultNum = tempNum/d;
resultDen = tempDen/d;
public static int simplify(int a, int b) {
if(a%b > 0)
return simplify(b, a%b);
else
return b;
public void writeOutTrue(boolean check) {
System.out.println("The fractions entered were: "+num1+"/"+den1+" and "+num2+"/"+den2+".");
System.out.println("The sum of the fractions entered is: "+resultNum+"/"+resultDen+".");
if (check == true)
System.out.println("The fractions are equal!");
}//Main class
public class FractionDemo {
public static void main(String[] args) {
boolean truthCheck = true;
int firstNume=0, firstDenom=0, secNume=0, secDenom=0;
System.out.println("\nThis program gathers a faction from the user and displays it to the screen.");
System.out.println("If the first fraction entered equals to '0' to the program will exit.");
Fraction fracData = new Fraction();
while(true) {
fracData.readIn();
truthCheck = fracData.errorCheck();
if (truthCheck == true)
truthCheck = fracData.isZero();
if (truthCheck == false)
break;
truthCheck = fracData.equals();
fracData.add();
fracData.writeOutTrue(truthCheck);
}Well, first off, I really don't like your simplify method. If I were you, I'd return an array of two ints, one for the numerator and one for the denominator. Or a Point object, but that could get confusing. :P
I think your modulo method of simplifying may not work for all situations, but I'm not completely sure; I'm having trouble following it in my head. Personally, I think I'd do simplifying like this:
public int[] simplify(int n, ind d)
int nFactors[] = getFactors(n);
int dFactors[] = getFactors(d);
// take out factors that are the same here, and the multiply the remaining ones in nFactors for the new numerator and the remaining ones in the dFactor for the denominator.
publicn int[] getFactors(int n)
int size=1;
int twos;
int threes;
int fives;
int sevens;
boolean canFactor = true;
while(canFactor))
if(n%2 == 0)
size++;
twos ++;
n = n/2;
if(n%3 == 0)
size++;
threes++;
n = n/3;
if(n%5 == 0)
size++;
fives++;
n = n/5;
if(n%7 == 0)
size++;
sevens++;
n = n/7;
else
size++;
canFactor = false;
int factors[] = new int[size];
for(int i = 0; i<factors.size; i++)
if(twos != 0)
factors[i] = 2;
twos --;
else if(threes != 0)
factors[i] = 3;
threes --;
else if(fives != 0)
factors[i] = 5;
fives --;
if(sevens != 0)
factors[i] = 2;
sevens--;
else
factors[i] = n; // this takes care of some of the other prime numbers, like 17 I think
}I think that code would work for simplifying; but there are probably some exceptions that would get through it; I'm not a mathematician.
Then, to compare equality, simplify both fractions and if the equal, then the fractions are equal.
I think your problem with your add method lies in your simplify method, but I'm not sure. If you gave us numbers your program messed up on it would help. I don't have my IDE up here, so I can't test your code.
As for your isZero method, why divide it out? A fraction will only be 0 if the numerator is 0.
I hope I was some help. shrug Use my code at your own risk, it's totally untested. I don't know if it will work, but I think it'd work for most cases. I tried a few numbers; I haven't found one where it won't work (yet). -
Multi-lingual Java program/problem
Hi,
The following program from the Sun books, is supposed to work with different languages. Except it doesn't!
It has a problem finding the Properties files (?)
It gives the following Exception:
Exception in thread "main" java.util.MissingResourceException: Can't find bundle
for base name MessagesBundle, locale en_GB
here is the Sun program:
import java.util.*;
public class I18NSample {
static public void main(String[] args) {
String language;
String country;
if (args.length != 2) {
language = new String("en");
country = new String("GB");
} else {
language = new String(args[0]);
country = new String(args[1]);
Locale currentLocale;
ResourceBundle messages;
currentLocale = new Locale(language, country);
messages =ResourceBundle.getBundle("MessagesBundle",currentLocale);
System.out.println(messages.getString("greetings"));
System.out.println(messages.getString("inquiry"));
System.out.println(messages.getString("farewell"));
and I have created several properties file (English, French, German, Arabic) as text files. Maybe I have problems with the properties files.
I have followed the steps from the Java Tutorial book from Sun.
Any help would be most welcome.
AkzFirst save a java file "MessageBundle.java" in your current directory, for the moment. Then save java files "MessagesBundle_en_GB.java", "MessagesBundle_fr_FR", "MessagesBundle_de_DE" or "MessagesBundle_ar_EG" for example. Compile them to class files.
Then try using your code with various locales. -
Enrolling Mac Developer Program Problem
Hello,
I'm in the UK and tried to enrol for the Mac Developer Program via https://developer.apple.com/programs/
I selected "Mac Developer Program" for $99/year and came to https://developer.apple.com/programs/mac/
I pressed the "Enroll now" button and came to https://developer.apple.com/programs/start/standard/
I pressed "Continue" and came to https://developer.apple.com/programs/start/standard/create.php
I was already logged in with my existing Apple ID and
pressed "Continue" with Existing Apple ID which brought me to https://developer.apple.com/enroll/selectEnrollmentType.php?t=cm
Because we want to use our partnership business name, I pressed "Company" and came to https://appleid.apple.com/account/manage
I don't know why I'm here now. I see no reason to edit my account details.
How do I continue?
Thanks for any help!Please can anyone help?
I think I've tried everything.
I don't know how to continue.
What might be the problem here?
Thanks.
Maybe you are looking for
-
Dear everyone, I have built some customized JSF components. In the taglib, there is attribute "id" for my components. There is no problem when the page is run, but when I click submit button, there are errors. javax.servlet.jsp.JspException: duplicat
-
If I buy an IPad to use it in another country, which one would you recomend?
If I buy an IPad to use it in another country, which one would you recomend?
-
Hi need some help! When trying to look at pictures on housing websites I either get just the top of the picture load or half the picture and the rest greyed out. It only seems to be on a few as everything on Facebook and BBC news seems to load ok. Ha
-
Hi all, we've a problem with the program RFUMSV00, an invoice verification posted with amount 0, tax amount 0, this is not dispay in the output of the program. The document is posted in this way: Vendor --> amount 0 Tax Amount --> 0 Item 1 --> Postin
-
I'm trying to use the move tool in Elements 12, however it wont let me as it says layers are locked, any ideas how I can get the move tool to work?