All Questions

4
answers

What's the difference in using sprintf in relation to using variables within the string?

Looking at some libraries and examples, it is common to find sprintf in some situations that I find strange. Reading your documentation I noticed that there are several types of formatting , however I see some cases that I do not see...
asked on 18.01.2017 / 01:21
3
answers

What to do when the argument passed in the constructor is invalid?

I'm doing a card game in Java, and one of the classes takes responsibility for starting the game. In the constructor, I get the number of players that will participate. I am doing the validation of the amount of players in the constructor itse...
asked on 27.09.2017 / 23:32
2
answers

How to create a toggle button on and toggle off?

I have seen that in some registers, they are using the toggle button a lot. Would anyone know how to do this?     
asked on 30.10.2016 / 18:40
3
answers

How to round a number to the highest value in Mysql?

I was doing some testing in MySQL and then came the need to have to round a number to the largest. It would be something like: if($numero == 1.5){ $numero = 2; } Although I could do this, I wanted to avoid making if / else...
asked on 13.09.2017 / 16:16
1
answer

Move string and replace a specific PHP character

I wanted to replace, in a string, all occurrences of the & character with a e (or remove it). The character may be in the middle of a word or appear multiple times in the same string. Example:    Original value: John went...
asked on 26.05.2014 / 10:09
3
answers

Why does not my Array item change in the foreach?

In the method call: AlunoPrivado aluno = new AlunoPrivado(); aluno.addCursos("Portugues", "matemática", "história", "física"); boolean result = aluno.changeCurso("Portugues", "ciências"); Implemented method: public boolean changeCurso(...
asked on 06.02.2016 / 02:46
4
answers

Separate text by space except within quotation marks

I'm trying to use a regex to separate space-separated texts, except for those within quotation marks, for example: Entrada: texto1 texto2 "texto3 texto4" texto5 Saida: Array("texto1", "texto2", "texto3 texto4", "texto5" ); Entrada: "texto0 t...
asked on 05.03.2018 / 18:50
2
answers

Difference between til "~" and slash "/" at the linux prompt?

I'm starting a lower level part, where I'll schedule the users part, permissions and etc. My first question is ~ and / at the prompt?     
asked on 15.09.2017 / 13:53
3
answers

How to read CSV files in Java

I'm developing a web application, where after the user uploads a CSV file, my java application needs to read this CSV. Preferably separate the data into fields, so that you can add these to a database for example. After some research done on...
asked on 29.07.2014 / 20:31
2
answers

Is the hgroup tag unusable?

I was seeing some video tutorials on HTML5 and I came across the hgroup tag that serves to group h1 , h2 ..., reading this this morning I saw that it was removed from HTML5. Does it confer? is not it necessary to study it anymore...
asked on 30.07.2014 / 13:26