Posts by Maniero • 444,682 points
6,921 posts
-
3
votes2
answers72
viewsA: I don’t understand what’s going on with this controller class, explain it to me?
You can say very few things. Is declaring the class DisciplinaController who inherits from GenericController<Disciplina> which is a class that actually implements the controller engine that…
-
2
votes1
answer1209
viewsA: Software license registration file issuance and control
Taking the processor ID is not a solution, this information may not even be available. And this was not even done to identify which is the individual processor. Any solution trying to identify the…
-
87
votes1
answer9485
viewsA: How is a compiler made?
To not get too broad I will make a summary (yes, this is a summary :P). And I will make some simplifications. Certainly fit more specific questions to deepen in some points. Various techniques…
-
6
votes1
answer179
viewsA: What are digraphs in C?
I wish you hadn’t asked :P The early days of computers had difficulties entering certain types of characters, so these sequences of characters were created to represent another one that really…
-
4
votes2
answers989
views -
7
votes1
answer355
viewsA: Centralize (use only one) a Try-catch for every WPF application
Usually the recommendation is to use Application.DispatcherUnhandledException Event: public App() :base() { this.Dispatcher.UnhandledException += OnDispatcherUnhandledException; } public partial…
-
6
votes1
answer1648
viewsA: Difference between method and constructor?
It depends on the context. Constructor is a method. Every method occupies a space in the memory where it is your code. But I don’t think that’s exactly what he means. What he probably meant is that…
-
10
votes2
answers669
viewsA: What are the advantages of using associative arrays?
In fact they can have various types of data with keys, not only strings. Its main feature is that the data is sparsely stored, i.e., it does not follow a continuous sequence, such as arrays common.…
-
11
votes1
answer3282
viewsA: How to compile the database to install together with a C#application?
Let it be clear that in this answer I am talking about purely desktop applications. I am not talking about client server where the client is an executable to run on the desktop and the database will…
-
8
votes2
answers8376
viewsA: Convert a positive decimal number into negative
If you just want to select the values as negative it’s like this: select -CAST(REPLACE(REPLACE(Valor1, '.', ''), ',', '.') AS DECIMAL(10, 2)) from TB1 or select -1 * REPLACE(REPLACE(Valor1, '.',…
-
8
votes1
answer451
views -
3
votes1
answer796
viewsA: Convert Javascript code to HTML?
Forget. Mercardolivre has a good reason not only to block GIF animation, but also Javascript and more powerful HTML features that allow you to do more elaborate things. Any attempt would likely…
-
7
votes2
answers450
viewsA: Static blocks, heritage and constructors in Java
To language specification gives a hint. Let’s analyze step by step. In the class load the static boot block is called. First flame Goo (prints "5") which is required for use in Foo (can’t run…
-
1
votes2
answers152
viewsA: What is the difference between instantiation in the same variable or in 3 different variables?
I would need to see the context. appear to be examples showing various forms of object use. I believe it’s just demonstrating in the first how to use the same variables to store different objects -…
-
45
votes2
answers2892
viewsA: PHP mixes object-oriented codes and procedural language?
TL;DR - Kind of You’re not entirely mistaken, but you’re a little. Informally we can say that it is mixed even, but almost all so-called object-oriented languages do the same. The bulk of the code…
-
1
votes1
answer127
viewsA: Code displaying decimal value in C# for Java/Android
I’m not sure what the point is, but you don’t seem to need the BigDecimal (but something on the Java side, but C# is C#). O Decimal no rounding problems. Actually it seems to me to be much simpler…
-
3
votes3
answers671
viewsA: Correct pennies in Boletophp Bank Slips
The problem is that PHP, like all languages, does not work well with accurate monetary values. I find it curious that a program ready to work with monetary values does not handle this well. Has…
-
5
votes2
answers431
viewsA: Count elements in a range of values
Essentially not and even if I have not know if it should be applied. Readability is a more important feature. I can even think of some things that save a few characters, but for what? I already…
-
7
votes2
answers642
viewsA: Error while trying to update table using C#
There is a syntax error because a space is missing in "update Cliente" +, in this way brought it all together. But this is an even smaller problem, the whole code has several problems. Never ride a…
-
10
votes2
answers2568
viewsA: What is the purpose of the size_t and ssize_t commands in C?
Technically they are not commands. They are data types. It is true that in the context the type is serving as a statement (statement) and this is translated by many people as command. size_t is…
-
6
votes1
answer399
viewsA: How to improve a star rating code?
The first thing I’d do is this: for ($i = 4; $i > 0; $i--) { if (isset($_POST["star" . $i])) { $star = $_POST["star" . $i]; break; } } In HTML it would basically only save on indentation. It…
-
4
votes1
answer106
viewsA: What is the operator << in the context of virtual memory paging?
This is the bit displacement operator. It’s faster than exponentiating when the base is 2. The use in virtual memory is broad, depends on each context. Obviously the access to physical memory is…
-
1
votes4
answers582
viewsA: How do I SELECT then INSERT
This resolves more simply and without risks of running condition. $comment = trim(strip_tags($_POST['comment'])); $insert = "INSERT into tb_comment (id_mark, id_user, comment, up_c, down_c, rate,…
-
5
votes2
answers75
viewsA: How to solve an elseif that needs to be exclusive?
In this particular case the first two conditions are wrong, because it must be executed only if it can be exclusive, then the condition has to ensure that it has nothing else. There is an error in…
-
18
votes1
answer329
viewsA: How to implement memoization in a PHP function?
You can cache the data, which is the basic principle of memoization, something like that: function fibonacci($n) { static $cache = array(); if (isset($cache[$n])) return $cache[$n]; $a = 0; $b = 1;…
-
2
votes1
answer1247
viewsA: Start Windows Service automatically
I found a response in the OS. public ServiceInstaller() { //... Installer code here this.AfterInstall += new InstallEventHandler(ServiceInstaller_AfterInstall); } void…
-
5
votes1
answer278
viewsA: What web language is used on websites for effects?
The only languages considered standard of the web are the HTML (5 is the newest version), CSS (3 is the newest version) and Javascript (Ecmascript 11 is the newest version in 2020). And all pages…
-
2
votes3
answers108
viewsA: Is there any way in pure C to implement set?
Not directly, you will have to implement the data structure. A library that already implements this is the Gnulib, but until you make it work you’ve turned around. It’s only worth it for more…
-
5
votes1
answer1184
viewsA: Garbage Collector for C++
There is the C++/CLI from Microsoft. It is not the default C++ but uses the same GC in C#. Some people consider that the proper use of smart pointers It is still a form of GC. Others think that this…
-
10
votes4
answers4957
viewsA: Call static class method by static variable
self exists only within the class. It cannot be used outside of it. It indicates that it is referring to something in the class itself. Therefore it gives syntax error, its use is not allowed in…
-
2
votes2
answers960
viewsA: What is the purpose of the 'Let' statement in a LINQ query?
This is exactly what it is. When you will sometimes use an intermediate result, it may be interesting to use a variable to keep a "cache" of the data, which is the normal function of every variable.…
-
4
votes1
answer462
viewsA: What is the difference between the Mysql Trigger and Mysql Event exception?
They have very different purposes, as the syntax presented in the question already gives a hint. The TRIGGER is an old database resource in general to fire - as the name says - an execution of…
-
2
votes1
answer116
viewsA: In a repetitive structure are there differences between working with Object or Array?
Essentially the difference is in the type of data that will be returned even. Use whatever is most convenient for your style or need. The fetch_array will obviously return a array which can be…
-
6
votes2
answers1276
viewsA: How to lock an executable file and prevent it from opening on Windows?
Need to put in Windows registry using class RegistryKey: using (RegistryKey chave = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", true)) {…
-
2
votes1
answer363
views -
2
votes2
answers1914
views -
5
votes1
answer106
viewsA: Code does not compile with several errors
Failed to declare the method, without it will not work even. import java.util.Arrays; class OrdenaArgumentos { public static void main(String[] args) { String [] nomes = new String []{ " rafael…
-
36
votes1
answer3003
viewsA: How does the Repository standard work?
Definition Roughly speaking we can say that it is a way of abstracting the persistence of data. It leaves the mechanism of how data is accessed isolated from business rules. It is not the entity and…
-
44
votes3
answers859
viewsA: I am suffering attacks of type SQL Injection
After being attacked he may have gathered important information that allows him to make the invasion by other means. When you have an hacked server it is not simple to make it safe again. If you…
-
8
votes2
answers288
viewsA: Where should exceptions be handled to display to the system user?
First of all do not abuse capture of exceptions. Make sure you can do something useful when you capture one and always capture the most specific exception possible. Unfortunately Java abuses the…
-
14
votes1
answer1022
viewsA: The use of immutability
One can understand a little about immutability in another question here on the website. It only ensures that the state will never be changed on the same object. It does not guarantee that a variable…
-
4
votes1
answer2062
viewsA: Exponentiation operator in C++
The probable historical motive is because neither does C. And it does not have, because originally it was not thought to perform many mathematical operations. Remember that the language was created…
-
12
votes1
answer592
viewsA: Can Hard Drive Defragmentation help my server perform?
On a hard drive, yes, you will gain by defragmenting. Note that this is a logical question, nothing to do with the hardware. It just depends on how the operating system works, specifically his file…
-
6
votes2
answers509
viewsA: How does the Table declaration instance work in Lua?
It does not have the constructor formally. It is possible to create a function that is a constructor for that object. It is something very manual. Methods are created as functions with "surname". An…
-
13
votes4
answers332
viewsA: In relation to object orientation, should queries have a class of their own or can they stay in a specific class?
There is no rule that determines this, especially the object orientation paradigm has nothing to say about. It is possible to reach a conclusion by adopting other concepts. Since there is no rule,…
-
1
votes2
answers8854
viewsA: Differences between Python versions?
Not so much. If there are no requirements to use version 2.7, because it will work with some legacy system, it is quite obvious that you should learn on top of the newer version, in the case of…
-
13
votes5
answers1943
viewsA: Is it possible to program to web with Lua?
No doubt, any language can. Even if there were some difficulty in the current ecosystem, and it is good to make it clear that it does not, it could be extended with C to give this capacity. Of…
-
12
votes3
answers2257
viewsA: Which loop is faster in C: while or for?
Most compilers will produce identical code and there will be no difference, but only testing in the specific version of a compiler to know. It is suggested to do and discover on your own. Example of…
-
5
votes1
answer111
viewsA: How to iterate with a table in Lua?
You can do it like this: dados = { nome = 'Wallace', idade = 25 } for k, v in pairs(dados) do print(k, "=>", v) end Behold working in the ideone. And in the repl it.. Also put on the Github for…
-
15
votes3
answers11209
views