Progress Bar using jQuery with a Grails backend? - java

I've written an excel upload function that allows a user to upload an excel sheet through a web interface and it will commit it to a table. The problem is that with a table with many records, it takes some time to go through each record and check for changes, so it tends to hang. What would be the best solution for a progress bar type control that I could use to show the users that it is indeed processing the workbook?
Thanks.

Maybe a simple "I'm working" message would do, maybe even with an animated wait spinner.

If you have to do it that way, the Grails jQuery plugin works like it should, and jQuery does include a progress bar which is easy to update as long as you know how far along you are. Far easier though would be to use Bobby's recommendation of a wait gif.

If the process takes a long time, you may consider an asynchronous approach where you allow the user to upload one or more files and then provide them with a widget that shows them the status of all of their file uploads. This increases the responsiveness of the application and provides for a better user experience.
See how GMail does file attachments, or how Flickr does image uploads through the site for some examples.

Related

How to upload large files from ajax to springboot in chunks

I have a JSP page using ajax as my front-end talking to a java springboot backend. I need to upload large files, which is currently working fine. The problem is that Cloudflare only allows 99MB at a time to be uploaded. I need multiple GB's uploaded at one time.
From what I understand it is possible to break the file into a chunks or BLOB and then send them through one piece at a time. It is fairly easy to find an example of this for the Ajax side of things, but I've yet to find anything for the correlating SpringBoot functionality.
Ultimately I'd also like to be able to stop and resume the uploads/downloads, so I think this would also be used in that instance?
Edit
It seems like Spring Batch might be the tool for this, but I'm still in the dark on how it would work with Ajax.

Linking Website form progress data to GIS

