UIManagedDocument + iCloud "Big Picture"? - core-data

I am working on my first "iCloud App". I worked through the Apple docs and the Stanford videos but I am still struggling to understand the "Big picture" of iCloud.
My goal is to create a "Library style" app (which is Apples term for an app with "a single Core Data stack with a single persistent store coordinator and a single persistent store") like the Employees example.
Following the Stanford videos I am using a UIMangedDocument to setup all Core Data stuff and enable the iCloud capabilities. The UIMangedDocument contains the Database and is "stored in the cloud".
This is already the first thing I struggle with: What does "stored in the cloud" really mean?
Before I started to work with iCloud I thought that to "store a document in the cloud" would mean to "store a copy of the document in the cloud". I thought there would be local version of my document within the regular sandbox and a copy of the document in the cloud. When ever the local document is changed these changes are also transfered to the cloud version. As I understand now this is not correct (at least not completely correct). Am I right?
The first thing I have to do to use iCloud is to call URLForUbiquityContainerIdentifier:. This will return the "iCloud URL" which means the URL of the folder in the cloud. All files which are stored under this URL will be "stored in the cloud", right?
My first assumption (local file + copy in the cloud) is not completely wrong. In fact there is a "local version" and a "cloud version" of any file that is stored in the cloud. This is because I can access the iCloud URL and store files at this location even if the device has currently no Internet connection. But this is only behind the magic of the iCloud framework and nothing I have to bother with. From my point of view the cloud is simple a special folder and any file or directory in this folder is stored in the cloud. The iCloud URL will ony be NIL if iCloud is deactivated in device setting. Is that right?
The second thing I struggle with is how iCloud will sync changes to a Document. Assume "TheApp" on device A creates a UIManagedDocument and stores in in the Cloud. After that device A goes offline. Meanwhile the document is accessed by TheApp on device B and some data is added (e.g. some new employees or departments are inserted). When device B goes online again it will receive the NSPersistentStoreDidImportUbiquitousContentChangesNotification and can merge all call mergeChangesFromContextDidSaveNotification: on the managedObjectContext of the document to copy these changes.
I was not able to find out if merging the changes is really necessary. As described above about from my point of view there is only one Document. If that is true, it is great that I am notified about changes but it should not be necessary to copy these changes to the "local version" of the document because there is not such thing as a "local version". This brings me to the question what mergeChangesFromContextDidSaveNotification: is good for.
Another scenario would be the same situation as before (document created on device A, changed on device B...) but now device A was not just offline but TheApp was completly shutdown while the changes were made on device B. In that case TheApp on device A will have to re-create/re-open the document after it is lauched again. What should happen in this case?
I did run some tests but the result was not always the same. In some cases the document started with its "old" version and than received the notification with the changes. In other cases the document started directly in its new version with all changes on board. For my app the first case (start with old version, receive update notification) would be better, but I was not able force the one or the other behavior. Is this the was it is supposed to work?
Thank you very much!

