bibiki 18 Posting Whiz

you sound like you have problems accessing the files no matter where you place them, and not with where exactely to put them. I do not know about netbeans... but if you are having difficulties with accessing your files, first thing that comes to mind is that you have paths hard coded and that inside quotes, your backsalsh are very likely not correctly typed in.... they should be doubled... example:
"c:\mycomp\myfolder\myfile...." <-- see, double slashes :)

bibiki 18 Posting Whiz

this what you have here would actually diverge. you need to make some changes to either i, k, or both to make sure that i < m(k - 1) would eventually turn false (if it already is true) so that you get out of your while loop.

anyways, you can define a separate variable somewhere in your code, name it count. insert a System.out.println(count); and a count++; statement at the end of your loop. make sure you initialize your count variable with 1. this would let you see how many times your loop is executing. you can do this many ways, but this is one.

bibiki 18 Posting Whiz

@taywin, well, the method will be slow. recursion is always slow. But, that is how recursion in this case should be implemented. let us assume the method signature is:
int recursive(int a, int b)
if we implement it recursively, for recursive(5, 6) there should be 6 invocations of the method, and the last to be invoked is the first to be completed... this I believe explains how the method works. the last invocation does not call the method anymore because the 6 must have become 1. I hope this makes any sense now. anyways. kind regards.

bibiki 18 Posting Whiz

let me try:
let as say you want to multiply 5 with 6.
upon first invocation of the method, add 5 to the first input param (that is five), and subtract one from 6. do this as long as the second param is bigger than 1. this, I believe, would be your recursive method. next time I comment, I write code. But writing code is against the rules, so brace yourselves :P

P.S. upon first invocation of the method, add 5 to the first input param (that is five), and subtract one from 6, and add to this the invocation of the method with 5 remaining the same, and pass for the second parameter whatever you get from 6 - 1 (the second parameter subtracted)

bibiki 18 Posting Whiz

well,
this is what I found online. check this link

https://forums.oracle.com/forums/thread.jspa?messageID=9254447

I am confident it will help you.

bibiki 18 Posting Whiz

if your code is c++ you need to put it in a language that MARIE understands. if your code is not in c++, it is in the language MARIE understands, in that case, you'd need to write it in c++. anyways, this "Write the equivalent C++ code in MARIE" tells me that you need to write some code, and the way I understand English, you are asked to write c++ code...

bibiki 18 Posting Whiz

I believe you need to put your jar file in your library folder, I'm sure the place where you got your jar should explain how to install it...

put the errors you get here and we might see what the actual problems are.

bibiki 18 Posting Whiz

include <lou>,
MARIE stands for Machine Architecture that's Real Intuitive and Easy. It is built in Java, but the code you need to write in c++ is not Java code. That is rather a weak imitation of assembly code I think. That code works with the architecture that MARIE represents, that is assembly. And you need to write that in c++. take your question to c++ forum because the language that is used to build a virtual architecture, in this case MARIE, has nothing to do with the code you posted and your assignment.

AND, I really do not care if someone calls me retarded on a forum. But in real life, I'd might mike-tyson one's butt.

bibiki 18 Posting Whiz

you are in the java forum. my first suggestion, move to c++ forum as you need help writing c++ code.

bibiki 18 Posting Whiz
bibiki 18 Posting Whiz

I could be wrong but BranchGroup inside javax sounds doubtful.

javax is a standard java library and it does not contain a media class. if it is to contain it, you should download that. look online for javax.media library.

bibiki 18 Posting Whiz

you still have your select statement wrong.

put echo $sql in your file and you will see what this statement looks like when you send it to your db. then, ask yourself is that what you want to send to the db. you'll see what the problem is here.

bibiki 18 Posting Whiz

your lines ten and eleven are wrong. you again have typos. you have some single quotes and brackets missing.

In addition, you have nothing happening between these two lines. In that case, line 10 is useless. insert an (echo $sql) statement after these two lines and see what you are asking your database to process. you'll see your mistake.

bibiki 18 Posting Whiz

;) mark your thread solved then. glad I was of help.

bibiki 18 Posting Whiz

one of the three constituents of the criteria in the following sql query results to no query (at least one):

$sql = ("SELECT  * FROM sc_users WHERE username = '$myusername' and password = '$mypassword' and isadmin = 1 ;");

either you have no user with username gatekeepr (which I believe is the case, it very likely is gatekeeper)... or one of the other two... check for gatekeeper.

P.S. You have gatekeepr spelled wrong.

bibiki 18 Posting Whiz

i guess you pass new Graphics g to it or something. do you pass the same g that you set color to on to paint()?

bibiki 18 Posting Whiz

have you by any chance included a super(g) somewhere in either your constructor or paintComponent or repaint() method? if yes, remove it.

bibiki 18 Posting Whiz

