BestJewSinceJC 700 Posting Maven

Please don't ask unrelated questions in the same thread. Create a new thread with the appropriate title. That is, unless the questions (or answers to those questions) directly cause new problems.

As for your actual question, have you tried using the setVisible(true) method? You may need to call a method after that also to cause the widget to render. Or it might not work for applets at all, but it is listed in the JApplet class doc.

BestJewSinceJC 700 Posting Maven

That third post sounds about right, though I admit I haven't read all of your code. Let us know if you have any trouble. Welcome to the forums

:)

BestJewSinceJC 700 Posting Maven

You cannot define methods inside of other methods. Any code, other than variable declarations, needs to be inside of a method. All you need to do (to make your code compile) is fix your brackets so that your code follows the rules I just mentioned. Making your code run correctly is a different issue. Once your code compiles correctly, repost it and explain *in detail* what problems you are having.

BestJewSinceJC 700 Posting Maven

Why would you declare "k" as type float? It should be declared as an int. Also, the ";" at the end of the for loop ends the loop. In other words, the for loop does not apply to the line directly after it since the ";" is there. Repost the code and tell us what errors (if any) you get.

BestJewSinceJC 700 Posting Maven

I don't see how your catch statement could possibly generate that error. You misaligned your code. Where in the code does the error actually occur?

BestJewSinceJC 700 Posting Maven

Look at your brackets. You can't put a for loop in the middle of a class definition. It has to be inside of a method. On line 21, you put a '}' that closes your main method. Then you defined a method "getCourse()" and afterwards, you have a bunch of code that is not inside of any particular method.

BestJewSinceJC 700 Posting Maven

Explain your problem better. It sounds to me like the command prompt is trying to tell you that the command line utility you're trying to use doesn't actually exist or cannot be found basically. But I'm no expert.

Edit:

To add to that I think there is a way in Microsoft OS'es to add an exe so that it is recognizable to be run anywhere from the command line. Otherwise you can navigate to the directory where your exe is located and run it from there. Don't know if that's helpful. My usual strategy is to "figure it out" when dealing with command line tools.

BestJewSinceJC 700 Posting Maven

Because arrays get special treatment as per the specs:

Why is that special treatment? Because they actually overrode clone..? Do they not usually do that?

edit: jumping ahead of myself, trying to catch you before you got out of the thread.

BestJewSinceJC 700 Posting Maven

ob is an array which is also treated as an object, and hence has a default clone method which is called at (1). But the default clone method returns an Object reference, so that should not be assignable to an array of type hello. But its being assigned here to an array of hello type without errors. Why ?

An array is-an Object and therefore you can call methods of the Object class on an array, which inherits these methods. However, as you can tell by writing a short program, the array class overrides the clone method. Therefore when you call clone() on an array, it does not simply return the same Object reference, but it actually creates another array.

Hello ob[]={new Hello(),new Hello(),new Hello()};
Hello ob1[] = ob.clone();
if (ob == ob1) System.out.println("Same");
else System.out.println("Not the same");

The above code prints not the same, which to me, indicates that a new array Object has been created. The exact details of what the clone() method does for the array class I don't know, or really care. You will note, however, that if you print out

if (ob[0] == ob1[0]) System.out.println("ob the same");

it will indeed print out that they're the same, which is because in that case, your Hello class does not override clone, so it just returns the reference.

BestJewSinceJC 700 Posting Maven
while  (number !=-1);

You never change the value of number in the loop, so this remains true forever.

Actually you are partially correct - the ";" was unintended, though, which is the cause of none of his other code being executed, which in turn is why his answer never gets printed out.

BestJewSinceJC 700 Posting Maven

Your program is stuck in an infinite loop. You said

while(number != -1)[B];[/B]

. Notice the ";". That causes the program to think "oh, the ; represents the end of the while loop". Remove that symbol and see what happens. You also never changed the value of number, so even after you make this change, it will not work. Since you never changed number, number will never be -1, and the while loop will never exit. You should change the first "while" to "if" and your program should work.

