Posts by Maniero • 444,682 points
6,921 posts
-
3
votes1
answer144
viewsA: Assert.Areequal() fails when everything seems to be right
I will not evaluate the algorithm, but rather the unit test. It is wrong. The method Assert.AreSame() checks if the two variables point to the same object. And obviously they don’t point. You’re not…
-
20
votes2
answers4066
viewsA: What are MIME types?
Multipurpose Internet Mail Extensions. It is a standard used to indicate how content in an email message should be treated, such as: encoding used, data format, split and other specific information.…
-
3
votes4
answers25519
viewsA: The input character string was not in an incorrect format. Operators
You’re catching something that is long turning into string and then turn it into int and play in a variable double. This is crazy and it doesn’t make sense. Change the return of RAM() for: return…
-
10
votes2
answers138
viewsA: How long does an x++ increment take?
Very little. It is a few processor cycles (it itself can be 1, depends on the processor). It is even difficult to measure. Measuring things like this is complicated because the time it takes to make…
-
3
votes2
answers1491
viewsA: Store some elements of an array in another array
I’ll give you a solution that I don’t know if it’s what you want. But the code doesn’t make much sense either, so I don’t know if it’ll make a difference. You probably want to do something else and…
-
2
votes1
answer1407
viewsA: Launch a custom Exception
From what I understand you have a business rule and not an exceptional situation. Then you should not use this mechanism. The last thing you should do in this case is to replace a if simple-for-a…
-
1
votes2
answers333
viewsA: Difficulty defining the path where a particular txt will be created
If you want the current path and not a fixed one: String path = new File(".").getCanonicalPath(); I put in the Github for future reference.…
-
14
votes2
answers135
viewsA: While with incomprehensible format
You need to understand what expressions are. And that they can be formed by sub-expressions. Java is a reasonably well written language and does not do magic. Everything has a criterion. If you…
-
4
votes2
answers1846
viewsA: Error invalid Conversion from 'int' to 'int*' using -fpermissive
The first code only compiles with options to pass possible problems. This is a warning. So far so good. The second code doesn’t work because you’ll be picking up dirt. The last thing you should do…
-
3
votes2
answers995
views -
3
votes1
answer592
views -
3
votes4
answers311
viewsA: Creating Data Base through Stringbuilder
The problem is on this line: str.append("dt_leitura DATE), "); I put in the Github for future reference. You close the parenthesis and then continue, which generates a syntax error.…
-
10
votes1
answer695
viewsA: What is a Prototyping Language?
The term as put in question I do not know, is possible, but I do not know any language that is specifically for this. A language that can be used to prototype is one that has little ceremony, which…
-
2
votes2
answers203
viewsA: Errors with C array manipulation
If you can’t look at the bugs and find simple problems like that, you won’t be able to program. Missing you dedicate a little to trying to find the bugs, some are typos, and many of them happen…
-
18
votes4
answers41801
views -
5
votes2
answers125
viewsA: Implementing relationship in C#
The only way is to have a reference to the mother: public class Mae { public string Nome {get; set;} public List<Filho> Filhos {get; set;} = new List<Filho>(); //C# 6 } public class…
-
22
votes1
answer2647
viewsA: What are HTML5 Aria-* attributes for?
They are related to page accessibility for people who encounter difficulties due to some special condition. The term means Accessible Rich Internet Applications. These attributes give better…
-
3
votes3
answers1130
viewsA: Storing array values in a single variable
This is probably what you want: $array = array(12, 14, 121, 123); $var = ""; foreach ($array as $item) $var .= $item . " "; echo $var; Behold working in the ideone. And in the repl it.. Also put on…
-
7
votes1
answer96
viewsA: Is it possible to raise desktop projects on Github?
Github is just a repository of projects, it doesn’t know what language it was written in, what technology it used, in what form or other features its project has. So of course you can put a…
-
1
votes2
answers126
viewsA: while code does not make the correct condition
The code has some problems and the biggest one is that the comparison is always being made with the first number and not with the biggest one so far. Another serious problem is not having an output…
-
1
votes1
answer175
viewsA: Data conversion error
Might have some problems: USU.iAcesso_Usuario = Convert.ToInt16(Status_Label_Tipo); I put in the Github for future reference. Maybe I should take Status_Label_Tipo.Text. Depending on the type of…
-
1
votes1
answer155
views -
10
votes3
answers8723
viewsA: Difference between "Attribute" and "Instance Variable"
Informally the terms are almost interchangeable even. To some extent. The term attribute is widely used in modeling languages such as UML. And it is common for Java programmers to refer to variables…
-
6
votes1
answer1229
viewsA: Embedded database with C#
It is possible to encrypt and control access by Sqlite, not ready, you have to do this process, but it is doable. I would think twice before discarding it. Other options may have more facilities,…
-
1
votes2
answers94
viewsA: How to obtain data entered in a form not yet recorded?
What you’re wanting to do is nothing more than an extra page. So when you send the form data to the server, it should be routed to a controller who will do all that is necessary and call to view…
-
7
votes1
answer199
viewsA: Convert string to specific format in date
You need to do the exact conversion, but if the date is not in the expected format, chipped: DateTime.ParseExact("sex, nov 6", "ddd, MMM d", new CultureInfo("pt-BR")) Behold working in the ideone.…
-
7
votes1
answer454
viewsA: Is it correct to say that encapsulation aims at cohesion? Why?
Yes, encapsulation is a technique for achieving cohesion, though not the only one. And encapsulation also has its own goals. Obviously the attempt to carry the encapsulation to iron and fire can…
-
4
votes3
answers1689
viewsA: How to make visual form inheritance in Windows Forms?
In fact, what you’re doing makes no sense. It kills every advantage of inheritance. If I understand, you want to do polymorphism. Then you turn this method into virtual and reimplementation in the…
-
33
votes5
answers5756
viewsA: What is Design Pattern?
Normally we see the design pattern as a cake recipe. It is a model to be followed. It’s a way to encode something to get a certain result, a certain solution. Usually these recipes were created by…
-
7
votes2
answers140
viewsA: What are numbers for when creating columns in databases?
It may vary according to the implementation of each database, but in general it determines the maximum number of characters that can be displayed in the column or the maximum that can be used in the…
-
7
votes3
answers2556
viewsA: How to know how many objects were instantiated?
You will create a static member in the class that will hold the instance counter. In the constructor will increment this counter. You just need to know how many were instantiated or need to know how…
-
1
votes1
answer223
viewsA: Memory consumption (HTML element x jQuery objects)
In general this is correct. The first records only one element and the second all elements. But this difference may not be so great. And this can be stored for a short time and then collected, so it…
-
18
votes1
answer1388
viewsA: What is a Nosql bank? How does it work?
This definition has already undergone changes and not everyone agrees with them. Some say that the correct name of the technology should be Norel. In some cases Noschema, because that’s what he…
-
5
votes1
answer258
viewsA: What are the main programming languages that integrate Sqlite?
None mainstream. Programming language is a set of rules for writing code that will be executed by the computer, so it makes no sense what was asked. Even implementations of programming languages do…
-
11
votes2
answers326
viewsA: Is the term ASP.NET MVC correct?
It’s not right. It is correct to use ASP.NET MVC. This is the name of a Microsoft technology. It is a proper name and should be spelled correctly. The name is one thing. There it is correct to use…
-
3
votes1
answer93
viewsA: Why should we make a bootloader before the kernel first?
You can start wherever you want. And you can use a bootloader ready, as many do. The GRUB is the best known. As its name says it is responsible for finding where the operating system is on the disk…
-
1
votes1
answer189
viewsA: Segmentation failure
You have created a method that returns a string, but did not return anything. Then causes an error. #include<string> #include<iostream> using std::string; using namespace std; class…
-
5
votes1
answer1326
viewsA: How to locate an image without informing the absolute path?
I think this is what you want: Image img = System.Drawing.Image.FromFile( System.Web.HttpContext.Current.Server.MapPath("~/Content/images/SemFoto.jpg")); Documentation. There are some other ways to…
-
9
votes4
answers12732
viewsA: Multiple return in C/C++
Multiple return Neither C nor C++ allow returning various values in the function. The most common when it is necessary to return more than one value would be to pass one parameter for reference, so…
-
5
votes2
answers110
viewsA: How to take a value from a Javascript code and use it in PHP?
This does not exist, you are mixing PHP with Javascript. They are different languages and run completely separately. Not only at different times, but in different places. One is not a continuation…
-
6
votes2
answers928
viewsA: How to scan a string and check content within it?
Use the method Contains() to know if one text is present within another: if ("Olá Mundo".Contains("Olá")) { //Faça o que quer aqui } I put in the Github for future reference.…
-
14
votes2
answers720
viewsA: What Means Two Keys in Javascript
This is specific to this Non-standard API. Avoid using it. Is a placeholder. It is used to produce an interpolation of string, although it uses a simpler form. It is very similar to the {0} used in…
-
2
votes1
answer109
viewsA: Memory allocation and wiping in C - how much should I worry about?
You should worry since the function strdup() (would be better to use strndup()) allocates memory in heap. All memory allocated in heap must be released. C has not Garbage Collector and all memory…
-
2
votes1
answer88
viewsA: Exit loop as soon as the string name equals 0
#include <iostream> #include <locale> #include <string> using namespace std; int main() { setlocale(LC_ALL, "portuguese"); int idade[20]; string nome[20]; char sexo[20], expe[20];…
-
11
votes1
answer3112
viewsA: Debug and Release mode in Visual Studio, what is it for?
Basically it is a way to choose which settings will be used to create the project. These are common and already come with Visual Studio but it is possible to create your own settings. See…
-
2
votes4
answers257
viewsA: Use of setters in the builder
Depends on what the methods setNota1() and setNota2() do. If they only assign the value of the parameter to nota and nota2 then there is no difference. Obviously if the methods do anything…
-
2
votes1
answer433
viewsA: I’m wanting to display the amount of negative numbers typed using functions
I’ll help you along the way you’re going, but there’s a lot of things you’d better do differently. One of the changes is that I would probably pass the argument by reference rather than making a…
-
24
votes1
answer1625
viewsA: When does Stack Overflow occur?
First make sure you understand what is the stack. It is a portion of memory previously allocated by the application that is filled as needed by the functions (or scopes). As the execution goes into…
-
7
votes1
answer2417
viewsA: Simulate boolean type in C
The best option is this: #include <stdbool.h> This requires a C99 compliant compiler, which is virtually all counting, you can use the type _Bool. If you don’t have a compiler like this, the…
-
3
votes1
answer559
viewsA: I’m having trouble displaying the names of people over 18
If you are using C++, use the language, do not mix with C. Then use the cin for data entry and string to store texts. There it is easier. One of the problems is that it seems that you are wanting to…