verruckt24 438 Posting Shark

Before performing any calculations on the value from the text field just check using a regex whether every character in the text field is either a digit or a period (.) character. You could form the regex so that you can restrict the number of digits before and after the decimal point.

verruckt24 438 Posting Shark

I remember you creating a thread similar to this asking for the same thing. Where you were given this link. Now what has happened according to me is that, you did not mention the version of JDK that you were using in that thread and the link shows you how to get the free space but using JDK 6.0, so you started a new thread this time, asking the same question but specifically for JDK 1.5. But I guess what escaped your attention (or may be you didn't bother to read the entire link) was that, that in the same link towards the end they have mentioned what one needs to do when using JDK 1.5. So I suggest you go and read the lnk once again.

verruckt24 438 Posting Shark

The addItem method of JComboBox takes an Object as an input so you could pretty much try adding JCheckBox to it.

verruckt24 438 Posting Shark

Firstly a combo box would allow you to choose one of several choices so putting check boxes inside it which themselves are used as multiple select components would not be a good option. You could use a list box instead which itself will give you the option of selecting several options within the list so may not not have to worry about putting the check boxes in it.

verruckt24 438 Posting Shark

I am sure you mustn't have been aware of google then because these were one of the top few results there.
1. Threads in Linux --- 1, 2
2. Threads in Windows --- 1

Salem commented: Tsk tsk, he wanted "4" help and you only gave him 3 links ;) +36
verruckt24 438 Posting Shark

"Eye of the Tiger" - Survivor

No, that I was listening to some time before. Let me tell you the truth, but this is Hindi.

"Masakali" - Delhi 6

verruckt24 438 Posting Shark
if ( variable == s[0] ) variable = "some_value0";
else if ( variable == s[1] ) variable = "some_value1"; 
else if ( variable == s[2] ) variable = "some_value2"; 
else if ( variable == s[3] ) variable = "some_value3";

I can't seem to figure out what you are doing here. If you are assigning the value that produced the smallest result to variable earlier then you just need to return the variable.

Also

if ( multiple > 0 ) variable = "fixed_value";

Shouldn't the multiple be multiple_smallest or is it fine because it is just a pseudo-code. But then how do you know it isn't working if this is just a pseudo-code.

So basically this should change to

if (multiple_smallest > 0)
    return fixed_variable;
else
    return variable;
verruckt24 438 Posting Shark

A GUI project/application/program is one where you present a Graphical User Interface such as a Window or form with buttons, textboxes, labels, images etc., where the user communicates with the system with the help of graphical components such as the press of a button, writing of text in text box, selecting/deselcting of a checkbox/radio button, selection of tabs etc as apart from a console based application where a user enters various commands to communicate with the application. Take the simple example of a file creation in a GUI versus a console based application. To create a text file you would hurriedly go to notepad (on windows) or a text editor like gedit and click New from the File menu and start typing the text in the file. To create the same file through console you would have to go to the DOS prompt (or a command shell ) and type "COPY CON filename" then type the file text and then say ^Z to save it. The difference is evident in the GUI method you pretty much do everything with the click of the mouse and press of buttons and coosing of options, in the console based method you have type commands for all things, not to mention the graphical method makes life a whole lot easier for a user.

Now moving towards applet, applets are small applications that run inside the scope of a browser. These aren't typical run from the console, though you can do that through the …

verruckt24 438 Posting Shark

No I did not because I was short on time and used the short, regex, instead, see my previous post. ;)

verruckt24 438 Posting Shark

It's true that I haven't been agreeing with most of what you have to say on this thread but one thing I need to agree with you on is that we both are certainly wasting our time picking at each other which isn't what we both are here for.

Lets say I was wrong and you were right, if that makes you smile and be happy. Yes we both got carried away and thats what we should keep an eye for and avoid. I want you to know that I wanted you to learn the way I think things could be learnt but I guess you have your opinions.

