Posts by Maniero • 444,682 points
6,921 posts
-
7
votes3
answers1491
viewsA: Is it good practice to use composite keys as the primary key?
Forget this "good practice" business. Learn all that is necessary (this site is great for clearing your doubts), analyze the specific problem and apply the best technique for the case. Good practice…
-
5
votes1
answer256
viewsA: What is the difference between "Exception.Message" and "Exception.Tostring()"?
ex. Message Simply displays the basic error message. ex Tostring.()? It has much more information, there is everything that is important, including stack trace and internal exceptions (Inner…
-
2
votes1
answer133
viewsA: Is there any way to access a position by string?
It is possible through a map or unordered_map, where the index can be purposefully a string. But where an integer value is expected it cannot use an string, at most can be used some conversion…
-
14
votes1
answer16141
viewsA: CMD, Powershell, Bash - What’s the difference?
Essentially they do, all are system administration utilities for processing commands started from a text-based user interface (console). It is used to call other utilities, initiate processes and…
-
11
votes2
answers229
views -
6
votes1
answer120
viewsA: Why is an expression with rest and multiplication giving the wrong result?
I did so and gave 7: #include <stdio.h> int main() { printf("%i\n", 105 % (3 * 4) - (3 * 4) % (101 / 10)); } Behold working in the ideone. And in the repl it.. Also put on the Github for…
-
14
votes1
answer717
viewsA: What are the main differences and advantages between PHP and Hack languages?
I won’t go into very specific details, just a general overview to help understand the differences. Typing I’ll start with the typing I believe is the main difference. Hack has static typing, while…
-
7
votes2
answers4863
viewsA: How to create a method with optional parameters in pure Java?
Some languages allow the use of arguments optional (parameters can never be optional). Java is not one of them. There is the possibility to create several methods overloaded with a set of different…
-
4
votes1
answer1627
viewsA: Working with Windows Forms as designer on Linux?
Possible it is, but the Windows Forms do Mono is quite problematic, generally people do not use. Some problems can be seen in the FAQ. In general there is preference to use the GTK#. Been having…
-
8
votes1
answer1263
viewsA: How to avoid buffer overflow in C/C++
It is even simple, just use a more modern function that avoid bursting, she is the fgets(), where it can determine the size of the buffer and the function itself will protect the memory. For all…
-
1
votes1
answer226
viewsA: Draw outside a form area
Second that response in the OS is possible in two ways, both with disabilities: var f = new Form(); f.BackColor = Color.White; f.FormBorderStyle = FormBorderStyle.None; f.Bounds =…
-
6
votes1
answer571
viewsA: Is there a difference between C++ from GCC and C++ from Visual Studio?
There are two C++ in Visual Studio. The . NET is C++/CLI, although it is still very similar to C++, it does not follow the standard language. In fact he is used only to facilitate. NET code…
-
3
votes2
answers4207
viewsA: Capture file name
The best way is to use a ready-made method like the GetFileNameWithoutExtension().…
-
4
votes2
answers3495
views -
1
votes1
answer75
viewsA: Enable variable spacing Code::Blocks
Install the plugin Astyle. I believe that he solves what he wants.
-
7
votes4
answers2583
viewsA: Can PHP’s unset() function improve performance?
In fact it is highly unlikely that you will get some performance gain. This command says that the variable will no longer be used. This does not increase performance. It even consumes a minimum to…
-
11
votes1
answer3711
viewsA: What is Native Script?
It is yet another attempt to offer a tool that allows you to develop cross-platform applications especially focused on mobile devices (iOS, Android and Windows). It is Javascript-based and gives you…
-
4
votes2
answers896
viewsA: Struct or Classes, huh?
In C++ structures and classes are virtually the same (classes have private members by default), so it makes no difference, neither performance. How it will assemble and use the code makes a…
-
8
votes2
answers2251
viewsA: Sizeof() or strlen()?
sizeof is a operator and returns the amount of bytes of an object or type. Not suitable to see the size of a string. If the string is represented by a pointer, the size will be of the pointer and…
-
6
votes3
answers408
viewsA: Use free() without malloc()?
In the shown example can cause trouble. It’s called dangling Pointer. The free() is acting on the variable palavra that has not been initialized. That is, in C has a value in it, you have no idea…
-
2
votes1
answer107
viewsA: How to customize the size of a window?
A MessagaBox() cannot have its size determined directly by the programmer. The size is indirectly determined by the amount of text placed on it. If you need to determine the same size, you have to…
-
11
votes3
answers271
viewsA: How to avoid the use of setters in such cases?
The good design object-oriented solves problems in the best possible way. When it is used to meet meaningless rules, it is not good design. If someone told you that you need to do this, you better…
-
4
votes2
answers74
viewsA: Where is the function that a decayed lambda to pointer points to stored? How is it released?
According to some answers in a question in the OS a structure is generated with the captured data and an access form. Then an instance is generated for the lambda where the data is stored. Another…
-
4
votes2
answers358
viewsA: Keep variable in memory until system reboot
I find this a little strange, it seems to me that the solution to the problem should even be other. But answering the question, it is neither possible in C#, nor in any language to keep application…
-
9
votes2
answers148
viewsA: Why doesn’t the pointer increase the value?
This produces undefined behavior. The increment operator is already an assignment operator. Just leave it alone and everything will work. #include <stdio.h> int main() { int *p, x = 10; p =…
-
2
votes1
answer143
viewsA: Do you use Typescript in Netbeans 8.1?
Yes, has the Everlaw on the Netbeans page. I don’t know him, I don’t know if he’s good. I also thought one more plugin However IDE for Typescript is not missing. The Visual Studio is the most…
-
3
votes2
answers117
viewsA: How do I use free() and return the same content?
It would be interesting to understand how stack and heap. Understand why should we use the heap. Also: When to choose whether to use a pointer when creating an object?. In general we must allocate…
-
7
votes2
answers69
viewsA: How should these variables end correctly without having a chance of memory Leak?
Assuming the allocation is the way you really need it, there’s no need to complicate it, just use a free() simple: free(ls_options); free(ls_buffer_send); Take advantage of and simplify allocation:…
-
4
votes2
answers310
viewsA: Which object performs best? Sqldatasource or Datatable?
It actually depends. I would say that using a DataSource (will use with DataReader, right? ). The way to use one or the other will determine more about performance. DataTable is a very complex…
-
21
votes5
answers7326
viewsA: Is Javascript an Object-Oriented language?
TL;DR I answer that in good measure in question What is the programming paradigm used by Javascript?. So I start by saying Javascript is multi-paradigm, among them object orientation. Introducing I…
-
5
votes2
answers614
viewsA: Interface and inheritance for the Java connection class
It’s hard to say for certain, some say it’s as certain as possible, others say it’s a waste to have to create new objects all the time. Particularly I would make a Singleton. But I don’t know the…
-
2
votes2
answers842
views -
7
votes2
answers464
viewsA: Tip for C code optimization
Optimizing is different from shortening. This code looks very artificial and little can be done. You can organize more, make it cleaner. You can take comments that have no function in it. You can…
-
10
votes2
answers965
viewsA: Is there any way to run a java program (.jar) from a C or C++ program?
You can use the command line (system()): java -jar "arquivo.jar" Depending on what you want to do you can use JNI. It’s very complicated.…
-
4
votes3
answers1104
views -
5
votes1
answer346
viewsA: When should I instantiate a class?
Classes are not called, only methods are called. At most it is calling the constructor that instantiates the class and the object is stored in the variable, in general indirectly. If you’re talking…
-
5
votes1
answer90
viewsA: Pass lambda expression on command line
Lambda is something internal to the code (essentially a pointer to a function), it does not pass through the command line (it is not a magic thing that turns into executable code). The only way to…
-
54
votes2
answers3546
viewsA: How does a computer understand binary code?
Concrete part As the name says the binary is only a sequence of bits, ie some state indicator on or off. At the time of its execution are only electrical pulses of low and high voltage (high is way…
-
6
votes1
answer500
viewsA: Is it OK to use SQL Server or Mysql with PHP?
The basic yes, it’s all the same, but came out of the "rice and beans" already changes everything. Changes the syntax of the SQL commands (not deeply, but incompatible in various details), and…
-
7
votes2
answers616
viewsA: How do I make my C++ programs multi-architecture (32 and 64 bit)?
Standard C++ only generates native code for the architecture it runs on, so there’s no way to run on different architecture. The only way is to compile for proper architecture. Of course a 32-bit…
-
6
votes1
answer159
viewsA: Purpose of lambda syntax in function/method
There is some limitation in a function/method in lambda syntax, if yes which? Only that it can only be "a line" with an expression that is its return. Even C#6 could not be used in any method. Now…
-
6
votes1
answer1504
viewsA: error: initializer element is not Constant
Place the variable inside a function. Don’t use anything global, it’s unnecessary in almost every case. In cases that might be useful you need to know what you’re doing well, understand all the…
-
7
votes2
answers577
viewsA: What is the purpose of unsafe command?
It defines that a block of code (can be a whole method, as in the query syntax) can use language resources considered unsafe. This is one way to ensure that the feature is not used inadvertently and…
-
2
votes1
answer400
viewsA: How to convert Ansistring to Char in C++ Builder?
The method c_str() converts the text to const char *, then just use Arquivo.c_str().
-
16
votes2
answers2384
views -
19
votes4
answers785
viewsA: Should I use a "Try-catch" to identify if a password is wrong?
If you have a memory allocation problem, the user, and consequently you, will receive a message saying "Incorrect User or Password". You think this is right? If the database stops working it will…
-
3
votes1
answer98
viewsA: Delegate (similar to C#) in Javascript
Javascript has a feature similar to delegate. It is the anonymous function, which at the bottom is the same concept of the delegate. It can take the form of closure. It’s usually used as callback,…
-
2
votes2
answers3200
viewsA: Code protection . NET
No technique will actually protect you, it can make it harder. If you’re hiding a secret, you’re doing something wrong in the code. If there is no secret, in general the evils of doing this outweigh…
-
56
votes2
answers3301
viewsQ: What is a paradigm?
What is a paradigm? Is there any more important than another? It’s the same thing Pattern design (design pattern)? It’s the same as language?
-
44
votes2
answers3301
viewsA: What is a paradigm?
What is a paradigm? According to the Wikipedia: Paradigm (from the late Latin paradigm, from the Greek παράδειγμα, derived from παραδείκνυμι «show, present, confront») is a concept of science and…