Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

Rafael Campos Cruz

Ranch Hand
+ Follow
since Apr 16, 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 Rafael Campos Cruz

Hi everyone!

I'm currently meddling with javaScript in order to implement a fingerPrinting system in my web application.

I've developed the following example in which I can get all the necessarily data:



It does exactly as it's supposed, and when I read the variables on the "teste" ManagedBean they are there as expected. The javaScript code is the following:



Which works correctly.

So when I tried to run it in the following page:



It simply won't work!

The function faz() is called and only the first "alert" popup is called, the second one which should show what is returned by dadosDaTela() isn't generated, why is that?
I simply cant see any reason for it to be so, could anyone help me?
8 years ago
JSF

Joanne Neal wrote:

Rafael Campos Cruz wrote:
I'm afraid that's more by luck than judgement. You are creating a separate thread for each command you pass to Octave and running those threads at the same time. It's quite possible that those commands could be run in any order.



OOooooh, now I understoo what you meant!

So basically:

8 years ago
I changed some stuff according to what you instructed and it simply can't run as being a "Runnable" instead of "Thread", so I kept it as Thread.

The output is the following, which is correct:

[SPOILER]

[/SPOILER]


And here follows my new implementations:





Thanks for the support, as soon as I get time I'll read the guide.
8 years ago
Ok, finally managed to understand and solve the problem.

Yes, threads are a necessity in this case, though I still don't understand quite well why (maybe JVM standard?), anyhow, I solved the problem by first creating a classe to handle both command execution and stream printing.

For anyone faces the same issue here it's the code:



With this I implemented 2 methods to automate its calling:



And them I implemented it this way:



The thread.sleep() values are completely arbitrary, as it sort of is what Octave takes to run the mathematical model, so you should fix it to whatever you need.

I would like to point aswell that this is running on a webService inside a ApplicationScopped managed bean, so I could reference my server locally (it's part of a SessionControl that I created, so the server would have to support only 10 running simulations at a time).

Thanks to all on guiding me to the solution!
8 years ago
I really tried to, however, if I try to read the OutputStream I'm able to, however the application never exits the "while", follows an example:




And no: No error is returned. Using the example in "When Runtime().exec() won't" it can run Octave correctly (the program being called), with no problem at all.

I believe it's looping for ever because Octave is waiting for a response and, thus, it stays open, waiting, never being terminated. Could you give me some guidelines, or an example, on how to input to this program direct inputs?

P.S.: Another note:

I could run this line, and achieve my objectives, on windows without any problem at all:



halp ><
8 years ago
Hi everyone!

I come here botter you guys a little because I've been bashing my head on this problem since monday and I've tried my best to grasp everything here but I still can't make it work.
I also based my code on this simple "how to stuff" which makes sense, but I don't know if it is right or not.

Anyhow, my problem: I have a webApplication and I need to call a software installed on my server (Octave) in order to run a mathematical model inside it (it's quite good and fast on doing so). However this software has no java-interface, so the only way to call it is through
calling it using runtime and I NEED to pass instructions for it. Because of the way that Runtime.exec() works the only way to do so would be to input instructions while the software is running.

I was able to understand correctly how to call the software, but I simply can't input commands into it. I know that the command String IS RIGHT, however I think that it don't get to the application correctly... can you guys help me? Here follows the code:



Can you guys help me?
8 years ago
Hi Arunkumar, thanks for your response!

I kindda didn't got to understand it though.

I'm not retrieving the data straight from a DB: it is handled on specific objetcs by a MB first, this way I can follow a very simple standard fow showing data.

My xhtml code is like this:
[spoiler]

[/spoiler]

however, on this page the everything works right:
[spoiler]

[/spoiler]

which is quite the same but with different MBs interacting.

Any ideas?
8 years ago
JSF
Good afternoon to you all!

I'm experiencing the following issue: I have a page which is used to edit the current data from a certain entry:



However, in one of tha pages that follow this style it wont load the data like on this print!

I've verfified the variables and the information is there correctly, just isn't showing.

What could cause this?
8 years ago
JSF
Lol, I put the code at the beggining of the doGet and it worked! I still would like to understand why it work only this way, but yeay!
9 years ago
JSF
Hum...

after some research I found some aswers, I tried the following:



for no effect...

I'm trying to search an alternative but a FAQ that I found said that this should sort it all out, why it doesn't?
9 years ago
JSF
How do I do that? What should I research for?
9 years ago
JSF
I expressed myself badly, sorry. It's just as you said: the button calls the address which I setted up on web.xml (in my case "baixar").

Either way, I may click the button in several instances, but only one of then will summon the servlet...
9 years ago
JSF
Hum... I'm having one last problem but, all on all, it worked just fine having the "setting up the file" and the "downloading the file" on separate pages.

My Glassfish Application Server runs inside a Linux machine and when I download the file accessing the application in the browser INSIDE the server, it works perfectly.

But, when I access it from the outside (when I access the application through a browser using its network address on a machine wich is not the server) the first time it will work correctly, but after that it will always copy the first file wich was extracted.

Not just that, the application won't delete the temporary file which was created and this allowed me to see something: the file created is correct, but not the one sent to the user.

By checking the logs I discovered that, when being called inside the server the Download Servet method doGet is called for each and every request that is deployed from the browser.

The same doesn't happen by making calls outside the server, the servlet is called just 1 time and never more, like if it's now waiting for requests with the doGet already running...

How can I force it to call doGet everytime? Is this a normal behavior?


9 years ago
JSF
My fear is that, as the data is saved in a real file and many users will extract data the same way, the file be overwritten before the user have a change to download it.
9 years ago
JSF
But there's a problem... I need to first get the data inside the file prior to downloading it...

in the page where these buttons will be the "data" which will go to the file is chosen (the are objects of a List and the user removes the ones wich he doesn't want) and the only way I can see of putting it inside the said file is through a MB method...
9 years ago
JSF