Posts by Maniero • 444,682 points
6,921 posts
-
5
votes4
answers1246
viewsA: Identify if all characters are equal
I would do exactly what you did because it should be the fastest solution. But there are several alternatives, one of them: var numbers = '1111121111'; console.log('numbersEquals = ' +…
-
6
votes3
answers347
viewsA: Difference between validation and mask
Mask Mask is still a limited form of validation. Its use requires the input data to be in a certain format. Through a pattern you force each position typed to have a certain character, for example…
-
6
votes2
answers67
viewsA: How to reverse series of denied conditions without affecting logic?
Why not reverse the relational operator of && for ||. In the first you want both to be non-empty. Then check each one if it is not empty, and apply the && to ensure that the two…
-
4
votes2
answers99
viewsA: What is the correct way to choose column types?
Every type of column in a table should be as suitable as possible for the need. If you have a date, you probably need to use a type that has date semantics. If you are going to use quantities, you…
-
6
votes2
answers14521
viewsA: Sort dictionary by Python value
You can use the function sorted(): dic = {'759147': 54, '186398060': 8, '199846203': 42, '191725321': 10, '158947719': 4} for item in sorted(dic, key = dic.get): print (dic[item]) Behold working in…
-
1
votes1
answer477
viewsA: How to break (split) strings and put result into separate variables?
Simplify. In this example the least manual way is not to do this assignment for these variables. They are not being used and even if they are used in a continuation of the code, why? Use the vector…
-
5
votes3
answers556
views -
13
votes2
answers4162
viewsA: Identify and retrieve PUT and DELETE variables
To facilitate you can create similar variables for consumption of your application. The only difference is that you will have to call some function to load them, it will not be automatic. You’ll…
-
2
votes2
answers814
viewsA: Monitoring internet connection at runtime
It has several forms a simple would be like this: using static System.Console; using System.Timers; public class Program { public static void Main() { var aTimer = new Timer(); aTimer.Elapsed += new…
-
4
votes2
answers5175
views -
5
votes2
answers1593
viewsA: What are the differences between normal jQuery and slim versions?
Slim does not own: the AJAX modules, because it is common for people to use another mechanism better or not need this, animation effects, since it has better ways to get the same result, what is…
-
17
votes2
answers1049
viewsA: PHP 7 already has stable version for production?
When you are in doubt about information spread on the internet and you can’t be sure if they are true (with all reason) what should we do? Find the official site to see if there’s anything there. So…
-
6
votes4
answers8334
viewsA: How to list all tables in a Sqlite database?
If you are using his "interpreter" you can use the commands .tables or schema, to list tables or their structures. If you want to do this in code and want a result that can be used for something in…
-
2
votes1
answer193
viewsA: Difference between pointer vector for a class and vector for a class?
Not necessarily. It depends on what you want, but almost always will be the case. The first one expects a memory address, so that’s what it should provide. You can do this with: something that…
-
5
votes2
answers59
viewsA: Unusual way to use a jquery function
Good, This is not jQuery, it’s pure Javascript. ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"][new Date().getDay()] That’s a literal of a array and access to one of its…
-
4
votes3
answers156
viewsA: Difference in behavior between for and for.. in
The first, one for traditional, sweeps the array. It accesses only the elements of the type object Array, but not their properties. It is similar to the new for...of. Already the for...in scans all…
-
5
votes3
answers527
viewsA: Do I need to use "Convert.Toint32()" for text?
My first suggestion is to look for some source that is easier for you. I advise to try to understand all aspects of programming before, or at least in the language. Learning language is easy,…
-
30
votes5
answers5742
viewsA: Is it possible to develop websites with C/C++?
Yes, it is possible yes. But almost no one does. Generally the gain is not worth the effort, which is much higher. What is more, if one does not master every process of development, master every…
-
2
votes2
answers85
viewsA: Replacing characters in a string
The problem is that you are not assigning the value to the variable. O replace() does not change the variable, it manipulates the value and returns that new value. If you do not store it somewhere,…
-
3
votes1
answer493
viewsA: For without the use of key
First let’s organize the code to make it easy to understand: int main(void) { int row; int column; for (row = 1; row <= 7; row++) { for (column = 1; column <= row; column++) printf("*");…
-
3
votes2
answers157
viewsA: Code error using switch and new date
The main error is that 0 is Sunday, then the other days. The beginning was a bit confusing too, the variable day was declared out of the function for no apparent reason. This kind of function doing…
-
7
votes1
answer1182
viewsA: Static functions in C
C has no methods, only functions (the original question spoke in methods). Although C++ has methods, only functions are static. What is known by the static method in Java and C#, for example, is…
-
6
votes1
answer72
viewsA: Database on Android persists the information?
A database exists precisely to persist data. When you put it on it, it stays there until the application erases, or the user interferes in some way out of its control. Obviously everything that is…
-
1
votes1
answer3626
viewsA: Invert stack values
I have improved on several things, among them I have simplified the passing of parameter, no need to pass pointer. But the main mistake is that the operator >= could not be used in while. When it…
-
5
votes1
answer275
viewsA: Views accessing other controllers
I will answer based on what you have in the question. I may have other information that makes me think differently. I don’t think you understand the MVC. You don’t need to have a one-to-one…
-
6
votes3
answers403
viewsA: Best practices in Javascript variable declaration
Problems of Hoisting In fact you run the risk of Hoisting if you don’t organize the code well. If the pain function is so complicated maybe the problem is something else. Note that if you organize…
-
12
votes3
answers935
viewsA: Why does Javascript allow using variables without declaring?
If it is intentional or is flawed there are controversies :) Well, it can be said to be intentional. Like every "good" dynamic language, in every way, as a language of script should be, it should…
-
7
votes1
answer362
viewsA: Split the table in two?
25 columns is a lot for a table? No, it’s a misery (although most models are even smaller than that). Thinking about goal orientation, are there many attributes to a class? (Large Class?) Think…
-
5
votes1
answer131
viewsA: How to average in SQL?
That? UPDATE t1 SET t1.media = (t2.notaum + t2.notadois) / 2 FROM t1 INNER JOIN t2 ON t1.nome = t2.nome; I put in the Github for future reference.…
-
14
votes2
answers249
viewsA: What is a Saas anyway?
The two fundamental characteristics that differentiate a "Software as a Service" or on-demand, standard software, also called on premise, sane: it is centralized somewhere, usually a public cloud,…
-
9
votes3
answers216
viewsA: Why is there an asterisk left?
I’m not even going to try to solve the problem in this code because it’s too confusing and maybe the problem was born out of confusion. The simpler you can do it, the better. Even if you want to…
-
7
votes1
answer1353
viewsA: How to return or extract more than one value from a function?
There are some possibilities to pass data from one function to another. A simple is to "return" a array values. This works if all values taken are of the same type. #include <stdio.h> #include…
-
12
votes2
answers1960
viewsA: Empty delegate ( delegate { } )
What is a delegate? It’s roughly a pointer to a method, right? So what you have in it is an address to something that can be executed. This can be stored in variables. And this is the great…
-
7
votes2
answers1616
viewsA: What is the use of the pseudo class :root?
CSS doesn’t necessarily have to be applied to HTML, right? It’s a way of styling documents. How to refer to the element that gives rise to all others? That is, what is in generic term the element…
-
1
votes1
answer301
viewsA: How to work with anonymous guy
Since the exact type of the enumerable is not known a solution is to indicate to the compiler that it should not check the typing and leave for the run time to solve this. Is done with dynamic.…
-
5
votes2
answers29835
viewsA: What do I need to fix? [Error] Ld returned 1 Exit status
The code has several errors, probably because it’s trying to do things randomly. Programming is not trial and error, it is studying, understanding every aspect of language, logic, problem and…
-
1
votes1
answer107
viewsA: Problem when displaying list
There are several errors in the code. This is how it works #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 12 typedef struct aluno { char nome[40]; int…
-
1
votes1
answer102
views -
8
votes2
answers119
viewsA: What’s going on in my C program?
The code has some problems. I gave an organized and solved the problems. The include makes no sense, the array is not zero in the statement, so the sum does not occur correctly and the statement is…
-
2
votes1
answer429
viewsA: How do compiler recognize . as decimal separator?
The compiler already recognizes dot numbers. What you want to do is your application to do this. First you need to write a minimally coherent code to at least compile. This one has basic errors. If…
-
2
votes1
answer71
viewsA: Visual Studio 1 Solution and 3 Projects, is it possible to separate them later?
That’s the whole idea. The solution is a way to group a set of projects that make sense to work together, what matters even from a technical point of view and not just organization is the project.…
-
7
votes1
answer775
viewsA: Mandatory field rule should be on the backend or frontend?
Is on the right track since the validation takes place on the server. And there’s nothing wrong with just leaving it there. The only mistake is leaving it alone in the customer. The user experience…
-
2
votes1
answer101
viewsA: About passing parameters in compiled programming languages
What would be more advantageous when calling a function, put in the stack from right to left or vice versa? If I understand what you want to know, in your code, in general, it makes little…
-
5
votes2
answers195
viewsA: How to convert a string with minutes/month/year to Timestamp?
String tempo = Métodos.getStringTempo(); int tempoSemLetra = Integer.valueOf(tempo.replace("s", "").replace("m", "") .replace("h", "").replace("d", "")); long added = 0L; //não sei porque precisa de…
-
1
votes1
answer356
viewsA: Return inserted value after INSERT
There’s no way to figure out what was inserted into INSERT except the last ID, has to do the SELECT even.
-
1
votes1
answer438
views -
3
votes1
answer141
viewsA: Menu with Polymorphism
It’s very simple, don’t do it. It doesn’t make any sense to put the Menu() inside Mamifero. It makes even less sense for the method (not function) to be virtual and to use polymorphism. The example…
-
4
votes1
answer151
viewsA: What’s wrong with the logic of this Python code?
There are two problems in logic. First the function bool() cannot transform the string at a boolean value like hold, so the correct comparison is with string, but without the function. Second if the…
-
4
votes3
answers460
viewsA: How do I create a directory through the Harbour language?
Using the function MakeDir(). So just do it: MakeDir("caminho desejado"). Remembering that Harbour is case-insentive and in thesis you can write the name of the function as you want. It returns 0 if…
-
10
votes4
answers2097
viewsA: Print arraylist information on the screen
There are some errors. First you need to create a list of Cachorros and not of Strings. Then you need to use a foreach to scan the entire list. I changed the name of the list variable because a list…