Generally I can recommend to read the iCloud Design Guide - in particular the section "Designing for Documents in iCloud".
As for your questions:
What does "stored in the cloud" really mean?
If your are using UIManagedDocument following the Stanford videos, your App will upload change logs when data is added/edited/deleted. However your device has kind of a "iCloud Cache" where it stores the iCloud data and access it from (you have access to that folder when you are offline or even when your app is deleted and reinstalled). If you NSLog the URLs of the documents in your iCloud folder (you should do this with NSMetadataQuery you get the path of the iCloud files locally on your device, which is
/private/var/mobile/Library/Mobile Documents/<Developer identifier>/<App identifier>/...
For this reason, you'll need to think about a bunch of things when accessing your UI(Managed)Documents on iCloud on the first time app launch or on each app launch (e.g. is iCloud available, do you have network connection, ...).
However, following the way of the videos you'll not have separate documents in your app sandbox and in iCloud (you could achieve this of course when saving your document for creation to the iCloud URL as well as to a local URL in the app sandbox).
The need of merging changes
As described above, your devices are saving change logs which include the adds/edits/deletes to your document. These change logs are uploaded to iCloud and downloaded by the other devices connected to the same iCloud account. Each device can rebuild the current state of your data model with the change logs. This makes iCloud extremly efficient (a complete upload on each time would take much longer). Concerning the sync process of these changes I can also refer to the iCloud Design Guide. In short, you'll have to think about your device syncing the local iCloud folder each time when it comes back to online mode.

For anyone still struggling try this site.
http://ossh.com.au/design-and-technology/software-development/
There are sample apps for iOS and OSX that include iCloud integration, backups, iCloud sync status, etc.

Related

Lotus Notes Design elements not refreshing

I recently made changes and created two forms in a database residing in a production server. When I sent out the link, the users are getting this error:
Unable to create document, database does not contain design.
I suspect that the database residing in their Workspace is not getting the latest design elements (not in-sync). I tried asking one user to remove the database from her Workspace, sent the link to the database to open it again, and click on another link which I provided to open up the two forms and she was able to access the forms.
May I ask if there's any other way I can do for them to not delete it from their Workspace and re open it again so it will get the latest design elements? Should I request the Notes Administrator to perform some codes in the console?
Form designs are cached by the Notes client, presumably to aid performance. As far as I know, it's not possible to disable the caching.
If users have a database open when you modify or add forms, it's usually necessary for them to close and reopen the database to see the design changes, but they shouldn't ever have to remove the database from the workspace and re-add it. I don't think there's any way to avoid having to reopen the database.
I have seen a problem affecting several users at one customer where Notes wouldn't update its design cache, no matter what they did inside the client. The only solution I found in that case was to close Notes, delete a file named "cache.ndk" from the root of the Notes data directory, then restart Notes. It's been 2 or more years since this last occurred, so it might have been fixed in some version of Notes.

Connections with the Excel and Access Database are preventing me from getting exclusive database

I have an access database that users are connecting to with excel files. I have way of managing people who are logged on using Access. However, I do not have a way to manage people who are connected to the database using excel. It is my front in so I am not worried about the Data I just want to be able to edit forms and add features.
Splitting your database will help...https://support.office.com/en-ca/article/Split-an-Access-database-3015ad18-a3a1-4e9c-a7f3-51b1d73498cc
But you can also look into making the FE you release to users as an mde or accde file. These will compile your VBA code and not allow users to enter design mode to change anything so these files are slightly smaller and more secure.
Then you can make changes to the regular FE mdb or accdb files that you have, test those changes and then when you are ready to release a new version, publish them as mde or accde files and copy it over the old version (or make back ups first, and then replace).

Lotus Notes Views are not showing up in the web browser

We have a legacy Lotus Notes application that we want to see if we can make an improvement, first by making a test environment for this application. Currently the application is located on the main server and being replicated every 15 minutes to the web server. The replica on the web server has different forms and views since they are adjusted to display the information on the web browser (in my understanding)
I have made a new copy of the application that is on the main server without any problem. I had some problem replicating it to the web server since I do not understand what will happen to those element design that are not being used in the application on the web server. So what I did was replicating the application from the main server to the web server, then deleted all the design elements on the web test then copy all the design elements from the production environment to the web test.
By doing that I was able to get into the login page then log in. After I login, the frameset that suppose to display the default view giving this error message 'HTTP Web Server: Couldn't find design note'. First of all, I thought this is normal since I could not find the view in the database and that confused me since the live system works without that view present on the database BUT when I tried to access a view that I know present on the database, I still get the same error.
So after all that I opened the web test application on a Lotus Notes client. I can open the views that are exist. Now at this point there are 2 things that I am very frustrated about:
The live system works even when the code specifically mentions views that I cannot find from the Domino Designer. It just does not make any sense
As a test I created a 'Test' view on the web test application. Basically I just told it to fetch one of the form called 'WORec' that contains Work Order information. Into my surprise, the view opens up on the web browser but shows no result, which frustrates me even more since the view 'WOByName' gets all the Work Orders just fine. These 2 views have the same selection formula, so I really do not understand why 1 view is able to show data where the other does not. Moreover if I tell the test view to fetch all the documents in the database it only fetch those documents that are not 'WORec' form
I know this is long but if I can get some pointers on what I am doing wrong here. I am just trying to create a test environment. Unfortunately I never dealt with Domino web application or a replication that completely has different element design.
Let's start with the test view.
When you created the view, you need to first verify it is a Public view. Private views or Shared Private on First Use (SPOFU) views are not what you want here.
also, verify the name and alias of the view is unique to your database.
Next, verify your selection formula is correct.
use formula, instead of simple so you can actually see the formula. e.g.
SELECT #UpperCase(Form) = "WOREC"
Refresh your view designer (F9) - do you see your records coming through?
also, make sure the view is not hidden from Web clients... you will see this in the designer client, when looking at a list of views - a column indicating whether or not it is hidden from web clients, note clients, mobile clients, etc.
if not, open one of the documents up. Show properties, verify the form property in the box (2nd tab), matches the value "WORec". If not, correct your view selection with the correct form name spelling.
Next, you need to make sure you are allowed to view this from the web.
Open the Access Control List (ACL) and add "anonymous" as reader or above.
Open the view in Designer, and Preview it in web browser.
As for the "Couldn't find design note" message - that's not good. You definitely are missing design elements. Whether this is due to a selective replication formula issue, or acl issue, or whatever, is hard to tell. But if you have a Notes thick client and a separate web version, I would recommend different databases (or master templates) and not trying to use selective replication to handle that sort of thing.
As I understand it, you replicated the database then deleted all design elements and manually replaced them by copying from the production web replica. Instead, you should have made a template from the production web database (by doing a design-only copy), and then you should have used the 'Replace Design' feature to update the test web database from that template.
As an aside: an application built the way you describe (two replicas on separate servers, each with a different set of design elements) is a pretty bad implementation. It may have been done in the very early days of Domino, before the "Hide from Notes client" and "Hide from Web" properties were available at the design element level. Or it may have been done deliberately for "security purposes" (which I put in quotes because relying on Domino design element to enforce security on a Domino web application doesn't really make the application any more secure). You may be stuck with this... but you may not be. So before you try to improve or enhance this application, I think you should look into using the "Hide from... " properties on the design elements.
On the other hand, if you stick with the current design, I do want to mention that you're going to need to make sure the ACL settings and selective replication settings on your main and web test replicas match the ACL selective replications settings on the corresponding production replicas. Otherwise, you'll end up with a jumble of design elements when the test databases replicate across servers.
I suggest you to make a new copy of the Notes Database that is on your web server to your test server.
try to open in with your browser and check that all is OK.
open this copy in designer and check that it contains the views that you didn't see previously on test.
I'm not sure that you have really 2 different designs (one for webser different from the one of your main server) so:
- on the main server: open the File/Replication/Option for this application. In advanced, check When web server receives from .... if the design elements is checked.
if not it makes sense that there are TWO different design versions.
Maybe the view you didn't find (on the web server) restricts use? to check this:
- In the view (on the main server) check in the properties of the view the tab with a key "all readers and above". If it's uncheck THIS is the reason why they don't exist on the web server AND that you don't see them in the designer:
If your don't have the role or are not the person which can "who may use this view" you don't see the view and can't copy it.
To correct this simply enter the ACL (file/Application/Access Control) and grant you the corresponding role.
I hope I helped

SharePoint Online file storage

We have a requirement to store documents in SharePoint Online as people copy files to a shared network directly.
Is there a way of automating this? I was thinking of a windows service which will poll the directories, find any changes like new subdirectories or new files, then upload them to a SharePoint Online document library.
You don't have to poll if you use a FileSystemWatcher inside your Windows service for real-time notifications.
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
However, if your requirement is 100% accuracy, you will need to build in some sort of tracking/checksum mechanism to make sure that every document was 1) detected and 2) successfully moved to SharePoint.
You may want to have your service check the delta every time it starts up, and then subsequently only respond to FileSystemWatcher events.
EDIT: Per Tony's question below, here are some additional thoughts on getting files to SharePoint.
First, try a simple test.
1) Copy the URL of a document library within the BPOS SharePoint site. Make sure you're on a machine that has the Office Online sign in app on it.
2) Open Notepad. Type some random text.
3) Click on File -> Save As.
4) Paste the URL.
5) Attempt to save the file.
This works great on "regular" SharePoint (done it many times). If this works with BPOS, it opens up several options.
File System Replication to a SharePoint Online or Office 365 document library is planned to be released with the "Cloud Connector for Office 365". With the current version database content is supported only, but bi-directional with V2.0