You don't have to go away from this forum. This forum promises help which is much more important than any particular member, whether you or me, if you have to go away just because of this, than it would be like defeating the forum's purpose. I leave this thread open to others who would want to help you. And also you could continue posting your further queries here and I can continue posting my replies to them if I find I could be of help minus all the fued.

:)

Edit : drakagn had already posted when I submitted mine.

verruckt24 438 Posting Shark

I may not be able to answer this question eventually but could guide the first few steps. Well, you don't need to convert the array strings to 1s and 0s and then the 1s and 0s to analog signals that flow in wires all you have to do is throw the data from the client machine by opening a connection with the server on whatever socket the server listens and then on the server side receive the dataand it will be as it was sent bu you. On the server side you could listen to incoming conenctions from various clients by using the accept() method of the ServerSocket class.

You could also "flatten" the array to a file and then send this file over to the server where it inflates it to proper type (assumes type is known). Here the flattening is called serialization and the inflation of the object from the file is called deserialization.

You could always google the terms with "java" to find more about them.

Edit : Damn !!! stephen84s kept it short just to beat me to it. ;)

jasimp commented: He may have kept it short but he had more links ;) +9
verruckt24 438 Posting Shark

What you could also do is read the file line by line, the same way as you are doing now and match a pattern in the read line using the String class' matches method. Where the pattern could simply be the string to be found in the file.

Note : The StringTokenizer is a legacy class and is use isn't recommended this is what the java guys have to say about it. StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead. In your case, instead of the split method the matches would do the job, which itself uses regex.

verruckt24 438 Posting Shark

More approrpiately what you could do here is read the entire line just like what you are doing here and then split the line based on the space character. So you get all the tokens in the first line in an array. The name is the first element of the array, the next are scores. Here the scores in the array are treated as strings, which you could convert into int or double as you require when you need to do the math on them. Then you could move on to read the next line and so on.

Use the split method of the String class to do this.

verruckt24 438 Posting Shark

Doh.. exactly I forgot to mention this which dickersonka correctly points out a name will do fine as well, as long as the DNS can resolve it.

verruckt24 438 Posting Shark

the i is the index position in the array. So if i is 2 it is the third element in the array (since arrays start from the index 0). In a double dimensional array this is essentially the same meaning, say for example you have a 2 arrays where each array is itself an array of 4 elements, they together make up 8 elements.

View this as a matrix of rows and columns
Columns -> 1 2 3 4
Row 1: 5 8 6 1
Row 2: 9 2 3 7

Imagine that row 1 is the first array and row 2 is the second array (each of four elements)
Now which element does arr[0][2] point to ?
Remember again that arrays have the base index as 0, so [0] means the 1st element and [2] means the 3rd element. So this points to the 3rd element of the 1st array, so in effect it means that it points to the 3rd column in the 1st row which is 6.

I hope you get that. You can practice some more using this.

Also it is important to note that even though I mention array elements laid out in rows and columns here, they are actually not placed in the memory that way. We "visualize" the array this way since it is easy to understand them this way. Arrays are laid out in consecutive memory locations.

Reading the array tutorials further would help much more.

verruckt24 438 Posting Shark

I haven't been taught jack about hardly anything I'm on an online course and have basically no instructor with very vague lessons written in worse than terribad context to what I may be actually doing.

This doesn't give you any excuse to not search for information online. Don't tell me, or anyone here for that matter, that you are taking a course in java where you haven't been taught to run programs which should rather be among the very first things taught.
I have seen many classes where on the first days of it they teach you to write and run a program called "Hello World". So don't just throw this crap onto us. Look for tutorials on the class site, I am sure you'll find help there.

have basically no instructor with very vague lessons written in worse than terribad context to what I may be actually doing.

A lot of the problems in the worksheets they give me include the most nondescript instructions that are debatebly the worst I've ever gotten in my entire career as a student.

Then this course is not worth it, do yourself a favour get out of the course.

