storage

Store and update a Swift Dictionary in NSUserDefaults Xcode

南楼画角 提交于 2019-12-06 04:24:46
I would like to store and update a Dictionary when a user enters a value. Everything seems to function until this code, and the application crashes: override func viewDidLoad() { super.viewDidLoad() if NSUserDefaults.standardUserDefaults().objectForKey("dict") != nil { answersSaved = NSUserDefaults.standardUserDefaults().objectForKey("dict") as [String:String] } } The error message says "anyObject is not convertible to [String:String]. It offers to add ! after the as but then the app crashes. dict is my Dictionary variable with Strings as values. I also have code updating the NSUserDefaults

Android External Storage vs. SD Card

百般思念 提交于 2019-12-06 03:47:09
问题 After reading the Android documentation on storing files, I see that External Storage can include both a removable sd card AND storage that is internal to the device, i.e. not removable. Is there a way to distinguish between removable storage and non-removable storage when choosing to save a file to External Storage? 回答1: I think you can't reliably distinguish between internal and external (SD) storage. At first glance it might seem like you can use something like Environment

Cassandra 1.1 storage engine how does it store composites?

人走茶凉 提交于 2019-12-06 03:04:21
问题 I'm trying to understand Cassandra's storage engine when it comes to composite columns. Unfortunately, the documentation I've read so far contains errors and is leaving me a bit blank. First, terminology. Composite columns comprise fully denormalized wide rows by using composite primary keys. This seems misleading because, AFAIK, composite columns can be used for composite keys, and also simply as composite columns apart from keys. 1: How are composite keys and column names implemented? Every

Indexeddb adds a new value instead of updating an existing value

北城余情 提交于 2019-12-06 02:34:29
When attempting to update a record within indexeddb using the put method, it appears that a new value is created rather than a change. According to MDN this is the method to update a record, yet I'm not having the expected result. Any ideas? Here is my code example. /* @keys initalisation */ extension.onupgradeneeded = function (event) { database = event.target.result; if (!database.objectStoreNames.contains('profile')) { var _profile = database.createObjectStore('profile', { autoIncrement: true }); _profile.createIndex('default', 'default', { unique: true }); _profile.createIndex('username',

Where is the best place to store the password salt for the website?

风格不统一 提交于 2019-12-06 02:13:57
问题 I have two salts, each user has a unique salt that is stored with the user info in the database. The second salt is one that is specific to the website. Both are needed to hash the passwords. Problem is I don't know where I should keep my website salt. Right now it resides in the PHP method that runs the hashing algorithm. Should I keep it in a file outside the /var/www/ and have PHP open and read the file? I don't want to store it in the database because that would defeat the purpose of

GCE Use Cloud Storage Bucket as Mounted Drive

Deadly 提交于 2019-12-06 02:03:49
问题 Is there a way to mount a storage bucket to an instance so it can be used by the webserver as storage? If not, how can I add more storage to the instance without adding another persistent disk with an OS? 回答1: You can certainly create a new (larger) Persistent Disk and attach it to your instance as a data disk. This is a very good option, since it keeps your website data separate from your operating system. See the Persistent Disk docs for details on all the options. In your case: Create a

How to use NSURLIsExcludedFromBackupKey Or kCFURLIsExcludedFromBackupKey?

一笑奈何 提交于 2019-12-06 01:35:12
My App had been rejected because I save in-app purchase data in Documents folder on iPhone. Data that can be recreated but must persist for proper functioning of your app - or because customers expect it to be available for offline use - should be marked with the "do not back up" attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent the corresponding file from being backed up. For CFURLRef objects, use the corresponding kCFURLIsExcludedFromBackupKey attribute. But I want the user to use the data even if they are offline, so I'll use

AzCopy login fails

匆匆过客 提交于 2019-12-05 23:15:25
问题 After running azcopy login and signing in with my Azure account, I see the following response on the sign in page: “User account from identity provider does not exist in tenant ‘Microsoft’ and cannot access the application in that tenant. This account needs to be added as an external user in the tenant first. Sign out and sign back in again with a different Azure Active Directory user account.” Am I missing something like an App Registration? 回答1: You are probably facing this issue because

React Native: write in AsyncStorage with java

放肆的年华 提交于 2019-12-05 22:34:45
So I have this text on the java-side that arrives from an Intent , which I'd like to save to AsyncStorage to being able to access it through React afterwards. Any chance I can achieve this? I have: package com.myapp; import android.app.Activity; import android.os.Bundle; import android.view.KeyEvent; import android.content.Intent; import com.facebook.react.LifecycleState; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactRootView; import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; import com.facebook.react.shell.MainReactPackage; import com

How to use Internal Storage of Android in Xamarin?

人走茶凉 提交于 2019-12-05 20:55:18
I want to be able to use Android's internal storage. I found some code snippets like: string path = Application.Context.FilesDir.Path; var filePath = Path.Combine(path, "test.txt"); System.IO.File.WriteAllText(filePath, "Hello World"); But I could not figure out what Application is in here. Is there any solution for that or different perspective? Thanks :) Use this: string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); string filename = System.IO.Path.Combine(path, "testfile.txt"); // Write using (var streamWriter = new StreamWriter(filename, true)) {