BestJewSinceJC 700 Posting Maven

That's why he should be using some sort of "start" protocol in the first place. Either the client or the server blindly expecting a successful socket connection to mean that they have the "right" connection is bad design in the first place.

Agreed, it would be, and yes, there is a start protocol (although it was not specifically designed with the intent to thwart "bad" connections). I think I will just try various ports in order then. I did know you could do that, but I figured a better practice would be some way to advertise what port you're on. Thanks for the replies guys.

BestJewSinceJC 700 Posting Maven

Sort of like your telephone number. If you change it, how will your friends know the new number.
Have a web site/page where you post the number that can be read by the software that needs to know your current port.

What other software is taking the number?

I have a Server that sits on a port and offers a Service. Any client that wants to connect should be able to. The problem is, how does the Client know what port my Server is listening on? The port could be hardcoded, but then if another program is already using the port, it will fail. PS, I'm fairly certain there is a better way than advertising it on the web. Maybe I'm going about this wrong though.

BestJewSinceJC 700 Posting Maven

Hi everyone,

I'm in a situation where I would like to have a ServerSocket that listens on a specific port. However, if this port is already taken, I would like to listen on a different port. How can I advertise what port my Java program is listening on, so that clients who are connecting to my machine know what port to connect to? Otherwise I do not see how a client would know where to connect to. If anyone has any useful links, advice, or even search terms that would be helpful, as I don't see anything. Thanks.

BestJewSinceJC 700 Posting Maven

Methods. Keep in mind that a method should do one thing and do it well. Some of your code can be broken down better; for example, you should have a method which gets one judge's score and another method that calculates the overall total score. The overall method would call the method that calculates one judge's score. The way you have it right now, if the methodology behind finding a judge's score changed, it would cause more problems. Consider, for example, if you wanted to change your program so that it got each judges score from a database. All you should need to do is change the mechanism/method that gets one judges score.

Hope that advice is helpful, but yes, methods are definitely the way to go for any code that you intend to be

1) reusable
2) modifiable
3) readable

BestJewSinceJC 700 Posting Maven

russia being at the top of the list doesn't surprise me. they have a whole cyber army for goodness sake. (as does china i believe) where's the U.S.'s cyber army? =P

In their Mom's basement

Nick Evan commented: :) +0
BestJewSinceJC 700 Posting Maven

No, there is no logic behind that. Why use a programming language if you're forbidden from using any of its features? But the question is intriguing..

How is the input read in without any Java API? Do you actually mean no Java API methods are allowed? Or are certain ones allowed but not others?

BestJewSinceJC 700 Posting Maven

Very useful link s.o.s. and thanks everyone for the replies. To summarize (for anyone who comes to this thread at a later date) I tested the theory of s.o.s's link by using

Integer i = 127;
Integer j = 127;
if (i == j) System.out.println("true");

And it prints true, but

Integer i = 128;
Integer j = 128;
if (i == j) System.out.println("true");

Does not print true.

I think it is true that the Java specification does *not* say that the references can't be the same when the primitive value is 128, just that it *has to be* the same if the primitive value is 127 (or any of the other values mentioned in that link). By the way, going back to my first post, if you explicitly create a new Integer Object, then obviously, the references won't be the same.

Thanks again guys

BestJewSinceJC 700 Posting Maven
Integer i = 5;
Integer j = 5;
if (i == j) System.out.println("true");

^ Prints true

Integer i = new Integer(5);
Integer j = new Integer(5);
if (i == j) System.out.println("true");

^ Does not print true.

I understand that in the second case, the == is comparing the references. But why not in the first case? It almost seems like the compiler is treating it as two 'ints' in the first case, since it knows in advance from the declaration. But shouldn't it be autoboxed as an Integer? Thanks

BestJewSinceJC 700 Posting Maven

Thanks, the link is much appreciated. The fact that they aren't changing the objectives means regardless of how they change the test questions, the same topics will be covered, so that's good enough for me. Thanks for your help s.o.s.

