Posts by Maniero • 444,682 points
6,921 posts
-
23
votes1
answer1697
viewsA: What is Fluent Interface?
It is a way of naming methods to be used in a construction that gives the impression of being writing a flowing, fluid text. He gives up a common, standardized nomenclature to adopt something that…
-
5
votes3
answers630
viewsA: Indications of use of cookies?
If you don’t see use for it maybe it’s good. It’s common for programmers to find a solution and then look for a problem to apply it. This doesn’t usually work out. One of the greatest uses is…
-
5
votes2
answers1833
viewsA: Error: Object of type 'float' has on Len
It even has a size in memory, but the function len() is not to analyze the size occupied in memory. And it’s not even the intention, after all its expectation is that it shows the amount of digits…
-
6
votes1
answer2296
viewsA: Rounding as a result of multiplication
Specific problem How data is being stored as DECIMAL I understand that these are monetary values or other kind of numbers that require accuracy. So the right account is being made with the last two…
-
2
votes1
answer711
viewsA: Write information in the browser console via the . NET
Not possible this way. What runs in the browser is independent of what runs on the server. There is no way the server (in this case ASP.NET) can directly instruct what the browser should run. The…
-
4
votes2
answers864
views -
8
votes1
answer356
viewsA: What is * for in the expression "Foo* foo = new Foo" in C++?
How the operator was used new, which is a memory allocator in the heap, the only way to reference the allocated object is through a pointer, and the * is the way to declare a variable saying that it…
-
27
votes2
answers440
viewsA: What does # mean in the name of some languages?
There is a theory that C# earned this name (initially the language internally was called COOL - C-like Object Oriented Language) because it would be the evolution of C++, and they continued to play…
-
6
votes1
answer431
viewsA: How to send attributes to extended classes?
Understanding inheritance It is difficult to answer this question because it has a conceptual error. And if it does not understand the concepts correctly it will not encode correctly. When you…
-
27
votes3
answers1767
viewsA: What prevents an array from being initialized with a variable size in C?
Confusion in the question Nothing stops him, he can be dynamic according to C99 standard, although it is rarely used. Note that it is nothing magical, it is only a trick to give the illusion that…
-
2
votes1
answer346
viewsA: "strstr()" function is not locating what I expect
By the way you are reading the text (which is not the most advisable) it is placing the end-of-line character within the string, there will search for the text c/ the end of line and will not find.…
-
6
votes3
answers847
viewsA: Conversion of a variable with replace to decimal
The right way to do this is to try parse taking into account the culture (there are scams that will only work by coincidence). If you had more information in the question I could give a more…
-
7
votes4
answers142
viewsA: Does calling dozens of classes in a system noticeably influence the performance of the application?
The amount of classes makes no noticeable difference, what you do in them can make a difference. Of course it makes a difference, but that’s not why you should use classes or not. The term "call…
-
7
votes1
answer452
viewsA: What is a type class "class Minhaclasseexample<T> Where T: new(){}"?
It’s probably not a list, it’s some sort of data structure, it could be if there were other parts that indicate that. The abstract means that the class is abstract. She cannot be instantiated, she…
-
4
votes2
answers16833
viewsA: How to obtain only the date, without the time, of a Datetime?
It all depends on the type of parcelamento.data_vencimento. He is a DateTime? So there’s nothing to be done, if the guy says there should be a date and a time, that’s what’s in it. What you can do…
-
5
votes2
answers597
views -
2
votes2
answers351
viewsA: Update data using LINQ
LINQ -> Language-Integrated QUERY Query -> Query It’s even possible, but LINQ was created to make queries. Do not try to subvert your function, especially without deeply mastering its…
-
4
votes1
answer485
viewsA: How to call the printer on a page made in ASP.NET MVC?
Just create an event to open the print window: <div class="container droppedHover"> <div class="row"> <div class="span6"> <button class="btn btn-lg btn-block btn-success…
-
9
votes1
answer268
viewsA: Simplify code
In his previous question I had already given a good organized in the code, now it’s worse again. There’s not much to simplify, it can only organize better. One of the mistakes you make is not to…
-
2
votes2
answers1387
viewsA: Simplify LINQ query with Contains
It’s hard to answer something without knowing the real context. Apparently the code is picking up all the ids budget items. I have my doubts if that’s what you wanted, but you’re doing this. Then he…
-
5
votes1
answer1532
viewsA: How to calculate months of a year from a decimal number?
I did what I understood. Obviously it is not very precise, it can give strange results in some cases, but only for an exercise is good. There are several things that could be improved in a specific…
-
11
votes2
answers925
viewsA: How do C’s hands work?
The question is too broad, it should be separated, but come on: What is the difference between declaring: char* s and char *s? None, is it taste. It is always necessary to use the function malloc…
-
7
votes1
answer6047
viewsA: What causes the 'System.Nullreferenceexception'?
Because of trying to access a variable that should have one object by reference and has nothing there, that is, it is null, so it has not been initialized with a valid value. This never occurs in…
-
5
votes1
answer392
viewsA: What is the advantage of using Tag Helpers in ASP.NET Core?
In general this extra weight is not significant and in the background if not using the weight may even be greater in some cases. The main advantage you have already noticed is the readability of the…
-
5
votes2
answers1261
viewsA: Compare value at each String position in Java?
The main problem seems to be the increment that is not occurring. At the moment you are adding to count own count which is initially worth 0, so it will never come out of this value. The…
-
15
votes4
answers6194
viewsA: Best practices for naming functions
Each team has its own standard, there is nothing universal. I studied the subject and concluded that each group of people chooses what they think best, but I found a pattern in better written codes,…
-
4
votes3
answers4226
viewsA: Persist information using Viewbag?
If you’re going to redirect, you have to use the TempData same. The ViewBag does not survive in this scenario. TempData["Login"] = retorno.login; TempData["senha"] = retorno.senha; TempData["nome"]…
-
4
votes2
answers3501
views -
8
votes2
answers2411
viewsA: Count how many pixels of a color the image has
As the question has no details, I will answer without details. It would be some more or less like this. var count = 0; var searchColor = Color.FromName("SlateBlue"); for (var x = 0; x <…
-
12
votes4
answers1239
viewsA: Format city names and ignore words like "do", "dos", "das", "da", etc
I would do so: str_replace(array("De ", "Do ", "Dos ", "Da ", "Das "), array("de ", "do ", "dos ", "da ", "das "), ucwords(strtolower("PORTO DE GALINHAS"))); Behold working in the ideone. And in the…
-
20
votes3
answers8119
viewsA: What are the best practices in field validation?
Error codes First I have to say that I do not like very much the solution that returns the error codes. It is not totally wrong and it is better to launch exception, which many programmers would do…
-
2
votes1
answer143
viewsA: How to call the value of a variable?
It would be a simple method call, assuming you already have the 2 coordinates in 4 variables coincidentally of the same name within the method main(): jTextArea.append("AREA = " +…
-
5
votes1
answer1408
viewsA: Email with Phpmailer without authentication?
Contact form is you sending a message to yourself, not the person sending the message to you. You don’t need to contact her server to do this, you need your password. That’s the way it works, either…
-
4
votes2
answers1373
viewsA: Best option to be used in error handling?
Basically right, it could only be more organized. I could organize even more than I did below, but I would run away from the style being done. That pile of echo It’s always a shallow way to deal…
-
2
votes2
answers100
viewsA: I am not managing to modify the value of the Book class that is a Book
Some initial details that do not cause major problems, but get used to do right: Try to indent and space correctly, make it easy to understand what is happening Avoid mixing methods that present…
-
4
votes1
answer137
viewsA: Is there a free algorithm to check syntax C#?
I’d say there’s nothing anywhere near that .NET Compiler Platform can do. It may seem complex at first glance, but the task you are wanting to do is complex. And actually his API is pretty easy to…
-
2
votes2
answers230
viewsA: How to implement and use the Binarysearch method?
Exactly, it does a search on the values and returns the number of the element in the list. If it does not find it will return a negative number. Note that it only works if the list values are…
-
8
votes5
answers675
viewsA: Why does Netbeans warn you not to access global variables directly?
I have no idea but I see no problem doing this. If it was access to a $_POST I would even understand that the suggestion would be to filter the content with a filter_input or similar technique. But…
-
2
votes1
answer694
viewsA: How to pick up attribute dynamically
It is possible to get this through reflection. C# is a static language, so there is no reason why it should have facilities ready for direct access. But it is possible to create a class with some…
-
6
votes1
answer123
viewsA: Why can I access a structure without the pointer?
The operator -> is the pointer access of a member of a structure. It is syntactic sugar for (*p).a, in the shown example. The code has flaws. It even works, but may not do what you expect.…
-
6
votes2
answers1071
viewsA: Show more accuracy in C++
You can do it like this: #include <iostream> #include <cmath> using namespace std; int main() { double num = sqrt(2); cout << fixed; cout.precision(52); cout << num <<…
-
5
votes1
answer1010
viewsA: Postgresql syntax error using keys
SQL has no keys in its syntax. Use parentheses: select first_name, coalesce(to_char(avg(p.amount),'99.99'), 'nnn') valor_medio from ( select c.first_name as nome_cliente, c.last_name as…
-
24
votes1
answer1790
viewsA: Why is Language D rarely used?
Marketing One of the reasons is that marketing is more important than technical ability. But this is a simplification. It’s obvious that having a big acceptance is important and this has been…
-
5
votes1
answer229
viewsA: Segmentation fault when accessing pointer content
The solution is simpler than it seems. From what I understand the use of the pointer is inadequate in this code. Using the vector is enough to solve the problem. #include <stdio.h> int main()…
-
10
votes3
answers959
viewsA: Why does calling System.gc not guarantee running the Garbage Collector?
It is possible to have control over the garbage collector, this just does not happen with Java in its standard implementation, as far as I know, also by specification. I will answer based on the…
-
5
votes2
answers982
views -
2
votes1
answer446
viewsA: Separator of thousands
If you can change the control you can use this in view: Html.EditorFor(model => model.contatoEfeitvo) I find this control even better. There in the model use on the property of contatoEfeitvo:…
-
6
votes1
answer112
viewsA: Can you use a dialog to open both folders and files?
It is not possible in standard control, have to develop a new one that does this. Have a example how it can be in a library that works justly with zip files (isolated project). Other project that…
-
6
votes2
answers1770
viewsA: Referencing folders created in the project
I may be wrong, but I don’t think you understand what you have to use in this using. He refers to namespace, not to projects and folders. To use classes that are in nomeProjeto.NomedaPasta, they…
-
13
votes2
answers2250
viewsA: ASP.NET needs a Windows server?
Classic ASP.NET, the one that emerged from the beginning of . NET is now considered a legacy technology. It will still be supported, but should not receive significant updates. Nor will I mention it…