I as a beginner struggle a lot to figure out how you can save reads of data which is constantly queried. Does anybody has some good resources to learn about this. Currently I have a list of exercises, which is frequently refreshed, but the reads are much more compared to the writes. I set it up on firestore and always serve it through ejs (template engine) to my modal. Instead of always querying the same data all the time to my template, can I save the results and just serve them? I could also serve it statically, which wouldn't be so dynamic as it's made by hand. But I could then save a lot of reads and just query the newly added (creation Date after I implemented the data static),or?
In my project I am using just plain HTML and plain JavaScript (Cloud Functions with express)
Is there no common practice for this kind of situation? You could also save the data like every hour on Google cloud platform as a JSON tree and then read it from there? Would save a lot of reads or you could make something like a load more button, where only the first 20 results are loaded ( but this would make the user experience a little tricky and not so likable..)
Related
I'm working on a project for my employer that is off-job-description for me. I am not in my department's IT/WebDev departments. That being said, my department is trying to streamline a process that is horribly done right now. Here's what I'm trying to do..
I want a form that can be submitted on a local computer (no PHP library at this time - ticket opened with IT for months now). It will then be used to populate a calendar (which I have no issue programming and filling automatically with PHP normally, but like I said - no library).
Basically - I need to be able to save the input data locally on a SharePoint folder and be able to "grab" that data when the site is loaded.
Again, I have no problem with the display/structure parts - I just need to know a good way to save/load the data (long term) until my IT gets its... stuff... together and get's me a php library and SQL Database.
I'm not looking for any type of script help or anything. I can learn what I need. I just need ideas of what type of function or something I can use. If you have a website with some tutorials or at least documentation for it, I'm happy to read up myself.
Browsers cannot access your local filesystem and are heavily sandboxed to protect you and your data from nefarious websites (even if you have written them).
As such, your only option of writing data to a Sharepoint folder is to leverage a server of some kind. This can be created locally on your own PC, or on a spare one for the time being.
You might to need to contact your IT admin, so that they can grant you access to your Sharepoint, so that your PHP code can read/write to your Sharepoint folder(s).
Good luck!
Alright, so ive been fiddling around with Spring Boot recently and built a pretty cool backend. I got a pretty good hang of it, I want to start to mess around with the front end more. So, I want to create a main feed that dynamically updates based on whats in my sql database. It will load a few objects/comments as I get closer to the bottom of the page. Something like the function of reddits system of its main feed. So I know I need to use JavaScript to implament the objects and I cant just use thymeleaf because thymeleaf creates the html on startup. I noticed JQuery and it seems cool but I was thinking, it seems like people put their calls to the server get requests in the public/resources folder. This includes the connection to the database. That just doesnt seem right to me at all, why would you want it to be public? And if it doesnt have to be public how do I do so.
So in summery: How do I server JS files that connect and use my database that can dynamically update my webpage. Also any recomendations on what to use?
Context: I'm building a simple website based on colouring in different countries on an SVG world map. For now, everything is just running locally, I have an index.html, an app.js file in which I've built a bunch of functions. But I'm really confused about where I should store data and how I should access it.
For example, I need to have a list of all the countries stored somewhere as an array, which can be read into a function in app.js, and used. I thought this was the kind of thing that a JSON array is perfect for, but it seems you can't just access a local JSON file, it has to be requested from a web server? I could just paste in the array as a global variable at the top of app.js, but that's supposed to be bad practice.
Should I have a separate data.js file which is called as a script somewhere? Or do I need to start using a database and learn some SQL?
Either get them from an API (yours or someone else's) or store them in your web page (perhaps as a sourced JavaScript file). Update the source when the list of countries changes (it doesn't happen all that often). There are various APIs available to get lists of countries and country data, for example RestCountries.
if you want to store things locally that the user creates e.g. to operate offline or across browser sessions then see Web Storage Overview for options.
I'm creating an application whose purpose is to fill out a long form, the details of which are saved to a remote database so they can be recalled/edited later. When the form is ready to send out, I need to convert it into a PDF and email it out. Preferably, I would like to do this without using the user's filesystem, but if that's not doable I can work with it.
I've been looking into solutions for converting to PDF such as jsPDF, and for the email functionality it looks like the standard is to use nodemailer. However, I'm not sure how to hook one into the other, especially if I'm going to be avoiding the filesystem.
This is a web app that will be primarily accessed with iPads and phones. My app is built in React, using Apollo/GraphQL for queries and an Express server, obviously all sitting on Node.
Are there any good solutions to this problem? This is a bit of a crunch time problem at this point, and any help would be greatly appreciated. I've been tearing my hair out on this.
I do all of the stuff you need, though it's not the same process, it's essentially the same.
First of all, you will be doing all of this in the backend. The user will submit the form, you will get the data there and work from here. Once you have the data, you will want to create a pdf file. To do so, I use this: https://www.npmjs.com/package/html-pdf It does what it says, works like a charm. In order to use it, you need to have some HTML. I get the HTML using ejs, more specifically, the render function. (you pass your data to the ejs file you want to render, get the html).
Once you have the html, convert it to pdf with that module (save it to some tmp folder, overwriting whatever was there or whatever you want to do), you can use the nodemailer to send the file (check the doc, sending attachments is just a matter of adding the data).
This is what I do. Surely there must be other ways to do the same.
I am creating a product that as end result will/can create e.g. 10 .sql files, each being a table. The tables will contain various pre-calculated data related to each other.
My users will need to upload these to their website (php, asp, whatever) and will need to make something useful. Only problem, the users may have next to zero understanding of databases, server-side code etc. This means it must be very easy to configure.
So I think thinking upload these .sql (or CSV files, whatever) tables to server, so they are publicly available (i.e. can be retrieved like any other public URL). And then find a Javascript in-memory database engine that can load .sql database files. Does this exist?
I imagine a Javascript solution could work well if amount of data could be kept somewhat down... Otherwise I may need to look for a PHP/ASP solution as well. (Any ideas for libraries that can init in-memory databases from .sql or similar files?)
Preferably I should be able to re-distribute this Javascript library. (So users can get a complete "directory" of .sql files + example page + Javascript database engine to upload)
So to make the question clear: Anyone knows a Javascript-based in-memory database engine that can run inside browser?
If you wish to use javascript and need some 'userfriendly' bridge database, you could use json or xml, because the format are simple text files (like csv as well) for wich you can find smart small editors for your users.
More json is made for javascript parsing and has an understanding tree format, but you should load only some part of sql datas in memory, saying data buffers in xml or json, with php requested with some javascript ajax call. Php do the sql database access work and then you can output json, and with javascript, it is for user's interface, you'll be able to display them.
You can use mysql to store a database in memory:
http://dev.mysql.com/doc/refman/5.0/en/memory-storage-engine.html
Here's a pure JS SQL engine that stores everything in memory, https://github.com/moxley/sqittle
It flatly denies being useful for anything though, and has a limited set of supported commands (see readme on above link.
http://diveintohtml5.ep.io/storage.html might be what you are looking for.
That question seems very old. You might want to look at LokiJS now.