size

How to check an Android device is HDPI screen or MDPI screen?

落爺英雄遲暮 提交于 2019-11-27 02:27:11
I want to check this to fetch different images by internet. How to do that? SteD density = getResources().getDisplayMetrics().density; // return 0.75 if it's LDPI // return 1.0 if it's MDPI // return 1.5 if it's HDPI // return 2.0 if it's XHDPI // return 3.0 if it's XXHDPI // return 4.0 if it's XXXHDPI You can check the screen density with: switch (getResources().getDisplayMetrics().densityDpi) { case DisplayMetrics.DENSITY_LOW: // ... break; case DisplayMetrics.DENSITY_MEDIUM: // ... break; case DisplayMetrics.DENSITY_HIGH: // ... break; case DisplayMetrics.DENSITY_XHIGH: // ... break; } EDIT

How to change legend size with matplotlib.pyplot

泄露秘密 提交于 2019-11-27 02:25:22
Simple question here: I'm trying to get the size of my legend using matplotlib.pyplot to be smaller (i.e., the text to be smaller). The code I'm using goes something like this: plot.figure() plot.scatter(k, sum_cf, color='black', label='Sum of Cause Fractions') plot.scatter(k, data[:, 0], color='b', label='Dis 1: cf = .6, var = .2') plot.scatter(k, data[:, 1], color='r', label='Dis 2: cf = .2, var = .1') plot.scatter(k, data[:, 2], color='g', label='Dis 3: cf = .1, var = .01') plot.legend(loc=2) Yann You can set an individual font size for the legend by adjusting the prop keyword. plot.legend

Easy way to get size of folder (ObjC/Cocoa)?

两盒软妹~` 提交于 2019-11-27 02:24:44
问题 Right now I'm using this code to get the size of a folder: NSArray *contents; NSEnumerator *enumerator; NSString *path; contents = [[NSFileManager defaultManager] subpathsAtPath:folderPath]; enumerator = [contents objectEnumerator]; while (path = [enumerator nextObject]) { NSDictionary *fattrib = [[NSFileManager defaultManager] fileAttributesAtPath:[folderPath stringByAppendingPathComponent:path] traverseLink:YES]; fileSize +=[fattrib fileSize]; } [contents release]; [path release]; The

Android: how to increase heap size at runtime?

北慕城南 提交于 2019-11-27 02:16:40
问题 I have an image cache in my application which is implemented using SoftReferences. Dalvik starts applications with relatively small heap, and then increases it in case of demand. But I'd like to have my heap size bigger from the beginning. That is because when I already have some images in the cache, and an activity starts (for example) or other peak memory demand occurs, my cache gets purged in order to let memory for that peak demand. As a result, after the peak is gone I still have 2-3 MB

Get size of POST-request in PHP

允我心安 提交于 2019-11-27 02:08:37
Is there any way to get size of POST-request body in PHP? As simple as: $size = (int) $_SERVER['CONTENT_LENGTH']; Note that $_SERVER['CONTENT_LENGTH'] is only set when the HTTP request method is POST (not GET). This is the raw value of the Content-Length header, as specified in RFC 7230 . In the case of file uploads, if you want to get the total size of uploaded files , you should iterate over the $_FILE array to sum each $file['size'] . The exact total size might not match the raw Content-Length value due to the encoding overhead of the POST data. (Also note you should check for upload errors

can size of array be determined at run time in c?

泪湿孤枕 提交于 2019-11-27 02:04:05
As I know, an array needs to have a specific size before compiling time in c. I wonder why this code still works? int s; printf("enter the array size: "); scanf("%d",&s); int a[s]; // Isn't s value determined at run time? Array sizes need to be known with ANSI 89 C. The 99 version of the spec removed this limitation and allowed for variable sized arrays. Here is the documentation no the GNU version of this feature http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC49 If you need to allocate an array with dynamic size, you have to get it from the heap, with malloc().

Getting size in memory of an object in PHP?

倾然丶 夕夏残阳落幕 提交于 2019-11-27 02:03:20
问题 There is a way to get the total memory PHP is using ( memory_get_usage() ) but how does one get the size in memory of an individual object? I'm obviously not talking about count() as I want the number of bytes in a potentially complex data structure. 回答1: You can call memory_get_usage() before and after allocating your class as illustrated in this example from IBM. You could even create a wrapper to do this, possibly storing the result on a member variable of the complex class itself. EDIT:

Java Toolkit Getting Second screen size

随声附和 提交于 2019-11-27 02:00:25
I have two screens plugged into my computer and was wondering if there was a way in JFrame or Toolkit of detecting which screen the window is on? I have this code: java.awt.Toolkit.getDefaultToolkit().getScreenSize(); Which gets my screen size of my main screen, but how can I get the size of my second screen, or detect which screen the window is on? You should take a look at GraphicsEnvironment . In particular, getScreenDevices() : Returns an array of all of the screen GraphicsDevice objects. You can get the dimensions from those GraphicDevice objects (indirectly, via getDisplayMode ). (That

Selecting the size of a System.Drawing.Icon?

心已入冬 提交于 2019-11-27 01:57:48
I have a icon which has a few different sizes (16px, 32px, 64px). I am calling ToBitmap() on it, but it is always returning the 32px image. How do I retrieve the 64px one? This is a fairly painful limitation in the ResourceManager class. Its GetObject() method doesn't provide a way to pass extra arguments that would allow selecting the returned icon by size. A workaround is to add the icon to the project instead. Use Project + Add Existing Item, select your .ico file. Select the added icon and change the Build Action property to "Embedded Resource". You can now retrieve the desired icon with

How to determine ACTUAL windows form size (with all nonclient elements) when running Aero?

丶灬走出姿态 提交于 2019-11-27 01:48:01
I'm trying to position my form precisely above the taskbar. Unfortunately my efforts are hampered by the fact that this.Height on my form returns a value which is 10 pixels smaller than the actual form (with all the borders, title bar, etc). I'm running Windows 7 with Aero. When Aero is turned off (and the borders are thinner), all works as expected. The form border style is FixedSingle . I don't want to implement Aero-specific hacks. What can I do to get the correct height? Yes, Aero lies about the window size returned by GetWindowRect(). It is a rather important appcompat hack, without it