Lance Walker

Greenhorn
+ Follow
since Mar 09, 2009
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
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Lance Walker

Hi, I recently made a post here for help filling out basic web forms with java (constructing and sending a POST request). I was able to code something that will complete basic forms, but this is only part of what I need. I'm trying to incorporate a client version of a registration form into my application as a matter of convenience for my users so they don't need to do so through a web browser. However, the form that I want to create needs the user to fill out a CAPTCHA to ensure that it is not an automated request. Is there a way I can fetch the captcha and display it on the client application so the user can fill out the corresponding code?

For example:
1. User wants to register
2. Opens up a registration jpanel which presents them with proper text fields for their name and email. It also fetches the CAPTCHA and provides a text field to contian the CAPTCHA's contents
3. The application takes all of these parameters and sends them to the registration page through a POST request.
4. The server responds to the application. The Application reads the response to determine whether this was a success or not.

Thanks in advance for any help.
Thanks for the help. I'm going to give these a try. I'll report back if theres a problem.
Are there any built in APIs which can handle this? I want to develop a simple application that can handle submitting data on online HTML forms using the POST method, but I haven't found anything that can do this so far, except for a few deprecated libraries. I figured this would be a common task, but haven't had much luck. Is this possible to do without overly bloated code?

Bear Bibeault wrote:No, this can actually be quite simple. It's the applet red herring that made this seem complicated.

If this is hosted as a Java web app it would be rather trivial to do in a JSP.

Otherwise, an Ajax solution, made easy with jQuery, might be the best bet. With it, you could send back to the server on page load for a list of n image names returned in JSON format that you would then use to create the image elements on the fly.



Ok, I'll probably stick to the Ajax idea. Thanks a lot for your suggestions, and especially your patience. Being new to Ajax/jQuery and being a lousy web "master" is a bad combination .

Lets hope I can whip up something. I've been reading this http://www.sitepoint.com/article/ajax-jquery/ to get a basic idea of what to do. If you have any other tutorials that might be useful to me, feel free to send them my way
Sorry, I'll try to be clearer here. My website has pages upon pages of "packages" of pictures that a user can download. I want to be able to provide a preview of these images, via thumbnails, so that they can easily see a sample of what they are downloading. I am trying to automate this process so I don't need to spend 100s of hours hardcoding the thumbnails into the HTML, so I'm looking for a simply solution quickly display a random selection of these thumbnails. My idea to automate this was based off of the fact that these images are already sorted into categories.

