Posts by Maniero • 444,682 points
6,921 posts
-
2
votes1
answer131
viewsA: Send e-mail with attachment in Lua
To documentation which you used in the previous question shows how you should do but you are doing it in a different way. Relevant part: headers = { -- Remember that headers are *ignored* by…
-
2
votes1
answer112
viewsA: Best way to distribute program using a Shared library
You need to distribute the library along with your application. You don’t necessarily have to install anything, only the library should be bundled with your application, no matter how you do it. Can…
-
11
votes2
answers5849
viewsA: How to cut a string?
It’s quite simple: nome = nome.Substring(0, 20); In this case you are picking 20 characters from the character at position 0. Method documentation. From there you can see in the documentation all…
-
31
votes6
answers3667
viewsQ: Are there objective advantages to a language being "case sensitive" or not?
Or is this just taste? I don’t want to if you like one more than the other. I don’t care why people like one or the other. I don’t want any bad answers. I don’t want to know historical reasons. I…
-
2
votes1
answer181
viewsA: How to set Nothing to a Datetime variable?
To DateTime cannot, this is a type per value that does not accept null values. However it is possible to return Nothing for a guy DateTime?. It seems to me that there would be no problem for you…
-
4
votes1
answer211
viewsA: Send mail through Lua
Maybe this can help: -- load the smtp support local smtp = require("socket.smtp") from = "<[email protected]>" rcpt = {…
-
9
votes2
answers121
views -
7
votes3
answers241
viewsA: Best way to keep data that depends on a condition
There are absolutely no right solutions in software development. So the best way depends on a lot of things. What can be said that the form considered the most correct is the first to involve the…
-
2
votes1
answer190
viewsA: Function with nameless parameter
You are declaring two functions, both return nothing. Both have a first parameter that will be one reference for a data of the kind Pessoa. This only exists in C++, not in C. Do not confuse with…
-
3
votes2
answers202
viewsA: How to optimally read a list of Arraylist dependencies?
Given the description of the problem, unless I have not understood something, there is nothing better that can be done. If you have some detail not explained, eventually you can find an optimization…
-
3
votes1
answer159
viewsA: Apply function to all list elements using VB.NET
LINQ is a query language to work with any kind of data collection, since arrays to collections that map databases. You haven’t posted anything that’s easy to identify what you really want but…
-
10
votes4
answers3989
viewsA: How to display 2 columns from 2 different tables in Mysql?
It’s not much of a secret: SELECT tabela1.nome, tabela2.apelido FROM tabela1, tabela2; I put in the Github for future reference. After the SELECT you will place the list of columns you want to be…
-
9
votes3
answers24407
viewsA: What is the performance difference between BIGINT and INT in Mysql?
Essentially there is no. It may even have some marginal difference but nothing that is important and even difficult to measure, let alone hinder something. And if there is, it’ll be more…
-
14
votes5
answers26385
viewsA: What is the best practice to know if an Row exists in a SELECT in Mysql?
You need to see the goal you want, if you really just want to know if there are values in the database the simplest among these options would be: SELECT 0 FROM tabela WHERE usuario = 'exemplo'; I…
-
11
votes1
answer2036
viewsA: What type should I use to save only the time (no date) in a database?
There is one specific type for this which is the TIME. This type has the seconds and fraction of them too (keep them zeroed if you don’t need them), but in general it won’t be a problem. But it is…
-
2
votes1
answer201
viewsA: How to use string in C++?
The problem is that you do not include the required header in case the #include <fstream>. #include <stdio.h> #include <stdlib.h> #include <iostream> #include <fstream>…
-
14
votes2
answers8037
views -
8
votes2
answers338
views -
109
votes6
answers13840
viewsQ: What good is a builder?
In general classes have constructor methods. What is the usefulness of the class constructor method? Why should we create it? It can work without it?
-
103
votes6
answers13840
viewsA: What good is a builder?
Not always a builder is necessary. There are languages that turn out well without one where it is even possible to create a constructor. Builders must give atomicity in the creation of the object.…
-
4
votes2
answers325
viewsA: Know if the application has been completed by the task manager
There is no reliable way to do this. The user can always finish the way he wants. In some situations it is possible to capture a Windows message and do something. But there are no guarantees that…
-
3
votes2
answers150
viewsA: What is Forcebrute’s logic of trial and error?
I found this code that can help you. I won’t tell you it’s the best way but it’s certainly a good start: import java.util.Arrays; public class BruteForce { final int min; final int max; final int…
-
5
votes2
answers8139
viewsA: Shortcut to create constructor with parameters
As far as I know, natively it doesn’t exist, or at least it didn’t exist. I can’t say in Visual Studio 2015 that it has new code helpers. There may be some plugin that does this (this for example, I…
-
4
votes8
answers2805
viewsA: How to know which is the last element on a list?
One more way: var sql = "INSERT INTO teste( " + campos[0]; for (var i = 1; i < campos.Count; i++) { sql += ", " + campos[i]; } or the solution I don’t like to use flag but uses foreach: var…
-
3
votes2
answers155
viewsA: Differences between arrays declarations
Essentially the differences are syntactic. That is, it makes no difference to the program as you make the statement. Note that in C# only the second form is valid in fact. In fact neither it, in the…
-
7
votes6
answers2762
viewsA: How to walk an Enum?
One more solution: foreach (var elemento in Enum.GetValues(typeof(TrianguloLetra))) { //faz o que você quiser aqui } Example: using System; public class Program { public static void Main() { var…
-
1
votes1
answer90
viewsA: What is a lightweight class?
As far as I know there is no clear and universally accepted definition of what this term means. Some people might say it’s a POD (Plain Old Data) where the data are roughly arranged in a manner…
-
7
votes1
answer521
viewsA: C++ with C#, is it possible?
It is possible using the C++/CLI. This is a managed version of C++ that is used with . NET. I won’t go into too much detail because you probably don’t want to use it. In fact it is usually only used…
-
11
votes1
answer226
viewsA: Why a loop FOR faster than 10 FOR together
Basically you need to read this question/answer to understand. In a lot of situations splitting up the work actually slows down. There is no miracle, if you do not have the resources for the…
-
3
votes3
answers1270
viewsA: How to remove the first item from an array without for or foreach
According to the comment what you want to do is this: var primeiro = arr.RemoveAt(0); Only that one array does not have the method RemoveAt then you have to create an extension method like this out…
-
3
votes3
answers1952
viewsA: How to get a text from a Qlineedit in Qt?
In general, this would be the case: suaString = lineEdit->text(); //lineEdit é o objeto do editor I put in the Github for future reference.…
-
3
votes1
answer124
viewsA: Declare variables at or near the top of where they are used?
It is probably best to ensure that all variables should be declared at the beginning. This goes against what is usually recommended. But merging several codes is also not recommended. So since you…
-
32
votes2
answers1620
viewsQ: When to use icon, or text, or more text icon?
It is common to see, in software for any platform, some places where the user can select an option and to identify there what is this option there may be an icon, or there may be a short text, or we…
-
13
votes1
answer14933
viewsA: Double type and Decimal type, which is suitable for monetary value?
I doubt you’ve ever had problems. I guess you’ve never noticed the problem. Most cases go wrong for a penny. Of course 1 cent errors can turn into thousands of reais when multiplied. The reason so…
-
11
votes2
answers1138
viewsA: Why can’t the implemented methods of an interface be private?
The purpose of private methods is precisely to hide the implementation of something. The interfaces serve to describe a contract that an API should have. Contracts don’t care about implementations.…
-
35
votes3
answers1996
viewsQ: What do I need to do to measure password strength?
Often we need to accept the input of passwords by users. In general we cannot accept any password that can be easily attacked, probably by Brut force (gross force) or similar techniques. It is…
-
2
votes1
answer73
viewsA: Which errors trigger the catch?
What makes the program flow into a catch is the launch of a throw. What are the throws that exist in your application? Which ones are in the libraries you are using? Whether they belong to the PHP…
-
5
votes1
answer104
viewsA: General problems in C
The code has some errors: #include <stdio.h> #include <string.h> #include <stdlib.h> // <=========== faltava este include #define Nome "nome" #define TAM_STRING 12 int…
-
4
votes1
answer148
viewsA: Condition in Mysql for data query
Yes, it is possible. It would be something like this: SELECT SUM(ProdValor) FROM vendas WHERE MONTH(data) = MONTH(DATE_ADD(CURDATE(),INTERVAL -1 MONTH)) AND Status = 'Aprovado' I put in the Github…
-
2
votes3
answers211
viewsA: Program using malloc twice
If the problem is to avoid doing any calculation of one of the leftovers again after the loop ends, it is easy to solve. The problem is that it is stopping when it arrives at the rest 2 and correct…
-
6
votes1
answer474
viewsA: How to change an HTML 4 document to HTML 5?
Exactly, this is the correct form. This form makes the code compatible with HTML 5 and earlier versions. Specification. Article on the advantage in this simple way. I just don’t like the spaces in…
-
1
votes1
answer70
viewsA: How to leave this DRY code block in Ruby
The two codes are not exactly equivalent, the condition of the elsif is very different, if they were the same (could be an error in the presented code) would be like this: if…
-
18
votes2
answers1806
viewsA: Why does a calculation with positive numbers give a negative result?
Actually the problem occurs in the expression 100 * 22118400. It exceeds the positive value limit of an integer and Java has chosen, probably for performance, to assume a behavior instead of…
-
9
votes4
answers16866
viewsA: How to know which DATETIME format is used in a given column of SQL Server?
Columns in tables are data. Data has no format. Internally it is even possible for some specific data to have some format but this only happens with text and yet it is something that matters for the…
-
4
votes1
answer118
viewsA: Sorting algorithm does not work
The way you’re doing is just exchanging between two elements, but you don’t keep making the exchange between all the elements. There are several ways to solve this. To compare all the elements in a…
-
8
votes5
answers26812
viewsA: When is isset required?
It’s not supposed to work differently in different places. Of course there may be permissions or specific settings issues that can affect, but in general what involves only code logic and not…
-
2
votes1
answer246
viewsA: Is it feasible to use Mysql with Entity Framework 6 and get good CRUD performance?
Define good performance. If it is an acceptable performance, yes, it is feasible, it is proven by having a huge amount of people who have done this. If it’s to have as much performance as possible,…
-
10
votes3
answers10773
viewsA: Is it possible to use Java pointers?
There is no possibility of using raw pointers in Java. Even references have only implicit use through instantiated objects. It is possible to simulate them through a array of bytes but just to…
-
11
votes1
answer1638
viewsA: What’s a POC in C#?
I can’t be sure without knowing the context, but I don’t think it’s anything specific to C#. I imagine it’s Proof of Concept, In other words, you’ve been asked to do something practical to show that…
-
8
votes2
answers24948
viewsA: What is the difference between Switch, Case and If, Else?
The comparison should be made in fact between switch and if. The case is part of the construction of switch to identify each block. The else has a similar shape but works differently. The switch is…