I wasn't asked to run the code

Hmmm.. exactly and when you are given the exam papers no one asks you to write them. Got the point ?

I don't want to go through all the trouble of doing it becaue I wouldn't LEARN as much

Hehe ....This is a …

verruckt24 438 Posting Shark

This is pretty straightforward. you just need to convert these conditions into langauge syntax. You would need an if construct over here and since you need to check both the numbers you need a conditional operator. You can check these things out on the java tutorial site.

verruckt24 438 Posting Shark

Some natural intelligence would come in quite handy here if it could take you to www.google.com won't it ?

verruckt24 438 Posting Shark

I am not sure about this, but does PERT/CPM fall under discrete maths ?
If yes these are used in project scheduling and management and hence in the s/w made for such systems.

verruckt24 438 Posting Shark

>If both numbers entered are over 100, then subtract 100 from each
>If both numbers are negative then add 200 to their sum.

Isn't this what you want to put in in the loop ?

verruckt24 438 Posting Shark

It should be in that part of your code which doesn't get called in loop. As of now I don't see any loops in your program which would keep asking the the user whether he wants to keep playing or if he wants to quit. I really do not know how in your code you are achieving multiple runs or whether you are even achieving it or not. The result method is something that would be called always passing the guesses of the user to be evaluated, so the result method is certainly not where you would want to put the declaration.

I suggest you change you code in a way first, so that it actually is kinda menu driven wherein after each cycle of guesses you ask the user whether he wants to continue. If he does you cycle/loop through the same process of collecting guesses and figuring out whether he is right or wrong and counting the wins and losses and plays. When finally he wants to quit you show him how he has fared in the entire session by showing him the values of the plays, wins and losses.

verruckt24 438 Posting Shark

Thats because of this:

fermi value=new fermi();

Everytime you call the result method you create a new fermi instance and assign it's reference to the same value variable so that the previous total play, total win and total lose get washed off.

In order retain the previous results you can modify your code in such a way that the same fermi instance is referred everytime a player plays. This is simple to implement, instead of declaring the value variable in the result method just declare for once and keep passing it to the result method everytime you call it.

verruckt24 438 Posting Shark

>I am getting an error for the last line it is saying the maxOutput and minOutput can't be resolved.

Thats quite accurate on the part of the compiler. The reason it says this is because of this :

String maxOuput = "The maximum of your integers is: " +num1+ " + " +num2+ " = " +max+ "\n";
String minOuput = "The minimum of your integers is: " +num1+ " + " +num2+ " = " +min+ "\n";

In both places you are missing the 't' in the Output.

verruckt24 438 Posting Shark

specify the IP address of the server in the place of localhost.

verruckt24 438 Posting Shark

>i create another constructor in d class and declare another statement outside the loop..

Are you creating another instance of 'fermi', I am not sure how that helps, but anyways if it solves your query, just mark the thread as solved.

verruckt24 438 Posting Shark

Instead of giving us th broad description of what you were supposed to do to start out with, where we have to figure out each and everything like the logic, methods, variables etc., give us directly the error that the compiler is throwing at you or tell us where you are stuck.

verruckt24 438 Posting Shark

The problem is you declare 'give' inside this while loop while(quit !=-1) but then this loop ends at the '}' after give.totalPlay(); , so that the 'give' variable goes out of scope and at this statment JOptionPane.showMessageDialog(null,"total play is "+give.totalPlay()+"\ntotal win is"+win+"\ntotal lose is"+lose); the compiler cannot find a declaration for give.

Move the declaration for give outside of the while loop so that it doesn't fall out scope before you want to reference to it.

verruckt24 438 Posting Shark

>one of the main points that I'e always stressed was that threads >are not just there to help the OP but to help many, many other >people as well, years into the future

