Very sorry but I couldn't get the source of the problem. Did you compile it? did you run it? whare does the problem lie?
The post above your post, specifies exactly where the problem lies
Very sorry but I couldn't get the source of the problem. Did you compile it? did you run it? whare does the problem lie?
The post above your post, specifies exactly where the problem lies
The above two posts have already informed you about the "side-effect" of the pointer assignment. I just want to add to it that would throw some light on the memory leak part.
When you permanently loose the base address of the memory chunk pointed to by b, you also loose your chance to free that memory, since to free any memory in langauges such as C/C++ you would absolutely need the pointer to it. Now, since you cannot free this memory and since it cannot be reclaimed by the language on it's own (like langauges that do offer such mechanism - Java) this chunk of memory is permamnently lost from the available pool of memory for your program. This memory has "leaked/drained" from the memory pool, and hence this is called memory leak. Too many such "leaks" would ultimately cause the pool to get exhausted and what you would get is an introduction to the famous "segmentation fault".
listModel.addElement("Cathy 7654328901");
listModel.addElement("Jessica 1654223789");
listModel.addElement("Larry 2766541397");
listModel.addElement("Marry 9871265347");
listModel.addElement("Sam 9871236453");
listModel.addElement("Smith 4512344879");
These lines cannot be in teh class body, they need to be inside some method of the Address class.Same goes for these lines:
list.setSelectionModel(ListSelectionModel.SINGLE_SELECTION);
list.setSelectedIndex(0);
list.addListSelectionListener(this);
list.setLayoutOrientation(JList.VERTICAL_WRAP);
list.setVisibleRowCount();
And these :
contacts.addActionListener(listListener);
contacts.getDocument();
listSelectionModel.addListSelectionListener(listListener);
You cannot have anything other than member declaration and/or initialize in the class body. Just going through some of the written programs on Java/Swing/AWT would help you.
As Ezzaral has mentioned, I would like to see more code, as these lines are perfectly fine.
oh man u still wan them converted?
i wish there was a button called "kick poster who doesnt try to code himself"
May I ask the point of this post ? The OP was made very clear from the first few posts that he wasn't going to get the ready-made help he was looking for, thats the reason he didn't return back. Your posting on this thread unnecessarily keeps it alive and on top.
hey noone will gonna give u d project kkkkk........
dis community is for programmars not for cheaters .
so u better take care of dis in future........
I don't want to dilute the essence of your post, but it would be a good thing to drop the IM/Chat speak yourself. Also use proper English in your posts it just adds to the readibility of your post.
I am unclear of what you are trying to do here, so correct me if I haven't understood but instead of copying choices to result and then returning back result, why not return choices.
i think u should only include<iostream.h> and else do as suggested by nucleon........
Read the posts written above.
I assume this is an exam question, and your urgency in the PM tells me that you might actually be answering one.
I am not keen on giving answers straight up, more so in your case, because of some of my assumptions mentioned above.
I would give you the hint for this, if you are smart enough to take it, I suppose you deserve to get through.
You know how multiplication goes, since it is a single digit multiplication here (4) you can work your way this way,
Since, ABCDE * 4 = EDCBA,
A has to be ones digit of the result of E * 4.
B has to be the ones digit of the result of D * 4 + tens digit of E * 4
So to put this into prrogramming terms,
A = (E*4)%10
B = ( (D*4) + ((E*4)/10) ) % 10
I hope you are able to work your way now.
NOTE : Ignore my earlier post, as I completely misunderstood the problem.
As mentioned in my previous post, I have for long lost touch with C++, but I assume from what I know, that none of the current collection of GNU compilers use the .h suffix. The new crop of compilers are bound to throw an error at you for that.
From what comes to my mind immediately after seeing this, you are in effect copying only about half of the string since you begin by assigning i to 0 and j to the last character of the word, then you increment i while simultaneously decrementing j. i and j will meet somewhere in the middle so that rev only has about half of the characters of word. Now in this case strcmp
will never return a 0.
This is IMO, a long time I haven't been doing a lot of C++, so tell me if I am wrong.
You need to loop your code to print all the tokens. Something like:
while(st.hasMoreTokens()){
// parse every token OR print it OR do whatever
}
Since currently there is no loop, it exits after printing just the first token.
Also note, the StringTokenizer
class is a legacy class and maintained just for compatability reasons, it's use si discouraged. Use String.split()
instead.
Well there can be thousands of correct values here for the variables that you mention. For ex: ABCDE could be 4 and EDCBA could be 16, ABCDE could be 16 and EDCBA could be 64, etc, etc. So you cannot exactly get to the values that you mention.
Do you want to find out all possible values ?? I doubt.
Tell us more about your program.
for(int x=1;x<=(num);x++)
Since 1 is not a prime number don't begin your loop with it, rather initialize x to 2.
Definition of prime : An integer greater than one is called a prime number if its only positive divisors (factors) are one and itself.
I guess not.
Are you in your senses ?
Detail your problem, where are you able to connect to the database from. Where is your phpMyAdmin located.
It would help you to know that user accounts in MySQL are made up of a username and a host that the username is allowed to connect from. So the account name is 'username@host'. An account john@mydomain may be able to connect to the MySQL server does not mean that the account john@domain2 would be able to connect to the same MySQL server too. This is what allows two persons with the same username but on a different machine to be identified as two different user accounts in MySQL and hence be controlled differently.
So when you say, you are able to connect to the server from, say, your PC does not mean that you should be able to connect from phpMyAdmin as well, cause, the phpMyAdmin module could be located on a different server.
@javaAddict : Not that even if he would have detailed his problem to the minunest detail, I would have helped. I would have still left him there to fail misrably.
And yes I mentioned that in the comment where I flagged a post of his as being bad. I also mentioned that he was running helter-skelter everywhere, scattering posts all over.
To explain you the concept of universe in set theory, will have to give you an example.
Say, you have a set of men who play football, a set of men who play cricket, and set of men who play baseball. Here the universe ia set of all men, some of which play football, some of which play cricket, some of which play baseball etc, etc.
Now let us apply this example to a few men
Universe = {A, B, C, D, E, F} // set of all men (universe set)
Football = {F} // men who play football
Cricket = {C} // men who play cricket
Baseball = {B} // men who play baseball
Now as mentioned by you in your post the complement of a set is U- (that set), so in our example the complement of set Football is
Universe - Football = {A, B, C, D, E, F} - {F} = {A, B, C, D, E}
A universe set is in the context of the example. For a different example which also includes men and women players, your universe set would be the set of all human beings (Men + Women)
I hope you are able to figure out what a universal or universe set is, and also the complement operation.
Ohh I am so sorry miss, I should have figured it our from your username. But I guess answering the question took all my attention. ;)
And do take up the major, it's really so satisfying and fun, this programming thing.
@sillyboy : I too never give an answer straight up, as I believe you would learn a good deal trying such things then you ever would writing a correct program right away. But when I looked at his code I could see that he had initialized the input variable in other places, which made me believe that he missed it here, and I guess it's fine telling someone that "hey you missed this one here". So I gave him the statement with an exaplnation for the same to make clear that he understands the things and take enough pointers from it for further reading. Also when I told him about it, I didn't give him the exact place to put it in, I just told him to go over his code in the Player.java file and check where this statement should have been put, which he is supposed to know only if he had put the others in the place himself. I hope this clears up.
Also I think it's sometimes ok to drop a few hints to let the fellow make progress and make sure he is motivated for the further task. :)
I suppose you need to ask for the number of grades and then continue looping in the for loop for those many times.
Now, if you understand the for loop construct,
initialise a counter to 1 and continue it to the number of grades, incrementing it once every time.
Think on this and let us know the result.
I am glad that you failed, you were in a test and you weren't knowing such trivial things. I am sure you had been given enough time to learn them, obviously as it appears from your condition, you passed the time, without actually putting it to good use. It's good that you get punished for your mistakes, thats the only thing that could avoid you from doing such mistakes in the future. Also it's good that no one from here helped you out with those ready-made while loops that you wanted, beacause I'm damn sure that you wouldn't have bothered yourself with them for the rest of your life had you passed this exam.
You haven't initialized the input
variable at the time that you are using it to get user input.
human = input.nextInt();
Initialize it to
input = new Scanner(System.in);
The thing is you need to declare variables, and then initialize them for use. If you do not initialize an object reference, then the value that it has is null
, now when you use it to call a method then you get a NullPointerException since the object refers to null you cannot actually call a method on it.
If you check your code, in Player.java you do declare 'input' but do not initialize it before use.
VernonDozier has already given you the directions, if you have taken a look at them you would understand it on your own.
To tell you in brief about Operator Overloading : It is to attach a new/different meaning to an already existing operator in the language. This is called overloading because doing this seems a bit like putting extra meaning to the same operator in a way making excess use of it, in a way "overloading" it with functions that it is supposed to do.
>+=, which implements the same operation as the unionSet(monthsSet &B) function;
So now in the assignment given by you, you are supposed to add more meaning to the += binary operator in C++ and attach one more meaning/function to it of creating an unionSet. Note I say here "one more" because of the reason that the operator is already supposed to do one function already assigned to it by the C++ language that of adding the operand on the LHS of it to the operand on the RHS of it and then assigning the sum to the operand on the LHS, as in :
a+=b;
So you now have to create a function similar in signature and operation to the function unionSet and name it is "+=" so when you call it on objects it has the same effect as that of :
a.unionSet(b);
This is exactly what VernonDozier mentions in his post. I hope you can work your way …
See the API docs for the ProcessBuilder class. Also check the ErrorStream for the process to check for any errors. Go through this thread.
Well thats not a yes/no question exactly. But I like to read socio-politics books, technical books - java, software designing, etc and some times just good fiction/thriller stories.
Do you swimming ?
Obviously, as it appears from your information as also from a google search over the topic, this is a bug in MySQL. And guess what the MySQL people accept this, actually this is bug # 25156. Many people have had this problem. Take a look here
Edit : The MySQL guy tells us there that this bug corrupts the my.ini file when editing with the MySQL Administrator. You would have to correct the file manually with correct values from InnoDB setup variables.
Your query should be of the form :
SELECT a.fruits FROM tableA a where a.fruit NOT IN (SELECT b.fruit2 from tableB b where b.fruit1 = 'apple') AND a.fruits != 'apple';
This will work provided that 'apples' appear only in the fruit1 column of tableB.
Don't expect this query to work out of the box. I won't give you the ready query, thats something that against the rules of this forum. This is just a form of it to show you on what lines you should be thinking over it.
Also furthering to what KevinADC has already mentioned what is the criteria that you want to print values on ? We can't figure from two values which values you want to print and which ones you just need to ignore.
risk, rib, is
norway
I like hanging out with a colleague of mine, so may be that would be fun too.
Is it true that you need to be crazy enough to be intelligent enough.
Okay if your query is solved, mark the thread as solved so that others are aware of it.
This depends on your relational design. As you mention information about your project, the hosts are "service providers" and the users are "service consumers/takers". You need to decide whether what relationship the hosts and users share. If a user can have content hosted on multiple hosts then there is clearly a many-to-many relationship between them, as hosts certainly can have multiple users.
Once you have decided this, you need take into consideration what attributes/information you would like to store for the hosts and the users. Each of these attributes would be fields/column in the tables. From what I understand, I don't think that hosts and users would share more than a few attributes and hence it is advisable to use two different tables for them.
>I would also like to allow the host admin to be able to add/edit/delete users associated to that host.
This is concept that you would have to implement in your coding.
Detail your query, it is very difficult to advice anything from what you have provided, give us the table designs.
You aren't using a password for the root account and your access is denied, this certainly means that the root account on localhost does have a password.
Initially the root accounts created by the install script in MySQL do have an empty password, but as mentioned above your server does seem to have one.
so that the i can copy the code
English isn't my first language, I wouldn't have come across it at all if the Brits hadn't stayed for close to 300 years. But from whatever impure version of it I know, I can only deduce one meaning from that, which is what others deduced too. And you weren't exactly hinting at copying the example code, so...
Okay if this has been solved, would you now care to mark it as one.
Hmmm... now you are saying something.
Will have to ask others that.
am I ?
Just Love it.
Surfing ?
Yes, I agree.
Wouldn't a majority of them agree ?
sort, rot, for
Daniweb.