xls file read , write in mobile application and sync operation - ios

i am currently trying to implement a xls file read write operation in an iOS application.
So basically the requirement is, there is a big xls file which is having many dropdown , data or empty space present in a particular server.So very first time when multiple users open the app , they have to download that xls file & based on xls file a form will be created on app & later user can perform read & write operation on that form(although network is not available). But Once network is available , all the users can sync it back to the server.
Now i have 2 options
Option 1:
Create a CSV file from xls sheet on server side & send it to user.So user will perform Read & Write operation and save all data in sqlite db & on network availability they sync it back to server.
Option 2:
Create a webservice which will be created by using that xls file & send the XML to device, so based on XML user will create form and do offline mode read write operation & on network availability app will create a new XML file and sync it back to server.
So between option 1 and 2 which one is better & why ?
Any webservice is available to do such operation ?

It depends on which type of data you are getting, how many columns your csv file has, if the no. of columns are less i.e 2-5, 1st option would be better.
But if you have data with many columns, you must use XML, and XML is very good for storing hierarchical data.

Related

shiny app - saving and loading

I have a shiny app
where I upload a csv file
and then render it in UI using renderdatatable.
Now, I take the uploaded file as a a dataframe annd save it to a rdata file.
If the user interacts with the application again
I would like to load the csv file from the file system using renderdatatable.
To accomplish this I just use the load function and then call the dataframe.
I would like to know if there is a similar implementation on the same
A few things unclear here are when you say user interacting with the application again, do you mean a reactive response like changing a value in a text box or dropdown and accordingly re-displaying the contents of your dataframe; or a completely new session where the user wants to retrieve the previously viewed data.
If it is about a reactive response, then once the csv is read, you could access it by calling it with the input object - input$file1 or reading the temp location where the uploaded file gets saved (eg tmpdir())

ASP.NET MVC upload file containing objects

I have a directory that contains a csv file and avatar images.
The contents of csv file are as
Id Name Avatar Dept School
1 Mark 01019.jpg Market None
2 John 21122.jpg Business None
3 Sam 33311.jpg IT None
....
....
50 James 9823.jpg IT USA
The avatar images are placed in the same folder of csv file.
What I want is that when a user uploads csv file, then the info in file is converted into business objects, say Person. I can upload and parse the csv to get Id, Name, Dept, School, but ofcourse cant make it upload avatar images (in the csv file) to server, in same web request.
What are the possible ways to achieve this? Assume that I want to avoid zipping all images+csv in a single .zip file and then upload it on server.
Thanks.
I just love when people end their question by excluding the only possible solution.
The server (where your web application is running) has no direct access to the client (where the files are). The only thing the server can work with is what the client chooses to give it. So, your option is to have the user upload each image file invidually, along with the CSV, or to zip it all up, so they can send everything in a single upload. That's it. Period. At least with a standard web page.
You can of course create a Java applet or a Flash application that the user would authorize to access their filesystem to retrieve the necessary files. Essentially, the process is still the same, it's just the Java/Flash app would automatically do the file uploads instead of requiring the user to manually do them. However, both Java (on the web) and Flash are all but dead technologies at this point, so by using either of those, you're creating a dependency on something that is constantly exploited and not guaranteed to continue to receive security patches for the life of your application. Flash, in particular, has already been end-of-lifed, so Adobe will abandon support entirely within the next few years, max.
Long and short, tell your user to zip it up and upload a zip file.

CKAN upload custom format tsv on schedule

I am trying to upload custom formatted data files from the UK climate site e.g.this file. There are 5 lines of metadata and 1 header line.
1) Can CKAN preprocess the file according to a format I give it so that only data are picked up. Possibly saving the metadata in the description?
I would prefer a frontend option because I want users to be able to do this themselves.
2) Is it possible to have a dataset uploaded automatically once the url is entered. I currently have to go to the manage -> datastore page and click on upload to datastore to have the data populated.
3) Can the dataset be updated at a regular interval?
Thanks
Not currently. Doing ETL on incoming data is something that is discussed a lot recently, so it may happen soon.
You shouldn't have to manually trigger a load into datastore. Is this when creating a new resource, or if you're editing an existing resource? When editing a resource I believe it is only triggered if the URL changes.
You can use https://github.com/ckan/ckanext-harvest to have data pulled into CKAN on a regular schedule - there are harvesters for various different stores, so it depends on where it is updated from.

CouchDB and iOS

I need some help with a CouchDB iOS project.
I'm using Apache CouchDB Server and the couchbase-lite iOS Framework.
On my CouchDB I have a template document.
- CouchDB Server
- database
- template
- document 1
- document 2
- ...
My goal is to only synchronise my iPad with this template document to get the latest data which my application needs.
But when I enter some data on my iPad, I want that this data should be pushed only to couchBase Server.
How can I "tell" my application to synchronise only one file and not the entire database with my server and at the end how can I "tell" my application to only push the data that is input from user side ?
More importantly, Do I need two databases on my server? One for the template and a second one for user input data?
If YES, then I just need to know how I can only push my data.
Guidance needed. Thanks.
This is how I solve this:
I tend to add a 'last update' date to all my documents, and store this in a format that means they'll be sorted in time order (epoch or yyymmddhhmmss) both do.
Create a view that uses the update time as a date.
On your client, store the time since you last updated.
When you update, access the view with a startkey parameter set to the last update date.
You can then either use 'include-docs=true' to get the documents as you query the view.
I tend to use 'include-docs=false' though as it means when a lot of documents have been updated I transfer less data in a single query. I then just directly access each document id that the view returns.

How to update the data table on client side.(iOS MMO game)

Currently I'm developing an iOS MMO game using cocos2d-x. The game uses many data tables (excel files) which are created by the designer. These tables contains such numbers as how much gold(crystal, etc..) will be needed for upgrading a barrack.
My question is, is that how to update that tables once if the tables have been modified on the server side?
My option: Use SQLite to store table on client side, once the tables has been modified on server side, the server will parse the tables (excel files) and send the data in JSON format.
then the client parse the JSON string and save that data to SQLite file.
Is there any better way? I find that some game stores CSV files on client side, how do they update those CSV files?
How you store the data (and in which format) is entirely up to you, although the framework does provide some helper classes (checkout ccUserDefault). The simplest way to check whethere data files on the client side are up to date is to checksum them (either apply a checksum to the data stored in the file or on the whole file itself). So to check for sync, the server side app applies a checksum to the data and so does the client (using the same algorithm, of course ;) ) and the numbers are compared; if they match, the data is in sync.
This is arguably more reliable if the server-side app generates the data files and sends them down, rather than relying on the client-side app to do it. But as long as the server knows how to generate data files using the same method that the client does, then the success of the client's file generation process can always be verified using this same checksum method.

Resources