How to create a Google Drive-like directory? - javascript

I am working on a project which requires form input and utilizes that input to add documents to a document directory. On the other hand, we want the input sent through the form to be sent through a server as an HTTP request to some back-end code such as python, Java, or C++. The application would execute and return outputs of the data associated with the input. Some sample images are provided below.
(The plus opens up a modal box with an associated input form.)
Additionally, we want to add functionality so that the right side-bar displays the statistics of the most recent clicked on the document (provided by the back-end code sent through the server). I think that I will have to use some sort of database such as mySQL, but how does that fit with the application-side programming (python/Java/C++)? Overall, we are having major issues implementing this. Any recommendations as to how to implement this as well as concepts relating to how Google Drive (a similar mechanism and framework) operates would be of help. If there any questions, I am happy to respond!

Related

How to store and make changes to a database within a Chrome Extension?

I'm currently working on a Chrome Extension which searches for specific content within webpages.
Now, my idea is to build a Database based on the correctness of this search result (which would be verified by the users), so it can be more accurate in these searches as the database grows. Kind of like a Machine Learning process I guess.
I'm fairly new to programming and I would like your advice on what are the best possible ways to do this.
Currently I just have JS/HTML/CSS, and it seems to me that I'm gonna need some other language.
A single CSV that the Extension could read/write would be enough for this, I think. Or something with SQL.
Thanks in advance!
You have to compose and post a CRUD command to a web server page (a server you own or you controll)
That page can be written in php, asp.net..
Web server page receive the CRUD command and run the relevant statement on your database via OBCD driver (or other similar driver)
Normally the web server page then responds, as a result of your post, with a message (text, xml, json) that makes you understand if the command has been successfully executed or not.
EDIT 04/30/2021 16:24 Rome Timezone
you say:
which would be verified by the users
what did you mean exactly?
more users together contributes to make the shared database better ?
or every single user contribute by itself to make his own database better ?
if one then my previous answer could be a good start point.
if two, forget my previos answer a think to build a indexedDB within your extension.
Read a csv or txt file through XMLHttpRequest is not a problem, but how do you thing to write the same file with the same tool (XHR) ?
You could think about a Google public spreadsheet.
"Google Sheets" allows you through an "endpoint url" and a set of API to insert new rows\records and to read the entire content of the spreadsheet
or (if I remember correctly) part of its content.
I state that it's now 2 years or maybe more since I got interested in Google Sheets.
Based on the information in my possession, perhaps outdated,
I can tell you that "Google Sheets" it is a path that I DO NOT advise you to follow.
First, because spreadsheet url being public would allow an attacker to pollute your DB by inserting many rows\records
by simply typing a url in the browser's address bar or creating a simple bot that inserts thousands of lines in a while.
Second, because that set of API do not allow you to implement very sophisticated queries (certainly not at the database level).
If you are really interested in Google Sheets I suggest you check what I have just stated.
If you have to "waste" energy to learn something new
I would suggest you to give priority to SQL and then to a server-side programming language (php, asp.net, node.js)
However, a free space hosting service with php and mySQL support is not too difficult to find.

Using JS/PHP/JS to hide API key

I am designing an application which uses an API key provided to me by a company.
In order for me to make my application public, I need to hide the API key in my released product, because currently it is sitting in JS code and visible to all users.
My app basically provides real-time statistics, and is completely functional, but only at the JS level.
From my understanding, in order to hide my key, I need to do the following:
Client uses web app --> AJAX call to MY server --> Gets my API key --> AJAX call to company's server --> Return only the object from the company's server to the client web-page.
I have written PHP, JS, SQL, and HTML before so I'm FAMILIAR with the languages, but this chain of events seems a bit over my head.
Usually I buy books to understand this type of thing but it seems like a pretty specific example that some of you guys would be able to help me with.
Can anyone explain how this might be done, using layman's terms? I'm not completely stupid but my biggest roadblock here are the following two concepts:
How can you AJAX call to a PHP page, and tell it to make another AJAX call to an external server?
How do you execute that second AJAX call? Is it just another (hidden) js file?
The stats are provided in real time, so you type a name in, and it generates a graph on the page within less than a second. I want to keep it like this and not have the user refresh the page.
Thanks so much. Let me know if you need any more information from me.

Sharing dynamic client and server-side content between JSP's

