All Questions

1
answer

JavaScript generating float with several decimal places

When creating an ordering system (quantity x value) I noticed that in some cases when adding broken values, JavaScript returns numbers with many more decimal places than expected. Example: (123*1.23)+(312*3.26) //retorna 1168.4099999999999...
asked on 17.08.2014 / 21:18
2
answers

How to allocate dynamically when I do not know how many positions I will use in C?

In a part of the code I need to transform an integer into binary and store it in a vector of characters, however, I do not know which integer I'm going to get to binary, so I do not know how many positions my vector will have %. How to handle...
asked on 31.08.2015 / 02:56
3
answers

Assign type to parameters

Is it possible to assign types to the parameters in functions in PHP? Example: public function random(int $length) { // ... }     
asked on 07.03.2015 / 23:30
3
answers

Generate setters only in the class constructor or generate outside the constructor

In Java classes, it is common for to create private attributes and to generate getters and setters for these attributes. But, I read that you can do something a little different: only generate the getters and leave the setters in the...
asked on 08.08.2014 / 15:06
3
answers

What is the purpose of {} in the code below? and what is the definition?

$objeto->{'getEndereco' . ucfirst($tipo)}()->getCep();     
asked on 04.07.2017 / 14:59
2
answers

Why does the address of some sites contain number after the www?

Why are there urls that contain any numbers after the www? (www1, www3, www12) What does this influence? Can I create a link like this? Ex: link link link     
asked on 06.05.2015 / 18:40
2
answers

What is the correct way to stop a "for" loop?

Let's say I have this for loop that works based on my array name: var nomes = ["Nome 1", "Nome 2", "Nome 3"]; for(i = 0; i <= 2; i++) { if(nomes[i] == "Nome 2") { console.log(nomes[i]); console.log("Stop!");...
asked on 12.05.2015 / 19:41
5
answers

How to import a variable inside a function of a class?

I would like to get the $valortotal and take it into a function of a class as can be seen in the example below. Thank you. $valortotal = 15.00; class CreatePaymentRequestLightbox { public static function main() { $pedid...
asked on 19.05.2015 / 22:10
2
answers

How to create and manipulate lists in PHP?

In java it is possible to create and manipulate list of any data type using List<E> , see the example below: List<String> lista = new ArrayList<>(); lista.add("Stack"); lista.add("Over"); lista.add("flow"); I created...
asked on 06.10.2016 / 15:21
4
answers

Error net :: ERR_BLOCKED_BY_CLIENT when requesting Ajax

I came across a strange error when I tried to run an ajax request, and I was not very successful in finding solutions. Here is the error: Line199offorms.jsis$.ajax({in:$.ajax({type:"POST", url: _url, cache: false, data: {...
asked on 10.03.2014 / 21:06