BestJewSinceJC 700 Posting Maven

Oracle Certified Professional Java Programmer was formerly known as the Sun Certified Java Programmer certification. Does anyone know if the switch to Oracle has changed anything significantly, such as the questions that will be on the test? Or is it the same cert with a new name? The reason I ask is because it is easy to find materials to study for SCJP, but not for the new Oracle one.. do the materials for SCJP still apply?

Thanks

(btw - I did a search, plenty of SCJP questions, but don't see this one answered anywhere.)
(also, hi guys, long time no see :) )

BestJewSinceJC 700 Posting Maven

Update: I've accomplished the above by typing crontab -e into a command prompt on the server, then modifying the file with

59 23 * * * wget http://distillery.bah.com/~iteam1/RunScriptNightly.php

Which should run at 11:59 pm each night. It has the side effect of causing a log to be created on the server (when I type 'ls' command, it says I received new mail, and it says the directory and filename in which the mail is located). It also downloads the file (because that is what wget does) and drops it into a directory. To be honest, both of these things annoy me. I could run another script using cron to clean up after this mess, is that the best option?

BestJewSinceJC 700 Posting Maven

I read on various articles on google that a 'cron job' is used to schedule a task to run periodically on a server. I'm in a situation where I need to schedule a script to run nightly. The script would probably be written in php and update a MySQL database. Is a 'cron job' the ideal way to accomplish this? Thanks for any information

:)

BestJewSinceJC 700 Posting Maven

Changing the variable "size" in the Vizatuesi method has no affect on the value of the variable size that was originally declared in the paintComponent method. In fact, the 'size' variable in the paintComponent method and the 'size' variable in the Vizatuesi method are two completely different variables. When the Vizatuesi method is called, a variable called 'size' is created on the stack. This variable is completely separate from the size variable back in paintComponent.

bibiki commented: it's not the first time that BestJew answers my question right. +0
BestJewSinceJC 700 Posting Maven

Hahaaa

Don't give this 'homework kiddo' any help

BestJewSinceJC 700 Posting Maven

Well that doesn't show where you called the layout method and what you called it on. See this article which reiterates what I explained before.

BestJewSinceJC 700 Posting Maven

Can you show me what you tried doing? Just the relevant parts, like setting the table data then attempting to redisplay it. You might also try calling the layout() method on the Display that contains the table. Basically calling it on the outer component might work. I forget the correct terminology and TBH I don't have Eclipse installed right now due to a hard drive failure and subsequent wipe, so I'm not in a position to test anything.

BestJewSinceJC 700 Posting Maven

It happens because changing the size of the column indirectly causes the layout() method to be called on your widget. In order to dynamically insert data into the table, you could just call layout() on the table after you add the data. Then you won't need to reset the column size.

BestJewSinceJC 700 Posting Maven

You have several tests in your actionPerformed method; this implies that you should probably have a separate ActionListener for each button. For example, since b1 is 'Up' and b2 is 'Down' you should probably have separate listeners for those. Otherwise, it is pointless to use an inner class and you might as well just have OrderItem implements ActionListener.

As for the question you asked, you can access the variable of the outer class by using [from the inner class] OuterClass.this.varName

BestJewSinceJC 700 Posting Maven

Sometimes people actually buy products because they're good. What you suggest might work for a while, but there is no way that Apple could sustain the market if this were just for the cool factor as you suggest.

That isn't what I said. I never said their technology was no good, just that the extent of their competitive advantage is small or none. In other words, without the 'cool factor' Apple might have an advantage in the products they sell, but in my opinion, it is a small one. Apple only gets many of these sales because they are the cool thing to buy.. as you implied yourself (i.e. passion to buy). Maybe you disagree on that first point about the technology, but I don't think google would have a very hard time encroaching on Apple's market - they have the resources, the technical know how, and the cool factor needed - to produce and sell the products that Apple is known for. I do not believe that Apple, on the other hand, has the technical know how to make significant gains in Google's market. That, to me, means that Google has an advantage as far as the topic of this article goes. And is probably why Google doesn't have a problem with taking jabs at Jobs.


