All Questions

2
answers

What is the best alternative: define, enums or variables?

Recently, in a project where I have to declare many contributors, I had this doubt. What is the best option define's , enum's or constant variables? At first I think using enum is the best alternative for not polluting the...
asked on 06.03.2014 / 15:57
2
answers

What is the finally used in PHP 5.5?

PHP 5.5 has implemented a feature (which I've heard of in other languages) called finally , in handling exceptions (along with try/catch ) We have the following example: set_error_handler(function ($errno, $errstr, $errfile, $er...
asked on 26.01.2015 / 15:42
2
answers

Is there a performance difference between "new" and "clone" in PHP?

What is the advantage of using clone instead of new to create an object in PHP? I know that to use clone it is necessary to pass an instantiated object. But because it is not necessary to "redo" the instance there is sign...
asked on 16.09.2018 / 15:34
3
answers

How to check if user left the window

I would like to know a way to check if the user exited the window of my page with Javascript, for example, if he switched tab (to search for something in Google for example) the script changes the window title to another title that I define .....
asked on 09.03.2014 / 00:04
4
answers

Sorting an array of objects by date

Well I'm with an array of objects and I need to sort the closest to today to far away from today. For example today is 24/11/2015 ai I have in my array the dates: 30/11/2015 27/11/2015 25/11/2015 30/11/2015 In case the result I'm needing...
asked on 24.11.2015 / 14:08
4
answers

Working with values that greatly exceed the long (64 bit)

How are operations stored with numbers that exceed the limit values of type long and double ? How are the four primary operations done with these numbers (sum, subtraction, multiplication, and division)?    Context It is co...
asked on 29.02.2016 / 18:49
5
answers

Get value of an attribute in td

I have a PivotTable where there are 9 columns In one of the last columns there is a disapproval button , and when I click it, I want to get the name is in a td in the same tr dynamically. SCRIPT $(document).on("click", ".btn-d...
asked on 24.07.2014 / 15:31
3
answers

How do I prevent Django from finding IDs in the template?

I'm using Django 1.4 with location (L10N) enabled, which causes numeric values in the template to be formatted: 1.234,56 . The problem is that every time I put ID in the template, for example: data-id="{{ form.instance.id }...
asked on 11.12.2013 / 17:21
2
answers

Is it wrong to leave business rules in controllers?

I see in several code examples this, and even in the "default" project that is created in visual studio, they leave a good part of the rule in the controller Is it wrong? When to use this? What is the advantage and disadvantage?     
asked on 16.09.2014 / 22:40
2
answers

PHP 7 has typing arguments and return, but is optional. this is good or bad?

I would not like to raise a controversial issue here about the PHP 7 language, which was recently released, but only to understand some points about typing. Come on: In versions prior to PHP 7, the functions do not have return typing. We h...
asked on 11.01.2016 / 14:19