Differentiating between file content changes and metadata changes in changes API feed - google-docs-api

My app caches Google Docs files locally and needs to update them then whey change. When I request a changes feed, the results include all items that have changed, regardless of the type of change. I only need to re-download those items whose actual content has changed; I don't need to download documents that have merely been shared with somebody new or otherwise had their metadata changed. I know that you can request that expanded ACL data be included in the changes feed, but that may not be sufficient if it will only help me detect permissions changes, and not other changes to metadata.
Is there a way to do this? The files that are being downloaded are quite large at times (5-10MB), and the accounts that I'm tracking frequently have thousands of files, so imagine my users' consternation if they're on a slow connection and my app suddenly has to re-download hundreds of files due to a simple change like a folder being shared with a new user.
Thanks!

How about the revision feed?
You can find exactly what you need.

Okay. I overlooked the simple answer hidden in the XML: there is a checksum element included in the docs feed for all documents.

Related

Where to store and access additonal content for iOS app from own server

I am trying to understand something that is not clear to me about the storage and access of additional content downloaded from my own server to my iOS app. Clearly this is possible, see the section called Downloading Content from Your Own Server . I understand how to process receipts and how to make a call to my server. What is not understood is:
When I initiate a download from my server what file type does the download need to consist of? Can it be anything I want?
Where I am a supposed to store it on the device considering the app bundle is not allowed to be updated?
How does my app access the data?
In the simplest of cases, say I am delivering an xml or json file I guess most of the above would work like this: store the file in the documents directory, use filepaths in the app to access and load the data.
However what if it is something more complex that includes say images and other data that should be accessible just like other resources in the app bundle are accessible?
The crux of what is not clear to me is what type of data can be delivered, if it is anything I desire (which I presume it is) and I have complete control of the data type, where should this data content be stored and how can I enable my app to access this data as seamlessly as possible. For a concrete example suppose I am making a game, the first level is included in the app bundle, I deliver the second level via my own server, now, can I load that level the same way I load the one in the app bundle?
If there is a link or documentation I can pointed to that would be helpful but I have not found anything just yet, perhaps it is the concept of the app bundle that is most confusing because on a regular program I can do whatever I wish and things are not so unclear.

Mvc azure storage, auto delete storage after certain time

Im developing a azure website where users can upload blob and metadata. I want uploaded stuff too be deleted after some time.
The only way i can think off is going for a cloudapp instead of a website with a worker role that checks like every hour if the uploaded file has expired and continue and delete it. However im going for a simple website here without workerroles.
I have a function that checks if the uploaded item should be deleted and if the user do something on the page i can easily call this function, BUT.. If the user isnt doing anything and the time runs out it wont delete it because the user never calls the function.. The storage will never be deleted. How would you solve this?
Thanks
Too broad to give one right answer, as you can solve this in many ways. But... from an objective perspective because you're using Web Sites I do suggest you look at Web Jobs and see if this might be the right tool for you (as this gives you the ability to run periodic jobs without the bulk of extra VMs in web/worker configuration). You'll still need a way to manage your metadata to know what to delete.
Regarding other Azure-specific built-in mechanisms, you can also consider queuing delete messages, with an invisibility time equal to the time the content is to be available. After that time expires, the queue message becomes visible, and any queue consumer would then see the message and be able to act on it. This can be your Web Job (which has SDK support for queues) or really any other mechanism you build.
Again, a very broad question with no single right answer, so I'm just pointing out the Azure-specific mechanisms that could help solve this particular problem.
Like David said in his answer, there can be many solutions to your problem. One solution could be to rely on blob itself. In this approach you can periodically fetch the list of blobs in the blob container and decide if the blob should be removed or not. The periodic fetching could be done through a Azure WebJob (if application is deployed as a website) or through a Azure Worker Role. Worker role approach is independent of how your main application is deployed. It could be deployed as a cloud service or as a website.
With that, there are two possible approaches you can take:
Rely on Blob's Last Modified Date: Whenever a blob is updated, its Last Modified property gets updated. You can use that to identify if the blob should be deleted or not. This approach would work best if the uploaded blob is never modified.
Rely on Blob's custom metadata: Whenever a blob is uploaded, you could set the upload date/time in blob's metadata. When you fetch the list of blobs, you could compare the upload date/time metadata value with the current date/time and decide if the blob should be deleted or not.
Another approach might be to use the container name to be the "expiry date"
This might make deletion easier, as you then could just remove expired containers

