This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of DevSecOps Adventures: A Game-Changing Approach with Chocolate, LEGO, and Coaching Games and have Dana Pylayeva on-line!
See this thread for details.

Rooks Forgenal

Ranch Hand
+ Follow
since Jun 05, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Rooks Forgenal

The first one uses Future objects. This allows me to place a timeout on each object with the 'Future.get' function. This is nice but adds a bit of variability in the code. I don't know if it will take seconds to run the request or hours or days. It really doesn't matter because after 1000 objects are created, it begins to get flaky. About 10% of the time Apache kills the parent process (a Perl CGI script), and thus killing the child process (the forked Java process).On the other hand, I can control the timeout of the entire executor and force it to timeout before Apache's hard timeout of 10 minutes (set in the Apache config). This way I can ensure proper cleanup before Apache gives it the axe. I would love to incorporate both timeouts. However, the bit of code above dies after 2-3 minutes (~1000 callableObjects) 10% of the time and cannot be trusted.
Apache Errors for the first bit of code:
[error] [client <IP Address>] \tat java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:258), referer: http://my.box.net/code/UI.pl
[error] [client <IP Address>] \tat java.util.concurrent.FutureTask.get(FutureTask.java:119), referer: http://my.box.net/code/UI.pl
[error] [client <IP Address>] \tat Thread_Handler.setupThreads(Thread_Handler.java:38), referer: http://my.box.net/code/UI.pl
[error] [client <IP Address>] \tat <Java Main>.main(<Java Main>.java:72), referer: http://my.box.net/code/UI.pl

Question 1: What is wrong with the first bit of code to cause it to be unstable? Is this a bug in Java or my ignorance?
Question 2: Why is the second bit of code stable? I really see no difference as long as the total time to run is under 10 minutes.
Question 3: Is there a better way to do this whole idea?

Thank you for any help you can provide.
11 years ago
Do I have to change this:To:
11 years ago
Works like a charm! Thank you so much for your help. I have updated the code to match what was said in this thread. Thanks again!
11 years ago
OK, I tried it and yes, that works great. I should have known it need to know the object was callable. However, How do I instantiate this object now?This does not work....
11 years ago
Purpose:
Make it easy to multi-thread a group of callable objects, using a variable number of threads. Have the thread that ran the Thread_Handler.setupThreads() block until all the threads finish. Then return the finished objects back the the thread that ran Thread_Handler.setupThreads().Please note the comment. This error is requiring me to cast the executed object... I don't see why I would have to. Any suggestions?
11 years ago
As suggested by Peter Johnson, the solution to my issue is to use JSTL 1.2. The code is below. Thank you for your help.
SERVLET:JSP:
Let me begin by saying I am VERY new to servlets. I only just got my system setup to develop locally. I am able now to run everything (including Tomcat 7) inside eclipse. I have made my first servlet and jsp. I have a button in my JSP that will one day post a string, "HelloWorld" to a servlet. Until then, I am just making a String[2][5] out of Hello \n World, then I send it to my JSP. It is here I run into a problem. I don't want to cast my 2d array as a String object type in the JSP.

My Question: How do I preserve the object type in the transition from servlet to jsp?

Although I don't think it will help, I will provide my code.

EDIT: I have edited this code so it is at least working.
SERVLET:

JSP:
Let's make it generic, shall we?
12 years ago
I LOVE that code. I love it because I can predict its runtime it is simple and short.

You want me to explain the sentence I wrote?


short and simple. ...but not very malleable.
12 years ago
You cannot prevent theft/hacking. You can only make it prohibitively difficult to succeed at theft/hacking.

RF
12 years ago
That is the nicest way anyone has ever told me to "Google it". Thank you.

Let's pretend that the part where I setup a web application server has been done for me. (because it has)
The person who set this up is unwilling to show me the simplest form of a servlet because this person is a Perl purest and servlets have no place in this person's world. The only reason it is setup and running is for legacy code support.

If I might be permitted to make an analogy: I think forks are very useful, but why should I eat my soup with one?

RF
12 years ago
I can't put it all on here because it is at least 60 lines of code. However, I can give you the gist via pseudo-code. This is the recovery algorithm. To make the cipher, it is really just the reverse of this, with the need to fill in the holes with garbage data. You can make ciphers with as many passes as you like. Just reverse the string and encode again. Each time the data gets more scrambled (but you need a new terminating character each time you do).

Is this useful? Yes and No. By itself, it is no substitute for RSA encryption. However, you can use something like this to scramble the message before it is encrypted with RSA to make it even MORE difficult to reverse for potential hackers. With this you can force the need for an entire piece of data to arrive and be deciphered with RSA before you can unscramble it. That means that a hacker who gets a partial piece of data can get nothing from it even if they break the RSA (which is unlikely). Good times.

RF

12 years ago
Hello everyone. Let me start off by saying I am new to applications that run in the browser. That sentence is not very precise but it is what I mean.

I am currently following a few basic steps to achieve the desired effect. The effect being the user thinks they are running an application on their computer when really the application is run on the server and they are given the results. Here is what I do.

1. Use a browser to follow a path directly to a Perl or PHP file. The address takes me to a server and finally opens a script file. However, because the server is setup for Perl and PHP it runs the srcipt instead.
2. I use Perl and PHP to assembly my HTML on the server and it is sent back to the browser as a functioning webpage with which the user may interact.
3. The user then checks some boxes, fills in some criteria and otherwise directs the perceived application on what they want it to do. Then they hit a GO button. The browser posts that information back to the script on the server, and that script uses the information to access a database, collect its results and return a newly manufactured HTML page complete with the desired information.

I wish to use Java somehow to assembly my HTML on the server using nothing but a browser, a link and a file. I was wondering if it works the same way as the scripts do. Can I have a *.class file on a server, direct a browser to it, have the server run the java to produce the HTML and have the server send me back the custom web page in return or do I have to keep using these scripting languages?

Is it possible to see a simple hello world written in Java that might achieve this goal?

RF
12 years ago
This is NOT the best way to do this. However, it shows some of the qualities of a set and how one might go about making one. A simple ArrayList shuffle is the least amount of code but also gives you the least amount of control. The previous answers would/should be sufficient for your needs. This is just my 2 cents.



EDIT: The fun part of this code is the halting problem applies.
12 years ago
I have a question about getting my application on to a website. Basically, when I code something in Java and it works as a stand-alone GUI application through the JVM, how do I add that program to a webpage?

I will assume the most basic things are:
1. Buy/rent a web address (i.e. a service to host my webpage).
2. Purchase enough space on that host's server to hold a small database (text only).
3. Make the webpage via html+javascript
4. Add my source code to the webpage.

So my questions happen one number 3 and 4. What does html and javascript code look like to surround java code (the application)?

Brightmatter

P.S. perhaps making the GUI in javascript is easier?
13 years ago