We are trying to develop a website for tracking the progress of pipeline and assets. I want to link progress data entered from forms developed in Java to GIS. We will be capturing all the lat and longs of pipeline stretch and lat and log of progress of work.
I need help in developing shapefile dynamically based on the progress and also to view that shape file in my webpage
The javascript API does have functionality for uploading shapefiles form your desktop into the browser, but you will need another tool to create those shapefiles based on the progress.
For uploading the shapefiles, see the example here: https://developers.arcgis.com/javascript/3/jssamples/portal_addshapefile.html
There may be more examples available at https://developers.arcgis.com/javascript/3/.
For creating the shapefiles dynamically, you could use ArcMap or ArcPro if you have those, or one of many python libraries to help write shapefiles. There may even be some Java libraries to help with this as well but I only work on the front end so I cannot help you there.
For something simple in context, the complexity of what kind of workflow to best suite your needs can range depending on these questions (and probably others I'm not thinking of):
Do you absolutely need to create a shapefile for this? Why can't you just push the form to a spatial database (e.g. PostGIS) and then return the XYs of the points or the string of XYs for line features, etc.?
Where is the source of the data & what is the format? Is it a PDF, text on an HTML page, a .csv file downloadable from a page, etc.? You may need to implement scraping (from a site) or download and update, or your data could be live streaming - these are all different workflows and you need to establish these boundaries before setting up your workflow.
If your end game are points, all you need is XYs in a table format to display in GIS software. If they are lines or polygons, it'd be a little different. Again - what output type are they and what are you trying to do with it (e.g. import into QGIS)?
Without these answers, it doesn't make sense for anyone to suggest something to you that could be totally impossible for you to execute. Please answer these and think through your workflow from beginning to end and/or visa versa.
Cheers,
Shawn

Convert Web Page to PDF or Image

I need to convert a web page [which has not public access] to PDF or Image [preferably to PNG].
Web page contains set of charts and image. Most of the charts are populated through Ajax calls so there is a delay between page load and chart load.
I am looking answer for any of these questions:
1- I found set of snapshot api's but none of them support accessing my internal page. Since the web page I am trying to export is not public I need to be authenticated. Biggest problem is I cannot send request headers [such as session-id, cookie or other variables] along with these API's. It seems they don't support this kind of functionality.
2- I am not sure if I can do following: Login to my web page with HTTP client, add http headers, send get call and get HTML string. Then use one of the converters to convert it to PDF. What I am not sure is if it's possible to get proper PDF from the HTML string I got from http client since resources [css, js and etc] will be missing. I want my pdf/image looks exactly as it on the web site.
I really appreciate if you can help.
Thanks in advance,
ED
You're probably best of using wkhtmltopdf, which is a server-side tool and is easily installed.
There are two parameters you can use to wait for your Ajax to finish, try:
javascript-delay to influence the time the program waits for the JavaScript to finish
window-status to wait for a certain return code for the window
See the extensive manual for this program here
wkhtmltopdf generates a PDF and wkhtmltoimg generates an image, which is PNG (as you requested) by default.
Authentication is difficult because it involves security. Because the operation you are describing is unusual it is likely to result in all kinds of alarm bells going off. It is entirely possible to do but it is fraught, easy to get wrong and fragile in the face of security updates and code changes.
As such I'm going to suggest an alternate method which is one we often recommend for ABCpdf (on which I work). Yes we support standard authentication methods but the beauty of this approach is that it is robust and is applicable to other solutions (eg Java based) and novel authentication methods.
Typically you just want a PDF of the current page. The easiest way to do this is snaffle the HTML. The way you do this rather depends on your environment. For example under ASP.NET you can obtain the HTML of the current page using the HttpResponse.Filter property or by overriding the Render method of the page. The way you do it will depend on what you're coding in.
Then you need to save this HTML to a file and present it to your solution via a 'file://' protocol URL. Now obviously at this point any relative links will be broken but this is easily fixed by dropping in a BASE tag that references the place they are located.
Generally the types of resources referenced by an server-side page are static. So if you can create a tag that references the actual files rather than a web site, you will bypass any authentication for access to these resources.
That still leaves the AJAX based problems which are another can of worms. The render delay method is something we have supported for many years (from before AJAX was around) however it is not terribly reliable because you just don't know how long to wait.
Much better is a tighter link into the JavaScript via a callback you can use to determine if the page is loaded. I don't think ABCpdf is going to be appropriate for you since it is .NET but I would certainly encourage you to look for a Java based solution that uses this type of more sophisticated approach.

How ajax file uploads work?

We know that, JQuery ( or javascript ) can not access local file system. So how does the various ajax file upload plugins of jquery actually work and even show the progress bar ?
I once made an File Uploader using Java Applet and I could do it because somehow I was able to read the file from the local file system using applet. Because I was able to read it, I sent it a 100 lines at a time using ajax.post in multiple parts of 100 lines and as each of the part is successfully sent, manipulated the progress bar accordingly.
But, when we can not read the file from file system, then how do the ajax plugins of jquery show the progress bar and upload the files asynchronously ?
Typically, there is a handler on the server side accepting the post, and then another handler to report progress of any upload.
If you give an example framework to use, we can give a more specific answer.
They all have some sort of back end component that runs on asp/.net or .php (there are others, of course)
There is no way to implement an uploader on your site without something on the back end to save the files.
They use flash. See: http://www.uploadify.com/
Some, now use HTML5 features.
Not necessary that it will use flash . I have custom uploader where I am showing progress in a div with filling it by color based on process done . I have a uploadtracker.js which returns progress done and based on that I saw that div process based on its return value.
Check these samples .
http://malsup.com/jquery/form/#file-upload
Here are some other in case any of them helps .
http://www.tutorialchip.com/jquery/9-powerful-jquery-file-upload-plugins/

What's a good client-side, resize-before-upload, flash/java uploader?

does anybody know a good client-side, resize-before-upload, flash/java uploader?
We need this terribly on our project, since we have a lot of people uploading photos and most of them have photos which are bigger than 3MB. We want to be able to resize these photos before they get sent out to us.
I've googled for client-side java/flash uploaders, but I wasn't impressed with the results.
Is there anyone here who has already purchased a java/flash uploader before? Which ones are good?
Thanks!
http://www.shift8creative.com/projects/agile-uploader/index.html
I just finished this little project. It's a very tricky thing to do - resizing before uploading and then to make matters worse there's a few gotchas. Such as if you wanted to use a submit button outside of Flash (via ExternalInterface) to submit... You could end up in some trouble. I released my project for free and it should take away all the headaches for ya. Though it's only a single file upload (some other projects like swfupload and plupload aim to provide multiple file uploading but are much larger projects and I feel too bulky and take too long to setup on top of the fact that they really aren't that seamless, you'll be jumping through hoops on the backend).
http://www.plupload.com/
Allows you to upload files using HTML5 Gears, Silverlight, Flash, BrowserPlus or normal forms, providing some unique features such as upload progress, image resizing and chunked uploads.

Categories