size

MySQL VARCHAR size limit

廉价感情. 提交于 2019-11-28 09:45:50
If I have a column in table with field of type VARCHAR(15) and if I try to insert data of length 16, MySQL gives an error stating Data too long for column 'testname' at row 1 Does anyone know why VARCHAR fields in MySQL take fixed length? Also how many bytes does a VARCHAR field take per record based on the size given? If you set a column to be varchar(15) the maximum bytes allowed is 15. Thus you can't pass it more than 15 characters without modifying the column to support more than 15. If you store a 4 character string it should only use around 4 bytes out of a possible 15, whereas if you

Physical disk size not correct (IoCtlDiskGetDriveGeometry)

懵懂的女人 提交于 2019-11-28 09:28:09
I use the code below to get the physical disk size , but the size returned is not correct. I've checked the size with other tools. The code below reports Total disk space: 8.249.955.840 bytes and it should be Total disk space: 8.254.390.272 bytes How can I retrieve the actual/correct physical disk size? Tested on USB drives and normal hard drives. The code is long, here separate it in parts to show. The structure: [StructLayout(LayoutKind.Sequential)] internal struct DiskGeometry { public long Cylinders; public int MediaType; public int TracksPerCylinder; public int SectorsPerTrack; public int

Page count of Pdf with Java

≡放荡痞女 提交于 2019-11-28 09:08:27
at the moment I am using itext to read the page count of a pdf. This takes quite long because the lib seems to scan the whole file. Is the page information somewhere in the header of the pdf, or is a full filescan needed? Mark Storer That's correct. iText parses quite a bit of a PDF when it is opened (it doesn't read the contents of stream objects, but that's about it)... UNLESS you use the PdfReader(RandomAccessFileOrArray) constructor, in which case it will only read the xrefs (mostly required), but not parse anything until you start requesting specific objects (directly or via various calls

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

余生长醉 提交于 2019-11-28 08:43:31
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 problem is that its highly innacurate. It either adds a few megabytes or deducts a few megabytes from the

Spring upload file size limit

梦想的初衷 提交于 2019-11-28 08:41:44
问题 I'm using Spring Boot for my application, and I want to upload some files into my database. I used a tutorial to achive this, and it works fine. My problem is that I don't know how to set max file size to upload. The default is 1MB but that's just not enough for me. I added these lines to my application.properties: spring.http.multipart.max-file-size = 100MB spring.http.multipart.max-request-size = 100MB but it didn't help. My code: FileService.java @Service public class FileService {

How to make a javafx button with circle shape of 3xp diameter?

半城伤御伤魂 提交于 2019-11-28 08:37:14
I want to make a VERY small round button with no text on it. Here is how I tried. Button bt = new Button(); bt.setShape(new Circle(1.5)); bt.setMaxSize(3,3); However,there are two problems: 1.The shape of the button is not perfectly round, but more like an oval. 2. The bt.setMaxSize(1.5,1.5); does not take effect. As i reckon, its diameter is more than 3... How could I make a smaller rounder Button? Help Appreciated. Update: on close review of the resultant button, setting the shape like in José's answer seems to work better on very small buttons than setting the -fx-background-radius as used

size of a datatype in c

我的梦境 提交于 2019-11-28 08:35:35
问题 Is size of a datatype hardware architecture dependent or compiler dependent? I want to know what factors really influence in determining the size of a datatype? 回答1: The compiler (more properly the "implementation") is free to choose the sizes, subject to the limits in the C standard (for instance int must be at least 16 bits). The compiler optionally can subject itself to other standards, like POSIX, which can add more constraints. For example I think POSIX says all data pointers are the

Android: how to increase heap size at runtime?

谁都会走 提交于 2019-11-28 08:24:04
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 of free space but my cache is empty! The solution I see for this trouble is pre-allocating a bigger

剑指offer--滑动窗口的最大值

我的未来我决定 提交于 2019-11-28 07:15:55
题目描述 给定一个数组和滑动窗口的大小,找出所有滑动窗口里数值的最大值。例如,如果输入数组{2,3,4,2,6,2,5,1}及滑动窗口的大小3,那么一共存在6个滑动窗口,他们的最大值分别为{4,4,6,6,6,5}; 针对数组{2,3,4,2,6,2,5,1}的滑动窗口有以下6个: {[2,3,4],2,6,2,5,1}, {2,[3,4,2],6,2,5,1}, {2,3,[4,2,6],2,5,1}, {2,3,4,[2,6,2],5,1}, {2,3,4,2,[6,2,5],1}, {2,3,4,2,6,[2,5,1]}。 /* 题目:滑动窗口的最大值 思路:滑动窗口应当是队列,但为了得到滑动窗口的最大值,队列序可以从两端删除元素,因此使用双端队列。 原则: 对新来的元素k,将其与双端队列中的元素相比较 1)前面比k小的,直接移出队列(因为不再可能成为后面滑动窗口的最大值了!), 2)前面比k大的X,比较两者下标,判断X是否已不在窗口之内,不在了,直接移出队列 队列的第一个元素是滑动窗口中的最大值 */ class Solution { public: vector<int> maxInWindows(const vector<int>& num, unsigned int size) { vector<int> res; deque<int> s; for(unsigned

VBA Excel Function for returning file size in byte

て烟熏妆下的殇ゞ 提交于 2019-11-28 07:08:11
问题 I wish to return the file size of some files in the same folder or in a different one with VBA in Excel 2010. 回答1: There is a very nice and simple VBA function, which was not mentioned so far, FileLen: FileLen("C:\Temp\test file.xls") It returns the size of the file in bytes . In combination with looping through files in a directory it's possible to achieve what you originally wanted (get sizes of files in a folder). 回答2: Here how to use it in Excel Cell: =GetDirOrFileSize("C:\Users\xxx