I have an Eclipse project being run locally from my machine through Tomcat. The project is a web application with patients, HCPs, and administrators able to log in to do various tasks. One of these tasks is to run a group report on patients based on certain search criteria. After a group report is run, there should be an option to view the group report as in XML format.
The way that I have structured my project is I have created a groupReport.xml file locally. Once this file was created, I committed it so that when I run the project on a Tomcat server, I can manually point my browser to the website address of where the XML file is stored on my server (localhost:8080/project/groupReport.xml for example).
Each time that a group report is run, I have a java class that rewrites the groupReport.xml to reflect the new changes. This java class uses a FileWriter that writes it to the local path on my hard drive. The problem with this is that navigating to localhost:8080/project/groupReport.xml will only display the XML information for the group report that was first committed before the server was started. It does not reflect any changes to the XML that has been rewritten locally.
I have tried to use relative pathnames to have FileWriter write to the XML file being stored on the server side, but could not achieve the results I was looking for. Is there any way for the XML on my server (localhost:8080/project/groupReport.xml) to be rewritten any time the locally stored XML file is rewritten?
I do not know any PHP or Ajax, so if there's a similar solution using just Java and Javascript, that would be preferable.
Related
So currently I have a Raspberry Pi that gets the data from somewhere, processes it, and writes it to a local CSV file. The data comes at irregular intervals and I'm planning on displaying these numbers in CSV onto a webserver, perhaps in the form of graphs.
I did look into fusion charts and they do seem to have a real-time graphing option, which I was able to use. Here are a few concerns: (apologies for dumb questions: not too equipped with web dev)
Is merely running an HTML file on a web browser basically acts as a webserver? I tried out Nginx and all it did was created an HTML which I was able to run on a browser, which I was able to do with the source code from fusion charts that I stored in a separate HTML.
How would I go about constantly keeping track of the latest data being written to a CSV? In the source code of fusion charts, I see it calls a function to update the chart within setInterval() which also takes an argument to set the frequency. With this, I could maybe just use the last line of the CSV while keeping track of the index, so the next data is taken from index+1 and so on...
How do I map a local file to a server without me having to manually upload it myself? Just to test, I uploaded the csv file to something like this on gist. But ideally, I'd want the local CSV to be mapped to a remote server so the numbers are reflected in real-time based on the local file, and then the JS code will then simply read off the raw CSV file.
My overall goal is to store large video files (5 GB) in SQL using my MVC app. The highest I can get the web.config to allow file uploads is 3GB, so I found this solution that uses JavaScript to slice the large file into chunks and send it to the controller using AJAX.
https://www.codeproject.com/Articles/1034347/Upload-large-files-to-MVC-WebAPI-using-partitionin
This works fine to store the file on the file system, but I want it in the database. I am using Entity Framework currently to insert this "FileModel", but I obviously cannot take the same approach because the database insert would just be the first data chunk.
I am at a loss as to what to do. I see FileStream mentioned, saving the file to the file system and keeping the file path in the database, but most of these postings online are a little dated. I am running .Net 4.5 and SQL 2012. Any suggestions are greatly appreciated.
Storing such big files in the DB does not sound like a good idea. Why do you want that?
Save the files to /temp location and run another script to move them to the DB and delete the file afterward.
You can also modify the MergeFile() to use and return a binary stream of the file that you can use to insert into your DB.
Is there any flat file database system that works well with javascript such as one in JSON format or similar. I have heard about mongodb, couchdb and others but it seems whole setup of it must be installed on the computer.
Of course, I can't use sqlite beause I think I won't be able manipulate it via javascript and I don't want to use any server-side language for my small apps.
I searched on google as well. Basically I am just looking for flat file database system that I can put in javascript app's folder (meaning portable database and app) and be able to use it anywhere, for example on some other computer without having to install any dependencies ? Does such portable flat file database exist out there ?
How about PouchDB? It's intended for web apps that cache data offline.
I am trying to build a web application to replace the functionality of an older desktop economics program. That program is essentially a calculation engine built on top of a Microsoft access database. The inputs and results are all stored on a series of tables. To offer compatibility to the legacy users, I want to have the ability for users to connect to their older, local access databases and upload them into the web app.
The approach I was contemplating was to have a page that allowed the user to select the database they wanted from their local machine and then have the schema and the data for each table sent to the web application. I don't really want to upload the whole file -- I just want to extract the relevant data.
I have done some research and I have looked into the HTML File API. One shortcoming is that the API does not expose the file path of a selected file so there does not seem to be a way to pass that to the connection string necessary to connect to the database using ODBC or ADO.
In summary my basic question is: How can I get the contents of a user's local database into a web application only using the browser?
You will have to upload the whole file to the server first. You can do your manipulations on the server to save only the relevant part and delete the rest... For security reasons Javascript is not able to read file's content from the local user's machine.
A suggestion - you can upload the file to server, read and print the relevant data as JSON or XML format, then delete the file and use all the data in your ajax response on the client's browser.
As a server developer, I would get my PHP code to access environment variables for deployment settings.
How would you approach the same problem for a purely HTML/JavaScript/jQuery page?
For example, would you load in a JSON file?
I'm tracking the page in git, and I don't want to save person-specific information in the main repo.
Use some build system (ant, phing, shell-scripts...) and create the template for config file.
On the build step just fill the template with real values (taken from environment or wherever you want) and prepend the real script with the configuration object.
As a result of building process you'll have the specific file for particular client.