I don't know if I'm phrasing my point very well here ..

BestJewSinceJC 700 Posting Maven

Apple sells their products based not on passion like you claim, but a desire to fit in. People use google products because they are technologically superior to competitor's products, which is something I do not think of Apple. To explain further, I do believe that Apple has good technologies, but in their popular product lines, they do not have that much of an advantage over competitors - except that Apple is the cool thing to buy. When it is no longer socially cool to buy Apple products, Apples sales will fall. Google does not need it to be "socially cool to google" because their search engine is simply better, so people are going to use it regardless.

BestJewSinceJC 700 Posting Maven

I agree, well at least I think the moderator badges and stuff should be static and plain to see and carry the greatest weight of importance. However, it is probably something which is near the bottom of Dani's To Do list if she is considering changing it.

Doubtful. It simply isn't on Dani's list. Last week people were complaining about the lack of the aforementioned information, and Dani implemented the "invisible fix" (i.e. you have to highlight the name to view the stats). IMO this is valuing "cleanness of appearance" over usability.

BestJewSinceJC 700 Posting Maven

Balls, she got me. Test case .. fail? Smh. To explain, I thought this shenanigans was broken because after posting, I clicked 'expand' and nothing happened. But after refreshing the page, it expands again.

Luh you

BestJewSinceJC 700 Posting Maven

>> Never accused you of such. I used your post as a point of reference; just an example of the sentiment reflected by many, in the life of this thread and others similar, concerning the recent changes.

Fair enough, lets move on and be grateful that Daniweb doesn't look like the site that The Dude linked to.

:)

Nick Evan commented: Amen +0
BestJewSinceJC 700 Posting Maven

Both are complete crap. By comparison, either version of Daniweb is unbelievably amazing, despite any flaws.

BestJewSinceJC 700 Posting Maven

>> My opinion is just as irrelevant as others opinion. My suggestions are just that, suggestions. I will not try to impose my opinion coercively, even when I am on the majority.

>> This is not my site. It is not a democracy. Still will be here if I don't visit anymore. My opinion is just as irrelevant as others opinion.

I have no authority here and cannot force anyone to do anything. Accusing me of being coercive is therefore just a strong statement with no basis. And the freedom to express your opinion is an inherent right, democracy does not grant it.

I hope I have not misunderstood or quoted your post out of context, but it seems to me that you understood my actions out of context. My decision to discontinue posting in the other forum isn't a threat. IMO, sitting idly by, despite the fact that I have no intention of continuing to post here if certain things don't change, makes no sense whatsoever.

BestJewSinceJC 700 Posting Maven

The homepage content I mentioned in my previous post doesn't save between log ins? Its probably a cookie or something but should be saved as settings for each user IMO, so it should work anytime you log in.

BestJewSinceJC 700 Posting Maven

Dani:

I like how you've organized the tabs in each forum so that I can easily switch between filters. The option was there before (I think?) but I never used it. One idea for that area .. it would be cool if members could create their own "custom sorts". For example, you give a list of options and members can combine the options. For example, given the following list of options:

"My favorite forums"
"Unanswered Threads"
"Today's posts"

It would be awesome if I could make a custom filter that produced the results "Today's unanswered threads in my favorite forums", which would just be an && of all of those options I listed above. This could also allow you to define a set of generic filters, but allow members to add their own or remove ones they don't want from yours.


I don't know if this changed since last time I looked at the homepage or not, but I like the system you have with 'Recommended Forums' and how that causes the homepage to be customized. That being said, after I select the forums that I want, the 'Recommended Forums' list should not be in my way anymore. Even if I minimize it using the box you've provided, the next time I go to the homepage, it is in my face again.

BestJewSinceJC 700 Posting Maven

