size

Do certain characters take more bytes than others?

吃可爱长大的小学妹 提交于 2019-11-27 06:19:17
问题 I'm not very experienced with lower level things such as howmany bytes a character is. I tried finding out if one character equals one byte, but without success. I need to set a delimiter used for socket connections between a server and clients. This delimiter has to be as small (in bytes) as possible, to minimize bandwidth. The current delimiter is "#". Would getting an other delimiter decrease my bandwidth? 回答1: It depends on what character encoding you use to translate between characters

Why are Oracle table/column/index names limited to 30 characters?

非 Y 不嫁゛ 提交于 2019-11-27 06:16:54
I can understand that many years ago there would be this kind of limitation, but nowadays surely this limit could easily be increased. We have naming conventions for objects, but there is always a case that turns up where we hit this limit - especially in naming foreign keys. Does anybody actually know why this isn't a bigger size - or is it bigger in 11g? Apparently the answer is that it will break currently scripts that aren't defensively coded. I say that is a very worrying thing, Oracle is trying to be the database, surely this is the kind of thing that you must constantly improve,

C# FileStream : Optimal buffer size for writing large files?

笑着哭i 提交于 2019-11-27 06:13:44
Suppose I'm writing a couple of files to disk, between 2MB and 5GB. What are sensible buffer values for the FileStream ? Is it sensible to work with buffersizes of several megabytes, or should I stick to kilobyte-buffers ? Rubens Farias Default buffer size is 4 KiB. Also, take a look here: Sequential File Programming Patterns and Performance with .NET A quick little benchmark based on the document referenced shows no increase in performance on my system greater than 128KB buffer size. Your mileage may vary, feel free to use the below. Stopwatch sw = new Stopwatch(); Random rand = new Random();

WPF - Get size of UIElement in Memory?

荒凉一梦 提交于 2019-11-27 06:06:01
问题 Is there a way to get the size of a UIElement that resides in memory and has not yet been rendered? I currently have a routine that creates a Grid from a DataTable and then adds the Grid into a FixedDocument . I need to know the size of the Grid because I want to automatically switch from Portrait to Landscape if needed; or even change the FontSize of the grid. 回答1: You need to force a render of the item, or wait for the item to be rendered. You can then use the ActualHeight and ActualWidth

Undo auto resizing for iPhone 5 screen after adding Default-568h@2x.png

烂漫一生 提交于 2019-11-27 05:50:05
问题 I followed the instructions in this answer: https://stackoverflow.com/a/12397309/1084932 to update my app for the new iPhone 5 screen size. Great, worked perfectly! But, I am not quite ready to make this update and wish to roll back to the letterbox setup for now. I tried deleting Default-568h@2x.png to see if that would work, but my app still fills up the full iPhone 5 screen even without the Default-568h@2x.png file. Anyone know how to undo the auto resizing for iPhone 5 after adding

How to list all folder with size via batch file

心已入冬 提交于 2019-11-27 05:17:56
I want a simple solution for list of folders and size of them in either txt or csv format. I use this code for folder list dir C:\Temp\*.* /b /a:d > C:\folderList.txt current output <<folderList.txt>> folder1 folder2 folder3 desired output <<folderList.txt>> folder1 # 100 MB folder2 # 30 MB folder3 # 110 MB Simply it would generate the size of each folder.. How can I proceed?? any help For each folder in the list, use dir command to retrieve the size of the files under the folder @echo off setlocal disabledelayedexpansion set "folder=%~1" if not defined folder set "folder=%cd%" for /d %%a in (

How to reliably get size of C-style array?

…衆ロ難τιáo~ 提交于 2019-11-27 05:06:51
How do I reliably get the size of a C-style array? The method often recommended seems to be to use sizeof , but it doesn't work in the foo function, where x is passed in: #include <iostream> void foo(int x[]) { std::cerr << (sizeof(x) / sizeof(int)); // 2 } int main(){ int x[] = {1,2,3,4,5}; std::cerr << (sizeof(x) / sizeof(int)); // 5 foo(x); return 0; } Answers to this question recommend sizeof but they don't say that it (apparently?) doesn't work if you pass the array around. So, do I have to use a sentinel instead? (I don't think the users of my foo function can always be trusted to put a

Using sizeof on arrays passed as parameters [duplicate]

左心房为你撑大大i 提交于 2019-11-27 04:56:25
Possible Duplicate: Sizeof array passed as parameter Given the function below I understand that sizeof returns the size of the pointer of the type in the array. int myFunc(char my_array[5]) { return sizeof(my_array); } However calling sizeof on an array not passed as a parameter normally returns the sizeof the array. What causes this inconsistency? What is the best way of getting the size of an array when it is passed as a parameter? What causes this inconsistency? The name of the array decays as an pointer to its first element. When you pass an array to an function, this decaying takes place

Specifying the maximum string length to scanf dynamically in C (like “%*s” in printf)

限于喜欢 提交于 2019-11-27 04:37:33
问题 I can specify the maximum amount of characters for scanf to read to a buffer using this technique: char buffer[64]; /* Read one line of text to buffer. */ scanf("%63[^\n]", buffer); But what if we do not know the buffer length when we write the code? What if it is the parameter of a function? void function(FILE *file, size_t n, char buffer[n]) { /* ... */ fscanf(file, "%[^\n]", buffer); /* WHAT NOW? */ } This code is vulnerable to buffer overflows as fscanf does not know how big the buffer is

Size of zero pixels in CSS with or without 'px' suffix? [duplicate]

与世无争的帅哥 提交于 2019-11-27 04:32:41
问题 This question already has an answer here: 'property: 0' or 'property: 0px' in CSS? 9 answers Googling for the answer to this question has proven difficult so I figured somebody here should know. Within CSS, I've seen zero pixels declared as simply '0' yet also as '0px'. mystyle { width: 0; } anotherstyle { width: 0px; } The minor problem with '0' is that if you change it to some non-zero value, you might forget to add the 'px'. And when making a value '0', you may forget to remove the 'px'. I