verruckt24 438 Posting Shark

Darling read the posts carefully.

Firstly check your langauge here, this is not some cheap internet chat that you are into. Read the forum rules regarding chat speak, because I am sure you haven't cared.

And towards the answer to your post. I guess you are mentioning this :

Thread sequence depends on many factors as System clock, processor type, OS, OS's scheduling algos. So try using some other concept instead of sleep.

I don't find anything about I/O, which is the prime cause of concern here. You are mentioning a whole lot of other things here but not the one which would help the OP in figuring out the problem.

And this is the proof of that, which is what he says after your post:

Every time when I execute this program its change its output.

verruckt24 438 Posting Shark

masijade has solved your problem. Every public class must be saved in separate file and the name of file must be same as public class.

PS: You post dice class twice. - Isn't it?

This was so very helpful, especially after the long, over-detailed post of masijade that still left so many things ambiguous and in the open to be explained.

Thank you.

verruckt24 438 Posting Shark
verruckt24 438 Posting Shark

@OP : This program isn't written by you isn't it ? Since you do not even know whether it's for C++ or Java. So before I give you an advice, unlike others who I guess haven't put a thought to this, I would like to know the source of this program. Why you would like to change it and Why you are working with something that you even do not know the origin of ?

verruckt24 438 Posting Shark

They are variables but used in different context.

And what is that suppose to mean ? Not to mention JC had already given the answer.

verruckt24 438 Posting Shark

I have mentioned in my previous post that sleep doesn't works fine in all case.

You might be surprised to know that sleep is not the only one that causes the problem, seldom actually. Any kind of blocking I/O is the main cause why a thread could be made to relinquish control of the CPU. And even if you remove the sleep command altogether you certainly have I/O there.

verruckt24 438 Posting Shark

So now the problem is not your code. So chill.

Not necessarily. There might not be a problem as such in his program but that does not mean the o/p would be as he wants it. It depends on the how the threads are schedule and hence, as mentioned, the same compiled program may generate various output sequences. I feel the advice of JC is the most valued here.

@hardik : You might have been lucky to get a sequence where the threads have been exactly alternating the execution cycle.

@OP : Follow what JamesC mentions about the wait/notify, it is the std procedure.

verruckt24 438 Posting Shark

@serkan : The reason you cannot argue with Narue over this, or more appropriately, should not, is that even if people are working for 10-12 hours, can't they learn on the job itself ? Thats what Narue wants to mention when she says that to not learn anything from the job, they should be doing a job where they are absolutely not allowed to "think".

When I started my internship, in the organization that I currently work in three years back, I used to stay back in my office as long as I could sometimes staying over in the office too, because fresh, not to mention naive, as I was just out of college, I was eager to soak in as much as I could and as fast as I could. That was the time when I learnt a lot of new things whether in programming, or just being social whatever, I never felt the need to go learn something apart from just doing my job, I learned so much during that time. Contrary to this many of my friends got home early working for as few as 7 hours and I am ready to bet that they did what Narue is ready to bet her money on. ;)

verruckt24 438 Posting Shark

As hardik.rajani mentions there's is little programming "tradition" to this.

The concept of the Top of Stack is that the Top should always point to the uppermost/topmost element in the Stack.

Now to follow this concept, it would be a logical thing that you first need to increment the top counter by one so that it points to an empty position in the Stack (the new top) and then enter an element at this position, so again after the completion of this operation our view of the Stack is consistent of the Top pointing to a the topmost element.

This is in the case of the Array implementation of Stack, and since we know arrays have a beginning index as 0 we cannot have the top pointing to 0 as in that case it would wrongly be conveyed that there exists a single element in the Stack. So we keep the top pointed to something that is one position lower than 0 (-1) so that the operation of adding elements to the Stack performs as mentioned above:
1. Increment top by 1
2. Add element to top

The remove/pop operation proceeds this way:
1. Copy element at top position
2. Decrement top by 1
3 Return copied element.

Following this procedure we can be sure that if the top points to -1, the Stack must certainly be emtpy, thats the reason we check the top being equal to -1 for …

verruckt24 438 Posting Shark