Thank you for making the "code" button darker. Maybe new members will use it more often now. Like other members have mentioned, the quotes are difficult to read. I currently either have to squint or move closer to my screen to read them. Making the font larger and darker would be helpful. Oh, and again, minor, but "Originally posted by cscgal" > "Quote originally posted by cscgal".

BestJewSinceJC 700 Posting Maven

Dani most certainly is listening, and acting upon many of the points raised in this forum. However, there is a difference between listening and accepting every argument made.

There is a clear consensus on two issues - the quotes system and readability. Font size is the biggest issue affecting site usability, yet nothing has been changed, despite almost everyone who commented complaining about it.

The reason I'm no longer posting in the help forums is because, for example, the simple act of scanning the thread listings is frustrating. To continue to post in those forums would indicate that I find the current state of things usable, which I don't. I do not think that my opinion is more important than anyone else's in regards to the site design, and if Dani refuses to change certain things, I understand that. But since I no longer find it enjoyable to post, I won't be posting anymore if certain things don't change.

BestJewSinceJC 700 Posting Maven

IMO, she isn't listening. At this point, the only way to effectively make the point is to refuse to help anyone in any forums, unfortunately.

BestJewSinceJC 700 Posting Maven

Dani you need to take the feedback of your users way more seriously. You didn't fix the quotes to anyone's satisfaction (still hidden by default, still hard to read due to black on gray) and you also have made no changes to the large fonts.

(I know I said I was leaving, but Community Feedback forum doesn't count.)

:p

BestJewSinceJC 700 Posting Maven

I'm also gone for awhile. I've given it a fair shot but the Java forum where I spend most of my time isn't getting any easier to read. I'll be back when threads are easy to quickly assess (as far as which ones are important at a first glance), read, and respond to again. Peace.

BestJewSinceJC 700 Posting Maven

It can't hurt so when in doubt, do it. As far as I know the only possible consequence is that no other file will be able to open the file for writing until you close the FileWriter, but I also suspect that garbage collection might cause the FileWriter to relinquish its resources as part of the garbage collection process anyway. Again, those are my suspicions, do not take them as fact. But do know that only one thread at a time can have a file open for writing, so if your FileWriter is not closed, you haven't given that resource back to the OS, and as a result, nobody else can write to the file while it is open.

BestJewSinceJC 700 Posting Maven

So they do have more colors than purple! :P

I noticed that the quotes now have an 'expand/contract' type button on them. I'm not sure if they show by default yet, though..

(edit: nope .. and sometimes when I click expand/contract it won't do so until I reload the page.)

BestJewSinceJC 700 Posting Maven

Yeah I can but I'm not going to. I would explain it to you but you're clearly useless.

BestJewSinceJC 700 Posting Maven

That sounds like a 'hack' solution rather than a true fix. Assuming that your computer's decision of where to go is fast, you should just run all of your code on the Swing Event Dispatch Thread. For example, see how they call createAndShowGUI() in this example (pay attention to the code in main and in the createAndShowGUI method, the rest is unimportant). You can't run into the problem you described if the code is all running in one thread, and in this case, doing so shouldn't cause your application to freeze since you have very little time sensitive code.

BestJewSinceJC 700 Posting Maven

I should have used the sarcasm tags. :idea:

~s.o.s~ commented: LOL? :) +0
BestJewSinceJC 700 Posting Maven

My friend is building something (in fact, he already built it) that requires an embedded device. The requirements are that it be as cheap as possible and be able to run a GUI that allows the user to select a drink or create a drink and have a little bit of additional memory so that the user can save a drink. The GUI will be displayed on a touch screen.

My question is: what language(s) would be best for this, does anyone have any links to helpful information, and does anyone have any advice on the hardware needed, how much it costs, etc? I'm assuming it will be pretty cheap because it isn't speed critical and the only requirement is that it can run the GUI.

Thanks for any advice.

BestJewSinceJC 700 Posting Maven

You're such a sweetheart Nick.