Posts by Maniero • 444,682 points
6,921 posts
-
4
votes3
answers468
viewsA: Search for word in the first array column
Since it is a somewhat more complex algorithm that requires some lines I find it more interesting to make a method that treats this. An extension method makes use more natural. But if you don’t want…
-
1
votes1
answer86
viewsA: Error creating child node, generalized list
Lacked a = in the if. You assigned a value instead of comparing. Note that I improved some aspects of the code, as I had done before. In C there are no methods, there are functions. I also advise…
-
2
votes1
answer380
viewsA: request for Member 'attributeOuDecisao' in Something not a Structure or Union
When using a pointer to a structure the correct operator to access the members is always the ->. In addition whole types should be initialized with 0 and not with NULL. #include <stdio.h>…
-
4
votes2
answers6288
viewsA: Get the current date directly from the machine
You have to use the function localtime() to provide you with the date in a structure, then you can assemble as you like. There are people who create functions ready to abstract that. #include…
-
2
votes2
answers140
viewsA: It is possible to save multiple values in a single database field
Yes, it is possible, if the column is varchar You can put whatever text you want into it. But it’s rarely the right thing to do. It may be your case, I don’t know what you want. Of course your…
-
2
votes1
answer42
viewsA: How to count how many characters are in a selection?
I believe that an answer in the OS does more or less what you want. It would be something like this: using System; using EnvDTE; using EnvDTE80; //não sei se precisa de todos eles using EnvDTE90;…
-
5
votes4
answers17399
viewsA: Average between 3 notes
There is a syntax error using the comparison operator <= (smaller or equal). Following the line of your previous question: var idade = []; for (var i = 0; i < 3; i++) idade[i] =…
-
4
votes1
answer749
viewsA: Saving fields with comma
There is a type problem, do not use a text property to store a monetary value. Changing this should help. That code doesn’t make much sense, it’s complicated to insert something that’s just the…
-
1
votes1
answer3674
viewsA: Display 3 numbers in ascending order
The best way to do that would be with a array and use the sort(): var idade = []; for (var i = 0; i < 3; i++) idade[i] = prompt("Informe a primeira idade: "); idade.sort(); for (var i = 0; i <…
javascriptanswered Maniero 444,682 -
3
votes1
answer147
viewsA: Is it possible to "simulate" C++ Templates in C?
Not exactly. You can even create a tool to read the generic code and generate the concrete for each type. It’s hard, hard, easy to do wrong, and it probably doesn’t pay. It is always possible to try…
-
3
votes1
answer92
viewsA: If allows you to execute other unwanted lines
The code has several problems, the main one being what Bacco said in comments. As there are no keys in the command block the if will selectively execute the first line only after the if, the rest…
-
3
votes2
answers1756
viewsA: Field type suitable for storing currency in Oracle
You can write any data in the database, depending on what you want. The most correct type of column for storing money is a NUMBER with fixed houses (there are alternatives). Example: NUMBER(19, 4)…
-
5
votes1
answer304
viewsA: Is it correct, following object orientation, to use pointers to C++ functions?
Correct can only be said by seeing a concrete case. In this respect the question cannot be answered. The actual case has not been put forward, so even if I say you can do it, if you do it wrong it…
-
5
votes3
answers220
viewsA: Attributeerror: 'Qstring' Object has no attribute 'strip'
Can use simplified() of own QString. It is a more limited method, but it can work. Depending on what you want can be used to trimmed() also. Can use replace(QString(" "), QString("")) if you want…
-
4
votes1
answer2214
viewsA: Percentage in C
You need to take the percentage out of the loop, it can only be calculated once you have all the data. In addition it is necessary to ensure that the division is made as float to have decimal…
-
6
votes3
answers1831
viewsA: How to compare variables using Javascript?
I believe the easiest way would be to search in a array of the values to be compared. If array is because the variable is worth at least one of these values. There are people who even have some…
-
8
votes3
answers2680
viewsA: How to iterate over a dictionary?
One can say that essentially there is only one way. It is repetition through a flow control mechanism, preferably structured. There is no clear pattern, there is common sense and the most obvious…
-
2
votes2
answers285
viewsA: Where to use accumulators in a unique peer-review algorithm?
Each of them must be placed inside the if after all it is in it that it is decided whether it is even or odd. Do not forget to reset the variable at startup to not catch dirt from memory. #include…
-
8
votes1
answer128
viewsA: How does a machine identify the type of data?
The machine does not identify anything. Typing is an abstract concept existing in high-level languages. "They" choose the types and rules for them. For the computer there are only a lot of bits, it…
-
17
votes1
answer3650
viewsA: What is the difference between virtual and Abstract methods?
Both are mechanisms of polymorphism. Virtual methods have implementation that can be superimposed by a derived class. Abstract methods have no implementation and therefore, must have an…
-
5
votes4
answers330
viewsA: Problem with functions being performed multiple times
With a code you could respond better, but basically what you need to do is have a global variable that controls whether it’s already run or not, something like that: var fadeJaExecutado = false; the…
javascriptanswered Maniero 444,682 -
8
votes3
answers2573
viewsA: How to use constructor overload in Typescript?
Typescript did not solve this problem that already existed in JS. You can fix that, but there must be something that makes it harder, maybe maintain interoperability with pure JS code. You gotta do…
-
1
votes1
answer443
viewsA: Turn multiple columns into one
Reply from the author in comment. Sub macro() 'Step 1: Declare your variables. Dim MyRange As Range Dim MyCell As Range Dim i As Double i = 6000 'Step 2: Define the target Range. Set MyRange =…
-
3
votes2
answers233
viewsA: Error: "invalid operands to Binary Expression ('char *' and 'char *')"
In C to concatenate strings it is necessary to use the function strcat(). So it would look something like this: char* endereca(Pessoa* pessoa) { if (pessoa->sexo == 'M') { char *msg = malloc(8 +…
-
28
votes3
answers1336
viewsA: Is it ideal to use primitive types in Java?
He can have whatever opinion he wants. He said why? Always try to understand why, more than understand what. If he disagrees with what everyone does he should justify. Some people might think it’s…
-
1
votes2
answers2511
viewsA: How to add item in array through a foreach?
I believe the problem is attribution. It needs to be array really? I think it would be better to do with a for. var di = new DirectoryInfo(_caminhoEmail); FileInfo[] rgFiles = di.GetFiles("*.ost");…
-
7
votes1
answer110
viewsA: Allow new conditions to be added without modifying code
That’s not a problem, but you’re right that it can be difficult to maintain. Some people like to do something more "object-oriented". So it would have a method for each case, but I think an…
-
7
votes2
answers1189
viewsA: What is an output parameter?
I will try to answer as correctly as possible, but without knowing the language the answer may not be true, although I am confident that this applies to almost every case. appendFooter(s);…
-
2
votes1
answer214
viewsA: Error while printing static list
There were so many mistakes in the code, I can’t even remember everyone I fixed. I will try to describe them by comparing what is in the question and what is left in mine that still has several…
-
8
votes1
answer79
viewsA: Why can’t a Trait implement an interface?
Allow a trait implement an interface makes perfect sense to me. We can face the trait as an interface that has implementation, and has not been, unlike the abstract class. So if one interface can…
-
4
votes1
answer2898
viewsA: Code to show procedures in Mysql
I believe that’s what you want: SELECT ROUTINE_TYPE, ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = 'nome do banco de dados aqui'; I put in the Github for future reference.…
-
5
votes1
answer558
viewsA: How to access the indexes of a very large vector in C?
You need to make a loop and vary the index by the loop variable. I made an example with 6 numbers, but just change to 100 in the second line. Do not put an odd value that will give problem. I…
-
1
votes1
answer108
viewsA: Use VB6 app on a smartwatch
If you are going to create, it is not done. If it is already done, it will not create. It has not been said which device, but none of them runs VB6, it is dependent on full Windows and there are…
-
16
votes2
answers3182
viewsA: What is the difference between Simple Factory, Factory Method, Abstract Factory?
All patterns are often abused. They should only be used when it really is a solution to a real problem. I’ve seen factories being used where I didn’t need them, where the code could build the…
-
4
votes3
answers459
viewsA: Does C# have a class for handling properties files?
There are some libraries that allow to do something very sophisticated. I wouldn’t know to specify a specific. There is something a little different in the standard library, it would be the class…
-
28
votes3
answers19255
viewsA: What is the difference between while, for, while and foreach?
They are all used for loops. There are even some "creative" uses, but they will always be controlled repetitions. while The structure of flow control enquanto repeats the command block until the…
-
4
votes1
answer106
viewsA: Encrypt critical data in the database
First, follow what Lacobus says in the question comment. One of the things you should do is encrypt the database as a whole. It is not a 100% secure solution, but it is the simplest to do and it…
-
9
votes1
answer1759
viewsA: Can you make a type of "setInterval" in PHP?
PHP doesn’t have it native. Nor does it make sense. When you need something like this and PHP applications rarely need it, and it is common for programmers to opt for a wrong mechanism for their…
-
5
votes3
answers248
viewsA: How does development work for Xamarin?
If I want to create an app in Xamarin for IOS, I’m required to have a MAC? Has been answered in C# Mobile Development Needs Mac?, I won’t repeat here. Xamarin creates a folder in the Droid and IOS…
-
4
votes2
answers257
viewsA: How could I enter the structs in a list?
I will redo the code to C++ without using the C style. The appropriate is to use a map, Which was described as a requirement. If the requirement is wrong there the solution would be another. I…
-
5
votes3
answers190
viewsA: Console, Windows Forms or MVC what’s the fastest for heavy loads?
It makes no difference because the processing has nothing to do with the user interface. It is even difficult to compare their performance because the interface should not be chosen by which is…
-
18
votes3
answers2015
viewsA: What is the difference between async, multithreading, parallelism and competition?
Processor None of this depends on the computer cores directly. True parallelism depends on having multiple processors (logical or physical). Without the computer having effective ability to process…
-
4
votes2
answers166
viewsA: What is the Countable interface for in PHP?
According to the documentation is to force the implementation of the method Count(). It is used in classes of data collections that need to standardize to obtain the count of all items contained in…
-
9
votes2
answers309
viewsA: What’s the difference between Savechanges and Submitchanges?
Savechanges It is transactional in full. If there is a failure that prevents the persistence of all the data, everything goes back to the original state (rolllback) has to start from scratch.…
-
15
votes2
answers529
viewsA: What is checked in the code in C#?
The checked is used to determine whether the arithmetic overflow will be considered as an error. Then if the value passes the limit that the type supports an exception it will be thrown preventing…
-
9
votes3
answers2766
viewsA: Count or Count()
Generally whenever you can use the property Count is better because access is direct. The expectation is that it will always be O(1). Count() is a LINQ extension method, so you can only use it on…
-
2
votes2
answers544
viewsA: Change Color of an Error Message using Annotation
Normally you change this in CSS (usually found in ~/Content/css). See the styles: .field-validation-error - directly what you want .input-validation-error - assist if you want to modify the field…
-
6
votes2
answers113
viewsA: Denied file deletion on C#
From what was posted the file is probably open. The line that opens: XmlTextReader xmlLer = new XmlTextReader(caminho + cliente); Does not close the file. The correct is to open with using,…
-
6
votes1
answer201
viewsA: Problem with strlen()
The fgets() includes the line end character typed in the data entry in the string, so it shows one more character. We will make the code print the ASCII codes of each character to see what is inside…
-
15
votes3
answers8989
viewsA: What is "build" and what is its relationship to the IDE?
Is a microsoft conference... lie :P I say this because there are many possible contexts, there are two more used which seem to be than are speaking in the question It has nothing very special, is…