458 Posted Topics
Re: Which operating system are you using? Any service packs installed? Use hard drive diagnostic software to check the drive. See [url]http://www.hitachigst.com/hdd/support/download.htm[/url] Seagate has a program that works with some other vendor's drives. [url]http://www.seagate.com/www/en-us/support/downloads/seatools/[/url] Then click on "Download SeaTools for Windows now". | |
I am trying to automate a login to a website and then navigate to a webpage and retrieve the html from the page. I found some examples of how to login, but am having difficulty figuring out how to navigate to another page once logged in. I've read some information … | |
Re: javaAddict's method is probably the best. If you are going to want additional numbers/indexes--like the 3rd or 4th smallest--you may just want to sort your array. Then the "smallest" numbers will have index of "n-1". Second smallest will have index of "2-1 = 1". Third smallest will have index of … | |
Re: Did you install the Java JDK before installing textpad? I would recommend using NetBeans, it's a free download and can save a lot of programming time. | |
Re: Use "RandomAccessFile". [url]http://java.sun.com/j2se/1.4.2/docs/api/java/io/RandomAccessFile.html[/url] [code=Java] private String readFirstLineOfFile(String fn){ String lineData = ""; try{ RandomAccessFile inFile = new RandomAccessFile(fn,"rw"); lineData = inFile.readLine(); inFile.close(); }//try catch(IOException ex){ System.err.println(ex.getMessage()); }//catch return lineData; } [/code] | |
Re: You are missing a return statement. Also, to make it more effecient, use "else if" statements. [code=Java] public static int[] negativePositive(int[] arr) { int[] ret = new int[3]; int i = 0, e = arr.length; while (i < e) { if (arr[i] < 0) { ret[0]++; i++; } else if … | |
Re: You have to decide if you want it to be graphical or a console application. If you want to have a console app, use Scanner to allow the user to hit the enter key until they specify that he/she wants to quit (ex: by entering "q"). Use "java.util.Random" to generate … | |
Re: Press the "esc" key during booting and you should be able to see additional information. | |
| |
Re: To be honest with you, your code gives the appearance that you combined your code with someone else's code. Check your variable names. I would recommend to choose a variable naming standard for yourself. You used "hourlyRate" in one place and "hourly_rate" in other places. This gives the appearance that … | |
Re: I think that your formulas are not correct. [url]http://math.about.com/od/formulas/ss/surfaceareavol_3.htm[/url] Check the documentation for "Math.pow". You are raising radius to the power of radius. To get data do something like the following: [code=Java] Scanner scan = new Scanner (System.in); //change the delimiter from space to newline in.useDelimiter("\n"); System.out.println ("Enter Radius:"); if … | |
Re: It's undersirable (in my opinion) to make the user re-enter all five scores just because ONE of them was wrong. Ask for each score individually using a for (or while) loop. You can also use "switch-case" statements in place of "if/else if" statements. Some considerations when writing a program include: … | |
I am trying to write a program to display the unicode character when a user enters a unicode character code. ex: If the user enters: "\u00C3" in the textfield, I want to display a capital "A" with a tilda (~) over the top of it. Here's my code so far: … | |
Re: The documentation for BufferedReader states the following ..."Returns: A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached." When you reach the end of the file, the value is "null". [url]http://java.sun.com/j2se/1.5.0/docs/api/java/io/BufferedReader.html#readLine() [/url] As Agni said, tmp … | |
Re: Here's a possible solution. Not sure what you are trying to accomplish, but this sounds like it should do it. There are probably better options. [code] int i; String myNumberAsString; myNumberAsString = Integer.toString(i); [/code] [url]http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Integer.html#toString(int)[/url] Then you can use the String function "charAt". [code] int indexNumber; char desiredDigit; String myDigitStr; … | |
Re: Use a for loop in you "vowelCount". Also, you can't print an array like that, use a for loop for that too. Look over the usage of "substring" again. | |
Re: How is your computer connected? Wireless or wired? What brand router are you using (and what version)? Have you tried reseting your router? Not unplugging and plugging it back in, but following the manufacture's instructions for reseting the router (probably pressing and holding the reset button, unplugging the power and … | |
Re: Check out "ArrayList", it resizes itself as necessary. If you choose to use it, you would create an "ArrayList" of your class (ex: "Employee"). | |
![]() | Re: When using scanner if you use "next()", the data is in String format and needs to be converted. If you use, "nextInt" or "nextDouble", it converts the data for you automatically--consider using "hasNextInt()" or "hasNextDouble()" as well. Here's something to get you started. Create a new scanner. [code] Scanner in … |
Re: When you are reading these integers in from your file, you can either insert them into an array, or just add them together as you read the line. When you read a line in from file, if you read it as text do the following to convert it to an … | |
Re: See the post #7 in the following article: [url]http://www.daniweb.com/forums/post999241.html#post999241[/url] . The "isInteger" method, basically does this, but rather than exiting the program, it returns false. You could use it as is (call the "isInteger" method), and then if it returns false, you have encountered a non-integer and can exit your … | |
Re: Looks like you are making good progress. After you get everything working, maybe rather than hard coding the number of trials, you want to prompt the user for this info. From your "Rolling Dice" post, it looks like you know how to use the scanner. Maybe it's too early yet, … | |
Re: Change the following line from: [code] Scanner number = new Scanner ( System.in ); [/code] To: [code] static Scanner number = new Scanner ( System.in ); [/code] OR better yet, just move it inside of the main method: [code] public static void main(String[] args) { Scanner number = new Scanner … | |
Re: Here's something to get you started. Create a class called HourlyEmployee for the hourly employees: HourlyEmployee: [code=Java] public class HourlyEmployee { protected double payRate; protected double hoursPerWeek; public HourlyEmployee(){ } //constructor public void setPayRate(double newPayRate) { payRate = newPayRate; } public double getPayRate() { return payRate; } public void setHoursPerWeek(double … | |
Re: FYI: Indenting for loops does not make them nested. In order to be nested, one for loop must be inside another. If you look at VernonDozier's example you see a nested for loop. Here's another example with 3 for loops that are nested. Notice how one for loop is contained … | |
Re: The problem you faced earlier with: [code] System.out.println("Total Price is $" + distance/mpg*ppg+parking+tolls ); [/code] was because "+" is a String concatenation operator. Do your math operations, store the value in a variable, and then print the variable. To use printf you can do the following: [code] double total; total … | |
Re: See the following: [url]http://support.microsoft.com/kb/313100[/url] and [url]http://www.daniweb.com/forums/post933374.html#post933374 [/url] | |
Re: It comes from the days of ASP. The "Request.QueryString" command is used to collect values in a form with method="get". SimpleForm_1.asp [code] <form method="get" action="SimpleFormHandler_1.asp"> <TEXTAREA NAME="location" COLS=33 ROWS=4></TEXTAREA> <input type='submit' value='Add Event'> </form> [/code] SimpleFormHandler_1.asp [code] <%@ Language=VBScript %> <% Dim userLocation 'location is the variable name as defined … | |
Re: See the following post: [url]http://www.daniweb.com/forums/post933374.html#post933374[/url] | |
Re: You have some other errors: while(fin.eof() && count<MAX_SONGS) It gets to the end of the file before this is true. Need to change to: while(!fin.eof() && count<MAX_SONGS) To do multiple getline's without checking for EOF each time, you could do something like the following: [code] while(!fin.eof() && count<MAX_SONGS){ if (getline(fin,songs[i].title)) … | |
Re: Use "DecimalFormat". [code=Java] import java.text.DecimalFormat; private String twoDigitNum(String myNum) { //specifies a 2-digit number DecimalFormat num = new DecimalFormat("00"); //for a 4-digit number use the one below //DecimalFormat num = new DecimalFormat("0000"); return (num.format(Double.parseDouble(myNum))); } [/code] | |
Re: You received this error because you used "x", but haven't yet assigned it a value. [code] int x; //x is being used, but hasn't been assigned a value yet selectedJava = x; [/code] . Your code has other issues though. It throws a "ClassCastException" (thrown "if the search key in … | |
Re: Add some error handling to your code. Also double check the data types in the database. I think that if you use ".AddWithValue" it is assumed that you are passing the correct data types. Ex: if "CheckIn_Date" in the database is of type Date/Time then you probably need to pass … | |
Re: **Warning**: This process, if improperly performed, could make your computer unbootable. It is recommended that you back up your files before proceeding. 1. Create a restore point Control Panel -> Backup and Restore Center -> Create a restore point or change settings (on left side) 2. Open cmd window (right … | |
Re: Probably need to install "2007 Office System Driver". See [url]http://www.microsoft.com/downloads/details.aspx?familyid=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en [/url] . That is if you are using the 2007 version. Other things you may want to look at are: [url] http://www.connectionstrings.com[/url] [url] http://support.microsoft.com/kb/247412[/url] MS .NET Framework 3.5 SP1 [url]http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ab99342f-5d1a-413d-8319-81da479ab0d7 [/url] ODBC .NET Provider [url]http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=6ccd8427-1017-4f33-a062-d165078e32b1[/url] Jet 4.0 SP8 (32-bit) [url] … | |
Re: Here is an implementation of what I think llemes4011 was talking about. See [url] http://java.sun.com/javase/6/docs/api/java/util/Scanner.html[/url] and [url]http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html [/url] [code=Java] public static char typeChar(String message) { boolean validInput = false; char userInputChar = 0; System.out.println(message); //don't use this one because it ignores //possible user input //char userInputChar = keyb.next().trim().charAt(0); do { … | |
Re: I haven't used scanner a lot, but I think that error handling is built in. Below is an example of prompting for 10 integers. If invalid data is entered it prompts again. If "quit" is entered, the program exits. [code=Java] Scanner input = new Scanner(System.in); int x=0; while (x<10) { … | |
Re: Where is your code? What is your question exactly? | |
Re: Use ASP with ADO. If .NET framework is installed, you could also use ASP .NET [url]http://www.w3schools.com/asp/asp_intro.asp[/url] [url]http://www.w3schools.com/asp/asp_ado.asp[/url] [url]http://www.w3schools.com/ado/ado_intro.asp[/url] For connection strings see: [url]http://www.connectionstrings.com/[/url] | |
Re: Download and run the Intel Chipset Identification Utility: [url]http://downloadcenter.intel.com/Product_Filter.aspx?ProductID=861[/url] Download Chipset (SATA) drivers. [code] Go to: [url]http://www.intel.com/support/chipsets/[/url] Find the link for your chipset. -Click on the link. -Under "Drivers and Downloads" look for the column "Intel Chipset Software Installation Utility". -Click on the "Download" link for your chipset. -Select the … | |
Re: You need to add the following import to use "DecimalFormat": [code] import java.text.*; [/code] Line #9: add "+" between 0.025 and num.format(monthlySales) Line #9: num.format requires a number not a string If monthlySales is declared as String, you need to covert to a number before passing it to format. [code] … | |
Re: Which operating system is currently installed on your computer? What kind of disk are you using to boot with (vendor recovery cd/dvd, Windows installation cd/dvd)? Does your "boot disk" boot on another computer? Is your cd/dvd drive able to read disks (is the drive good)? Some "boot disks" require that … | |
Re: To get data into the class I know of two methods. 1. Create appropriate constructors and pass the data in that way. See: [url]http://java.sun.com/docs/books/tutorial/java/javaOO/constructors.html[/url] 2. Use set methods. [code] ... private float cost; ... public void setCost(float newCost) { cost = newCost; } // end setCost [/code] To get data … | |
Re: Don't think you can do this: [code=Java] .... //set variables int [] counter = new int [10]; //number of integers //processing phase while([] counter <= 10);//loop 10 times { ..... [/code] I've never seen anyone try to write a statement like that. Don't think that is valid syntax: while([] counter … | |
Re: Opening with a new buffered reader, opens the file again. You may want to read your file data into an ArrayList and then work with it--depending on how large your file is I suppose. If you really want to work directly with the file and be able to change file … | |
Re: You need to follow your code--execute your code on paper. Follow line by line and write down on paper what the values are for the variables. For example: if (i <= day). You set i=1. So unless the user enters a value for day of "0" this will always get … | |
Re: Store the random number in a variable. Then search the array for the randomly generated number. If it is found, generate another random number. Repeat until random number does not exist in the array. | |
Re: If you have a floppy drive you can get the XP boot disks here: [url]http://support.microsoft.com/kb/310994[/url] | |
Re: Sorry about the code formatting. You have multiple things going on: In "addDefaultData" you give the impression that "studTranArray" is a record. Ok, records/struct don't really exist in Java so you can use a class to try to achieve something similiar. You do the following: String [] defaultNames = {"Alvin … | |
Re: [url]http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.18.1[/url] <i>15.18: ...If the type of either operand of a + operator is String, then the operation is string concatenation....If only one operand expression is of type String, then string conversion is performed on the other operand to produce a string at run time. The result is a reference to … |
The End.