Posts by Maniero • 444,682 points
6,921 posts
-
15
votes2
answers13989
viewsA: What is the function of the super in a Java constructor?
It’s to call the mother-class builder. If this class is composed at least in part by another inherited class, this part also needs to be initialized and this is a way to initialize the mother class…
-
5
votes1
answer368
viewsA: Design Observer applied to events
The general understanding is this. Nothing stops you from doing this. But the Observer standard is a mechanism and not a business rule as you used it. If I showed you a code, I could do a better…
-
10
votes4
answers6237
viewsA: How does the "#include" directive work?
You are importing a text. What the compiler does is simply the same as you copy and paste the text that is inside the include into the text that is in the main source. This is why the position in…
-
3
votes1
answer51
viewsA: How do I use the VS Command Window?
It’s just for you to run some commands from Visual Studio. It can be easier than doing some things by it for those who are used to commands. You can speed up because you don’t need to use the mouse.…
-
10
votes2
answers1715
viewsA: Back previous position in Visual Studio
One way is to simply use CTRL + TAB to navigate between TABS. Or you can use CTRL + -, to get back to where I was. It means Navigate Backward. Shortcut reference.…
-
25
votes3
answers57329
viewsA: Format double with mile and decimal
The two answers posted are correct, but there is an addendum regarding the culture used. The answers show how normal it is to be used if you are sure that a computer is configured with a culture…
-
5
votes1
answer781
viewsA: How to save data to a global array
What you want is done with global, then you’d have to do something like this: global $errors[] = 'Tabelas criadas com sucesso.'; But this is a terrible idea. At the very least I could create a class…
-
8
votes3
answers667
viewsA: What are these attributes in the properties?
Have you seen in the other answers what is an attribute. They can be used in: Assembly, Module, Class, Struct, Enum, Constructor, Method, Property, Field, Event, Interface, Parameter, Delegate, An…
-
1
votes1
answer370
views -
8
votes2
answers316
viewsA: Can I use MIT along with GPL?
Only a specialized lawyer can guide you properly. I can give you preliminary information. If you described your situation correctly (it’s amazing how common it is for a person not to understand…
-
7
votes2
answers4042
viewsA: Get property values of a class
I would do so: private string[] ObterValoresPropriedades(object objeto) { var val = new List<string>(); foreach (var item in objeto.GetType().GetProperties()) val.Add((item.GetValue(objeto) ??…
-
2
votes2
answers422
viewsA: What are the possible cases of using a persistent connection?
Think of a website where people post questions and answers, comment, and do other things. Think that people will want to know when there is a change in the list of questions, when someone changes…
-
7
votes1
answer1518
viewsA: Compare two dates
In general everyone recommends using the Jodatime which is much better than the original API. But you can do the following: (DataAtual.getTime() - DataSalva.getTime()) / (1000 * 60 * 60 * 24) == 5 I…
-
2
votes4
answers395
viewsA: How to Debug only one project in Visual Studio?
Right click on your solution (through Solution Explorer); choosing Set Startup Projects; select the project you want to run in the section Single Startup Project; Give the Apply to finalize.…
-
2
votes1
answer935
views -
7
votes1
answer118
viewsA: Distinguish forms within PHP
The $_GET is not normally used with forms, but rather $_POST. The trick to distinguish is to use an identification information of this form. In the most common case is to use a field hidden in HTML.…
-
11
votes1
answer1771
viewsA: How to perform automatic pull with Git?
It is possible to use a web hook provided by Github API. He is your Listener. Documentation Git for hooks configuration. To get what you want automatically, you need to write a script. An example. A…
-
3
votes1
answer563
viewsA: How to check if a name is in the database?
If you place a restriction in the database you must resolve. This is done through the clause UNIQUE KEY. CREATE TABLE `tbl_users` ( `id` int(11) NOT NULL auto_increment, `username` varchar(250)…
-
8
votes1
answer95
viewsA: How not to ignore directories with the same name?
Use the path absolute: /build/ It is also possible to use ! or !* to clear the previous patterns but do not recommend this solution. Documentation.…
-
12
votes2
answers450
viewsA: Getters and Setters can only "walk" together?
No, you can use either of the two separately as per your need. Good practice is the one you need and is correct. If you won’t use the getter publicly, do not create it. In fact if you also don’t…
-
2
votes1
answer303
viewsA: Application icon in Visual Studio 2012 Express
As you’ve been asking about C++ I’ll understand that this is the kind of application you’re talking about. What I’ll show you next not available in Express versions (the original question didn’t…
-
6
votes1
answer915
viewsA: Assign an expression to a variable
Since you don’t know the basic concepts well, you use the wrong terms. The phrase "Expressions within a variable" makes no sense. What exists is to assign an expression to a variable. Any high-level…
-
4
votes2
answers120
viewsA: Reset variable
If I understand what you want, exactly this way is not possible and I do not know a way to do it in any language. It is possible to do something different that produces the desired result using a…
-
5
votes1
answer1334
viewsA: How to create a window without using the GUI builder?
I agree that it is often better to write the code in hand than to use the generator. It gives more flexibility and control. I am visual Builder hater :P Visual Studio generates codes that are easier…
-
32
votes5
answers80372
viewsA: How to "round" a float in Python?
That’s a recurring question. This rounding "problem" occurs by the way the floating point number is stored and manipulated in the CPU itself, and does not depend on Python. The processor works with…
-
10
votes1
answer9108
viewsA: How do I update Github repository after changing files locally in Git?
It seems to me that your problem is quite simple, you just need to know the right command to send which is the push: git push It has numerous variations but it alone solves the basics. Of course the…
-
3
votes1
answer85
viewsA: How to remove sidebar with CSS or otherwise?
In the div specific use properties overflow-y: hidden; and/or overflow-x: hidden; depending on which bar you want to delete (can be both). There are some extensions in some browsers but it is…
-
46
votes4
answers40074
viewsA: What is the difference between display:None and visibility:Hidden?
display:none removes the element from the layout page. But you can still continue manipulating it in the DOM. visibility:hidden no longer shows the element, that is, it is no longer visible on the…
-
4
votes3
answers1629
viewsA: Multiple connections with the Bank
In your code only one suffices. What may occur is your application being called multiple times by the same user or different users. It would be several instances of the application, each one will…
-
2
votes2
answers1914
viewsA: How to make Insert in tables with many relationship for many?
To use this code you need to load the namespace appropriate: using MySql.Data.MySqlClient; The secret is to get the last ID inserted after each INSERT with the property LastInsertedId to use in the…
-
1
votes1
answer101
viewsA: Why define a constant for the same document and check if it exists in the document itself?
It is difficult to say for sure what the intention of third parties is if they have no documentation. An accurate answer could only be given by the person who did it. I can tell you why I would do…
-
3
votes1
answer1120
viewsA: Change zip code column by inserting dash in Firebird
You didn’t give a lot of details but I think this will solve: UPDATE cidades SET cep = SUBSTRING(cep FROM 1 FOR 5) || "-" || SUBSTRING(cep FROM 6 FOR 8); I put in the Github for future reference. If…
-
3
votes1
answer272
views -
5
votes4
answers274
viewsA: Problem checking prime numbers
Has two problems. The first is inattention, very common among programmers who do not get used to using keys to define block always. See this code: for (j=2; j<n[i]; j++) { if (n[i]%j==0) { } else…
-
7
votes3
answers736
viewsA: What kind of treatment can be performed in this case?
Actually the way to treat depends on the need of the application. The requirements of the application will determine what you should do. The question you should ask is what should happen to the…
-
8
votes1
answer700
viewsA: What’s it for, and when to use Friend?
Friend is a modifier indicating that that member of a type (class, structure, enumeration, delegation, etc.) or the type itself will be visible throughout the Assembly (in general a DLL). That is,…
-
8
votes1
answer1411
views -
42
votes2
answers29427
viewsA: Git warning: LF will be replaced by CRLF
Line terminator LF => Line Feed (ASCII 10) CRLF => Carriage Return + Line Feed (ASCII 13+10) This is how the text lines of the file end. Either with just one character or with both. In general…
-
22
votes3
answers23896
viewsA: Difference between type text and type varchar in SQL Server
TEXT does not have a specific size limit beyond the maximum of the database. It is stored in the specific area for blobs since the expectation is that it will be great. VARCHAR can have a size limit…
-
35
votes3
answers6039
views -
3
votes1
answer154
views -
52
votes3
answers11626
viewsA: What’s the use of the reserved word "Yield"?
TL;DR We can say it’s a syntactic sugar existing since C# 2 to control program execution flow while maintaining a state. It is widely used to give better efficiency and abstraction in the execution…
-
1
votes2
answers705
viewsA: How to calculate hash?
There are several forms depending on the purpose. One of the most common is to use MD5. This is done with the function md5_file(). You can also use the sha1_file() that is slower but one gives a…
-
3
votes1
answer925
viewsA: Subtituition of special characters by ASCII codes
If I understand what you want has a function ready for this, it’s the htmlentities(). If you want to change this in the HTML source, you can make a script quick to process all files using this…
-
57
votes1
answer5366
viewsA: What is the meaning of the operator "?"
He is called null-coalescing. In some contexts he is called the operator "Elvis". If the first operand is null, the result of the expression will be the second operand. Otherwise the result will be…
-
7
votes3
answers1181
viewsA: Passing vector to functions
The code has some problems: The Main() need to return a int. Some compilers accept different from this but it is out of the standard, learn to do everything by default. One function cannot be inside…
-
3
votes2
answers808
viewsA: How to use Filter in Folderbrowserdialog
Maybe your problem is not in the directory selection but in the files. I already answered something like this in another answer. You must use the Directory.GetFiles() with filter options: public…
-
1
votes2
answers593
viewsA: How to pass filenames to a Datagridview using Folderbrowserdialog?
To get only the file name contained in a path is used the method Path.GetFileName(). He’ll probably do something like this: List<string> selectedPath =…
-
9
votes2
answers1480
viewsA: How to edit a list in C#?
It’s almost a mix of registering and consulting. You need to find the client as in the query and ask for new data as in the registration. Only instead of adding you change the data of the client…
-
18
votes3
answers10053
viewsA: Why is it not good practice to use namespace "Std" in C++?
It’s good practice. When it’s useful and when you know how to use, knowing it has some implications. You may have encountered a problem by a specific situation. The real problem Maybe bad practice…