size

Constraining proportions of GUI elements in Spritekit game

血红的双手。 提交于 2019-11-30 13:25:54
问题 I apologize in advance because of huge post, but everybody who ever tried to make some kind of universal app knows that this is pretty problematic stuff, so please be easy on me... The goal What I am trying to achieve (shown on image above) is to use @2x assets on both iPhone 5 and 6, and maintain same look of an app. And if possible, to do all that without manually calculating scale and position properties of nodes based on detected device... So in short, how to achieve that app

How do I get the size of a directory in C?

情到浓时终转凉″ 提交于 2019-11-30 13:21:42
问题 Is there a POSIX function that will give me the size of a directory (including all sub-folders), roughly equivalent to " du -s somepath "? 回答1: $ man nftw NAME ftw , nftw - file tree walk DESCRIPTION ftw() walks through the directory tree that is located under the directory dirpath, and calls fn() once for each entry in the tree. By default, directories are handled before the files and subdirectories they contain (pre-order traversal). CONFORMING TO POSIX.1-2001, SVr4, SUSv1. Simple example

How to deal with form size issues from Delphi 6 and WinXP to Delphi 2007 and Vista/Win7

雨燕双飞 提交于 2019-11-30 13:09:59
问题 I have an application written in Delphi 6 and compiled on Windows XP. Usually I leave 8px free between controls and the edges of forms. When this app runs on Vista or Win 7 this gap is smaller or not present at all. I think this might be because these versions of Windows have thicker form borders. Now I am moving the app to Delphi 2007. In the form designer the forms have lost the bottom and right gaps. How should I deal with this? I have hundreds of forms and don't want to go changing them

PHP: Measure size in kilobytes of a object/array?

喜欢而已 提交于 2019-11-30 12:58:51
问题 What's an appropriate way of measure a PHP objects actual size in bytes/kilobytes? Reason for asking: I am utilizing memcached for cache storage in my web application that will be used by non-technical customers. However, since memcached has a maximum size of 1mb , it would be great to have a function set up from the beginning that I can be used to measure size of selected objects/arrays/datasets, to prevent them from growing to big. Note that I am only planning on using this as a alert

How does HDFS with append works

耗尽温柔 提交于 2019-11-30 12:44:02
Let's assume one is using default block size (128 MB), and there is a file using 130 MB ; so using one full size block and one block with 2 MB. Then 20 MB needs to be appended to the file (total should be now of 150 MB). What happens? Does HDFS actually resize the size of the last block from 2MB to 22MB? Or create a new block? How does appending to a file in HDFS deal with conccurency? Is there risk of dataloss ? Does HDFS create a third block put the 20+2 MB in it, and delete the block with 2MB. If yes, how does this work concurrently? EthanP According to the latest design document in the

Get the size (after it has been “stretched”) of an item in a ViewBox

核能气质少年 提交于 2019-11-30 12:41:30
Consider the following: Let's say the Window is 1024x768 and the ViewBox fills the entire window, this means the TextBox is really large on the screen. I want to get the size of the TextBox as it is currently on the screen. If I get DesiredSize or ActualSize or even RenderedSize I always get 100. Any suggestions? Update: I could probably get the ActualWidth of the ViewBox and divide it by the ActualWidth of it's child which would give me the current scale factor and expose that as a property somehow but I'm not sure that's the best way to do it. Markus Hütter This is how you get the

How to get matplotlib figure size

会有一股神秘感。 提交于 2019-11-30 12:29:26
问题 For a project, I need to know the current size (in pixels) of my matplotlib figure, but I can't find how to do this. Does anyone know how to do this ? Thanks, Tristan 回答1: import matplotlib.plt fig = plt.figure() size = fig.get_size_inches()*fig.dpi # size in pixels To do it for the current figure, fig = plt.gcf() size = fig.get_size_inches()*fig.dpi # size in pixels You can get the same info by doing: bbox = fig.get_window_extent().transformed(fig.dpi_scale_trans.inverted()) width, height =

Create thumbnail and reduce image size

橙三吉。 提交于 2019-11-30 12:18:24
问题 I have very large images (jpg) and i want to write a csharp program to loop through the files and reduce the size of each image by 75%. I tried this: Image thumbNail = image.GetThumbnailImage(800, 600, null, new IntPtr()); but the file size is still very large. Is there anyway to create thumbnails and have the filesize be much smaller? 回答1: private void CompressAndSaveImage(Image img, string fileName, long quality) { EncoderParameters parameters = new EncoderParameters(1); parameters.Param[0]

MySQL error: The maximum column size is 767 bytes

一世执手 提交于 2019-11-30 12:15:00
问题 When I run a program which does something with MySQL, I got this error message: 2015-06-10 15:41:12,250 ERROR app.wsutils 419 INCRON: Error: ('HY000', '[HY000] [MySQL][ODBC 5.2(w) Driver][mysqld-5.7.7-rc-log]Index column size too large. The maximum column size is 767 bytes. (1709) (SQLExecDirectW)') I Googled a little bit, and found this error might be relating to the innodb_large_prefix option. However, I am using MySQL 5.7.7 rc, which has already set innodb_large_prefix to be "ON" (checked

How to get a WPF window's ClientSize?

萝らか妹 提交于 2019-11-30 11:16:45
In WinForms, Form had a ClientSize property (inherited from Control), which returns the size of its client area, i.e., the area inside the title bar and window borders. I'm not seeing anything similar in WPF: there's no ClientSize, ClientWidth, ClientHeight, GetClientSize(), or anything else that I can think to guess the name of. How do I go about getting the client size of a WPF Window? One way you could do it is to take the top most child element, cast this.Content to its type, and call .RenderSize on it, which will give you its size. <Window x:Class="XML_Reader.Window1" xmlns="http:/