Frank Hanner

Greenhorn
+ Follow
since Jan 11, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Frank Hanner

Jorge Vazquez wrote:I've been doing some exercises from codingbat, and I haven't figure out a way to solve this particular problem; may be someone could point me how to approach this. Thanks

http://codingbat.com/prob/p155405




Do you see a pattern at all?

It's divided into n sections. Inside each section is n numbers (n*n). Each section is essentially counting down. With each section progression the number of zeros decreases by 1 and the appropriate number for the count down is inserted. If that get you thinking about it the right way, I'll show you some example code that might help.
5 years ago

Richard Tookey wrote:

Frank Hanner wrote:When I invoke the .bat and an error occurs somewhere within the .bat script, my Java program hangs even though the .bat process is finish



This is most likely the classic deadlock caused by not handling the process 'stderr' stream. You should study the 4 sections of http://www.javaworld.com/jw-12-2000/jw-1229-traps.html and implement ALL the recommendations. Failure to do so will likely to result in you pulling your hair out by the roots.



That's what I was beginning to realize, too.

Why does this happen? It doesn't really make any sense to me. It makes me a little bitter towards Java.
5 years ago

Henry Wong wrote:

Perhaps it would be a good idea to worry about the error? What is the Exception / Error that is returned? When you get the output / error stream, what are the values that you get back? Etc.

Henry



Isn't that catch statement only executed if the Process has a problem creating? If I put an output statement in the catch clause, nothing ever gets outputted; thus, there isn't an issue with the actual creation of the Process. I'll put in code that retrieves the output/error stream and report back.

Frank
5 years ago
Hey guys,

I'm developing a GUI, and when a certain button is pushed, a .bat file is invoked that performs several commands that manipulate a directory (copy, move, etc). When I invoke the .bat and an error occurs somewhere within the .bat script, my Java program hangs even though the .bat process is finish. But when I invoke the .bat file and no errors occur from within the script, all is dandy and my Java program carries on. Nothing in the my Java program relies on the manipulation done from the .bat script, so I don't see why it hangs.

Here is my code



Sure I could do away with the .bat file and do it all primarily in Java, but I'm interested in why this occurs for my own sanity.

Thanks
5 years ago