Yes some config file or such to enter in the base rates or better is like reading an excel sheet which could be likely downloaded from some other source so that the user doesn't always have to keep changing the values manually, or even better would be the approach of screen scraping the site you have referred to so that you could extract all the currency values once in a while and then have them used in your calculations. Here you could have a config value of say how frequently to read in the site.

I do not know your familiarity with Java, so whichever way you think to be the best suited for you, could be taken up. It's your call.

Note: The credit for the idea of screen scraping goes to s.o.s who convinced me that it was still a good idea for some school/college projects which could not afford the cost of communicating with the site through an API. :)

verruckt24 438 Posting Shark

Every public class should be defined in a file named identically. So, it's obvious that a file cannot have two public classes. So you need to create two files for the two public classes and then make them to refer each other, being public, this is possible (as long as it falls in the classpath).

verruckt24 438 Posting Shark

I just hope for your sake ramborambo from this post and you are not the same person, or you will get banned

I guess he is.

verruckt24 438 Posting Shark

Your program specification mentions arrays, I don't see any arrays defined in your program. Check the Java tutorials on how to define and use arrays here.

verruckt24 438 Posting Shark

Even if the user hits the cancel button you won't get a NullPointerException. If the user clicks cancel you would get an in value specifying that the user hit the cancel option. So just fetch the value in an int and compare it to JOptionPane.CANCEL_OPTION, and write your code depending on that.

Check the JOptionPane class for information

verruckt24 438 Posting Shark

Just one more suggestion that comes to my end (it's a crazy one): Go looking for female psychiatrists in your locality of your age, tell them about this problem of yours, tell her you want many sittings with her not just a few, by the end you'll either have found a "smart and deep thinker" or atleast would have cured yourself of finding one. ;)

verruckt24 438 Posting Shark

But Mr. Sendur, it's like you are in search of water and where are you looking for it ? In the dryest of the places of the World. Got the point ?

What are you doing searching for a smart, deep thinking, intelligent young girl near a strip joint. Not that those girls lack feelings or emotions - but any girl with atleast one of those virtues would not be found in an area within 5 km of a strip joint. So stop looking for water in the desert and start by looking for it in the most greenest of the places, the chances of you finding a source are a lot better.

As mentioned earlier, if you want a deep thinking, smart young girl for yourself, go get a few girl-friends, start understanding what they normally look for. And it won't be so difficult to find someone, get yourself involved with a local community of say programmers or thinkers, try finding out smart girls in your college etc., and don't waste too much time at the strip joints or else by the time you reach the college looking for smart ones all of them might already have been picked up by other smart ones.

verruckt24 438 Posting Shark

I guess you have a pretty clear idea of what is happening around here. So I just would like to give you the notion of why it happens.

When you declare a variable inside a method or more appropriately a block, the variable falls out of scope at the '}' (closing brace) for the block, which means as soon as the block ends. Since you declare the variables change1 and change2 inside the try block, these variabels would fall out of scope as soon as the try block ends. Naturally a variable which has fell out of scope cannot be accessed and that would explain the cause of the error.

So you need to do something like this:

String change1, change2;
try{
// try some code here
}
catch{
//catch some exception here
}

if (change1.equals("whatever") && change2.equals("whatnot")){
// whatever and whatnot  code
}
verruckt24 438 Posting Shark

Don't you have a dictionary stored in alphabetical order? You don't need to compare anything to every possible word, just check alphabetically to see if it is there period. Right?

But even then you are comparing the generated word with some words having the starting letters same as it has, this certainly takes up time more so if you are comparing a common start for e.g. 'co' there might be so many words in th dictionary count,common,complex,complexity,compare,comparing,complexion and so on, what then you are still making comparisions which are necessarily a waste of time. The contains method will be a sure way of being fast, with all left upto the implementation of the Collection class, which certainly is much faster.

verruckt24 438 Posting Shark

@s.o.s : I was thinking more of on the lines that the user was building a logging tool one like apache log4j.

@OP : And if you are doing that, more than anything else you should look at the tool as the pipe from source to sink. Where the sink should be pluggable to accomodate the needs of various users/systems.

