B
B
Benderlidze2014-09-17 19:18:48
reCAPTCHA
Benderlidze, 2014-09-17 19:18:48

File update indication on the server. How to do it right?

There is an xml with a list of objects on the server - in fact, a php file that unloads the database from the database.
there is an application that pulls this file to the phone and parses
the question of how to correctly implement the update of this file, so as not to download it every time, but only after updating the data in the database on the server
, I thought to compare the file size on the phone and on the server in bytes, if different, then download new
or there are more reasonable options options?
and if this is a date in headers, then how is it reasonable to store it if this file generates different data based on the parameters passed by the get

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
andreibalkin, 2016-09-11
@andreibalkin

You can change the scale using css by writing them for the captcha block. Standard like a block with a class - g-recaptcha.
transform:scale(0.8);
-webkit-transform:scale(0.8);
transform-origin:0 0;
-webkit-transform-origin:0 0;
Just like in the mobile version, make a different scale, for example, using media queries [email protected] screen and (max-height: 480px){}

D
Dmitry Entelis, 2014-09-17
@DmitriyEntelis

Comparing the file size is generally not correct, because the data may change (for example, the price of a product was 100, it has become 200), but the file size will not change.
You need to compare something that is guaranteed to change when the data changes.
The simplest is the date the data was modified. Best in milliseconds.
That is, with any changes in the database - update this number.
Be sure to give it in xml.
Accordingly, the application first separately requests the date of the change from the server (by headers or a separate question - it doesn’t matter) and compares it with the date that was in the xml.
Plus solutions - it is very easy to check if you need to download or not.
Minus - in those cases when something has been updated - you still have to download everything.
There is only one way out - to implement your own protocol that supports incremental updating of data from any version to the current one. But this is a separate big and resource-intensive story.

V
Vitaly, 2014-09-18
@vipuhoff

If you finish your product as indicated above, if not, and you need to "save traffic", etc. you can file a hosting service in the same way, which will "cache" the last option and inform the client that they do not need to download yet

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question