Posts by Maniero • 444,682 points
6,921 posts
-
23
votes2
answers484
viewsA: Is there an opposite for `contains`?
Are you looking for Except(). var resultado = lista1.Except(lista2).ToList(); I put in the Github for future reference.…
-
4
votes1
answer74
viewsA: Comment equal #Region from Visual Studio
Lucky you don’t have. This was a C mistake#. But you can make it similar effect specifically with your editor: // <editor-fold> Your code goes here... // </editor-fold> Works with…
-
10
votes4
answers1541
viewsA: What is the difference between "++$variable" for "$variable++"?
You will only find difference if you use this within an expression. These are pre- and post-increment operators. They are operators that in addition to adding one to the variable’s current value, it…
-
9
votes1
answer147
viewsA: Should license comments on CSS or Javascript files be maintained or not?
Always remembering that I’m not a lawyer, much less a licensing expert, so I’ll tell you about a developer’s practice. It essentially depends on the license. If it forces you to keep it there, it…
-
2
votes2
answers3293
viewsA: Datetimepicker, get first and last day of the month
The question is not very clear but it must be something like this: var data = picker.Value; //pega a data que está no controle var mesAnterior = data.AddMonths(-1); var primeiroDia = new…
-
3
votes1
answer2021
viewsA: How to program GUI in C?
Besides the GTK+ that you already know there are a multitude of libraries that can be used. I will quote the best known ones to C (not C++, as requested): API Win32 (Windows standard library, not…
-
9
votes1
answer338
viewsA: C libraries outside the ANSI standard
You got it right. The libraries of sockets are not part of ANSI. This standard defines only about the language and everything that is considered to standard language library that has only very basic…
-
7
votes1
answer838
viewsA: How to print the variable name in C?
I can do with a trick in the preprocessor. I found this macro in response in the OS: #define DUMP(varname) fprintf(stderr, "%s = %x", #varname, varname); The secret is in the # which transforms the…
-
28
votes2
answers9703
viewsA: Is it possible to program object oriented in C?
I will say something concrete: it gives! But it does not usually compensate in most cases. What I would say the same for all OOP. Perhaps the best example of a C program using OOP is GTK which uses…
-
1
votes1
answer769
viewsA: How to kill a specific user process on Windows Server?
According to this response in the OS can do this: Process[] processlist = Process.GetProcesses(); bool rdpclipFound = false; foreach (Process theprocess in processlist) { String ProcessUserSID =…
-
11
votes2
answers437
viewsA: Performance difference of Any() and Count()
You’re right. By the way these methods work, analyzing item by item from a collection, there are more advantages to using the Any() (source) when you can do it. With the Count() (source) you are…
-
7
votes2
answers379
viewsA: Is it bad practice to overwrite declared variables as a function parameter?
In general there are no problems. Can whether the past type has semantics of passage by reference. Obviously in this case the change will affect the variable that was used as an argument, if a…
-
12
votes3
answers1482
viewsA: Why does Visual Studio suggest simplifying names? - IDE0001 Name can be simplified
String Empty. First, String.Empty is the same thing as "". Who says it’s different or has advantages, does not know the implementation and is inventing things (has even been different in the past by…
-
13
votes1
answer150
viewsA: What is the relationship between OOP and code security?
I’ll answer the part that can be answered here. Listing the forms of attack, something that’s mutable, doesn’t lead anywhere and this kind of response isn’t part of the philosophy of website,…
-
2
votes2
answers1325
viewsA: Sum decimal places Javascript
According to the description of the comment the change needed should be this: valorDois = parseFloat(document.getElementById('bc').value.replace(".", "")); I put in the Github for future reference.…
-
7
votes2
answers1506
viewsA: What is the difference between assigning and comparing string variables with function or with assignment and comparison operator?
strcpy(s, t) You’re copying the contents of t in s. This copy happens byte to byte of string. That is, all the bytes which are present at the address indicated by t at the end of the operation will…
-
8
votes2
answers141
viewsA: How to Lambda in Extension Methods with Multiple Lists?
I think this is what you want: var resultado = listaObj1 .SelectMany(o => o.PropObj1, (objeto1, objeto2) => new { objeto1, objeto2 }) .SelectMany(o => o.objeto2.PropObj2, (objeto2, objeto3)…
-
6
votes3
answers3527
viewsA: How to find the Javascript version (via code)?
By code, in general it has no way. There is no function or variable that indicates this. There are techniques for you to find out if it is really necessary. But you will have to take care of it and…
javascriptanswered Maniero 444,682 -
4
votes2
answers296
viewsA: How to make a LINQ/lambda and consume it in the view?
The simplest is the one you are doing even. Others form as the ViewBag or create a view model may be useful in certain situations, but are more complex and therefore should only be used if the code…
-
5
votes1
answer3427
viewsA: Statement const at the end of function in C++ and const before argument in method
With this type modifier you make it clear to the programmer and compiler that the object will not be modified. Members who keep status will not be changed by this method. It is an important…
-
11
votes3
answers4527
viewsA: Remove currency formatting and take only the PHP number
I think it’s the NumberFormatter::parseCurrency() that you want. $formatter = numfmt_create('pt_BR', NumberFormatter::CURRENCY); var_dump(numfmt_parse_currency($formatter, "R$ 5.000,00", "BRL")); I…
-
21
votes2
answers4960
viewsA: What is the difference between "lambda" and LINQ? How to differentiate them in a sentence?
LINQ is one thing and has two different syntaxes: a is the query syntax or form declarative and that many people think that just this is LINQ (their second example) another is the method or form…
-
6
votes1
answer564
viewsA: Cardinality of the index does not update
Cardinality in this context is the relation of uniqueness of the data according to the index key. It is usually better to have high cardinality, that is, the closer the key produces unique values,…
-
7
votes1
answer711
viewsA: How does the class constructor statement in Qt work?
You understood right, it has to do with inheritance, at least in the first case. This is a startup list. In this case the manufacturer MainWindow is calling the builder of QMainWindow, obviously…
-
11
votes2
answers1087
viewsA: A Mysql query, with`crases` vs without
It depends. If you know what you’re doing, either. If you don’t know, the first is better, so you avoid conflicts that may arise and you don’t know how to resolve them. Some programmers adopt this…
-
4
votes1
answer606
viewsA: Check if a value is present in an array
You need the function in_array(). for ($i = 1; $i <= 50; $i++) { echo '<td class="'.(in_array($i, $vetor) ? 'paint_me_green' : 'paint_me_red').'"></td>'; } Behold working in the…
-
4
votes1
answer291
viewsA: How to list variables within a table in Lua?
There’s already a size response. To traverse the elements: minion = { hp = 1000, x = 10, y = 25 } for i, v in pairs(minion) do print(i, "=>", v) end Behold working in the ideone. And in the repl…
-
14
votes2
answers16161
viewsA: What types of data exist in Mysql for text?
It depends on what you need. No details, context in question. A VARCHAR allows 65535 characters (bytes if using an older version < 5.0). But this limit is lower in practice. The row size is also…
-
5
votes2
answers332
viewsA: How to prevent a website from being listed on Google
It has several techniques to solve this, each with its advantages and disadvantages. For its description just use the robots.txt which is a file that tells searchers that you don’t want that content…
-
1
votes1
answer294
viewsA: How to make the Split in some lines except specific?
I know it’s not what you want but the best answer I can give you is not to use RegEx for this. Not least because that’s not all you’ll want to do with this string. His example already shows why. I…
-
6
votes1
answer609
viewsA: Install SQL Server with the application
It depends on what you did, but I would say that it is not necessary to install on all computers, in general it is only necessary on the computer that will be the server. Of course, if you have done…
-
12
votes4
answers8429
viewsA: How to use template string in Javascript?
Javascript currently implemented in browsers does not support string Interpolation,. You gotta do it like this: "Meu nome é " + nome + ", e tenho " + idade + " anos" Or use the function created by…
-
1
votes1
answer22
viewsA: Database in CSV
But they created: Mysql. And it does not serve as a de facto database. The format does not allow for most of the operations and guarantees expected from a database. Anyway they are different things.…
-
7
votes1
answer488
viewsA: Different numbers become equal after conversion with doubleval
And we’ll go again. I’ll answer because I don’t have an answer for PHP yet, and someone will answer before the question is closed as duplicate. You can’t use like double or equivalent when numerical…
-
5
votes1
answer1790
views -
6
votes3
answers211
viewsA: How could I improve the code?
I was just going to comment but it got big. Essentially no, after all he does very little. Unless you want to apply a number of things that are usually recommended in terms of architecture, but it…
-
4
votes3
answers2478
viewsA: How do C graphic libraries work?
I’m a little rusty with this but I guess it’s still that way: #include <graphics.h> int main() { initgraph(); //faz alguma coisa aqui closegraph(); } I put in the Github for future reference.…
-
1
votes1
answer569
views -
6
votes1
answer407
viewsA: Is it possible to show exception message in en-BR?
Besides not being good at catching Exception I talk about it in several questions here, the ideal is to do something useful when capturing an exception. Showing the exception raw text to the user is…
-
2
votes2
answers399
viewsA: Import modules with Python
I don’t think you’re talking about the installation. There’s documentation. The default import code is this: from babel import * This will import the entire Babel library. But you can choose only…
-
5
votes1
answer101
viewsA: Transferring and summing values from an SQL column
There is not much secret to do this in SQL. You didn’t give a lot of details about the table but basically this is to do in all rows: UPDATE tabela SET col2 = col1 + col2, col1 = 0; I put in the…
-
5
votes4
answers228
viewsA: Read XML documentation generated by Visual Studio
Visual Studio can use this directly (in fact you only need the compiler), but if you want something external that does something more sophisticated: Ghostdoc - quite popular and easy to use doxygen…
-
6
votes3
answers747
views -
6
votes4
answers13678
viewsA: Rounding a decimal to a lower decimal
Do so: console.log(Math.floor(44.97714285714286 * 100) / 100); I put in the Github for future reference.…
-
16
votes3
answers1786
viewsA: What is the usefulness and importance of "do... while"?
In no situation do we really need the do ... while except to make the code more elegant and better express the intention that the execution of the block should take place at least once before…
-
3
votes3
answers3072
views -
8
votes2
answers1801
viewsA: list.foreach vs foreach
There’s a difference, of course. The first can be slower (there are controversies with my identical test) and it’s more confusing. It is so confusing that in the newer implementations of the class…
-
7
votes1
answer319
viewsA: How to have multiple addresses in one class of person?
No, this way you can only get one address. There are several ways to allow more than one address, one of them, perhaps the simplest, is this: public class Pessoa implements Serializable { private…
-
6
votes3
answers129
viewsA: How to create mandatory exceptions in C#?
Luckily it doesn’t. This what you want is called checked Exception and has a lot of problems that is not the case now. Beyond what if there were people would abuse. It’s not enough that people think…
-
5
votes1
answer422
viewsA: How to handle code in a DLL?
First, it is unlikely that you will need to fiddle with the barcode. This is something standardized and if you are ready, tinkering will probably only spoil. Blocked class is a term I don’t know but…