verruckt24 438 Posting Shark

I faced atleast two of the problems posted by niek_e at around the same time he posted them. (Submit button problem and no notification through mail). I never face the load problem since I am using FF and ABP since long. But it looks promising to know that somebody's working hard behind the scenes to get it to work smoother.

Also I like the fact Dani mentions that the site is growing, this I guess should be a pat on the back to all the members here who offer voluntarily help and bigger pat for those who make sure the show runs on.

verruckt24 438 Posting Shark

No

Do you love studying various algorithms ?

verruckt24 438 Posting Shark

If you are developing a logging tool, flat files are the best. Since an application using your tool might be logging hundreds of entries in a matter of a few seconds and needless to say you are certainly not going to achieve that kind of speed with logging into a database system.

On the other hand you could implement multiple alternatives and let the user select one of them.

Also if you absolutely want to have the log entries put into a database system what you could do is use a flat file at runtime to log in entries as they are generated by the application. But these entries are written in a formatted manner to the file, say comma-separated so that you could push them into the db say on the issue of a single command at a later time. Check the "LOAD DATA INFILE" option for MySQL back ends.

This option has the advantage of speed with the logging into the flat file at runtime (though this file won't be of much help to read from) and the added option of having the entries into a db for viewing them through an interface. Once the log entries are in a db you can build up the view for each user accordingly through the use of different queries.

Note : LOAD DATA INFILE of MySQL is much like the bcp (Bulk copy) of MS-SQL Server, which inserts records into the db in bulk and hence …

verruckt24 438 Posting Shark

Alright that advice comes from someone who has done this program first hand, whereas I haven't had such experience, the optimizations I suggested were some of several that came to my mind upon an initial read of your problem statement, so you know who to bet your money on.

verruckt24 438 Posting Shark

No, I don't think so. (Though many of us would have just loved it)

Did the egg come before the hen ?

verruckt24 438 Posting Shark

I ain't finding much time apart from my work place to code anything. At workplace I need to build a small router/accounter for text messages that determines from the prefix of the destination (mobile) which gateway to route this message to and to search what price the user has been allotted on that gateway. This needs a lot of db table information in memory as I can't keep querying around for the information and I use the data structures from the Collections package for that.

A small JIT compiler/runtime assembler thing. Lost all the code I had on a thumb drive, so I have to start over(better this time).

You seem to doing something that I find interesting, could you tell us more about it or point to resources ?

Also William is working on another interesting activity of compression. Could you too tell us more ?

verruckt24 438 Posting Shark

Firstly I guess you need not dump all generated permutations into an array. You should only dump those permutations which generate a word out of the unscrambling of the original word, which you can figure out by comparing each genarated word with the list of all dictionary words that you have gathered.

Searching each generated word with a long list of existing words (which might be in thousands) is itself a time consuming task, but you can have the dictionary words put into an ArrayList and then compare each generated word using the contains() method of that class, so I guess this could be much faster than iterating over the words.

Here in this algorithm another very important decision is to generate as few unscrambled words as possible. So in this sense you should try to able to discard a combination of the letters, which is not going to form a word, as early as possible. For eg. in the example you've given of 'time', you should be able to detect that there are no words of length four starting with 'tm' and hence shouldn't move further into generating the permutations starting with this combination. The more longer the word the earlier the better. So if suppose you have been given a scrambled combination of the letters of the word 'difficult' and you come to know that there are no nine lettered words starting with the two lettered combination 'df', you can eliminate the generation of …

VernonDozier commented: Some good ideas here. +15
verruckt24 438 Posting Shark

I fail to understand why this thread is named what it is. No one's interested in Rashakil Fol anymore I guess.

verruckt24 438 Posting Shark

My goodness Serkan, living in the US hasn't had much of a positive effect on your English langauge skills, now have they ?
;)

verruckt24 438 Posting Shark

The NeverEnding Story - Limahl, I just love this theme.

verruckt24 438 Posting Shark

What's the "assembly" word over here ?

Also the spec says the method should return an int, so this would most probably be the index of that element in the array. You have instead declared the return type as "String".

