size

Creating an ICNS Programmatically : “Unsupported Image Size”

心已入冬 提交于 2019-12-06 14:34:52
I'm trying to create an ICNS (including a 1024x1024 image) programmatically. Currently I'm creating an NSImage , then I create CGImageRef objects with the appropriate resolution, finally I'm adding them to an icon by using CGImageDestinationAddImage() . Peter Hosey has helped me create '@2x' images already, but the sizes of the images don't wanna be set. This is the code (still a bit messy, sourcefile represents the path to the image) : NSSize sizes[10]; sizes[0] = NSMakeSize(1024,1024); sizes[1] = NSMakeSize(512,512); sizes[2] = NSMakeSize(512,512); sizes[3] = NSMakeSize(256,256); sizes[4] =

what is size of empty class and difference between union, structure and class in c++ ?

本秂侑毒 提交于 2019-12-06 13:50:12
问题 what is size of empty class and difference between union, structure and class in c++ ? My idea: if no static members in them, they should be same because all members are allocated on stack. If they are all empty, they are same. if they have static members, it depends the relative location of the members inside them. right ? thanks 回答1: C++ Standard standard specify's that the size of an Empty class should be Non-Zero . Usually, it is 1 byte on most systems. In Bjarne Stroustrup's words, the

How can I set a size limit for files uploaded in Alfresco 4.2.c?

淺唱寂寞╮ 提交于 2019-12-06 13:32:15
I think the title is pretty self-explanatory, now... I have been looking for a way of limiting the size of files uploaded in Alfresco 4.2.c through Share. I'm surprised there isn't any mechanism provided out-of-the-box, looks to me a pretty basic feature. After some investigation the only way I see to make it possible is by implementing custom policy or behavior, according to what's discussed here: http://forums.alfresco.com/forum/developer-discussions/web-content-services/limit-file-upload-size-34d-10272011-1416 Do anybody knows any other (simpler) approaches? EDIT: As Andreas Steffan

C Windows buffer size

五迷三道 提交于 2019-12-06 12:34:00
In windows lets say i'm using the recv function to receive data from a socket. I'm curious how big would an optimal buffer be? I could make it 1024 bytes or I could make it 51200 bytes, or bigger. I'm wondering which one would be better for performance. This doesn't only apply to the recv function, lets say im reading a large text file, do i want a very large buffer, or a smaller buffer? THe operating system performs its own buffering, so the size of your buffer does not really matter. the performance penalty lies in the function call: a 1 byte buffer will be inefficient because it will

Size of memory allocated to a SQLite in-memory database

折月煮酒 提交于 2019-12-06 12:12:03
问题 If a create a in-memory sqlite database using syntax below, then what is the size of maximum memory allocated to it? my $dbh = DBI->connect('dbi:SQLite:dbname=:memory:'); What will happen if size of in-memory database becomes greater than max available memory. Suppose I have 1 GB free and the database size become 1.1 GB, then will some data be written to disk or what? Is there a way to change the value of max-memory allocated to a in-memory sqlite database? 回答1: It will use virtual memory,

[转载]PyTorch中permute的用法

家住魔仙堡 提交于 2019-12-06 11:45:17
[转载]PyTorch中permute的用法 来源: https://blog.csdn.net/york1996/article/details/81876886 permute(dims) 将tensor的维度换位。 参数:参数是一系列的整数,代表原来张量的维度。比如三维就有0,1,2这些dimension。 例: import torch import numpy as np a=np.array([[[1,2,3],[4,5,6]]]) unpermuted=torch.tensor(a) print(unpermuted.size()) # ——> torch.Size([1, 2, 3]) permuted=unpermuted.permute(2,0,1) print(permuted.size()) # ——> torch.Size([3, 1, 2]) 再比如图片img的size比如是(28,28,3)就可以利用img.permute(2,0,1)得到一个size为(3,28,28)的tensor。 利用这个函数permute(0,2,1)可以把Tensor([[[1,2,3],[4,5,6]]]) 转换成 tensor([[[1., 4.], [2., 5.], [3., 6.]]]) 如果使用view,可以得到 tensor([[[1., 2.], [3.,

How to find floppy\ CD sector size in Linux?

旧街凉风 提交于 2019-12-06 11:36:04
问题 How can I get the sector size for floppy and CD disks in Linux, via C++ code? Thank you all. 回答1: "#include <hdreg.h>" and use ioctl HDIO_GET_IDENTITY to obtain a struct hd_driveid . On this structure, the x->sector_bytes field is the sector size. #include <stdlib.h> #include <stdio.h> #include <sys/ioctl.h> #include <linux/hdreg.h> #include <fcntl.h> #include <errno.h> #include <string.h> #include <cctype> #include <unistd.h> int main(){ struct hd_driveid id; char *dev = "/dev/hdb"; int fd;

Fixed icon size in OpenLayers 3

久未见 提交于 2019-12-06 10:39:06
I searched for 2 hours now, but it's still not clear if it's possible or not in OL3. I would like my icons to be fixed size (not to the screen, but to the image map I'm using). I mean, it should cover the same area even if I'm zoomed out, and not covering the half of the map (like I was using a circle polygon, but I have complex Icons so I have to use it as point features). Is there any solution to it? Like in QGIS: MAP UNITS. I already have these: var jelekStyle = function(feature, resolution) { if(feature.get('tipus')=== 'falu') { icon = '00_ikonok/falu.png', size = [115, 233], scale = 0.05,

size of app's background for various Android devices

馋奶兔 提交于 2019-12-06 10:03:05
问题 I am designing a background for my app for all Android devices. I was thinking what would be the size of the image in pixels? From the developer site I found the following equation px = dp * ( dpi / 160) Then, px depends on two variables. First, dp, and we have xlarge screens are at least 960dp x 720dp large screens are at least 640dp x 480dp normal screens are at least 470dp x 320dp small screens are at least 426dp x 320dp Second, dpi and we have low-density (ldpi) screens (~120dpi). medium

How to find byte sizes of R figures on pages?

落花浮王杯 提交于 2019-12-06 09:28:31
I would like to monitor the basic quality of the figures produced in R on individual pages such as byte size of each page, ... I can now do only quality assurance of average pages, see the following chapter about it. I think there must be something builtin for the task than average measures. Code which produces 4 pages in Rplots.pdf where I would like to know the byte size of each page in an output here; any other statistics of the page outputs is also welcome; you can get the basic memory monitoring by objects here but I would like it to correspond to the outputs in PDF # https://stat.ethz.ch