Using a package file type with NSPersistentDocument - objective-c

I am creating a document-based application and I want to use NSPersistentDocument. My document will have several image assets and I would like to avoid saving the assets in the database directly. What I want is to have a package as my document type, and within it have Core Data file as well as my image assets. Then, in Core Data I would save paths to the image assets.
However when I subclass NSPersistentDocument, it seems to want to use the document file for the actual Core Data file, and I don't get the opportunity to employ a package solution.
Is it possible to use a package with NSPersistentDocument? If not, is there a preferable architecture to use? I want to stick with Core Data for this project. Thanks!


What's the best way to do asset management with node? [closed]

I'm building a set of one-page applications. I want all the resources that app needs to be delivered in one big initial payload.
Each version gets it's own asset package but they are all a part of the same parent app.
What is the best way to set something like this up to deliver sets of resources?
connect asset manager (click the link to the docs) will combine separate CSS/JS files into a single file, compress them, convert images to base64 for embedding with data URIs into your CSS files, minify the code, etc
From the README:
What does it allow you to do?
Merge and minify CSS/javascript files
Auto regenerates the cache on file change so no need for restart of server or manual action.
Run pre/post manipulation on the files
Use regex to match user agent so you can serve different modified versions of your packed assets based on the requesting browser.
Supplies a reference to the modified dates for all groups through assetManager().cacheTimestamps[groupName] as well as md5 hashes assetManager().cacheHashes[groupName] which can be used for cache invalidation in templates.
Wildcard add files from dir

Retain existing file during auto update C#

I have already developed an windows mobile app using c# in compact framework 3.5. I implemented the auto upgrade functionality like this, if new version is released, my app download the new version, uninstall the existing version and install the new version. This is working fine.
I need to accomplish the following during the auto upgrade,
After install the new version I need to retain some user modified xml file from the old version app and replace the same file in newly installed app. I need to retain the existing settings xml file in newly installed version. How to implement this in compact framework 3.5
When a CAB is uninstalled, all files that it installed are removed. There are three general ways to circumvent that behavior for app data files:
Have your app create the data file in the first place, not the CAB file. If the CAB doesn't place the file, it won't delete it. This is a common mechanism for configurations and databases that don't need seed data.
Rename or move the file you want to keep. If the CAB installer can't find a file, it can't delete it. You might ship your data file, or whatever file you want to keep, with a "fake" name, and when the app runs, look for the fake-named file and rename it to the name you want. This also provides the ability to actually update the file if you want to through some app logic.
Create a custom setup DLL (in C) and do something in the Uninstall_Init function to move or prevent the deletion, then include that DLL in your CAB file.

Node Webkit Desktop App - Browser default caching of PDF files

I have built a desktop app using node webkit and need to cache PDF files that are viewed via the App when online so that they are also available offline. I haven't found a solution yet but during testing I noticed that files that I had previously viewed online were available offline even though I haven't written any code for this yet. Therefore these must already be cached automatically. I did a search to find where the files are being saved exactly but couldn't find anything.
Can anyone explain this or point me in the direction of information on this so that I understand how it works and ensure my App can utilise the default behaviour of the browser caching?
I have found a solution to store the PDFs locally, however this isn't my query. I am looking for an explanation as to HOW the PDFs are available when offline without this code I have written. The files must be automatically be stored somewhere otherwise how would they display?
The default caching behavior of node-webkit is controlled by the page-cache property in package.json :
"webkit": {
"page-cache": true
Only typical web resources can be cached this way (scripts, style sheets, etc.). To be able to view PDF files offline, you can store them manually.
There are several ways to do that :
Save a file directly to disk (the simple solution, just store the files in App.dataPath)
Use a database
Use Web Storage
Use the application cache
All of these are documented here : Save persistent data in app
The default location to cache your app files is mentioned in your package.json manifest file.When the app is initialized the settings in your manifest files are loaded by default.Since cached files cannot be accessed programmatically,you can overwrite the default files manually.
To get the application’s data path in user’s directory for windows,you can write it in Jason format in your package :
You can read about other cache menthods in node webkit's documentation :

access file from another project under same solution

I have a C# solution containing several MVC projects. Under Project1 there is a directory for storing images which can be edited, deleted and added by user from the front end.I need to access those images from the Project2. But, i don't want to hard code the file path. How can I do that?
You can add the files as links (shortcuts) to your second project.
Here's a quick walkthrough.
Edit: Sounds like I misunderstood the original question. If you're looking to have access to dynamically created/deleted images across multiple websites, then you should probably look at creating a shared folder on your server and having use-modified files deposited there.
If you don't have a dedicated server that you can log into, you can probably still share files between your sites if you can set them up as virtual directories under a common site in IIS. They should both be able to access a folder that sits inside the site root.
This isn't a direct answer to your problem, but I believe it will help, if your images are resources within Project2:
Basically, you'll need to create a ResourceManager for the Project2 within Project1, and then use it to grab the resources. It should be pretty straightforward.
I've answered a similar question .Net MVC: How do you share scripts among multiple projects in one solution? where my answer works with any type of file (.html, .js, .png, .jpg, .cs, .css)
Update 1
For doing this at Runtime, I would create a database (MSSQL) and store the files in that database's FileStream (this does not store them in the MDF Database, Filestream vs Normal Files). This makes the files available to any project you create and you can add additional meta data (like the user) for additional authorization, logging and querying.
Option #1. Retrieving the files (images) can be done by any application and would then be served by that application. The advantage is any type of bandwidth usage can be easily and directly tied to the application serving the file. The disadvantage is that if your user is using your multiple sites, the file would not be cached by the browser cross websites.
Option #2. Retrieving the files (images) can be done by a seperate file share project. Each time another project needs a file, it can query the database, and create the appropriate URL to the file share project url and retrieve the image on the client side.

Best practice of keeping application configuration in plist file

This may sound a newbie question, anyway I'm new to iOS dev,
I would like to know what is the best practice of keeping application configuration specific data in plist file. Do you keep it in Info.plist file of the project or in separate plist file ?
Thanks !
The easiest (and most user friendly) implementation is trough a Settings.bundle that shows in the Settings application, see Implementing an iOS Settings Bundle this implies no code just a Root.plist see, the Settings Application Schema Reference
Info.plist is the file with the metadata of the application, you can not write to it from the application, configuration specific data should be is stored in the user defaults plist trough the NSUserDefaults api.
Additionally you can use the NSUbiquitousKeyValueStore api for iOS 5+ to store the preferences in the cloud so they are the same for all user devices.
Of course you can do all this manually if you want to write directly to a plist in the documents folder for example and even make that file ubiquitous and store in the cloud also but this is not generally what you want to do.