The logic to solve this should be implemented in two steps:
1. Where you count the vowels (I guess thats what you mean) in each word and assign a weight to each of these elements based on it. These weights could be assigned in a corresponding integer array, where an integer at index i is the weight for the word in the index i of the word array.

2. Next you move through the weights array finding the maximum weight, if there are two (or more) elements having the same weight, you compare the words in the words array at the corresponding locations and then figure out the max weight.

In the end you just return the index of the max weight in the weight array, due to our earlier arrangements of the weights this index will match the index of the "heaviest word".

verruckt24 438 Posting Shark

Ehh ? What ? Could you detail out on this.

verruckt24 438 Posting Shark

How about an expansion of your username itself - Green Extreme, it would do more than just cause a stir especially in these days of Global Warming concerns.

What say ?

Grn Xtrm commented: Great suggestion. Thanks. +1
csurfer commented: Good one there lol... +3
ahihihi... commented: :) +1
verruckt24 438 Posting Shark

As i stated above, my "i love you" thing is only valid for one individual, and everybody knows who she is.

This isn't a nice thing to say, especially when that someone has announced her discomfort with such stuff. I don't believe much in casting people in religious moulds anyway so I won't be talking about religions, but respecting other people's feelings is something that I guess comes under the one religion we all belong to - humanity.

I love reading some of the threads started by you Serkan, sometimes when I get dizziness out of work I like reading your posts, they lighten up the mood. I also support the thought that a little bit of joking and kidding around, healthy arguments and debates only nurtures relations and brings out good knowledge. But I suggest that one should know where to draw the line, and where to call it quits, and please make sure you don't step on other people's feet here.

verruckt24 438 Posting Shark

I did what you suggested exactly. My action listener tries to set the the panel to a different image but nothing changes.
Could you suggest something else please?
Thank you

Show us your code, so that we might help you better. Also this thread has already been marked as solved, so start a new thread.

verruckt24 438 Posting Shark

Detailing out what you need exactly would help us help you here. Plus it might not be that it cannot be done through Java. And finally show us your effort here, as to what you have actually got done.

verruckt24 438 Posting Shark

I should say I have to agree with Serkan Sendur here in this thread. I'm not saying that I have the same feelings for Narue as he does, but I mean I agree with him when he says "You have the liberty NOT to read this thread"

I don't know why Nav33n and MosaicFuneral, (and don't take this the wrong way guys) have to act like some personal bodyguards for Narue. Don't think at all that I endorse the way Serkan talks about Narue or anything else, but c'mon guys don't crowd up on someone, Narue is quite capable of handling such things, let her and Serkan sort it out. I say this because I have seen a couple of threads by Serkan where he says something and then all the other members just mob up on him trying to tear his every post apart. If he does or say something wrong the moderators would take appropriate action against him but let us not be judgemental about anything and everything that he has to say.

MosaicFuneral commented: He's just so easy to play with. +3
verruckt24 438 Posting Shark

As you have posted this in the Java Forum I assume your questions relates to the Java Language.

Well talking about functions and methods:
Functions are a block of code that are perform a specific task and return a value. These help in modularizing code into logical pieces. They also help in sprucing-up (trimming) the code as a function can be called from various places and the same code need not be written in different places hindering the readability of the code. Also since the code is not repeatitively written in many places maintenance is easy, as you just have to fix a bug (or make a change) in one place instead of many.

In Java, functions are referred to as "methods". Other langauges such as C, C++ etc prefer to call them functions.

Procedures : Procedures may perform several different tasks. Although I don't remember this distinction being made in programming langauges atleast. Sometimes functions may also be referred to as procedures, as you may have heard some lanaguages, which are modularized on functions, such as C being called procedure oriented langauges or procedural langauges.

Refer to the INTERNET for more.

verruckt24 438 Posting Shark

Are you actually asking us what you should include on your resume to fake one years experience in Java?

I guess, yes she is.

i now have to show 1 year experience in java ,j2ee but can u please help me as too wht should i show in this 1 year and what i have been working on? like TEchnical documentation,project code.

