Query Available iOS Disk Space with Swift

iOS 11 Update The answers given below no longer provide accurate results under iOS 11. There are new volume capacity keys that can be passed to URL.resourceValues(forKeys:) that provide values that match what is available in device settings. static let volumeAvailableCapacityKey: URLResourceKey Key for the volume’s available capacity in bytes (read-only). static let volumeAvailableCapacityForImportantUsageKey: URLResourceKey … Read more

Really force file sync/flush in Java

Actually, in C you want to just call fsync() on the one file descriptor, not sync() (or the “sync” command) which signals the kernel to flush all buffers to disk system-wide. If you strace (getting Linux-specific here) the JVM you should be able to observe an fsync() or fdatasync() system call being made on your … Read more

“Not allowed to load local resource: file:///C:….jpg” Java EE Tomcat

sending tag <img src=”https://stackoverflow.com/questions/23969953/c:\images\mypic.jpg”> would cause user browser to access image from his filesystem. if you have to store images in folder located in c:\images i would suggest to create an servlet like images.jsp, that as a parameter takes name of a file, then sets servlet response content to an image/jpg and then loads bytes … Read more

how to check internal and external storage if exist

it’s already explained in android documentation. Code taken from documentation boolean mExternalStorageAvailable = false; boolean mExternalStorageWriteable = false; String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { // We can read and write the media mExternalStorageAvailable = mExternalStorageWriteable = true; } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { // We can only read the media mExternalStorageAvailable = true; mExternalStorageWriteable = … Read more

What does “Thin Pool” in docker mean?

Short story: A thin pool is a storage source that provides on-demand allocation for storage space. It is more or less similar to virtual memory, which provides full address space to every process. Long story: Fat Provisioning The traditional storage allocation method is called “fat” or “thick” provisioning. For example, a user claims to use … Read more