Posts by Maniero • 444,682 points
6,921 posts
-
5
votes1
answer229
views -
2
votes2
answers121
viewsA: I can’t remember some concepts about class arrays
1 - It is correct, everything in the code (except a syntactic error), in the concept in a general way, at least as far as can be identified. Of course, in real code, a lot of things are wrong there.…
-
6
votes2
answers177
viewsA: What is the name of the concept employed in this code?
That seems to be a association (would need more details to be sure, I’m using intuition). Eventually could be a composition (again, it depends on details). And one day you may want to switch to a…
-
4
votes1
answer415
viewsA: Static public variables in C#
I start by saying I’m afraid if this partial really is necessary. Static variables are of the class and not of the instance. That is, there is only one object in them, you cannot have several. Is…
-
6
votes2
answers180
viewsA: Why does the statement "char *argv[]" work in the main rg, but not in the body of the code?
Because it needs to, or say the size of array so that the allocation is done, or initialize the content so that the compiler can infer the size. Works in the main() because the allocation is made by…
-
1
votes3
answers287
viewsA: Out Of Memory when running a Getfiles in a very large directory
Try trading for EnumerateFiles(). He does it more efficiently. But you need to see if this is the problem. Have you measured it to make sure it’s there? Isn’t this doing multiple times? Not sure…
-
1
votes1
answer709
viewsA: Set time zone for the whole project
It’s not possible. I don’t even know if it’s desirable. Times usually work better as UTC in most situations and only be presented or manipulated in specific situations such as Timezone. What you can…
-
5
votes2
answers553
viewsA: Know how many ports are open in Java program
Introducing You can always do what you want. Ideally, do what’s best for each situation. Those who are learning still don’t know what’s best. But it is certain that it is more advantageous to learn…
-
7
votes2
answers1008
viewsA: Redeem code from an executable program?
If it is something simple it is easy and the best thing is to do it again. If it is something complex you will not get a good result by decompiling the code. In any case the best result is to do it…
-
3
votes3
answers134
viewsA: Understand "," as "." when formatting
First, Visual Studio is just an IDE, he helps develop, he not executed, he doesn’t have to understand anything. Second, the code performs what it was ordered to do, the computer "understands" what…
-
6
votes2
answers238
viewsA: Why is this algorithm in Java not running?
The code is full of typos. Programming is detail. You need to organize the code, pay attention to what you are typing. You don’t just drop a text and get it done. You have to pay attention, be…
-
6
votes2
answers696
viewsA: Calculate the smallest element of a list
It has three errors: the initial value must be the largest integer possible; it must have the variable printed and not a function printed; and the printing must occur after the loop ends and not…
-
4
votes3
answers219
views -
2
votes1
answer489
views -
4
votes3
answers149
viewsA: How to generate new code from DBO
The specific problem is that the method used returns the number of affected lines and not the generated code. The right one is to use the ExecuteScalar(). In cases where there is concurrent access…
-
11
votes3
answers7601
viewsA: Get time and date independent of system time
There’s no way to do that. The problem is not of format or time zone, it is error of the hardware use that provides the time. Javascript only takes what the browser provides. The browser only takes…
-
5
votes2
answers284
views -
3
votes1
answer514
views -
15
votes2
answers6254
viewsA: What is data persistence?
According to the wikipedia article: It is characteristic of a state that survives the process that created it. Without this ability, the state would exist only in RAM, and would be lost when RAM…
-
7
votes4
answers602
viewsA: How can I replace "String.isEmpty()" in Java?
The easiest way to know if a string is empty is checking if its size is zero, which is what Java does in the method isEmpty() in standard Java, so you can also do this: if (data.length() != 0)…
-
3
votes2
answers216
viewsA: View Model should have related classes?
View models represent data that will be presented in the view. Your goal is to assemble a model that makes it easy to use when presenting them, probably each in a different screen control. They…
-
4
votes1
answer70
viewsA: Problem with HTML document validation
If you want to conform to this pattern you need to put a header, as it was done. And of course you can ignore alerts as you wish. I see no problem if it is your wish. It’s not an obligation, it’s…
-
7
votes1
answer585
viewsA: What are namespaces in XML?
In essence the purpose is to avoid conflict of names too, equal to the namespace C# or C++. The declaration and import syntax is different, but it works analogously (not identical). It remains only…
-
4
votes2
answers1453
views -
3
votes2
answers1274
viewsA: Compare properties of an object with properties of a list
In that answer in the OS I found something that is more or less what you want. You have to think if it pays to use this, you have to use it a lot. It’s slower and less reliable. Maybe you need to…
-
2
votes1
answer195
viewsA: Search text in a String as a "like"
You can do it like this: if (a[0] == '9' && a[a.size() - 1] == '4') If you want to make it easy to accept patterns with more than one character: auto patternBegin = "9"; auto patternEnd =…
-
6
votes1
answer583
viewsA: Use "Fieldbyname" or the associated variable?
Mode 2 is faster by being solved at compile time and the compiler can check that the name is correct. Mode 1 has the advantage of flexibility, even if the form used is not so advantageous, if using…
-
2
votes2
answers912
viewsA: Reading user information
The problem is that it is picking up a character. You need to take a text and convert to number to work. I did this to demonstrate, I modernized the code and solved a problem that wasn’t printing…
-
2
votes2
answers125
viewsA: Find Values between two prefixes and swap one for the other
I tried to do something that seems to be what you want. You may have problems because the problem is not well defined. If you improve the definition, I can change it a little bit and make a more…
-
11
votes6
answers502
viewsA: Empty semicolon doesn’t make a mistake?
At the time of the question I understood the answers as certain and I voted for them. But they are talking about the consequence and not the cause. It is true that it seems that intelligently the…
-
3
votes1
answer87
viewsA: What does the "arguments" function written in PHP do?
It separates and validates arguments coming, probably from the command line, and returns one of them specifically. It seems the arguments exist in two forms: key pairs and value separated by a =…
-
5
votes1
answer1689
viewsA: Is it recommended to use PHP caching? How to use?
First: recommended where? On a site with few hits or millions of hits? Cache is advantageous when there is a lot of access in certain patterns. It is not something magical that is put and the site…
-
1
votes2
answers5168
viewsA: Relational database model with SKU
It seems appropriate, but it may not be. You are the person who knows the real problem the most and has doubts, imagine we who have no idea where it will be used, how, what the needs of today and…
-
5
votes2
answers843
viewsA: Overwrite methods based on name only
No, that’s not possible, the method is not composed only by its name. Whenever the method signature is different it is another method. There is method overload (which is quite common, more than the…
-
7
votes1
answer441
viewsA: What is the difference between Kotlin data class and Scala case class?
Essentially they are used for the same goal, that is, they define a record. Therefore they automatically gain the main methods necessary, among them the "accessors" methods for the fields, the…
-
6
votes1
answer1072
viewsA: Char comparison, ignoring the case sensitive
Just use the function tolower() to take everything tiny. I took advantage and improved some things, for example give a more meaningful name to the function and that does not overlap one existing in…
-
10
votes1
answer810
viewsA: The Joel Test, how does it work?
What is This is Joel Test (In Portuguese). It does not measure software quality, although some believe it does. In fact some believe that it is possible to quantify the quality of the software, when…
software-engineeringanswered Maniero 444,682 -
2
votes1
answer390
viewsA: Clone a struct without copying the memory address
This code is copying the pointer, carrying the code has two variables pointing to the same object, so changing one changes what is pointed at the other. What you need is to create a new object and…
-
5
votes2
answers102
viewsA: Sort method is not ordering correctly
There are several errors. This code is basically C and not C++. Use bits/stdc++.h is not recommended, is a waste of resource. The logic is very strange. It is not sending the beginning and end of…
-
10
votes1
answer315
viewsA: What is the function of an open-source license? What are the main licenses?
What is the function of a license in open source software? Same as proprietary software. It is a legal instrument that determines authorship, ownership and how the software can be used, modified,…
-
10
votes1
answer1911
viewsA: Maximum size for database tables
Most boundaries are theoretical. In each version this may vary (the data below may be outdated), although it has now become rare (maybe it occurs with Postresql which is "low" near others). It is…
-
25
votes3
answers1076
viewsA: Is it correct to prefix variable names with their type?
That’s called hungarian notation (the original question did not say what it was). It is correct... if you have a reason to do it. Or it is wrong to do it just because you saw someone doing it.…
-
4
votes2
answers728
views -
6
votes2
answers849
viewsA: Catch instance of daughter class
There is no way, the daughter should always refer to the mother and not the other way around. You have to do it in hand. What you could do is the parent constructor accept a parameter that takes the…
-
6
votes1
answer349
viewsA: How to implement a destructor in Javascript?
The only way is to call in the same hand. Your code is correct and will have to be so. There is no resource available in the language that allows this. And as far as I know there is no forecast to…
-
6
votes2
answers1128
viewsA: What does an abstract class type variable mean?
I almost closed as a duplicate of this: An interface is a variable?. It’s essentially the same thing. ReprodutorFabrica does not return something because it is a class, classes do not return. Who…
-
8
votes3
answers3574
viewsA: What are the functions of an ORM?
Strictly speaking the only function that a ORM must ter is the mapping of the data model found in the database (relational) to the model found in the application (object oriented). The data source…
-
3
votes1
answer119
viewsA: Is it possible to implement an abstract class in PHP without the need for inheritance as in Java?
No inheritance is impossible. But you don’t need to use a class to instantiate later, if you’re using PHP 7. In previous versions you can’t. I would even have another kind of technique without using…
-
4
votes1
answer63
viewsA: Nullreferenceexception using Htmlagilitypack
The method SelectNodes() returns a null if it does not find any node that meets the specified one. Then the code tries to catch the count and generates this error. But you may have some previous…
-
13
votes1
answer422
viewsA: Is replacing strings with Regex slower than Replace()?
Always measure To know about speed always have to measure the real case. And can change depending on a number of questions. It may be different if it runs on a different platform, if the data is…