Is it feasible to programmatically change the name of a directory in SharePoint?

To quickly summarise my question:
Is it feasible to programmatically change the name of a directory (with both files and sub-folders) in SharePoint? I am expecting that users will have files checked out on at least some occasions what I am attempting the rename.
The background:
I am currently contracting for a company that produces web based software (ASP.NET) with a configurable document management system. The system can be configured to use different underlying systems, with the most common environment being SharePoint (WSS 3).
I have been assigned a task to extend what has to now been a fairly simple system (simply output files into a fixed directory structure, occasionally read). Having never worked with SharePoint before I am doing some research on best practices, and am attempting to work out what is viable. At this stage I do not have access to a testing environment myself, so am limited to reading up online.
One request is to have the directory structure reflect the name (as one example) of the current client - so all documentation for a client will be in one place, and can be accessed externally via SharePoint or other compatible applications. The specification cites that if the name of the client changes then the directory structure should immediately update. My concern is that this will either directly cause errors (eg. Permission denied) or indirectly cause errors (loss of work for users who have externally checked out files).
As a follow up question if there are concerns with the above, is there a better way to implement the above? I have looked at suggesting the users use views to access the structure in SharePoint, however there is a concern from our BA that users will not be able to directly upload new files into this structure.
Thanks
The issue with Folders in SharePoint is that they are not really folders in the way you would expect of a file system. All files in a SiteCollection are stored in one big-assed table on the Database (checkout the AllDocs table).
I cannot categorically say it is safe to rename the folder without doing a bit of testing, I know that the folders "name" is not the key to accessing the document, despite it appearing to be based on the Url you see in the browser.
The best bet is to do a quick test, but I am pretty sure that your plan will not be a problem.
The potential issue is if any Content Query Web Parts etc rely on specific folders to exist or if any other "code" or "pages" look for that folder and not the folderId.
Save the content of the list before you "attempt" it in production. You don't want to loose data.
Checked out documents will still work the way you expect them to.
You may however have to run a crawl again.

Resources