Laravel 5.2 Application - autosync two mysql databases [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have created web application using laravel, now I need to add functionality for users that when there is no internet connection available data must be stored in their local database, and when the system get internet connection than the data should be sync with the live sever. If we have only one client and one sever than I can use master-salve deployment, but here in my case there are more than 1 local clients.

Instead of having two databases you could tweak the front end a little bit to save data in HTML5's localStorage in a neat JSON format so when the user reconnects, you could just push the localStorage items with AJAX and iterate through the array of json objects storing them in empty model objects and save them each.
As for old data, you could store their ID's also in the localStorage so you can just update them which you could easily do with $some_model->update()

Related

(Laravel) Update interface every time there is a change in the database? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I'm new to Laravel, I want to update the interface every time there is a change in the database but I think calling a JavaScript every 5s to update the interface is not very efficient, so I wonder what is the most efficient way to do that?
Have you considered using some for of websocket to create a connection between your backend and JavaScript based UI?
Either https://laravel.com/docs/master/broadcasting or https://github.com/beyondcode/laravel-websockets would allow you to notify your UI to request the updates from your Laravel backend.
My personal suggestion would be that you JS would receive a notification that something had changed and then have to obtain the updated information via Ajax so that you are not sending confidential information through Pusher's servers.

Is it okay to use Firebase as function call like state if the data was change then call my server side (I used PHP) instead of Firebase as a database? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I want to use firebase just a function call just to use my existing database and just to have realtime changes in my site.
Firebase can't magically add realtime functionality to an existing database. It actually has an entire backend infrastructure set up to enable its realtime functionality, which your database would be missing.
Some options:
Build your own realtime functionality on top of your current database.
Synchronize changes to your database with a copy of that data in Firebase, which you then use for updating realtime listeners.
Switch your data model over to Firebase completely.
And I guess the last option is:
Keep using your current database, without realtime options.
None of these is pertinently better or worse than the others, so pick whichever one makes most sense to you and be willing to change your mind along the way.

How to bring parsed files to a unique format [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have different sources like S3 (json files) and API, and I have to bring all the data to a unique format to store the data in DB.
I tried to parse files and API response on my php back-end but it is too slow.
Is there some best practices or advises how I can do it in a right way?
I'm going to do an Interface with all required methods, and Class' for every source which will implement the Interface.
If I will work with hundreds or thousands files (per hour) Is this approach the best way to do it?
P.S. Currently the project is build on top of Symfony2 framework.
I guess you are forced my traditional RDBMS to convert all sources to specific format.
You may use schema-less systems like MongoDB, Cassandra or even JSON type in MySQL 5.7 to store 3 fields: id, source_type and source_json. This way you create several classes that know how to parse the source_type (ex: S3) and use them accordingly

Best way to load thousands of data in a fast way [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
i have this Mobile app built with android where data is stored in the server using PHP and MySQL.
Android - Mobile App
PHP - API
MySQL - Database
In Mobile App, we have newsfeed. We have already 150 datas. We recoded the time, its loading 20secs of 150 datas.
Im thinking that i should load only first 10 datas and when scroll down, loads another.
What do you suggest?
Another question. Does MySQL Join makes the query fast?
Yes you can fetch the small chunk of data. For a this you need to handle the query in such a manner that it accept a page number for the data.
For example if you are fetching the record 1-10, you will pass the page number 1 and accordingly you will get a result.
Also you make use of Endless Adapter in your android app

Updating a MySQL table every couple of seconds with large amounts of data? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I've create an application that has an autosave feature. So instead of the user having to click a save button, their settings are automatically saved with every interaction with app. Behind the scenes, every time the app changes, I POST the data to PHP and update a MySQL database table.
It's working well but nobody's using it yet so my question is: If I'm updating a MySQL database table with this save data (and the saved data could be the equivalent of a 100kb XML file) every couple of seconds, could I experience performance issues? It should be noted that there could be hundreds or thousands of users using the app at the same time.
Any tips or advice would be appreciated.
Bundle up and serialize all your data changes into a single JSON object before POSTING (as a single field). Fewer large interactions will offer better performances than constant tiny ones.

Categories