I've done quite a lot of searching about capabilities of JSPs and have been unable to find a concise answer to my issue.
I am currently writing a web application which uses a single jsp (with an imported CSS) to build a site with multiple functionalities. Specifically, the application has the ability to read and write data from/to an external server, as well as update user content and info.
For the sake of aesthetics and clarity, it makes the most sense to designate different areas of the site to each of these tasks, one at a time. Rather than attempt to use page divisions and conditional statements to control their visibility and execution, I want to essentially "cut up" the logic behind this dynamic content and spread it across multiple JSPs to allow for more organized editing, testing, and modification of the code by both a web developer and programmer, without either necessarily having to collaborate.
Assuming that all of the JSPs involved have the appropriate imports, are there any essential measures I need to take to allow seamless sharing of content between these JSPs? For example, if a user writes to the server and stores their data as some entity, (from a page with tools from one jsp) will the functions used to query the database work if I simply copy that code into another jsp and have the user navigate to that page in order to access that persisted data?
Thank you for your feedback!
Learn the design pattern Model–view–controller. It'll great to help you solve many of your project problems. And your architecture will more maintainable and scalable. You can see here and here for more information about the implementation of this pattern with JSP.

Salesforce data loss prevention - can I embed JS on standard salesforce pages?

I'm looking into possible ways to control and monitor data leaving our Salesforce Org. Currently solutions appear to fall into two broad categories:
Lock down features for users using profiles. E.g. Prevent certain kinds of users from having reporting, or exporting rights
Have third party monitoring software installed on work machine which monitor and control interactions with salesforce.com
Neither of these suits our requirements. Our problem is with users who need to be able to run and extract reports but doing so from some internet cafe. We also can't restrict them to work machines as a lot of them are travelling salespeople.
Furthermore, salesforce have said they don't provide any kind of report on what reports have been run, or what data exported.
I'm investigating the third possibility which is bolt some sort of monitoring JS code onto salesforce.com itself. If possible, I'd like to embed JS on the salesforce Report tab (and any other page where data can be exported) and intercept clicks to the "Run Report" or "Export" buttons. I'd call a logging web service with the user's name, the report parameters, time etc.
Does anyone know if it's possible to embed custom JS on salesforce pages? Or any neater solution to the above?
Thanks for your help
Ray
Salesforce is very protective of their code base, to that degree that even custom Apex code runs on a completely different domain so that they can use cross-domain scripting to prevent us from tweaking their pages :) So unless a man-in-the-midddle SSL attack is used there is no way to inject something in their code.
Maybe a grease monkey script? But users could remove them or just use another browser.
I do not think you have an ideal solution here other than security, either profile (object level) or sharing (row level). Think of it this way, someone keen on stealing data could just grab HTMLs of detail pages of rows participating in report, grabbing raw data from HTML and running reports externally. Maybe force traveling salespeople to use RDP to office located machines?
Another option would be to make a subset of your reports info visualforce pages (write out the SOQL and apex needed to gather the data, then write VF markup to display it) and then log and/or restrict who can access those pages and when (including checking the source IP).
There's clearly some serious effort involved in moving more complex reports over to this format, but it's the only way I can think of meeting your requirements.
This would also allow you to not include any sort of export options, although they could of course save the raw HTML of the page if they really wanted to.
To embed javascript in a standard SFDC page go to "Your Name" => "Setup" => "Customize" => "Home" => "Home Page Components" => Click the edit link next to "Messages & Alerts". In the "Edit Messages and Alerts" page there is a text area that you can paste javascript code that will be excecuted on almost every salesforce page.
Here are a few notes when doing this
Do not put empty lines in your code because the system will add a p html tag in it.
Use absolute references to your Salesforce pages because managed packages have a different url structure.
I'm not sure how much longer salesforce will allow this but it currently works.
For more info see http://sfdc.arrowpointe.com/2011/11/18/email-autocomplete-using-jquery/
Slightly different way of doing it https://salesforce.stackexchange.com/questions/482/how-can-i-execute-javascript-on-a-sfdc-standard-detail-page

Can excel fill in certain fields based on variables from a website?

Our ecommerce platform will does not currently create invoices. I have an invoice template that I currently use in excel, so I essentially just copy and paste about 8 points of data from the ecommerce platform to the spreadsheet, then print it out.
Even though the ecommerce platform does not create invoices, that data can be sent anywhere I would like, including a website or email, so I've used it to automatically notify me of certain purchases via email.
What I am wondering is since the variables (eg. user_address) are always the same that are sent from the platform, can that information somehow be sent to an excel spreadsheet (my template), which will then be populated by the appropriate variables, so all that's left to do is print it out?
I'm not really a programmer, so any code snippets you can provide or some idea of whether or not this will take a programmer would be appreciated.
Yes, check out Apache POI, this would let you create something in Java, perhaps a servlet, that would catch the data from your ecommerce app and make a spreadsheet.
Alternatively you could make a Google Spreadsheet and an associated form and write some intermediary script in whatever language you like that will send the right post variables to the Google form from the ecommerce app. I would expect this solution to be much less involved.
I would suggest taking a look at APIs like JExcel, which lets you read/write cells of an Excel file using Java. If you send your data to an Excel file, and then pull it out using this package, you could get the desired results. You may still need a programmer for this method, although there would not be a lot of work involved.

Categories