Posts by Maniero • 444,682 points
6,921 posts
-
10
votes3
answers3392
viewsA: How to use static and global variables in PHP?
How to use global variable? Simple, do not use. Global variables are problematic. It is difficult to ensure that it will not be confused with other variables. It’s hard to understand who and when…
-
1
votes4
answers2193
viewsA: How do I search a value within a String?
If the question really is only about what is written, Java has a function ready for it. String s1 = "isto é apenas um teste"; String s2 = "teste"; System.out.println(s1.contains(s2)); Documentation.…
-
5
votes2
answers1014
viewsA: Setting up a database, how do I make this relationship?
Let me ask you a question that will help: It is right to insert the column id_company in virtually all tables? Only you can say that. Only you know the requirements of your system. If there is any…
-
8
votes3
answers1561
viewsA: Increment letters in PHP?
This is typical of weakly typed language such as C for example. One type can be used as if it were another. Note that this is different from being dynamically typed, so much so that C is statically…
-
6
votes3
answers823
viewsA: Assign array type in PHP
Is not possible. PHP was dynamically and weakly typed, in the background nothing has fixed type. All arrays PHP accepts that any element has any type. It can be mixed at will. It is an inherent…
-
4
votes2
answers733
viewsA: Format string in View
The ideal is to put these things on the model or controller when relevant. The view should be reserved only to assemble the presentation. If you need to have the die with the first capitalized…
-
16
votes1
answer1733
viewsQ: What are the main differences between Dart and Typescript?
We already had a question comparing two languages that run on top of Javascript. I think it was necessary to compare two languages created for the purpose of creating applications for browsers and…
-
15
votes1
answer1733
viewsA: What are the main differences between Dart and Typescript?
Dart is a language created by Google to create great applications. The initial goal was to provide not only a language but also a better infrastructure for developing web applications. But as…
-
3
votes2
answers517
viewsA: How does Std::move work?
There are several situations that either you keep doing specific manipulations to avoid data copying or you allow these copies to be made creating a performance cost. This usually occurs in types…
-
54
votes3
answers22473
viewsA: What is "with" in Python for?
It is used to ensure completion of acquired resources. A file, for example, is opened. Who guarantees that it will be closed? Even if you explicitly put in the code that it should be closed, if an…
-
3
votes1
answer55
viewsA: Accept any Annex format
First of all, that code doesn’t seem to make any sense. I may be wrong because I’m not seeing the whole and I don’t know exactly what your goal is but I think it only works in specific situations.…
-
7
votes2
answers686
views -
2
votes2
answers766
viewsA: Remove objects from memory
There is no way to optimize the presented section. It seems to me very suitable. O . Net will take care of releasing the memory when it is possible and necessary and you do not need to worry about…
-
5
votes1
answer1983
viewsA: Internet Explorer restricted script execution
The only way this does not appear is not to use Activex. This type of technology is dangerous to the user and exists only for legacy issues. As there is risk the user is at least warned of this and…
-
12
votes2
answers121
viewsA: Which of these three codes is the most recommended in memory and speed?
There is little difference and in PHP the concern should not be this. This is called micro-optimization and should be avoided until it proves absolutely necessary. If you really needed to optimize…
-
2
votes3
answers956
viewsA: Variable array assignment
I think this is what you want: $numeros = range(0, 9); shuffle($numeros); $id = array_slice($numeros, 1, 9); $mult = ""; for ($i = 0; $i < 9; $i++) { $mult .= $id[$i]; } Behold working in the…
-
28
votes3
answers7874
viewsA: ASP.NET MVC or Webapi?
They are separate things, so it is not a matter of being advantageous to use one or the other. They should be used for different purposes. Although they could be used together. So much so that the…
-
4
votes1
answer97
viewsA: Different ways of exposing data
Right or wrong is relative. I doubt there is a definitive answer to each case. You have to do what is ideal for the situation. In fact it needs experience to get each case right, especially when it…
-
4
votes2
answers607
viewsA: Foreach duplicating the data
I believe this is what you want. I see no reason for two foreachs. This solution was given because the viewBag was created in the wrong way. So she would look like this: ViewBag.Ferias =…
-
3
votes2
answers207
viewsA: How to create a database in SQL Server?
The user must be valid either in SQL Server or even in Windows if using delegated authentication to the operating system. using (var connection = new SqlConnection("data source=NomeDoServidor;…
-
3
votes2
answers145
viewsA: I used an array in a method parameter and do not know how to run
I think that’s all you want. teste.mostrarClientes(cliente); You can change this method to filter what has no initialized values. It is not the most correct but it works. if (cliente[i] != null…
-
2
votes1
answer1101
views -
4
votes1
answer2188
viewsA: Exception in thread "main" java.lang.Nullpointerexception
The fact that a program compiles does not mean that it is right. This code is very confusing, you are mixing GUI with data. You need to initialize the vector elements before using them. You are…
-
7
votes2
answers145
viewsA: Is it necessary to use metatags on administration pages?
Meta tags, even description and keywords can be useful for other things. They are documenting for your own use. So if you have any reason to use them, use. If you can’t find any reason why not use.…
-
3
votes1
answer412
viewsA: Create a method to get records by id
As you did not give more information I will put something that would work an application of mine. Of course you will have to make several adaptations, use the method properly or change it to take…
-
1
votes1
answer155
viewsA: Thread starts but there is no reaction
Threads are complicated. Even experts in them avoid using them directly when they can. Prefer to use Tasks where possible. This is the official recommendation and there are reasons for this. Avoid…
-
2
votes1
answer1277
viewsA: How to place image and text in the same Datagridview cell
You’ll have to create a class that can handle this. It’s probably not worth the effort to do again what someone else has done, so I’m gonna leave here what I found in the O.R. in that reply. using…
-
4
votes1
answer1688
views -
3
votes1
answer648
viewsA: Unilateral replication in Postgresql
If it is just a test server I strongly recommend to make the copy of the data on demand and not do it online. You will have to mount scripts to do this for you. In general it is a simple thing, to…
-
7
votes1
answer1262
viewsA: What are the limitations of the free Visual Studio Online license?
This is exactly what you described. Microsoft cannot give too many advantages to its users? :) Any project can be hosted there. Anyone can use under any circumstances. In fact it is not so…
-
3
votes2
answers233
viewsA: Is there any way to handle all Exceptions of the software?
Yes, there is. First there are some things I want to tell you. Save some exception (with the pardon of pun) very well justified there is only one place where you should capture the Exception. It is…
-
11
votes7
answers552
viewsA: What is the difference between these parameters (array) in these methods?
The first two are explicitly indicating that the parameter should receive one array. The latter no, a value of any kind can be passed. This is called hinting type in PHP. The first and last…
-
2
votes4
answers1209
viewsA: Button with pause function
There is a way. In these hours people discover something called separation of concepts (in English). Much of the code that is posted here that involves a graphical interface does processing within…
-
5
votes1
answer641
viewsA: A little more about File.Writeallbytes
It does not. This method is even blocking. It must run completely without external interference. You can create thread (and this is not even the most recommended way of doing it) that will not…
-
6
votes1
answer282
viewsA: Is sending parameters to another function using object or hash a good practice?
Once again I begin the answer by saying that good practice is doing right for the specific situation. In general it is common to work with objects when it makes sense to group various information…
-
37
votes7
answers2649
viewsQ: Should people’s names be stored in two or just one column?
In business systems, especially international Erps or even in websites we see that the register asks for the last name (last name) and the name (first name). In some cases there is even the middle…
-
3
votes2
answers215
viewsA: What are Git mod sets really?
These terms are not always used in the right way. Git uses snapshot which is a state of content at a given time, so it is also known as point in time. These snapshots are from the entire repository.…
-
14
votes2
answers898
viewsA: Are business rules always related to validation?
In fact it is very common that business rules are validations, but not necessarily. The interpretation of what is a business rule and what is a mechanism is not always very clear (I asked a question…
-
3
votes1
answer272
viewsA: Search the database with encrypted data
It was not given many details but by the described way I believe that is only encrypt what you want to look for, then the comparison will be made of the data encrypted with another data likewise…
-
5
votes2
answers362
viewsA: How do I convert LINQ to SQL for Mysql?
The comments gave to understand (I think) that you want to stop using SQL to use LINQ. On top of everything Vinicius said, you shouldn’t do that if you want the possibility to use several different…
-
6
votes2
answers558
viewsA: Break inside method that returns Boolean
If you want to give break and the return within the if, makes no sense. Can’t put anything after a return. If the problem is just the error that is occurring, just take the break because the only…
-
2
votes2
answers236
viewsA: Error: Undefined index
There’s a mistake in $myrow[ID] on the three lines of links that form the HTML. The correct should be $myrow['ID']. And it needs to encapsulate between keys because it’s a complex expression. So:…
-
6
votes1
answer115
viewsA: Running an app under development on a real device impairs its performance?
At first it does not harm anything directly. But... Your concern makes sense, if the application has problems it can at least leave the device vulnerable if it allows somehow to be accessed…
-
4
votes2
answers2812
viewsA: Decimal variable removing decimal places
If the error is occurring because a data was entered incorrectly, what is missing is a validation. You should avoid using any data without first being sure that it is suitable for use. You can never…
-
10
votes2
answers352
viewsA: What does the operator = mean in C#?
This is xor operator. In case he makes a self assignment. calculoChave ^= c; Behold working in the ideone. And in the .NET Fidlle. Also put on the Github for future reference. is the same as…
-
2
votes2
answers180
viewsA: Use Static Closures or Closures in PHP?
I am surprised that in one of these situations it is possible to access the $this. A static function should never be able to do this. But again, we know how language developers don’t think at all.…
-
3
votes2
answers102
viewsA: Is Binary cast available in PHP?
First the manual says it will be available in PHP 6 (which is a version that died). Or another version since even in this PHP is a mess. So you can’t test it now. This kind of operation shouldn’t be…
-
3
votes1
answer2956
viewsA: Is web tax printer possible?
If you are using a tax printer even for tax purposes, forget it, the legislation itself prevents use through browsers. Not explicitly but by the software type-approval requirements. Even if it is a…
-
6
votes2
answers3052
viewsA: Try and Catch continue running (after Exception)?
First I must insist that you should not do this. It makes no sense to pass up a programming error. I talk about it a lot and you can start reading in that reply. Second, it is not easy to help this…
-
3
votes1
answer680
viewsA: Lua print(table) in string (taking all its values)
I think this is what you want: Conta = {balance = 0} Contas = {} Senhas = {} Inicial = 5000 function Conta:withdraw (v) Conta.Balance = Conta.Balance - v end function Login() io.write("Digite seu…