Les Morgan

Rancher
+ Follow
since Sep 29, 2015
Les likes ...
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
Cows and Likes
Cows
Total received
19
In last 30 days
0
Total given
0
Likes
Total received
123
Received in last 30 days
0
Total given
104
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Les Morgan

I like the analogy!

I recently got carried away writing a SQL Script, about 600+ lines later I needed to debug it. It was all basically code that I had writen before.  Low and behold we had upgraded our version of SQL and our debugger didn't work. I was left with the task of manual debugging 600+ lines of SQL Script. I barely retained my sanity over the day and a half it took to debug.

Les
2 weeks ago
Back in the day it was a Radio Shack Color Computer, the old gray case with the black square buttons for keys, it had an RF modulator on the output so you could plug it into your TV or you could bypass it and use a composite monitor. 16K (I piggy backed another 16 so mine had 32K) was the whopping amount of ram and it ran on MS DOS precursor and BASIC all ROM based. It was a 6809E CPU from Motorola running at 0.89 MHz.

I soon found that it was so mind numbingly slow that I took up assembler, and programmed in assembler and basic until I want off to college.

I derived 3 years of college in my spare time using that little machine, so when I got to college all I had to do was learn the names of most of the methods that I had derived at home in my spare time.
1 month ago
In general, Java is faster because of the JIT Compiler.
3 months ago
Domingas,

As already stated it is impossible to comment on your code when you do not include it.

Here is a general rule of thumb that I use when doing graphics:

Draw your background image to your graphics context, this clears your screen; then draw your objects into the graphics context, that makes it appear that your objects can float over your background; use double buffering to keep the flicker down.
4 months ago
Roger,

Paul brings up a very valid point, but to answer your question:

Most programming problems are born out of 3 things: scope, visibility, and life. In order to use the methods and properties of an object, you have to get a reference to that object.  To get a reference to an object you have to have visibility of that object. To have visibility of an object it has to be in the scope you are coding.  In order for it, or a reference, to be in the scope you are coding, the object has to be live.

So basically, you get a reference to the object, then you can use any of its appropriately methods or properties that are appropriately visible to you.
4 months ago
Jon,

There are 4 instances that I can think of where I use static:

1 -- Factories: I don't want to have to instantiate a factory just to use it.
2 -- Class Variables: they are like wormholes, they are the same throughout the universe. If you don't know what that means, then don't use them.
3 -- Interfaces: you can add static and default methods to an interface and not have to recompile the project--static and default are not the same thing.
4 -- constants: static final--they are what they are and you cannot change them anywhere.

There are probably more, but the very best thing I can say is: as a general rule of thumb, don't use them. So unless you know you really want them, what they do for the instance you want, and specifically what the side effects are in using them.
4 months ago
Could you give us a little more to go on? Are you looking to store in a DB or just "trick your admins"?
Using NetBeans it is very easy to make a JAR:

On the menu choose "Run" / "Clean and Build Project"

once it is done, the JAR can be found in the "dist" (distribution) folder of your project director.

7 months ago
the -cp option is a commandline option that can be used to set the classpath, path, that your OS uses to search for your Java support files.

I was surprised at your statement about google not having any references... so here is a google search parameter list that should get you tons of answers for your subject: "java classpath environment variable"

BTW: when I tried googling class path and java classpath -cp and all combinations thereof, I received many, many hits... more than I cared to follow.
8 months ago
I look at the code you posted and reviewed your question, the quandary that I am left with is: "This is not your code." The next thing that comes to mind is that it looks a lot like a homework problem from HS or an entry level comp sci class, either being the case, then I'll assume you are taking it to get a grade. The next quandary that comes to mind is: "How are you going to give me credit for your course for doing your homework?"

So... Do you have a specific question, other than, please do my homework for me, like: I don't understand what a binary tree does... tons of examples on google there, or how do I decide if it's a left node or right node--also tons of examples there on google.

If you have a specific question, please ask.  while this is not a homework service, there are many experienced programmers waiting to help you understand, but no do the work for you.

8 months ago
You have "before" and "after" that you can use it's very simple:

return myCalendar.before(newCalendar): // returns true if the date is before myCalendar;

return myClaendar.after(newCalendar); // returns true if new Calendar is after myCalendar;
8 months ago
I see, and a very good point indeed. I think then that I would randomly generate a point, and do an area search for the highest probability in that area, probably using the grid overlay idea on too of the area.

So lay the grid out, I like the 2X2, and take a random shot, then search say 2 or 3, or even a random number, grids in each direction from the random shot, and choose the highest probability in the area.
8 months ago
Rafael,

I do not see your problem, the logic is identical; if you did it, as you say, before, then you are still just doing a boolean check to see if something is selected or not.

What are you having the problem with?

Les
8 months ago
Carey,

I am afraid my thinking goes along this line: since you have probabilities and there are ships of finite sizes, then I would overlay a grid and pick the highest probabilities from that grid. So in the classic Battle Ship, you have 2, 3, 4, and 5 hole boats.  I would start with the 2 grid and choose the coordinates with the highest probability.

Les
8 months ago
Claude,

If I am correct in my understanding, then you want to know how many PoJo's there are (objects that have been created).  This seems like an excellent place to take advantage of a Class Variable.



With each "new MYPoJo()", the creation of an object of type MyPoJo, then the counter gets incremented by 1.  This Class Varaible, iPoJo , is referenced in each instance of a MyPoJo object.

Les
8 months ago