JavaPrograms, as an idea, I would recommend you replace your switch case statement with if-elseif statements and I believe you'll see the problems times variable is giving you. otherwise, NormaR1 has helped you a lot. just take a break, and get back to your code after a few minutes.. and perhaps you'll figure it out

bibiki 18 Posting Whiz

well,
I am not sure I can help you much with these issues you are having. However, I would like to just give you some feedback which might help you rethink things and perhaps find a solution.

your line fifteen says "do line 17 if there is no more results in rs"

AND, you reset the selected item on line 26 every time there is a result in rs. naturally, this causes the last result on you result set to be selected as the item on cboBreed.

hope this helps a bit.

bibiki 18 Posting Whiz

try this:

"select BreedName from breedmaster where BreedName like(%"+ch+"%)";

this could be one problem. hope this works, if it does not, let us know what exactly is happening so that we can help you more.

bibiki 18 Posting Whiz

you can do the filtering on the database. this is actually very easy in sql based databases.

perhaps a key up handler should be defined. every time a key is released, the database should be queried for records that contain the string you have in your input field, or whatever it is, and then the query result should populate your combobox.

querying database records that contain a string on a field is as easy as:
SELECT * FROM table WHERE field LIKE(%str%);

the % character is important because based on it the database knows if you are looking for records that start with str, or if it does not matter where str is within the desired queries. just do some searching for 'sql like' and you will be fine.

bibiki 18 Posting Whiz

harinath, he is looking for how to store a number with 10^6 digits, not 10^6 itself.

bibiki 18 Posting Whiz

:$ my bad. haven't looked at the code, just assumed he didn't put it in. I beg your pardon.

bibiki 18 Posting Whiz

before I highjack the thread:

import javax.swing.*;
   import java.awt.*;

   public class Println extends JPanel{
   
      public void paintComponent(Graphics g){
         System.out.println("It's happening");
      }
      
      public static void main(String[] args){
         JFrame frame = new JFrame();
         JPanel pan = new Println();
      
         frame.getContentPane().add(pan);
         frame.setSize(500, 500);
         frame.setVisible(true);//if I comment out this line, paintComponent is not invoked. only when this line is executed is paintComponent invoked (seems like).
      
      }
   }

anyways, sirlink, try puting as the first line in your paintComponent this line: super.paintComponent(g); this line clears everything in the pane before it draws what follows in your paintComponent.

bibiki 18 Posting Whiz

I could be wrong, but when you add a panel onto a frame, the panels paintComponent is automatically called. the other more experienced guys should correct me if I'm wrong.

bibiki 18 Posting Whiz

see, LongitudinalWaveProgram is your frame. you have this extending JFrame, right? that just means it is the frame. then, your LongitudinalWaveGraphics is your panel, because it extends JPanel, right? I don;t see why do you need line 13 in your LongitudinalWaveProgram file. And, I might be wrong, but I think you do not need to invoke repaint() inside your DrawLong(). hope this will be of any help. I don't think Vista should be a problem for the flashing.

bibiki 18 Posting Whiz
public LongitudinalWaveProgram (){
JFrame frame = new JFrame ("Longitudinal Wave - Adam");//instead of this, I believe you want to reach the effect that super(Longitudinal Wave - Adam); would reach. In addition, why do you need another frame named frame when LongitudinalWaveProgram is itself a frame?
JPanel pane = new JPanel ();
 
 
LongitudinalWaveGraphics lwg = new LongitudinalWaveGraphics ();
lwg.LongDraw();
pane.add(lwg);//here, you are adding a frame onto a panel. you should add a panel onto a frame

you're constructor method is a little messy, James explained a little earlier this what I am trying to explain. fix you're constructor method, or at least write comments, instead of actual methods, explaining what you want your constructor method to doo, one step at a time

bibiki 18 Posting Whiz

by any chance you're using jGRASP? I know that using jGRASP this happens frequently. If so, look for a Run menu on your menu bar, and there you have 'Make this main project' or something... this is of course assuming you are sure you're not adding Resistor... instead of Longitude... panel to your frame.

bibiki 18 Posting Whiz

your maintextarea variable does not hold anything. just assign it something, I guess new JTextArea();

Eiting: it's null. that's what your error message is telling you.

bibiki 18 Posting Whiz

go ahead do the sorting. just google for 'bubble sorting in java' and you will find a solution. however, inside your sorting, you need to do parallel rearrangement of your other arrays. hope this helps.

bibiki 18 Posting Whiz

you are welcome. i'm glad i helped!

bibiki 18 Posting Whiz

switch line 87 with line 88. the if statement should be inside the for loop, that means behind the bracket:

for (x = 1 ; x <= 10 ; x++){
if (age[x] <= 24 && bataverage[x] >= .280) //This is where the problem is
{
c.println ("Name: " + name[x]);
c.println ("Age: " + age[x]); //this prints age=0, even though the value stored in the area doesn't=0
c.println ("Position: " + position[x]);
c.println ("Batting Average " + bataverage[x]);
}
}

besides, in lines 80 through 83, you seem to change the values held by elements on array age. i don't know why would you want to do that. i tried compiling your code, but my compiler can't find Console class.

bibiki 18 Posting Whiz

no, the location of if statement is correct, it should be inside your for loop.

bibiki 18 Posting Whiz

you need an if statement. you need to check if a record held on the array you stored information corresponds to a player that is younger than 25 AND that has a batting average greater or equal to .280. is this of any help?

bibiki 18 Posting Whiz

if you wanted to get back to six, you'd need to save somewhere the result of 6/2 first. that way, 6 = (6/2)*2 + 6%2, in general a = (a/b)*b + 1%b. (I'm assuming you work with Java, and declare your variables as int since 7/2 = 3 (not 3.5) for Java ints) otherwise, there is no inverse function of modulo function. and please, quit the slang as it makes it necessary to read your posts at least twice.