How to initialize an iOS app with default data?

I'm writing an app that needs to access data from a large file every time a button is pushed. I've been reading up on it and the apple documentation says:
"You can create a separate persistent store that contains the default data and include the store as an application resource. When you want to use it, you must either copy the whole store to a suitable location, or copy the objects from the defaults store to an existing store."
Does this sound like the best way to go?
I've created the database with the table I need and put it under "Supporting Files" in Xcode - is this an application resource? Also I'm not sure what it means by "you must either copy the whole store to a suitable location" - is this not it?
Finally, my main question - how do I access the information in the DB in my .m files? Thanks for bearing with me, still very new to this.
Does this sound like the best way to go?
I believe it depends on what kind of information you want to access and if you need to update this information (add new information, modify it, delete, etc).
If you just want to read the data and do something with it, check out Property Lists and XML. In case the data is structured somewhat like a relational database and it is necessary to modify it, check out Apple's Core Data framework.
Is this an application resource?
Yes, it kind is, don't worry about the nomenclature so much but for more clarification check out Apple's own guide about resources.
Also I'm not sure what it means by "you must either copy the whole store to a suitable location" - is this not it?
You can load the store from multiple locations (folders, different files, etc), this just means that you should pick the best that suits your application.
Note, the files you import to your project are stored in the application's bundle and you can't (as far as I know) modify them. So, if you choose to include a Core Data store file, you need to copy the store from the bundle to a location of your preference (ex: the documents folder).
How do I access the information in the DB in my .m files?
It depends on your pick. As it looks like you're more interested in using Core Data, start by looking at the link I've provided above and searching some tutorials.

Saving html to 'manage files'

I have an external editable html file (using blocks of contentEditable="true") linked in the table of contents. Using Valence, could I save the edited contents of that file to the 'Manage Files' section of that course? Started reading through the Valence docs, but thought i'd ask here before wasting too much time there. Thanks, S
I'm not quite sure what exactly your meaning. Currently, the only direct access that you have to course content through the Valence Learning Framework APIs is via the course content module-topic structure. The URL property associated with an uploaded topic file situates it within the "manage files" tree, and you can use this property to fetch the contents of a topic from the structure.
There are no API calls to in-place update the contents of a topic file; to update it, you must fetch it, delete the topic, then re-upload the updated file content to a new topic node. This may leave behind the previous topic file, unlinked from the content structure.
The current course content API design proceeds from the user scenario of roughing out the framework for a new course's content, and not necessarily maintaining or changing that course content over time. Enhancement to the course content APIs to more comfortably accomodate additional use-cases is on the roadmap, but is not currently fully scheduled and fleshed out.

Can the changes feed be limited to changes within a specific collection?

I've been pouring over the new documentation for the Google Docs API for more efficient ways to synchronize my application's resources and I came upon the changes feed. So far, all the documentation leads me to believe that the changes feed applies to the entire documents list only without the ability to inquire about changes to a specific collection. My application doesn't care about any documents besides the ones belonging to the collections the user has specified. Does anyone know if querying a specific collection for a changes feed is possible? Thank you.
That is not possible, but the nature of the changes feed is such that it should be cheaper to grab just the latest few changes, by storing the largest timestamp. Once you have the changes feed, you can filter them by looking at the entry's #parent link, that looks like:
<link rel='http://schemas.google.com/docs/2007#parent'
type='application/atom+xml'
href='https://docs.google.com/feeds/default/private/full/folder%3A0B343'
title='Some API Documentation' />

Resources