Posts by Maniero • 444,682 points
6,921 posts
-
11
votes3
answers8939
viewsA: What is the correct way to declare a string in C?
None of them are declaring strings even, are declaring variables that can support strings. The last one seems strange to me, but it works, if used right, generally it is not used unless it has a…
-
4
votes3
answers121
viewsA: How can this be improved? (It’s just a little game)
I would do so: #include <stdio.h> int Calcula(char *sequencia1, char *sequencia2, int pontos) { printf("O número está neste grupo?\n"); printf(sequencia1); printf(sequencia2);…
-
3
votes1
answer885
viewsA: Is there a difference between using backslash and simple?
It depends on the context. If it is for use as a directory separator, PHP abstracts this and uses what is most suitable for the platform that is running. It does not mean that it will always work as…
-
8
votes2
answers13776
viewsA: What’s the difference between Apache Cordova and Ionic?
Cordova is the open base project creating hybrid apps for mobile. It uses web technologies (HTML, CSS, JS) to create applications for mobile phones and other devices, but that do not run on one…
-
3
votes1
answer74
viewsA: Is this valid (x = (*mat)+;)?
That’s not valid, you can’t have one statement in parentheses. Why? Because the language specification (old text, new ones are paid) says so. They could allow it, but there is no advantage to it and…
-
1
votes1
answer61
viewsA: When I am instating a class I need to perform a 'delete' after using the object even if the class has a destructor?
Depends. Allocate into stack so no need, this is an automatic memory and the compiler generates its own code that will displace whatever it takes. If the allocation is in the heap need to know if…
-
5
votes1
answer253
views -
7
votes1
answer223
viewsA: Why hide the implementation of a class?
This is about the open-close of SOLID. Whenever you put a public behavior, or even protected in a class and allow this class to be inherited you have a responsibility with that, any change has to be…
-
7
votes1
answer64
viewsA: Is it wrong to have header and Section tags and not have a footer?
No, they are completely independent, you use each one according to your need, if you don’t have a footer just don’t use. On the other hand you could create a simple footer by placing an instruction…
-
5
votes2
answers59
viewsA: How to change the way a class/structure is printed?
Some considerations would make this structure better: using static System.Console; public class Program { public static void Main() => WriteLine(new Cores(80, 20, 160)); } struct Cores { public…
-
1
votes1
answer116
viewsA: syntax error, Unexpected ( Arg, expecting end-of-input )
Missing parentheses in function calls. Try to keep code organized and within a pattern, so avoid errors like this. larguraDaLinha = 40 str = '--> text <--' puts str.ljust(larguraDaLinha) puts…
-
3
votes2
answers105
viewsA: Error trying to imprint the return of a two-dimensional matrix
One thing I often say is that confusing codes that do more than they should always give room for error. This is the case. This code can be greatly simplified and solved some other problems not so…
-
3
votes3
answers914
viewsA: Insert two points into the string
If what you have is $valor = "0050"; just do it like this: $valor = "00:50"; If what you have is a variable that has 4 unknown characters and wants to separate them just do $valor = substr($valor,…
-
6
votes1
answer258
viewsA: Reason for using cursors in databases
You know that cursors allow you to access the selected data more or less freely, ie you create a set of stable data lines (keeps the same lines) that you can circulate through them and do what you…
-
3
votes1
answer444
viewsA: Read the txt and return it all in a Java String
It’s much simpler than that: System.out.println(new String(Files.readAllBytes(Paths.get("c:/algoritmo.txt")))); I put in the Github for future reference. Documentation.…
-
3
votes1
answer2487
viewsA: How to make a method return a string in Java
If you want the name returned, you should do this and not return the index as you were doing. There’s a lot of other mistakes there. You’re mixing the person with the algorithm, you’re creating…
-
9
votes3
answers46833
viewsA: How to rename the column name SQL Table
You need to reset every column like this: ALTER TABLE nomes_clientes CHANGE primeiro_nome nome VARCHAR(255) NOT NULL; CHANGE segundo_nome sobrenome VARCHAR(255) NOT NULL; I put in the Github for…
-
3
votes3
answers4858
viewsA: How to write a date in ISO 8601 type
DateTime.UtcNow.ToString("o"); or DateTime.UtcNow.ToString("yyyy-MM-ddTHH\\:mm\\:ss.fffffffzzz"); Source. Documentation. This is a form of representation of a text in the specified format. A…
-
4
votes3
answers835
viewsA: How to go through an array skipping some indices?
It must be something you wish for: for (var i = 0; i < vetor.length; i++) { for (var j = 0; j < vetor.length; j++) { if (vetor[i] == vetor[j]) { i++; break; } } } I put in the Github for…
-
10
votes1
answer961
viewsA: What makes Kotlin a language faster than Java?
Programming languages do not have speed. At most implementations have speed, yet it depends on a number of factors. Libraries are often a much more important performance factor. I can’t think of a…
-
7
votes1
answer110
viewsA: Is there any way to bring information from the database without using server side language?
It doesn’t exist. Any computation problem needs to be programmed with a programming language. In fact the question has arisen because it is using inappropriate tools to perform an activity. You fell…
-
6
votes1
answer100
viewsA: What is the use of default interface methods?
In fact there is no conflict, abstract classes are classes, so a class can only be inherited from a single class. Interfaces can still be inherited as many as needed, even with standard…
-
3
votes2
answers1641
viewsA: Pass pointer pointer as argument for a function
The problem is in memory allocation. If you want to allocate a pointer to pointer you have to declare so. Also understand that this is a C code compiled with C++ and not a C++ code. I prefer to do C…
-
3
votes3
answers898
viewsA: Validation and counting of days of a date
Go some tips: The date check can thus be simplified: try { var dataAtual = new DateTime(Convert.ToInt32(txtDia.Text), Convert.ToInt32(txtMes.Text), Convert.ToInt32(txtAno.Text)); lblData.Text =…
-
2
votes1
answer77
viewsA: How to put a form inside a tab?
This is not possible, the Form is a window, and a window is the biggest thing about a GUI desktop application, so it doesn’t have like something smaller, a tab, incorporate something bigger. You…
-
1
votes2
answers76
viewsA: Error while creating string array
Gives error because it is not allocating space for strings, only for your pointers. Then either changes to array and allocates in stack what seems most convenient for this case or use the malloc()…
-
3
votes2
answers498
viewsA: How to use if Else in the code below
Not quite if that you have to use, is while since the person can type wrong several times, then have to repeat until it is in accordance with the desired. In addition there is another problem, if…
-
3
votes1
answer60
viewsA: Why are boolean values converted to string in the case Camel in C#?
This is the decision of the creators of language and framework, has nothing specific. The name returned as string uppercase is a common form of use, if you need different it is easy to manipulate…
-
8
votes3
answers3452
viewsA: What is an absolute value?
This function is in all standard libraries of programming languages and other technologies that do mathematical calculations. It always returns the positive value of the number given, that is, if it…
-
6
votes1
answer7242
viewsA: String matrix
Always consider that a string is a guy char * (pointer for characters), even if you use a char * it’s still a pointer (could use a array there in certain circumstances, so if you want a matrix of…
-
9
votes1
answer207
viewsA: What is the difference between String name = "test" and String S4 = new String("Peter");
The operator == compares whether two objects point to the same memory location and the equals() compares the contents of objects. Give this equality because of the call interning, where two equal…
-
4
votes4
answers880
viewsA: Why is it not advisable to use PHP codes in the same HTML document?
I am of yours, in simple things do it as simply as possible. Of course, if you are learning the ideal is to learn to do even in simple examples of the way you do when the project is complex,…
-
5
votes1
answer132
viewsA: Why is it not recommended to use the C# project event with WPF and MVVM?
This is about MVVM and not about WPF. Of course, WPF usually uses MVVM, but nothing prevents it from doing through event handlers and abandoning MVVM. Some people think it’s sacrilege, but the…
-
1
votes2
answers252
viewsA: Return 2 values in a foreach
I think this is what you want: Private Function Funcao() As IEnumerable(Of String) Yield "Teste" Yield "Teste2" End Function I put in the Github for future reference. Documentation.…
-
13
votes1
answer690
viewsA: Why is it better to use char[] than String for passwords?
This is about safety. If information stays longer than needed in memory it has a better chance of the application being compromised and someone with access to the machine can get the password.…
-
1
votes1
answer36
viewsA: How to send the main program programming directive to some library?
Compiler directives indicate to the compiler how it should behave in several situations, so the only way to change its value is at the time of compiling the library used, if it does not have the…
-
8
votes3
answers8582
viewsA: What are Parallel.For and Parallel.Foreach loops?
some processing in data collections or some algorithm that is done as a repetition, provided that it is not dependent on the sequence to be executed, can benefit if they are made in parallel by…
-
7
votes3
answers16313
viewsA: Comparison of char in C
This syntax is completely wrong, you have to compare the variable against the character individually. if (atual->letra == 'a' || atual->letra == 'e' || atual->letra == 'i' ||…
-
12
votes3
answers172
viewsA: What is the difference in the 3 types of variables and how do they behave in the compiler?
static int valor1 = 10 / 5; This is a static variable, probably the compiler will do the calculation and store in static area of memory the result. static int valor2() => 10 / 5; Here is a static…
-
2
votes2
answers400
viewsA: What are the statements placed before strings?
Are indicative of which literal of string will be placed there, each has a different feature in which the compiler/interpreter understands differently and decides what to do. Has documentation of…
-
1
votes1
answer282
viewsA: Relationship of tables with the same attributes
The table that "commands" there is the employee, this is something concrete. If the person is an employee, it is there that he should be registered. The decision is only where to place the data that…
-
5
votes1
answer81
viewsA: Java type relationship or other language with processor architecture
No relation in most languages, that’s the size of the die and dot. In C, C++, Assembly (although the latter does not have formal types) and other lower level the type may have variable size…
-
9
votes2
answers6436
viewsA: Class, Superclass and Subclass
Class is the general term, is a data structure model, specifically in C# is always a type by reference. Inheritance is just creating a class that is based on another existing class reusing already…
-
9
votes1
answer227
views -
3
votes2
answers485
viewsA: How can I call a class void method to display an msg in a form
It is not possible, at least if I understood the placement. If the method does something but does not result in anything it cannot be used as expression in a place that expects some information,…
-
5
votes2
answers75
viewsA: Return a case sensitive record
If you want to compare all uppercase then compare with the other side all uppercase too: select count(*) from all_cons_columns where UPPER(constraint_name) = 'FK_OD8OU6G1L9T7IUFCP3O0TO189'; Actually…
-
8
votes2
answers1392
viewsA: What are they, Readpast and Nolock?
These clauses are tips for the optimizer of darlings meet some demand better, in general should only be used when it is certain that it needs a semantics of access to data different from the…
-
1
votes1
answer410
viewsA: Storing values of variables within the while function
This is the way, there’s no magic. qntd_alunos = int(input("Digite a quantidade de alunos: ")) qnt = 0 media_geral = 0 while qnt <= qntd_alunos-1: MB1 = float(input("Digite a média do primeiro…
-
15
votes1
answer615
viewsA: How does the lifespan of static variables work?
First understand difference between scope and lifetime (the original question spoke in scope). There are two types of static variables in C, one is the local scope (for example) and the other with…
-
8
votes1
answer1325
viewsA: Record records with the mask or remove before?
There are arguments for both sides. I particularly think the correct thing is without the mask because the mask is usually just a visual presentation of the data, it is not part of the data, the…