AS3 - Define shared object size - actionscript-3

I want to let the user save some bigger data in a shared object by choice. Is it possible to define the size the user needs to allow?
I'ld like to set the minimum to at least 10 MB to have some extra space for future usage.
I'm talking about this permission window:
http://www.flexdevelopers.com/b/uploaded_images/permission-773954.png
Thanks

Yes. SharedObject.flush() takes a minDiskSpace:int parameter.

Related

What does caffe do with the mean-binary file ?

In the caffe-input layer one can define a mean image that holds mean values of all the images used. From the image net example: "The model requires us to subtract the image mean from each image, so we have to compute the mean".
My question is: What is the implementation of this subtraction? Is it simply :
used_image = original_image - mean_image
or
used_image = mean_image - original_iamge
or
used_image = |original_image - mean_image|^2
if it is one of the first two, then how are negative pixels handeld ? Since the pictures are usually stored in uint8 it would mean that it simply starts from the beginning. e.g
200 - 255 = 56
Why I need to know this? I made tests and I know that the second example or the third example would work better.
It's the first one, a trivial normalization step. Using the second instead wouldn't really matter: the weights would invert.
There are no "negative pixels", per se: this is simply integer input to the matrix operations. You are welcome to interpret this as a visual alteration of some sort, but the arithmetic doesn't care.

What is the format of the Qpdeltamap used for ROI in NVENC?

I am trying to get started with ROI encoding with the Nvidia Encoder NVENC.
As a first step I am trying to get the Nvidia demos to encode using ROI. I know that the switch -qpDeltaMapFile enables the flag enableExtQPDeltaMap. This allows me to send a file with a qp map that the encoder uses to tweak the values obtained by the rate control algorithm.
However there is absolutely no documentation on the format of this file. I tried to use one value per byte, and one byte per value assuming fixed size macroblocks of 16x16. It doesn't seem to work as I would expect.
Any guidance or references would help a lot.
There was a bug in my code. It actually works almost as I described.
Assume your screen is divided equally in 16x16 blocks, then each value will be added to the qp that the rate control algorithm chose. Each value passed is a signed integer, therefore a negative value will improve the quality while a positive value will decrease it. A value of 0 will stay with whatever the rate control algorithm decided.

Windows Phone IsolatedStorageSettings: capacity and dynamic allocation

I am going to save enough big amounts of data in my WP8 app using the handy IsolatedStorageSettings dictionary. However, the first question that arises is how big is it?
Second, in the documentation for the IsolatedStorageSettings.Save method we can find this:
If more space is required, use the IsolatedStorageFile.IncreaseQuotaTo
method to request more storage space from the host.
Can we estimate the amount of required memory and increase the room for IsolatedStorageSettings accordingly? What if we need to do that dynamically, as the user is entering new portions of data to store persistently? Or, maybe, we need to use another technique for that (though I would like to stay with the handy IsolatedStorageSettings class)?
I have found the answer to the first part of my question in this article: How to find out the Space in isolated storage in Windows Phone?. Here is the code to get the required value on a particular device with some enhancements:
long availablespace, Quota;
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
availablespace = store.AvailableFreeSpace ;
Quota = store.Quota ;
}
MessageBox.Show("Available : " + availablespace.ToString("##,#") + "\nQuota : " + Quota.ToString("##,#));
The 512Mb WP8 emulator gave me the following values for a minimal app with few strings saved in IsolatedStorageSettings:
Lumia 920 reports even a much bigger value - about 20Gb, which gladdens my heart. Such a big value (which, I think, depends on the whole available memory in the device) will allow me to use the IsolatedStorageSettings object for huge amounts of data.
As for a method one can use to estimate the amount of data, I guess, this can be done only experimentally. For instance, when I added some strings to my IsolatedStorageSettings, the available space was reduced by 4Kb. However, adding the same portion of data again did not show any new memory allocation. As I can see, it is allocated by blocks of 4Kb.

What is meaning of PE section field bit value IMAGE_SCN_MEM_SHARED?

In a PE/COFF format file (for example, a Windows executable) in the section headers there is a field called Characteristics which has a bit mask value of IMAGE_SCN_MEM_SHARED (0x10000000) which is described by the spec as "The section can be shared in memory." What does this mean? Shared with what?
Also, as long as we are on this topic, what is the difference between the IMAGE_SCN_MEM_EXECUTE setting and the IMAGE_SCN_CNT_CODE setting?
Do the read / write settings result in flags being set on the memory to make readable/writable?
That means this section memory can be shared with another process instance of the same image.

Programmatically obtaining the number of colors used in an image

Question:
Given an image in PNG format, what is the simplest way to programmatically obtain the number of colors used in the image?
Constraints:
The solution will be integreted into a shell script running under Linux, so any solution that fits in such an environment will do.
Please note that the "color capacity of the image file" does not necessarily correspond to "colors used". Example: In an image file with a theoretical color capacity of 256 colors only say 7 colors might be in actual use. I want to obtain the number of colors actually used.
Why write your own program?
If you're doing this with a shell script, you can use the netpbm utilities:
count = `pngtoppm png_file | ppmhist -noheader | wc -l`
The Image.getcolors method in Python Imaging Library seems to do exactly what you want.
Fun. There doesn't appear to be any guaranteed method of doing this; in the worst case you'll need to scan the image and interpret every pixel, in the best possible case the PNG will be using a palette and you can just check there.
Even in the palette case, though, you're not guaranteed that every entry is used -- so you're (at best) getting an upper bound.
http://www.libpng.org/pub/png/spec/1.1/PNG-Contents.html
.. and the chunk info here:
http://www.libpng.org/pub/png/spec/1.1/PNG-Chunks.html
Alnitak's solution is nice :) I really should get to know netpbm and imagemagick etc. better some time.
Just FYI, as a simple and very general solution: loop through each pixel in the image, getting the r,g,b color values as a single integer. Look for that integer in a list. If it's not there, add it. When finished with all the pixels, print the number of colors in the list.
If you want to count occurences, use a hashmap/dictionary instead of a simple list, incrementing the key's value (a counter) if found in the dictionary already. If not found, add it with a starting counter value of 1.