size

Group variables based on lengths of specific arrays

此生再无相见时 提交于 2019-12-04 05:42:18
问题 I have a long list of variables in a dataset which contains multiple time channels with different sampling rates, such as time_1 , time_2 , TIME , Time , etc. There are also multiple other variables that are dependent on either of these times. I'd like to list all possible channels that contain 'time' (case-insensitive partial string search within Workspace) and search & match which variable belongs to each item of this time list, based on the size of the variables and then group them in a

iOS - How to find the right font size (in points) with the same height as a given CGRect?

空扰寡人 提交于 2019-12-04 05:23:53
Heading pretty much explains it. I have an image that I'm drawing text on. I want the text to be sized according to the size of the image and want to find a way to get a height for the font that is just a little shorter than the image itself. OK, so for everyone who thinks an iteration is not avoidable: NSString *string = @"The string to render"; CGRect rect = imageView.frame; UIFont *font = [UIFont fontWithSize:12.0]; // find the height of a 12.0pt font CGSize size = [string sizeWithFont:font]; float pointsPerPixel = 12.0 / size.height; // compute the ratio // Alternatively: // float

Average and maximum size of directories

耗尽温柔 提交于 2019-12-04 04:42:57
问题 I have a directory and a bunch of sub-directories like this: - directory1 ( sub-dir1 , sub-dir2 , sub-dir3 , sub-dir4 , sub-dir5 ...........and so on, hundreds of them...) How do I find out what is average size of the sub-directories? And how do I find what is the maximum size of the sub-directories? All using Unix commands... Thanks. 回答1: If you only have directories and not files in directory1 , then the following two "commands" should give you the size (in bytes) and name of the largest

iOS UIView get frame after rotation

梦想的初衷 提交于 2019-12-04 04:31:48
问题 I'm trying to get the size of my UIView after the orientation changes. In my view controller I implement didRotateFromInterfaceOrientation: and call setNeedsLayout: on my view. In my view's layoutSubviews method, it tries to perform some logic based on its new frame size post rotation, but the frame size has not been updated to reflect the new orientation (e.g. it is still 768x1024 instead of 1024x768 after moving to landscape). How do I get the updated frame size? 回答1: Just going to answer

Android and calculating the size of a one-line string in a given font and font size?

我与影子孤独终老i 提交于 2019-12-04 04:22:50
Is there an API method for calculating the size (i.e. width and height) of a string displayed on one line and in a given font and font size? Ronnie Paint p = new Paint(); p.setTypeface(TypeFace obj); // if custom font use `TypeFace.createFromFile` p.setTextSize(float size); float textWidth = p.measureText("Your string"); // you get the width here and textsize is the height. Paint mPaint = new Paint(); mPaint.setTextSize(/*put here ur size*/); mPaint.setTypeface(/* put here ur font type */); Rect bounds = new Rect(); mPaint.getTextBounds(text, 0, text.length(), bounds); then make the call of

LEETCODE 5257. 统计封闭岛屿的数目 Number of Closed Islands

旧城冷巷雨未停 提交于 2019-12-04 04:07:16
地址 https://leetcode-cn.com/contest/weekly-contest-162/problems/number-of-closed-islands/ 有一个二维矩阵 grid ,每个位置要么是陆地(记号为 0 )要么是水域(记号为 1 )。 我们从一块陆地出发,每次可以往上下左右 4 个方向相邻区域走,能走到的所有陆地区域,我们将其称为一座「岛屿」。 如果一座岛屿 完全 由水域包围,即陆地边缘上下左右所有相邻区域都是水域,那么我们将其称为 「封闭岛屿」。 请返回封闭岛屿的数目。 示例1 输入:grid = [[1,1,1,1,1,1,1,0],[1,0,0,0,0,1,1,0],[1,0,1,0,1,1,1,0],[1,0,0,0,0,1,0,1],[1,1,1,1,1,1,1,0]] 输出:2 解释: 灰色区域的岛屿是封闭岛屿,因为这座岛屿完全被水域包围(即被 1 区域包围)。 示例2 输入:grid = [[0,0,1,0,0],[0,1,0,1,0],[0,1,1,1,0]] 输出:1 示例3 输入:grid = [[1,1,1,1,1,1,1], [1,0,0,0,0,0,1], [1,0,1,1,1,0,1], [1,0,1,0,1,0,1], [1,0,1,1,1,0,1], [1,0,0,0,0,0,1], [1,1,1,1,1,1,1]]

Why BSS segment is “16” by default?

喜欢而已 提交于 2019-12-04 03:54:29
问题 As per my knowledge, segmentation for c program is: High address |---------------------------| |env/cmd line args vars | |---------------------------| | stack segment |--> uninitialized auto vars |---------------------------| |---------------------------| |---------------------------| | heap segment |--> dynamic allocated memory |---------------------------| | BSS segment |--> uninitialized static/global vars |---------------------------| | data segment |--> initialized static/global vars |--

Max 9000 characters in Android TextView?

ε祈祈猫儿з 提交于 2019-12-04 03:42:43
问题 I have items with a lot of text, mostly around 8500 to 9500 characters. I want to display that in a scrollable textview, but when put the text in a TextView, it seems to be truncated to a max of 9000 characters, while a (the original) String object can hold more. Is there a way to extend this number? Absolutely no parameters on restricting the size of the TextView has been set. Thanks in advance. 回答1: Here is a link which basically says: The answer is "how much memory can you allocate?" Of

Stretch Grid to window size

与世无争的帅哥 提交于 2019-12-04 03:40:40
问题 I've just started learning C# WPF with a basic empty project and I want to make a grid, with a background image, which stretches exactly over the window. The way it is now, the grid stretches, but not the way I want it. For example my background image is 1000x1000px and my window size is 1700x1200px so the grid stretches to 1200x1200px (it keeps the aspect ratio of the image. I don't want this, I want it simply to stretch all over the window. Here is my code: <Window x:Class="Backgammon

Change label size of Cluster Dendrogram in R 3.01

懵懂的女人 提交于 2019-12-04 03:23:52
Has anybody found a workaround to the apparent bug in R 3 which prohibits changing the label size on a Cluster Dendrogram? The following code used to work fine before updating R to 3.01 (prior version was 2.15 I think): plot(hclust, labels = data[, 1], cex = 0.3) Now there is no change to label size when altering the cex argument. You could set the cex parameter using the par() function before the call to plot() . For example: # example from ?hclust hc <- hclust(dist(USArrests), "ave") # default label size plot(hc, xlab="xlab", ylab="ylab", main="main", sub="") # reduced label size par(cex=0.3