Posts by Ivan Ferrer • 12,096 points
772 posts
-
5
votes3
answers1124
viewsA: Javascript Access Modifiers
The above understanding is correct? R: x.b and var f = null, do not receive anything globally, because they are private attributes of class x, only work within it, as they were not used for…
-
0
votes2
answers1119
viewsA: Manipulating XML with PHP
You have to do a foreach in XML, see is very simple: <?php $note=<<<xml <note> <nome>xiro</nome> </note> xml; $xml = simplexml_load_string($note); echo…
-
1
votes2
answers99
viewsA: mysql autoincrement restarts alone
Comparing TRUNCATE TABLE: Any AUTO_INCREMENT value is reset to its initial value. This holds for both Myisam and Innodb, which usually does not occur with sequence values. DELETE FROM TABLE ... If…
-
14
votes2
answers1408
viewsQ: How and when should we use Interface to document systems in PHP?
I always wondered exactly, if it is a good practice, to make a system always making use of Interfaces, or this is not necessary? Interface People { public function getName(); public function…
-
1
votes3
answers2032
viewsA: How to relate tables in Mysql to more than one entity?
You are doing a wrong thing, the correct thing is you relate the person/user (or your entity) to the phones, and your entity you relate to his profile, even if he already has an entity, you create a…
-
2
votes2
answers355
viewsA: Download file by mobile device
You can try this, but it does not support all browsers: <a href="/caminho/imagem" download="arquivo-para-baixar.jpg" title="Nome da imagem"> <img src="/caminho/imagem/arquivo-para-ver.jpg"…
-
5
votes1
answer1033
viewsQ: How to consume a JSON url without using jQuery
How could I consume a URL with data coming from a JSON without using libraries like jQuery or something like that for a structure like: [{chave:valor1},{chave:valor2}]
-
4
votes1
answer1033
viewsA: How to consume a JSON url without using jQuery
Let’s imagine you have one json file. with the following structure: [ { "nome": "Luiz Paulo Silva", "email":"[email protected]", "idade":21 }, { "nome": "Pedro Felix",…
-
3
votes2
answers6191
viewsA: Consume API (JSON) in form fields, how to do?
You can do something like this to consume the API, using jQuery, the combo dynamic part is up to you, because it requires time and dedication to development, I believe this is your job. But luckily,…
-
1
votes4
answers607
viewsA: Get full number of an input
There is no recognized number, mathematically speaking, started by zeros, this is just a numerical formatting, so you must put its value in string format, with quotes, so that it is kept in the…
-
3
votes4
answers16671
viewsA: Synchronous Xmlhttprequest error on the main thread is deprecated
Try it like this, and see if it solves your problem: <script type="text/javascript"> $(function(){ $("#collapse1").load('indicadores.php?id_indicador=2'); }); </script> Obs: jquery does…
-
3
votes4
answers668
viewsA: Retrieve dynamic input and insert into the bank with Procedure
The problem seems to be in the way you are executing the submission and the way you are trying to insert the data into the database. One important detail I recommend is to remove the id of…
-
0
votes2
answers899
viewsA: Configuration of . htaccess not working
There are a number of factors that should be considered, but try it this way to see if it will work: RewriteEngine On RewriteRule ^(.+)$ desenvolvimento/uniseries/site/$1.php [QSA,L]…
phpanswered Ivan Ferrer 12,096 -
2
votes3
answers66
viewsA: How to insert an Else to display message in case you don’t have files to upload
In your case, I believe it’s quite simple: <?php $files = $obj->field('upload'); if (!empty($files)) { foreach ( $files as $file ) { $file_url = get_attached_file($file['id']); echo '<a…
phpanswered Ivan Ferrer 12,096 -
7
votes1
answer3146
viewsQ: Can the MD5 hash repeat for different passwords causing collision?
A co-worker made a System in Java that encounters collisions in a series of MD5 hash passwords. But he did not stop to analyze the results, he made only a statement that they exist. Only that I…
-
3
votes2
answers244
viewsA: How to inject a variable into a page that was required by a function
You can do it this way, and pass the parameters: class View { function render($file, $variables = []) { extract($variables); ob_start(); include_once _APP_ROOT . DIRECTORY_SEPARATOR . 'tema' .…
-
2
votes6
answers1100
viewsA: Same number of characters in password after md5
The md5() is irreversible, the encrypted password is not accessible, the amount of characters will always be 32, the rash of the md5 can be repeated even if they have passwords of different…
-
6
votes8
answers1094
viewsA: Is it recommended to use constants for configuring a PHP project?
To constant is not a recommendation to use in settings, is a way to maintain a constant datum throughout your project, which will be used repeatedly in various places. In various situations, we may…
-
3
votes2
answers1951
viewsA: Testing whether a radiobutton input is selected in PHP
First, let us consider the following rule:: Radio Button: To select only one value (the same is kept name for all inputs, what changes is the value. Checkbox: Used for multiple selections. Name and…
-
1
votes2
answers1074
viewsA: How to do for when click on an item from a menu to receive the corresponding view tab in Angularjs?
Do more or less like this and see if it resolves: var angularApp = angular.module('MyApp', ['ui.bootstrap', 'ngSanitize', 'ngRoute']); var url = window.location.href; var levels = url.split('/'); if…
-
4
votes3
answers988
viewsA: Is it possible to include more than one.php file in the path of a Require?
Instead of using manual includes, because you don’t use an autoload for all required classes? define('PS', PATH_SEPARATOR); define('DS', DIRECTORY_SEPARATOR); set_include_path(get_include_path() .…
-
1
votes3
answers4206
viewsA: Catch callbacks from an ajax
First understand that there are different concepts about HTTP request. When it comes to a Client/Server request, the URL that is sent via POST, GET, PUT or DELETE, made through an AJAX request, is…
-
1
votes2
answers1115
viewsA: URL rewriting with parameter for another site . htaccess
For redirection I use to 301: Redirect 301 ^(www.)?velhosite\.com\.br/?people=alguem$ http://novosite.com.br/?pessoa=alguem Redirect 301 ^(www.)?velhosite\.com\.br/uma-pagina-qualquer?people=alguem$…
-
1
votes3
answers4049
viewsA: How to check if my current time is in an hour interval?
The form I recommend and is the most indicated, using the object new DateTime(): function checkInterval($dateInterval, $startDate, $endDate) { $dateInterval = new DateTime($dateInterval); $startDate…
phpanswered Ivan Ferrer 12,096 -
2
votes2
answers61
viewsA: Doubt $http Angularjs
There is no problem in using the POST method instead of GET. This method is safer and has a better data capacity than GET. In this method a parallel connection is opened and the data is passed…
angularjsanswered Ivan Ferrer 12,096 -
3
votes2
answers985
viewsA: Chronometer between two Angularjs dates
I created a directive on Angular JS for that reason: angular.module('iCountdown', []) .directive("iCountdown", function () { return { restrict: "EAC", scope: { setStartDate: "@", setEndDate: "@",…
-
1
votes5
answers269
viewsA: Changing text in several different places of the HTML page
For simplicity, I suggest making a method in jQuery, but if you want to write a little more and be independent of the library, you can do as the example suggested by @Tobymosque: The content in…
-
0
votes4
answers2965
viewsA: convert json to php object
Try something like this and tell me what happened? function json_encode_private($object) { $public = []; $reflection = new ReflectionClass($object); foreach ($reflection->getProperties() as…
-
4
votes1
answer1018
viewsQ: How to remove an already selected item from an upload Multiple
I have this example and would like to remove an item from my selection. However it is not removing properly, has a problem with the index number, how could it solve this?…
-
2
votes3
answers4981
viewsA: How to customize input file?
I suggest you do so: CSS @import url('http://fonts.googleapis.com/css?family=Open+Sans'); #multiple_upload { position:relative; } #uploadChange { position:absolute; top:2px; left:0; opacity:0.01;…
-
0
votes3
answers1751
viewsA: Receive Json array and insert into a loop with HTML
There’s N ways of doing, but always try to avoid writing the method .html() inside the loop, this overloads the method and may not work properly. Note that I output the HTML after the loop FOR:…
-
0
votes2
answers56
viewsA: How to remove a position from an Arraybuffer in javascript?
You can do so, that it will remove the element from the array: ArrayBuffer.forEach(function(value, index) { if (value == '21') { ArrayBuffer.splice(index, 1); } }); See working here…
javascriptanswered Ivan Ferrer 12,096 -
1
votes1
answer13076
viewsA: How do I generate the "apk" of my IONIC application
I was using zsh instead of batch. I managed to solve by doing the following, I typed in the console: cd ~/ ls -lha vi .zshrc I have included the following lines: export…
-
0
votes2
answers2664
viewsA: Manipulate and model Json object
Use the function push() to add elements in the array, you can separate it into layers before rendering: For more information about the chart, see documentation: AmCharts.useUTC = true; function…
-
2
votes1
answer13076
viewsQ: How do I generate the "apk" of my IONIC application
Following the documentation, should be two simple commands: To include the platform: ionic platform ios android To compile: ionic build android However, I’m getting a lot of red error on the…
-
1
votes2
answers1124
viewsA: Pass data to another input
Use the Select multiple: <!DOCTYPE html> <html lang="pt-br"> <head> <meta charset="utf-8"> <title>Múltiple Select</title> <link…
-
1
votes1
answer962
viewsA: Filter between two Ionic dates
$scope.prestadores = [ { "codigoPrestador":9520, "nomePrestador":"Diego", "dataPagamento":"2015-04-30T00:00:00-0300", "totalDebito":6327.59, "totalLiquido":96560.2, "totalLote":102886,…
-
2
votes4
answers1739
viewsA: Expire php link
Here I did an example using an expiration method based on a period interval: <?php function expireDate($dateStart, $dateEnd) { $dateCurrent = new DateTime(); $dateEnd = new DateTime($dateEnd);…
-
0
votes2
answers4294
viewsA: Line break of select options that contains a very long value
Here’s the answer to your problem: <section style="background-color:rgb(237.247.249);"> <h2>Seleção com texto longo abaixo:</h2> <select name="select_this"…
-
0
votes4
answers3805
viewsA: How to order an array dynamically with Angular JS?
Use the Angular JS filter orderby : In control, create an order filter: $scope.sortTasks = function(elem) { switch (elem.done) { case false: return 1; break; case true: return 2; break; } } And in…
angularjsanswered Ivan Ferrer 12,096 -
2
votes3
answers207
viewsA: I need a function to add <br> under certain conditions
Something like that? $(function() { var total = $('.post p:first').html().length; var line_brk = (total < 69) ? 69 : (total / 2); var el = $('.post p:first'); var data = el.html(); var t = '';…
-
2
votes2
answers3059
viewsQ: To group and remove lines with "null" values from this query in Mysql
CREATE TABLE tblCliente ( idCliente int(11), estado int(1) ); CREATE TABLE tblPergunta ( idPergunta int, idCategoria int, pergunta varchar(255), tipoResposta tinyint(1) ); CREATE TABLE…
-
0
votes1
answer24
viewsA: Redirect from domain to sub-domain with htacess
See if this solves: Redirect 301 ^(www.)?siteantigo\.com\/(.*)$ http://subdominio.sitenovo.com/$1
-
1
votes6
answers886
viewsA: Regular expression to grab the background-image url
I believe that regular expression should solve the problem: var css = 'background-image: url(1.png), url(2.png), url(3.png), url("3.png"), url('3.png');' var regex =…
-
1
votes2
answers1980
viewsA: How to group results from a row query to columns
The staff presented a solution to your problem: # Versao estatica SET @id_perguntas = '16,34,35'; SET @sql = NULL; SELECT GROUP_CONCAT( CONCAT('MAX(IF(cli_resp.idPergunta = ', idPergunta, ',…
-
0
votes3
answers10027
viewsA: How to show values stored in JSON in Javascript
To access a value from your JSON object: var dados = { valore: [ 2.51, 2.56, 2.87, 2.89, 2.94 ] }; //aqui vc está pegando o primeiro valor dados.valore[0]; //também pode ser acessado assim:…
-
2
votes2
answers97
viewsA: warning for empty in_array
To treat the error, you can do the following: function seuMetodoQueGeraPDF() { /* seu codigo vem dentro do seu método, e para qualquer condição de erro, você cria uma exceção. */ if…
-
0
votes2
answers31
viewsA: How to remove Level 1 keys using only one Callback method
I managed to do so: $myarray = array( array( array('id_usuario' => 1), array('idade' => 21) ), array( array('id_usuario' => 2), array('idade' => 15) ) ); $data = array_map(function($arr)…
-
2
votes2
answers31
viewsQ: How to remove Level 1 keys using only one Callback method
I don’t want to use foreach and neither for. For example, I have the following array structure: Array ( [0] => Array ( [0] => Array ( [id_usuario] => 1 ) [1] => Array ( [idade] => 21…
-
0
votes3
answers1011
viewsA: Read a txt file by php and mysql and viewed by each user
Here’s a way to do it: function readMyFile($file) { $data = file_get_contents($file); $collection = explode("\n",$data); $collection = array_filter($collection); $keys = array( 'id_usuario', 'mes',…