For example, www.example.com/images/todayspictures/*.jpg

So I figured I could parse the URL, or pass the names of the subdirectories as parameters and look for the thumbnails in a clone of the original file system.

Using the example above, the thumbs would be located at www.example.com/thumbs/images/todayspictures/(thumb)*.jpg

I could locate folder containing the correct thumb images, add all of the thumb images to an array, randomly select a few images, and then display them on the page.

It didn't seem like too hard of a task, but its much more involved than I initially though .

Again, thanks for all of your help and suggestions.

Paul Clapham wrote:I can tell you right now that your applet is going to look on the client for those files (that's what a File object means) and not on the server. And if you test it by running it via a browser on the same machine where the server is running, you're going to hide that error until you try deploying it.

You're going to need something on the server which returns a list of image files from a directory, since nothing has direct access to a directory on the server over the web. Not Javascript, not applets either.

By the way your home-grown URL-encoding method (changing space to %20) should be replaced to a call to a standard URL encoding routine. Both Javascript and Java have one.



Thanks for the advice, although I think I'll just scrap the applet. Its a lot more clear that I was headed the wrong way to begin with. That being said, I have to learn a bit about ajax/jQuery. Doesn't look too hard, luckly. So basically I'm just going to need to make a server side PHP/ajax script to get a list of the files and then simply output a few random images on the client side?

Bear Bibeault wrote:If there's no reloading, what's wrong with Eric's simple solution? You seem hell-bent on complicating this unnecessarily with an applet.

You do realize that applets run on the client, right?



Yeah I do, which is why it doesn't seem like an appropriate solution/wouldn't work. I'm going to give Erics idea a shot and I'll report back, hopefully, with news of my success. Thanks for your help and patience guys

Bear Bibeault wrote:

Lance Walker wrote:I wasn't aware I would need to sign my applet to access something on a local server



"local server" is an oxymoron. What do you mean by that?


Hmm, silly me. I mean the server that the applet is hosted on. Must be past my bedtime .

Also, I don't need the images to refresh at all. What I'm trying to do it to display a preview of images through a bunch of thumbnails, but its not necessary for them to reload without a refresh. I just don't want to display 200+ images at a time, so I want to randomly select them from a directory. However, this needs to be a very flexible solution because the file names of the images must be preserved, and there are a large amount of them.

Also, I just hammered out this applet. I'm going to test it, but it seems like lots of you guys don't recommend using an applet, so I'm still open to suggestions. I'm assuming that all files in the directory are pictures, and it loads parameters of the directory and subdirectory of where the pictures are located. Again, I have no idea if this works, but its a good example of what I want to do.

I wasn't aware I would need to sign my applet to access something on a local server, although I know that you need to sign it to have access to the users system.
In regards to Ajax, I've just never had any experience using anything like that. If its easy to learn then I'd be happy to take the time though. I'll google it now. Just though it might be easier if I used something I had some experience with. I also am not sure about my host's limitations, so I don't want to be disappointed if I code something entirely new and they don't support it

Thanks for the help so far

Edit: I was just thinking of something along the lines of this:

http://www.realapplets.com/tutorial/ImageExample.html

only slightly more advanced
Would this be possible using a java applet? I'm not entirely sure this would be a good solution because of the bandwidth issues that I suspect might arise from using many instances of an applet on a single page. But maybe coding a very small applet which will parse a folder on the hosting server and add any files with a .jpg .png etc. extension to an array? I'm going to take a crack at coding this, but does anyone happen to know if the file class supports web storage? Ex.


I was wondering if there was a way to display random images from a directory using JavaScript. I know that there are a lot of scripts that can be used to display random images from an array of preset images (ex. a random image from the array containing image1.jpg, image2.jpg, image3.jpg) however this is not a viable solution for me as I have a large amount of images with drastically different file names that need to be preserved. So is there a method that finds and randomly selects a file from a specific directory, and then displays that image, regardless of the image's file name?
Hi hopefully this will be an easy question to answer.
I've finished coding an applet that can be used to download files. However I do not wish for the files to be downloaded directly to the drive and I want the user to be able to select where to save the file using the NATIVE open/save browser feature (not JfileChooser). To do this, I used the following code, where targetURL is a string containing the full HTTP file path:




When I tested the applet out on both IE and Firefox (in these tests, absolute permission was granted to the applet to the local system through a digitial certificate), the applet opened the open/save file dialog perfectly in both browsers when downloading a .EXE file. However, when downloading a .torrent file (essential feature to the applet) only the IE dialog popped up. In firefox, a new windows is opened and a textual representation of the .torrent file is displayed, and looks much like if you were to open a picture file with a notepad. I am utterly baffled by this . Firefox has no problems downloading .torrent files through its interface, but for some reason when an applet is run it cannot seem to recognize the .torrent file. Is there any way around this? I would assume this might be a common problem for files other than .torrents or with other browsers, but I can't seem to find a google solution.

Any and all help is appreciated. I'll provide additional details/code as is needed.
8 years ago
I'm very new to both java and making applets, so please bear with me.

I need to digitally sign an applet so that it can read and write files on the local system. The applet downloads a file that the user selects and then the user can also upload files to a server.

However, I have absolutely no idea how to go about doing this, and everything that I've read so far is pretty cryptic and gets far to technical for my level of understanding. So far I've looked at http://faq.javaranch.com/java/HowCanAnAppletReadFilesOnTheLocalFileSystem and its references, and tried searching google for a simple tutorial.

Could anyone please define that steps that are necessary to signing an applet, or point me in the right direction? Also, I'm developing the applet on in the Eclipse IDE, so if there is a way to sign applets within eclipse, that would be fantastic .

Thanks in advance for any help!
-Lance
8 years ago
Thanks for your help. Things are looking better now
8 years ago