|
hi there
Trying too write a java program on towers of hanoi
It supposed to written in stack class.
There is a Peg class and Board class.
I have no where to begin with this
Please Help???
Thanks
|
|
|
|
|
Hohepa Hori wrote: Trying too write a java program on towers of hanoi
It supposed to written in stack class.
There is a Peg class and Board class.
I have no where to begin with this
Well, begin with Board class...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I have spent all day trying to figure out this junkstuff and seem to be getting nowhere.
I could have had this damn application done by now using ASP.Net or Silverlight but Nooooooooo.
Anyone have any words of wisdom on how to get simple navigation to work in JSPs?
I just want to be able to click on button on a templated page to move tot he next page and it doe snot seem to work. Of course I can just sett he navigation destination of the button.. Noooooooo I have to set this, then that, draw a link between pages in two areas, then blah blah blah blah blah blah..
ENOUGH!
|
|
|
|
|
what's wrong with Myeclipse7(all in one)???too slow,always stuck when I open a file
Undeniable:More information,more abilities,more energies,more time!
http://www.blogjava.net/tidelgl
|
|
|
|
|
I'm having troubles learning the concept of classes that extend Comparable. Any suggestions out there that could help my understanding? Same thing with abstract classes, I don't get the importance.
thanks in advance.
|
|
|
|
|
jonig19 wrote: I'm having troubles learning the concept of classes that extend Comparable
Which point don't you understand specifically ? If you want your objects to be comparable, you simply implement the Comparable interface and implement the CompareTo function. I really don't understand what you don't understand
jonig19 wrote: Same thing with abstract classes
Again, what is the point you don't understand ? Abstract classes are classes which should not be instanciated, they are only meant to be implemented by child classes. Thus, when you have abstract functions, it means that you have to implement those in your child classes.
|
|
|
|
|
Dear all,
i'm in a middle of a thesis.and i have some problem in getting the frame in video structure, so i can get it as an image.
can any body help me how to do it in java?
Thanx
|
|
|
|
|
any body here know to make Array of record in java script ..
can give me some example ...
thx b4 ..
regards
novhard
|
|
|
|
|
oredy have the answer ..
he he he ^.^
|
|
|
|
|
I've got an applet that needs to retrieve a "preview" of sorts of a file from within the applet. I think the best way to do this is to do what Windows Explorer does, and return an image of the file as a preview (or an icon if it can't preview, like returning the Microsoft Word icon for a .doc or .docx file). I have a feeling that this could be done through Shell32.dll. If so, how can I access that? And if not, is there another way to do this without having to save an image for every extension I might use beforehand?
Thanks.
|
|
|
|
|
hi i have written this code to execute a batch file in windows 2003 server R2
but it does not execute anything. it opens the cmd.exe window and does nothing also
the "Exit Value" and "Return Code" is 0.
can anyone help me about this?
is there any windows registry setting to restrict the execution of batch files programatically?
Thank you!!!!
try
{
Runtime runtime = Runtime.getRuntime();
Process process = null;
try
{
System.out.println( "Running: " + fName + ".bat " );
process = runtime.exec( "cmd /c start " + fName + ".bat" );
int returnCode = process.waitFor();
System.out.println("Exit value " + process.exitValue());
System.out.println("Return code value " + returnCode);
System.out.println("Finished running the SQL Loader script's process. " + " Exit Value = " + ( returnCode == 0? "Success" : "Failure" ) );
}
catch ( Exception e )
{
System.out.println(e.getMessage());
e.printStackTrace();
}
}
catch ( Exception e )
{
System.out.println( "Error running the sqlldr script: " + e );
e.printStackTrace();
}
|
|
|
|
|
if your bat script contains spaces or special characters you will need to enclose it in quotes... Dunno if that helps.
|
|
|
|
|
also ensure your path to the bat is readable by javaw -> try putting it in "C:\yourbatscript.bat"
|
|
|
|
|
i am getting the same results. the window title of cmd.exe is the exact path of the bat file but i didn't execute. maybe there is some kind of security setting for java not to invoke the batch files or a setting in windows server...
|
|
|
|
|
No i did this last week. Didn't set anything else.
webtools.java:
private void jButton13ActionActionPerformed(ActionEvent event) {
cmdExec cmd = new cmdExec();
String s = (cmd.run("ping www.google.co.uk"));
jTextPane0.setText(jTextPane0.getText() + s + "\n-----------------------------\n");
}
cmdExec.java:
package webtools;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class cmdExec {
public String run(String cmdLine) {
String line;
String output = "";
try {
Process p = Runtime.getRuntime().exec(cmdLine);
BufferedReader input = new BufferedReader
(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
output += (line + '\n');
}
input.close();
}
catch (Exception ex) {
ex.printStackTrace();
}
return output;
}
}
modified on Wednesday, April 22, 2009 10:13 AM
|
|
|
|
|
I'm starting to learn Java and have been testing Visual Editor in Eclipse. I notice there are several different versions & plug-ins available that are all quite different.
Which Plug-in / Version of Visual Editor do you use? What advantages does it have over other versions / products?
I'm on 0.9 (Has a palette - which I couldnt see on the other versions). It can be a bit buggy though - it doesn't like you making mistakes - and goes nuts if you do.
Which is your favourite and why?
(For items with multiple versions or items with the same name please include update links or version numbers, if possible.)
|
|
|
|
|
I am a C# developer by profession, but recently I have been playing around with Java (have been asked to create a Java game for my company). My question is, in C# you can return a value from a class using something like this:
<br />
public string this[int index]<br />
{<br />
return "yadayadayada";<br />
}<br />
my question is, how do i do the same in Java?
Big thanks, sorry for the noob question but I couldnt get a straight answer from Google
|
|
|
|
|
I am assuming the class extends a List of some kind.
For example:
public class TestClass extends ArrayList<String>
Then use something like this:
public String returnStringAtIndex(int index)
{
return this.get(index);
}
hmmm pie
|
|
|
|
|
is it right that Java doesnt support indexers? guess it doesn't really make a difference
Jonathan Harker
preecesoftware.co.uk
|
|
|
|
|
jharker1987 wrote: is it right that Java doesnt support indexers?
Java doesn't support properties.[^] So you have to use functions instead.
Is that what you mean?
hmmm pie
|
|
|
|
|
any body here have huffman coding decoding and encoding in JSCRIPT ..
if, have, please share with me ...
or give me a link to download it,..
thx very much ...
regards
novhard
|
|
|
|
|
Are you only looking for the a copy of code to cut and paste or are you looking an explaination of how it works and how to write it? I don't know of any examples in jscript but I have done this in C and to be honest the concept is going to be pretty much the same no matter what language you write it in. If you're interested I'd be glad to explain how it generally works in any language (can't say it would be specific to jscript).
Mike
|
|
|
|
|
thx for answering my question ..
i am looking for the copy of code ,
thanks too if u want to give me explanation about the huffman code ...
just give the link, where i can download your huffman code in c,
i will try to translate it to jscript ...
thank you ver ymuch ...
regards
novhard
|
|
|
|
|
I'll have to find the usb drive I have it on since I did it a little while ago. Hopefully I'll find it by tommorrow and post the code so you can see it.
But here's an explaination of how it works (please note if you don't know what a tree, structure, or linked list is I would suggest reading the wikipedia articles to learn that first since huffman uses them):
Suppose you had a long text file where all the letters were either an A,B,C,or D and you wanted to save them in the minumum space possible. Also suppose you knew that 80% were A, 15% were B, 3% were C, 2% were D. You could give each letter a 2 digit binary code but that would not be as efficient as giving the most commons letter(s) a shorter binary code even if this means the less common ones have to be slightly longer code.
For instance huffman would give them these codes:
A = 0
B = 10
C = 110
D = 111
It creates these codes by creating an unbalanced binary tree. To do this you create a list of nodes that are placed in order according to frequency. Then you remove the 2 least common nodes and create a parent node for them that contains the frequency of both nodes and place the parent node back into the list in order. You keep doing this till you have only 1 node and that node is your root node.
Here's what the tree looks like:
Root...................................(ABCD Freq 100%)
Level 1..........(A Freq 80% Code 0)..................(BCD Freq 20%)
Level 2...............................(B Freq 15% Code 10).........(CD Freq 5%)
Level 3.............................................(C Freq %3 Code 110)..(D Freq 2% Code 111)
The codes are determinded by where the node is on the tree. Left is 0 right is 1. To encode you create the tree and write the binary code for each symbol. To decode you start at the root and go left if the number is 0 and right if it is 1. You continue doing this until you reach a leaf node. Once you reach a leaf node you write the letter and start again at the root.
|
|
|
|
|
thx mates ..
i am oready know about the teory ..
but i feel hard to write it down to a code ..
specially in jscript ..
thank you very much for answer my question
regards
novhard
|
|
|
|