• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in why is my program looping

    Line 8 you have a missing ] and your quotes are all wrong - there should not be quotes round the array references. It should look more like (p1_num[0] + …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in split serial string in processing

    If those fields are separated by a comma and a space, you can simply use String's `split` method to create an array of fields String[] fields = sensorReading.split(", ");
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Request for help | AI

    Please don't let me put you off. The world we know was made by people who didn't listen to the no-sayers. Go for it! I wish you all the luck …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Create entities when near screen?

    ... that sounds like you are doing the right thing already. Maybe this is just an example of "premature optimisation" - trying to fix a performance problem before you know …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Create entities when near screen?

    Looking at that I wonder if you can/should split updateAndRender into two methods so you can call update for all the entities, but only call the expensive redering for the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Request for help | AI

    Your enthusiasm and commitment are truely superb. I'm sure that you have the right attitude to achieve great things. But in this case I agree that this total project is …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JavaFX: ProgressIndicator TableCell implementation query

    Hi n21115 JavaFX is still very new as a mainstream technology, and it looks like not many people here have got any real in-depth experience with it yet. Even if …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Create entities when near screen?

    I'm confused about the client updating entities. Yes, the client will *render* all the entities that are in its current viewport. But the clients do not have enough information to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Create entities when near screen?

    If you don't keep them all updated, how will you know what their correct state is when they come on-screen? If you don't keep their position updated, how will you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in why is my program looping

    You didn't show the declaration of `numtries`, but I suspect it's an int. `equalsIgnoreCase` is a method for the `String` class, so you can't use it for an int. You …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in why is my program looping

    You're welcome!
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in duplicates elements in array

    ...and another thing ... Funny how the thing you just coded turns out to be already in the API. I wanted to limit the size of the cache by removing …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in AP Computer Science help

    code III has invalid syntax = it uses the method names without their ()
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how to make tabs bigger in size

    By messing around with null layout and setBounds you are really wasting your time. Pixel positioning/sizing of components is useless in a world where screen resolutions go from 72dpi to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in why is my program looping

    That's how Random works - one number at a time. If you want multiple random numbers then use a loop like I showed, and inside the loop put the numbers …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in why is my program looping

    You seem to be trying anything in that statement without thinking about what you are doing. `nextInt` is an instance method in the `Random` class. To call it you need …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how to make tabs bigger in size

    If you want to fill a 300x400 window you will need much bigger sizes than 80x40
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in why is my program looping

    I already answered that 2 hours ago.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in why is my program looping

    Just keep calling randomgen.nextInt. Each time you call it you get a new random number Random randongen = new Random(); System.out.println("generate many random numbers between 1 and 15"); for (int …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in why is my program looping

    Probably q is an int variable, not an instance of the Random class
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how to make tabs bigger in size

    Since you are using a null layout manager you can setBounds to make things whatever size you want. What happens when you run your program on a Mac with a …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in duplicates elements in array

    Just for fun, and as part of a "get to know Java 8" campaign, here's a little class that does just that. You create an instance of the class, passing …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in duplicates elements in array

    Create a Map<String, Integer> that contains all the values you have processed so far, and check that before calling your method.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Polymorphism in java(Shape Hierarchy)

    In defense of that particular point... `side` is private. Where I come from it's considered good practice to use the public accessors for private variables, even in the same class. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Learning Java Redux

    + "VALUES(courseID, courseName, department, instructor, courseDescription)" That string just contains the literal variable *names* ("courseID" etc). Didn't you intend to concatenate the *values* of those variables into the statement?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in why is my program looping

    " i always to give age a value everytime the age is re-enter" No you don't. You give a new value to p1age, not to age
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Sockets: Datagram IP address == host IP address

    It's worth a try BUT... == and != test for Objects being/not being exactly the same object (same address in memory). You want to know if two different InetAddress objects …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Earley Parsing Algorithm

    DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in is something wrong with my method calculation

    You have to initialise *every* variable before you use it.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to do a progress bar that display current step?

    The Oracle Java tutorials are always a good source of info http://docs.oracle.com/javase/tutorial/uiswing/components/progress.html
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in is something wrong with my method calculation

    OK, that's better. The line numbers do not match your post, but I guess line 18 is gpa = (totalnumqpts / totalnumcredits); in which case totalnumcredits must be zero, you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in is something wrong with my method calculation

    Hi divinity02 I think you have been around DaniWeb long enmough now to know IF YOU HAVE A RUNTIME ERROR, POST THE ERROR MESSAGE!!!
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in application flood

    What is a "flood" application? DO you have any definition of what's required?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help me, I can't Update/Edit my jTable

    "When I click the save button it shows an error." What is the exact complete error message?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Chat Program: Client to Server to different Client

    Thanks for the apology and problem update. Just to be clear - the (only) take-away message is that typos *in posted code* can cause a lot of wasted time because …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Chat Program: Client to Server to different Client

    Your "just a typo" has probably wasted all kinds of time for people who have read your code trying to help you. An apology would be more appropriate than just …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Chat Program: Client to Server to different Client

    What's the relationship between the `address` and `addressList` Lists? Are you sure that addressList contains all the entries you expect? Is the size() of address as large as you expect?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in need help in setting timer

    Use a `javax.swing.Timer` to call a method that updates the info every 60,000 milliseconds. See the API doc for details
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Learning Java

    As far as I know there are little or no changes to how Sockets or the NIO SocketChannel etc work from Java 7 to Java 8.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in My Chess Game (works)

    ... and it's not great code - obviously written by someone with limited Java skills, so it's not a good example to follow. (Even less a good piece of code …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Jpanel to Jpg/png not working

    You need to do something like: 1. define some variables/arrays/whatever that can hold the definition of the latest random shapes. 2. write a method that populates that with new random …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to fill QuadCurve2D in Java Graphics2D

    You could try combining all those arcs into a single shape that will then fill properly. A `Path2D.Double` may be the best option.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Jpanel to Jpg/png not working

    That's it, just as I suspected. Every time you execute paintComponent you get new random shapes. To get the graphics for the file you call paint, which calls paintComponent... It's …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Jpanel to Jpg/png not working

    What does the paint (or paintComponent) method for the panel look like? The random button just seems to repaint without any explicit randomising, so is the randomising embedded in the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Jpanel to Jpg/png not working

    Line 62 is a terrible mistake. You have a problem related to a file being written In the code that writes the file you go out of your way to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in using position (index) number to find words in text files?

    After using String's `split` method (read the API doc) you have an ordinary array of Strings, which you can search with a `for` loop just like any other array
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in AI - predicting new location of moving object

    In that (simple) case you have two equations for the position at time t Pt, given the initial position p and the velocity pt1 = p1 + v1.t pt2 = …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Reading in a *.csv file and loading the data into an Array

    A bit late for the O.P. (!), but may be useful to someone searching this topic, so thank you.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in AI - predicting new location of moving object

    Are you able to predict the changes in the target's velocity?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in using position (index) number to find words in text files?

    If you split the para by white space you will get an array of al the words, so each word will have its own array index (ignoring puncuation for the …

The End.