Show what you have worked on for the entire year. What projects you have designed or developed or both, what documents you created or more appropriately what tools you used to document your projects. But then wait...you haven't done all this, you just want to show that you have done all this. In essence you actually want to fake the one year experience, isn't it ? Well then I guess we aren't experienced much on this ourselves as we haven't faked something on our resumes. Why not cook up something on your own, the way you got this idea of faking...
Or better yet why not do some real hard work and show it proudly rather than fake ? What say ?

verruckt24 438 Posting Shark

Happy Eastre to every1 !!!

Welcome back from your hibernation.

verruckt24 438 Posting Shark

gotdam theres a lot of misinformation being thrown around in this thread

i wish some of you people would go take a biology class or something

it's kind of embarrassing.

And what exactly is the mis-information here ?

verruckt24 438 Posting Shark

Also what you are forgetting is the Food Chain and Man (Human Beings) appear high on the Food Pyramid.

may be yes ! But the only problem is is it right or not ? is that much
of pain worth that taste ?

Try making a hungry tiger understand that. Understanding that if he absolutely wants to he too can play with the laws of nature and munch on mulberries, broccoli and spinach instead.

And think on it this way, what would we have if we gave up on all those (delicious umm...) non-vegetarian food, trillions of Chickens, Goats, Pigs etc and if not more atleast a billion deers, cows, rabbits, frogs and all other low rankers of the food chain.

verruckt24 438 Posting Shark

> explain Array

Which array you want us to explain ?

verruckt24 438 Posting Shark

Using the same socket wouldn't your chat and file data get interpersed with the application having no way to know whats what ?

verruckt24 438 Posting Shark

To expand what JamesCherill says in one line, The Java Compiler would add a default constructor if you haven't defined it and if you haven't defined a parameterised constructor either. But the moment you declare and define a parameterised constructor (and then don't define a default constructor) Java assumes that thats the only way you want your objects initialized (through parameterised const.) and wouldn't provide for a default one. This would be perfectly fine if you really do not want objects to be initialized the default way, but if you do want to allow that, you need to provide for the default constructor (thats what JC mentions).

verruckt24 438 Posting Shark

Huh? The very first line says Posts: 750

Oh..sorry, was it ambiguous there, it might have been. Actually I was mentioning about the posts in the particular forum, like it used to be before.

verruckt24 438 Posting Shark

Also Dani there's one more thing that I would like to mention, though the profile page does list the forums that the member has the most number of posts in, it does not mention the number of posts which to me is a good thing, could you put it back like the posts-per-day.

verruckt24 438 Posting Shark

>Store them into an array
I would like to suggest just a better way. Use a Map instead it would also give you better search capabilities than an array. Instead of searching of all the strings in the array, a Map would offer you search functions.

Store the Id as the key and the name as the value in the Map.

verruckt24 438 Posting Shark

See here.

verruckt24 438 Posting Shark

plz help me to complete this program if any of you know how to do it

We would not complete the program for you irrelevant of the fact whether we know it or not and as VD has said tell us what point in the program your stuck at, ask specific questions to which we might be willing to answer.

verruckt24 438 Posting Shark

Result 1: Student/User asks for help, another Student gives help then a Vet comes in and provides a better solution that the original poster doesn't understand because it contains much more information than what the OP originally asked for.

Thats called giving an insight into the stuff, which however useless it might feel to the OP or to beginners here, is of prime value. This insight is what would give the OP a much better understanding of the problem at hand than anything else if he cares to give it a look and thought. What another beginner provides would be superficial information without providing what goes on inside, which may look good then, because it's easy to understand but in the longer run you would want to have more of the insights especially from knowledgeable people.

@siddhant3s:
>>The 'Vet' is usually making a remark to :
>>1.Show that he knows

I don't agree with this at all.

>>A good 'vet' however sieves he comments by labeling it as "Advanced" or "Intermediate" content.

Frankly speaking I haven't come across any such labellings myself.

Original Poster has no idea on how to start the assignment and posts the question, yet individuals immediately assume that the OP is requesting the answer and not some hints on how to start.

Why does he not have the idea ? How often it happens that you have been given a school assignment and you have no clue whatsoever about …