bibiki 18 Posting Whiz

I would recommend jGRASP. it is very easy to use, and it does not have the auto-complete feature of Eclipse. it does have features that make numbering the lines of code easy, as well as indentation. I have tried Eclipse, but left it for jGRASP. hope this helps.

bibiki 18 Posting Whiz

well, remove lines 22 to 24 first. you do not need that if just yet. then see what .you get, perhaps that will direct you.

bibiki 18 Posting Whiz

try k less than 7...it most likely won't work perfectly, but it will give you a hint. tell us what does your int[][] a parameter to the method hold. it's dimensions. besides, you could reach the effect with a one-dimensional array as well...

bibiki 18 Posting Whiz

I think you only need to pass to the constructor method of JTextArea two in variables, int rows and int cols, and they will appear. try that and see if it works, I haven't tried. and please, post your code

bibiki 18 Posting Whiz

for comparing whether a number is between two and five (inclusive) digits in length, you can also do a test on whether it is grater or equal to ten and less than 100.000. another advantage of this is that someone could give your app an input such as 01, and although its length is 2, it still is wrong because the output would be 'zero one' which should be same as 'one'... in case you proceed with testing input length as a string length.

bibiki 18 Posting Whiz

i think each line is read as a single string. as a result, you could temporarily store your file in a String array, each line, one element on the array. and then, you put back the strings from your array to the file, excluding the ones you do not need on the file. that just means that you need first to open your file, count how many lines it has. initialize an array with that many elements on it. store file lines on the array. reopen your file, but now on writable mode (but not appendable), and put the strings from your array back on the file. hope this helps.

bibiki 18 Posting Whiz

you need an || (or operator) inside your loop, not an and operator. plus, in this code you posted you need two more sets of brackets, although I think you can do without the curly ones:

while ((lineNo == 1) || (lineNo == 2)){
br.readLine =null ;
}

try this know, and see if it works

bibiki 18 Posting Whiz

I tried to compile your code, but as I expected line 17 complains. besides, = is not a comparison operator, I assumed you meant ==. check that first!

bibiki 18 Posting Whiz

there must be some if statement that checks whether bullet border's (x and y positions) equal those of a monster, right? now, try adding/subtracting a few pixel's in that statement like:

if (bullet_border + 3 pixels == monster border){monster disappear}

if that does not work, try subtracting 3 pixels :)

bibiki 18 Posting Whiz

yes there is. there must be somewhere in your code a part that updates bullet's position by increasing/decreasing the values of bullet's x and y positions. if you increase the number by which x and y positions increase, your bullet appears to move faster in your screen.

bibiki 18 Posting Whiz

try posting the rest of your code.

bibiki 18 Posting Whiz

the best way to know if you are getting it right is to implement it, and along the way you'll see what you are doing wrong. what I tried to say is not exactly what you said last, but that does not mean your idea won't work. try it, see if it works, and if does not, come back and tell us what you did, and someone will help.

bibiki 18 Posting Whiz

hey javanoob101,

you have one "monster" class. since you want more than one monster showing on your screen, you instantiate multiple instances of monster class. so, there is one single class, but multiple instances of it.

now, when you do the instantiation, you store all instances on an array. and, inside your class, you could have some boolean variable that is initially true, but turns false once a bullet hits an instance of it. as a result, your machine knows when to print the actual instance of monster and when not.

as I myself am more of a beginner that an experienced programmer, I think I'd share my understanding of solutions offered as beginners are more likely to understand one another than experts :P

bibiki 18 Posting Whiz

I think when you instantiate your instance of FileWriter you need to do so in appendable mode. to do that, you write as follows:
new FileWriter(PassengerInfo.txt", true);

let me know if that works.

bibiki 18 Posting Whiz

you are welcome jsefraijeen,
if your problem is solved, mark this thread solved then lest someone reacts to this post four years from now like i see happening in other posts.