I don't think I'll try to convince her much on that since I liked the above statement from her as much as I have liked any. This is a real strong and convincing statement, which made my opinion in this matter align with Dani's. And yes this is true, a forum's goal should be helping as many people as it can and not only the OP. So, if someone can post useful information, even if it is six months down the line we should be open to it.

And on a much lighter note, if I need to convice her because of reason that I stated in my previous post, (people putting in their questions in old threads), let me get enough posts and rep points under my belt before I can start of thinking to do that. ;)

Lastly thanks everyone for presenting your views on this topic. Dani, Narue, John A

verruckt24 438 Posting Shark

>i saw many things

Like ? Images ?

>it diffecult to found spisific information about XXX...

Lame excuse that you would hear from a thousand non-triers

verruckt24 438 Posting Shark

>I don't want to know if a thread has been active within the last 3 months, I want to know if the issue was resolved.

I agree with this statement as much as I can, but I was hoping for some mechanism where we on our part can prevent somebody reviving an old thread with a question. I can understand somebody making an effort to answer the original question even after six months, rather it should be done.

But I suppose there's no way to do that.

Also and one thing, yes however we try we cannot change the behaviour, but we shouldn't leave room for a reason for not changing.

verruckt24 438 Posting Shark

We are not here to give you the solution. We are here to help you find the solution if you show initial effort. Where's the effort ? Tells us what have you searched on the net about threads in Linux/Windows. What you are only putting effort in is writing useless posts without following what others are tyring to tell you.

verruckt24 438 Posting Shark

Firstly, there's no need to be so heated up for nothing you can save your energies for your solution finding activity. I wasn't trying to be rude or mean even. All I wanted to make sure was that you understand the problem well, which I did not think you had. Since your understanding of the problem is very important for your answer to be in the right direction otherwise you cannot expect that to happen.

And to answer some of your questions:
>If i didn't know anything 'bout the question, i wouldn't have had posted it!
You don't know thats the reason you have posted the question and posted
how you'd go about solving it. Don't try to show-off now that you knew so much.

And if you know so much :
>I know htat for n elements, there are n! possible permutations
>And I think that the procedure should be something like this:
>(to make it recursive) enumerate the permutatipons of n-1 in each
>time that the recursive algorithm is calle

Then why haven't you already started working on it with whatever you know of it ? Where's the code to show us your effort. All this knowledge yet no code to post means, quite straightforwardly, no effort put in till yet.

>It doesn't matter if you or no one else doesn't share any ideas
>I've always come up with solutions of my own

Hmm... Why …

verruckt24 438 Posting Shark

Have you understood the question yourself ? What do you mean by this:

Describe a recursive algorithm for enumerating all permutations of the numbers {1,2,...,n}

I don't think so, with the way you have copy-pasted the assignment-looking statement. If you haven't understood the question in the first place you cannot even begin with thinking how to answer it. So if you understand that, you yourself would gain a slight insight into what should be done to solve it.

verruckt24 438 Posting Shark

Why can't you continue doing it ? As far as I am seeing you are going good.

Just one thing, if you know you are going to put only even numbbers in the array from amongst 50 numbers, instead of declaring the array as

int L[]=new int[50];

you can safely do this:

int [] L = new int[50/2];

Out of any set of fifty numbers there are never going to be more than 25 even numbers, isn't it so you are saving space on 25 numbers where each one is 4 bytes 25 x 4 = 100 bytes.

verruckt24 438 Posting Shark

But you are still missing two points here. One, that you aren't still catching any exceptions that might occur during such an operation. Only taking the SOP statement up will not work, rather it won't cause any difference. Second, What do you think the program will do if you do not have permission over the files you are deleting, it's going to throw an exception which you are ignoring altogether.

verruckt24 438 Posting Shark
Select resortname from table2 where resortid = (select MAX(resortid) from table1)

Try this.

verruckt24 438 Posting Shark

This means your program is getting stuck up at some place, so there may be some exception causing this. Put a try-catch block and print a stack trace in the catch clause, you will soon know what happens.

