storage

In C storing values that start with zero get mutated, why?

随声附和 提交于 2019-11-28 08:40:00
问题 For example: int main(){ int x = 01234567; printf("\n%d\n",x); return 0; } The following code produces: 342391 If I didn't include the 0 at the beginning, the value x would be 1234567, why does C store the value this way and is there any way to get it from not doing this? 回答1: Because numbers starting with 0 are represented as octal numbers. You cannot really modify this behavior, simply do not include the zero at the beginning. 回答2: Numeric constants beginning with a 0 are interpreted as

Using osmdroid without getting access to external storage

断了今生、忘了曾经 提交于 2019-11-28 08:11:31
问题 In my app I am using osmdroid for working with map. Map tiles are downloaded and kept in /storage/osmdroid . The application requires permissions WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE . If I deny access to storage, map is not shown. Is any way to show map without access to phone memory? 回答1: https://github.com/osmdroid/osmdroid/wiki/FAQ Fresh off the wiki press. Yes you can change the location to application private storage, in which case it should work just fine. Pro tip: set

How to store persistent data client side

我们两清 提交于 2019-11-28 07:44:51
I need to programmatically store data on the client side without having to transfer the data from the server on every page load. I considered generating a dynamic JavaScript file with the needed data for the current session of the user and make sure it is cached, but that seems really messy and there are a few drawbacks I can think of to such an approach. How can I go about storing persistent data on the client side? You may store data in window.name , which can hold up to 2MB of data (!). /* on page 1 */ window.name = "Bla bla bla"; /* on page 2 */ alert(window.name); // alerts "Bla bla bla"

Android 5.0 DocumentFile from tree URI

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 07:44:05
Alright, I've searched and searched and no one has my exact answer, or I missed it. I'm having my users select a directory by: Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); startActivityForResult(intent, READ_REQUEST_CODE); In my activity I want to capture the actual path, which seems to be impossible. protected void onActivityResult(int requestCode, int resultCode, Intent intent){ super.onActivityResult(requestCode, resultCode, intent); if (resultCode == RESULT_OK) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M){ //Marshmallow } else if (android.os

What is default storage class for global variables?

余生长醉 提交于 2019-11-28 07:35:30
What is default storage class of a global variable? While searching on web I found, some sites say it is static . But, static means internal linkage and the variable can not be available outside the file scope i.e it should not be available to other object files. But, they still can be accessed to other files using declarations like extern int i . And, if I explicitly mention static to global variable then it is not available outside the file scope. Then, what is correct default storage class for the global variables? The default storage duration is static, but default linkage is external. You

How to save an object with circular references?

女生的网名这么多〃 提交于 2019-11-28 07:32:49
问题 I want to save locally an object which has circular references. What are my options? My first thought was using HTML5 local storage but I can't stringify this object due to the circular references. Specifically I'm trying to save the DOMSelection object of the current selection. Example: var sel = window.getSelection(); var selstring = JSON.stringify(sel); // Breaks here ... localStorage.setItem("selection",selstring); The only way I could get the stringify to work now is by ignoring certain

Is $_SERVER['REMOTE_ADDR'] always isset()?

大兔子大兔子 提交于 2019-11-28 07:09:11
问题 I want to store ip2logn($_SERVER['REMOTE_ADDR']) values in the db for some reason. Practically, as I see, $_SERVER['REMOTE_ADDR'] always has a value. Could anybody confirm it is always set for any user and can't be not set by any reason? The reason I ask it is to be sure I should choose NOT NULL instead of DEFAULT NULL for the column in MySQL Table. So, I can store ipaddress varchar(15) NOT NULL (yes, NOT null) or ip2longaddress int(11) NOT NULL, and the second option is, as I understand, the

App's path for external storage in native code

余生颓废 提交于 2019-11-28 05:18:06
问题 I am trying to write a native library for my application so that i can do all file operation in the native code. I read that getExternalStorageDirectory() give the path of the external storage of directory. My question is how can i access the same without hard-coding the location to some string? Is there any function in android ndk that can give the same function as getExternalStorageDirectory() of java in C++ code? 回答1: JNI is your friend, and this isn't too complicated, as

can't create a folder in external storage on android device

半城伤御伤魂 提交于 2019-11-28 05:04:35
问题 I am trying to create a folder in external storage and I followed a couple of other threads here. However, even though I seem to be doing what they indicate, creation fails. Here's a piece of code boolean mExternalStorageAvailable = false; boolean mExternalStorageWriteable = false; String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { mExternalStorageAvailable = true; mExternalStorageWriteable = true; } else if (Environment.MEDIA_MOUNTED_READ

Secure credential storage in python

时光毁灭记忆、已成空白 提交于 2019-11-28 04:12:01
The attack One possible threat model, in the context of credential storage, is an attacker which has the ability to : inspect any (user) process memory read local (user) files AFAIK, the consensus on this type of attack is that it's impossible to prevent (since the credentials must be stored in memory for the program to actually use them), but there's a couple of techniques to mitigate it: minimize the amount of time the sensitive data is stored in memory overwrite the memory as soon as the data is not needed anymore mangle the data in memory, keep moving it, and other security through