I am writing a web application in AngularJS with the server code written in Java. The client code talks to server via HTTP API. The web application is mainly to show statistics and basically contain graphs.
The web page contains fields like from-date, to-date and the name of the country for which the statistics are to be shown. So after selecting a few graphs ( say I have a dashboard of 5 - 10 graphs ), the web page provides an option to save the web page's state, so that, I can open the page with the same graphs still being shown. i.e., I need not have to select the name, date, etc. again to have the dashboard of graphs.
I can easily contain the from date, to date and name in Angular models. But to save the page and reopen again, I need to persist the model data into some storage media and upon reopen, I need to read from the storage media and populate the Angular model, right?
How can I do this? Should I go with some frameworks, like django, etc. where I have a separate database server such as sqlite running? But I don't want such a complicated work. I need to have the simple client side coding ( HTML + JS ) and keep it neat.
Is there a solution for this?
Angular is a client side framework. In order to persist or retrieve data you'll have to use a server-side data base. Talk to it via a RESTful interface using $resource or $http.
Related
I'm developing Web application using Servlet. Right now I'm able to display data retrieved from MySQL database and display it to HTML; even user logging in works and response is shown on HTML via Servlet.
Specifically in case of Withdrawal transaction of bank account, there is need of multiple call transfer and data handling between Servlet and HTML. I've tried using XML for data transfer, and it works for single call with static data. But I'm unable to optimize it for withdrawal process.
Can you please tell me better way of doing this?
to develop web application in servlets,its always better to use MVC pattern(architecture) which separates code into 3 different groups
1)Model - this part of the framework is to store the data of the application, such as databases, text data, files and/or other web resources.
2)View - this is the graphical user interface of the application. That would contain different buttons, text boxes and other controls to let the user interact with the application to complete his projects depending on sort of the software he is using.(jsps,html pages)
3)Controller - the actual back-end code constitutes the controller of the framework. A controller controls the data coming from the users, or going to the user from a model(servlet code)
advantage of MVC pattern are
1)code reuse
2)separating of concerns
3)less coupling between the layers
I am trying to write a web application that displays to users a hierchical tree. Users can add,delete, and update the tree but the tree should look the same for all users. My first thought to save the state of the tree (i'm using JSON to represent the data in the tree) in a database but, what happens if there are a million/billion/etc number of people using the application? How do you make sure that all users are physically seeing the same thing if additions/updates/deletes could be going on simultaneously?
Something like signalr would would help:
http://signalr.net/
What can you do with ASP.NET SignalR? SignalR can be used to add any
sort of "real-time" web functionality to your ASP.NET application.
While chat is often used as an example, you can do a whole lot more.
Any time a user refreshes a web page to see new data, or the page
implements Ajax long polling to retrieve new data, is candidate for
using SignalR.
It also enables completely new types of applications, that require
high frequency updates from the server, e.g. real-time gaming.
I am creating a website and an App with Phonegap, I'm new in programming for mobile platforms, this site has a database and want this bunch of data is directly available in the App, but do not want to access the database remotely, then how can I do to send a request to the PHP site and it returns me a result to be displayed in the App using JS? How can I make PHP and JS? And is to make a "cache" in the App DB, make a copy on a daily basis, or when updating the DB?
ok well it depends how your site is setup. JS by default is client side, however you can do things like
document.getElementById('myiframe').src='phpscript.php';
thus refreshing the script inside of the frame, the script would pull the data from your database.
otherwise look into AJAX
In the application I am writing, a user captures information about a person via an online form. When they have completed the form they save their work, repeating this process several times in a session. When they hit 'Save and End Session' they are returned a list of the several person instances they have just saved, all data being saved to a server.
I wish to replicate this functionality in an offline app. Using HTML5 I understand how to cache pages, and how store the JSON form data in localStorage using raw Javascript (or perhaps Angular.js cache).
But is it possible to dynamically update cached webpages with cached data while offline? how, for example, can I write the the cached form data to a cached copy of the list page, updating that page with the data just produced, all during the offline session?
I cannot find an answer to this one. All suggestions are much appreciated!
If I understood this correctly, you want to dynamically update the html view while offline.
If you are using Angular, this is pretty simple.
You just have to cache also the JS controller, not only the html file (set it in the cache.manifest). The page will have the same functionality as the online app then. But if you want to send the stored offline data back to the server when offline, you can write a simple code that will:
Save the parameter in localStorage, which will mark if the data was saved while running online/offline app (you can recognize onine/offline by sending AJAX request to an existing part of the app, which is not available offline (so not cached one))
When app runs then in online mode, it will collect all the data stored offline and send it to the server
I have been working on a large project for about 4 months.
We have a "lead" that I constantly question.
The rules of the project (from the customer who has no background in IT) are
Only JavaScript will be used (Kendo UI package for CRUD).
It is to be "secured" with SSO - ADFSv2/ACS
It must have use Odata to interact with the database.
Please correct me if I am wrong, but does this not mean
A. This is clearly insecure. (after the initial login)
B. How can Kendo even handle database interaction (correctly) if it must update multiple tables?
There is another programmer currently working on a similar project and he is using Node.js for a web app that interacts with a Database.
Doesn't this suffer from a similar issue?
How does this client side CRUD work security and accurately?
Correct me if I am wrong, but it seem to me that you think that javascript directly access the database.
For that I see, Javascript is only used to manage the UI, and to contact (with Ajax ?) the server to update/create/delete entities.
It isn't insecure, but developers must ensure that the requested user's action is permitted (on server side).
Example : For a DELETE requested URL like https://myServer/myApp/Person/1, an user can modify this URL like https://myServer/myApp/Person/6 or https://myServer/myApp/Work/1.
So it must be verify that the user can delete a Person with id=6, or a Work with id=1.