verruckt24 438 Posting Shark

>We have BlueJ here at the school and quite frankly, I have had problems with it

You are telling me you haven't been taught running Java programs from console or from BlueJ either.

>I think I should be able to learn how to figure these things out by merely viewing the code and array that are provided

You have already figured it out "looking" at it, by running the program you are confirming what you have figured out is correct or not. Do you mean from this that you are asked to not to run the program, I am damn sure thats not the case go ahead and run the program and check for yourself.

>If anyone else can contribute in between then and now, feel free to post any advice.

Translation : I don't want answers such as the one given in the previous post, which tell me to do something on my own. I want answers that spoon feed me, I want to rely on other people for telling me whether I am right or wrong when I myself can do that with a little bit of effort.

verruckt24 438 Posting Shark

Figure out what myGrid.length is then figure out how arrays work so that you get what total += myGrid[count][i] and total += myGrid[i][count] does. Take a paper and a pencil and start substituting the values you won't be far from concluding what values you get. Once you start getting values you could deduce the logic (which is what the program does) by making a pattern out of the values. Make use of Java docs and your array knowledge which I am sure you might have been given before giving this assignment, yet if you require help with Java Arrays you can use the Array tutorial from java which can be found here.

verruckt24 438 Posting Shark

You have the program, you have the set of input over which to test I wonder what stops you from running the program, feeding it the input and then checking whether the output you predicted was right or wrong.

verruckt24 438 Posting Shark
for(i=0;i< String (1234455....upto >=500 digits);i++)

I don't see any problem in this.....

If you believe in re-incarnation that is. ;-)

verruckt24 438 Posting Shark

Help has already been offered if care enough to look for it.

verruckt24 438 Posting Shark

Your question is a little confusing but from what I have gathered here's what you need to do:
Take several strings from a user sort them alphabetically and show them, in a text area, in sorted order.

If yes, you can use the compareTo() method of the String class for this. It compares two strings lexicographically.

verruckt24 438 Posting Shark

I don't think so, but java docs can. Check the java docs for the methods and try implement the methods yourself those are some pretty basic ones.

verruckt24 438 Posting Shark

Yes you are right.

@lipun4 : Read what the docs for compareTo() have to say to understand the point masijade makes here cleverly.

verruckt24 438 Posting Shark

Anyways it gives the same outcome which is "-1"

verruckt24 438 Posting Shark
System.out.println("Enter the name of the lab this computer is located: \t"); }

Remove the '}' in this line that is what causes the previous while loop to terminate "prematurely" and on the next '}' it terminates the method/class, so that the next statement "appears" to the compiler out-of-place.

verruckt24 438 Posting Shark

>I found the best book to be google
Yes but sometimes you need a flow to what you are reading which is hard to get given the fact that you are looking up different articles written by different authors scattered all over the internet.
Also when you read different articles by different authors you would sometimes find them contradicting each other a bit, because every author has hos own style, his beliefs his own "best practices" etc,
I am not saying that this isn't a good way, yes it is, but for a beginner not a preferred way to begin with.

>Given a good compiler (NetBeans or Eclipse)
These are IDEs.

verruckt24 438 Posting Shark

Here is the tutorial for Regular Expressions (regex is short for them) you will get to know a lot about them and how to use them on the link.

To just provide a brief about what a regex is and how they would be useful in such operations, take the current example where you just want to check wheter a string is an integer, in other words you want to check whether it contains just digits or other characters too.
So you could define a regex with a pattern such as [\\d*] Here '\\d' means digits (0-9), and * means any number of occurrences of them. After such a pattern has been defined, you just check whether the string satisfies this pattern or not, any string satisfying this pattern would certainly contain only digits and hence would classify to be an integer.

verruckt24 438 Posting Shark

So is it that you are just interested in finding out whether the string contains all digits and not any other characters ? If yes you can use regex to do that, if not detail out the process.