Posts by Ivan Ferrer • 12,096 points
772 posts
-
1
votes1
answer1247
viewsA: How to fill a star rating?
The point is that you have a note from 1 to 5, which all indicates, in this sense, if the note is 3, you would have to make a checkbox in input number 3: <input id="stars" class="radioo"…
-
0
votes3
answers135
viewsA: Problem with Hover event in Firefox
Try it like this: $( '#work1' ).hover( function() { $( '#work2' ).attr("src", "/images/click.svg" ); }, function() { $( '#work2' ).attr("src", "/images/winter.jpg" ); } ); In jQuery, see working:…
-
-1
votes2
answers670
viewsA: How to use radio input with Hidden input
I did an implementation today for checkbox, but that also works for what you need with radio, take a look: HTML: <input id="chkCamp1" name="rad" type="radio" data-check="1" value="elemento 1">…
-
0
votes3
answers636
viewsA: How to deselect checkboxes when only one is selected?
There is no better way, what there is is solutions that meet the problem, in case I will present one of them: HTML: <input id="chkCamp1" type="checkbox" data-check="1" value="1"> elemento 1…
-
0
votes2
answers45
viewsA: AJAX with sync error
The biggest problem is that you are looping into nothing, because vc has an array and then there is another array inside, besides, the way you formatted the HTML break is incorrect too, I made an…
-
1
votes3
answers913
viewsA: Checkbox Fields From Database
From what I see, your problem is of condition, you are bringing only the marked inputs, in this case, just put all and ignore the filter, look just how you could do it: $getVehicleID =…
-
2
votes3
answers436
viewsA: What is the purpose of array_map to accept infinite array parameters after callback?
Within the array_map(), the method callback can perform a mapping with the other items in the list. <?php $array1 = array('vendedores', 'estudante', 'colaborador'); $array2 = array('balconista',…
-
9
votes3
answers8386
viewsQ: How to create a task scheduler without using cron and without using wordpress
I need to create an automatic method to schedule my email marketing system, to trigger emails automatically, without using the browser. Today my system is using cron, and every time I enable it on a…
-
-1
votes2
answers271
viewsA: Image appears "broken" after you changed the PHP version
I converted your method into a class, see if it helps you: http://viper-7.com/BOyUrk
-
1
votes1
answer149
viewsA: Injection of dependency into service
In service, it works differently: var teste = angular.module('userlog',['crypto']); teste.service('seuService', ['userlogService','cryptoService', function (userlogService, cryptoService) { //aqui o…
-
1
votes4
answers356
viewsA: Two-dimensional Array
It seems to me something very simple, follow an example: Consider that a matrix travels through the elements through an Axis: +------------------> x |[true, false, ...] |[true, false, ...]…
-
2
votes3
answers1340
viewsA: Removing spaces from a text file
To remove whitespace, use array_filter(): $abrirArquivo = fopen($uploadArquivo, "r"); while (!feof($abrirArquivo)) { $ler = fgets($abrirArquivo,460); $quebrar = explode(" ",trim($ler)); $quebrar =…
-
8
votes1
answer3054
viewsA: Doubt about double exclamation (!!) in javascript / Jquery
That doesn’t belong to jQuery, that’s Javascript. When you deny something twice, you are checking if a value is the inverse of false, try typing on your console: ! 'Hello World', and hit "enter",…
-
1
votes4
answers222
viewsA: Doubt in jQuery variable creation
the dollar sign ($) is an acronym for jQuery. Many people use it in variables only to represent that the elements worked belong to the jquery object, and not only to an attribute of the function or…
-
1
votes4
answers1698
viewsA: Retrieve checkbox values in an array
First of all, your code needs a few tweaks, I’ll reformat it below. For you to pick up a collection through a post method, you need to treat your inputs as array and capture them in the same way, to…
-
1
votes2
answers1591
viewsA: Get values of selected checkboxes and their respective prices
You can do the following, in your form, put the date-attribute (the parameter you want to capture): <input type='checkbox' name='acr[0]' data-id="1" data-valor="2.00" value='Queijo'/>Queijo -…
-
3
votes1
answer4404
viewsA: Mysql: Pivot (p rows/ columns) columns with the result of a query dynamically
I edited the answer to help at this stage: Put a zeroed value if it has no value for this: SET @sql = NULL; SELECT GROUP_CONCAT(DISTINCT CONCAT( 'case when projCenNome = "', projCenNome, '" then…
-
2
votes6
answers3209
viewsA: How to turn string into time in PHP?
You can use the object DateTime(): <?php $string1 = "12:04:32"; $string2 = "18:07:34"; list($h1,$m1,$s1) = explode(':',$string1); list($h2,$m2,$s2) = explode(':',$string2); $dateTimeOne = new…
-
0
votes2
answers294
viewsA: Problem when rescuing form data in Angularjs
First create a service: OBS: From what I noticed, you sent the url by passing parameters via get and not post. So I set it as a method get. //inicio do serviço .factory('FiltroEstabelecimentos',…
angularjsanswered Ivan Ferrer 12,096 -
3
votes4
answers127
viewsA: mount a regular expression
Here’s a simple way to do a validation: function checkBars(url) { if (url.indexOf('/') !== -1) { if (url.split('/').length > 3) { return true; } } return false; } if…
-
1
votes3
answers67
viewsA: Format buffer, php
This apparently seemed to me to be a JSON output, in PHP you convert this output like this in PHP: $saida = array( 'content'=>'<div id="_sub-item"> Espere, será exibido após o carregamento…
phpanswered Ivan Ferrer 12,096 -
1
votes2
answers319
viewsA: how to take an element from a table
What you got confused is actually the use of the variable in the case set x := x+1 means a simple sum of +1, that is to say, x is getting its current value more 1. DECLARE is used to create a…
-
0
votes3
answers81
viewsA: Spare me the news I’m clicking?
From what I see, you just go through the id into your Scope, and process your method for the same: .controller('LikeNoticiasHome', function($scope, $http, $stateParams, sessionService,…
-
0
votes3
answers358
viewsA: how to use date interval to count days?
Here an example of Countdown in jquery: http://jsfiddle.net/ivanferrer/wvfkbmf5/ And another in Angular JS: http://jsfiddle.net/ivanferrer/1cyxoytv/…
-
0
votes2
answers841
viewsA: Menu in PHP and HTML
When you make use of #ocorrencia in the URL, means you are pointing to an anchored place of your page. It will go through until you find the occurrence on the same page <a name="ocorrencia"…
-
1
votes2
answers1026
viewsA: How to use . Directive, modularization and layer splitting? Angularjs
Briefly, I will explain how the directives work. 1) to create a directive: app.directive("nomeDaDiretiva", function () { //seu método }); 2) to create a modulated directive:…
-
3
votes3
answers2852
viewsA: Passing Javascript Variable into an Input text
Just do this, so the variable is preserved in the script, but I recommend you improve it as it is very bad: function loginMeuSite() { var url_atual = window.location.href; var divLoginSite =…
javascriptanswered Ivan Ferrer 12,096 -
0
votes6
answers992
viewsA: Like saving today at the bank?
Create a datetime field, it will stick to the American format: Y-m-d H:i:s (Year-month-day Hour:Minutes:seconds): Then, for insertion, run the query like this: INSERT INTO tabela ( campo1, campo2,…
-
2
votes1
answer66
viewsA: How to make it a function to apply it to a PHP variable?
One way to do this is by using Angularjs: Counter model: http://jsfiddle.net/ivanferrer/b60djmho/ Model where you arrow the initial and final interval of the counter:…
-
2
votes2
answers462
viewsA: Search without returning PDO data
I believe your problem will be solved in this way: try { $termo = trim($_GET["termo"]); if (!empty($termo)) { $sql = "SELECT * FROM noticias WHERE titulo LIKE :termo OR conteudo LIKE :termo ORDER BY…
-
3
votes3
answers6427
viewsA: When should I use Empty or isset?
To summarize, here’s exactly what you need to know. Where it is empty, it will return bool(false): | valor com variável ($var) | isset($var) | empty($var) | is_null($var) |…
-
2
votes2
answers367
viewsA: User authentication with $rootScope
I suggest you determine a level variable before setting the routes this way: if (nivel == 1) { angularApp.config( ['$routeProvider', function ($routeProvider) { $routeProvider…
angularjsanswered Ivan Ferrer 12,096 -
0
votes5
answers446
viewsA: How can I capture a favicon from a site via PHP?
One idea I can give you is to first capture the site url using curl() or file_get_contents(): <?php if (isset($_GET['img'])) { $favicon = $_GET['img']; print_r(array('favicon'=>$favicon));…
-
0
votes4
answers327
viewsA: Search file name sent by json
If you already have a way out in json_encode() means there’s already been an upload processing, it doesn’t make much sense to recreate an upload form to send the same thing twice. Now what would…
-
1
votes1
answer239
viewsA: Why dynamically change the name of a variable in PHP?
Variable variant or variable, as you prefer to call it, can be used in n cases, but the most common of them is when you need to create a series of variables to apply in your system in a way that…
phpanswered Ivan Ferrer 12,096 -
0
votes3
answers2363
viewsA: Change height with javascript
Here’s a way to do it using jQuery: $('.botao').on('click', function() { var el = $('.minhaDiv'); if (el.height() != 1600) { el.height(1600); $(this).text('Ver menos'); } else { el.height(580);…
-
3
votes3
answers823
viewsA: Can I have Javascript write PHP?
The answer is yes, but not for the purpose you want. Using the Node.js it is possible to write files: Obs: all languages write files. But not all of them work together. fs.writeFile('message.txt',…
-
0
votes2
answers72
viewsA: Error opening network link
By network you won’t be able to, but I believe that if you do this, it might work, if you’re listing directories through the browser from a server: $dir = "\\\SR9/Infraestrutura/Controles/Termos/A/"…
-
2
votes2
answers386
viewsA: What(s) problems will I have with using ob_start() and ob_end_flush()?
When you use ob_start(); and end_flush(); You’re carrying a buffer of content. I do not recommend that you place class, connection, and config requests within these functions, for this you can use…
-
2
votes1
answer748
viewsA: How can I abbreviate a name to 2 words, ignoring (from, da, dos, das)?
A simple regular expression method will already solve your problem: function removeDaDeDiDoDu($name) { $name = preg_replace('/\s(d[A-z]{1,2}|a(.){1,2}?|e(.){1,2}?|le{1}|[A-z.]{1,2}\s)/i',' ',$name);…
-
1
votes2
answers3086
viewsA: Take Mysql data with PHP and move to Javascript
In case, you need to send a request via ajax and to list, you have to define the parameter that will be listed, in case I put a field tag: <?php require "conexao.php"; $sql = "SELECT tag FROM…
-
5
votes2
answers127
viewsA: How to invert values that are comma separated in mysql
If the data is coming directly in the string, just do this: <?php // se: "-46.63642120299626,-23.54854965191239,0" // está na variável: $row['latlng'] $params = explode(',', $row['latlng']); $lat…
-
2
votes1
answer562
viewsA: Enable php error page
I believe your problem is solved like this: RewriteEngine On RewriteBase / ErrorDocument 401 /401.php ErrorDocument 403 /403.php ErrorDocument 404 /404.php ErrorDocument 500 /500.php RewriteRule…
-
1
votes3
answers272
viewsA: is_numeric does not work with decimal separator ,
To change your string to a value, just do this, which will already work: <?php function convertNumber($val) { return floatval(preg_replace('/([,])+/','.', $val)); } $val = '0,2'; echo…
phpanswered Ivan Ferrer 12,096 -
1
votes2
answers962
viewsA: Friendly URL, images do not appear even putting absolute path
I believe this way you will release the files you need: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /projetolcj/ #acessa as requisições abaixo #se for um arquivos vazio RewriteCond…
-
3
votes2
answers1114
viewsA: How to connect two SELECT (combobox) in PHP and do Auto Fill?
The way I did the bottom is an example using ajax technology with jquery: <div id="select_m"> <label>Membros:</label> <select id="post_m" class='form-control'…
-
2
votes4
answers14598
viewsA: Print only the column of a matrix
Imagine your matrix is a table and you have an Axis: x and y: 0 1 .-----> x 0 | 1 5 1 | 7 4 2 | 8 3 V y If you want to access the position 7 (x=>0,y=>1). Just do it through the indexes:…
pythonanswered Ivan Ferrer 12,096 -
4
votes1
answer1917
viewsA: Insert value into the array at a given position via a conditional
Let’s assume your array is a collection like this: $colecao = ['item1','item2','item4','item5']; And you want to insert an item in key 2, after key 1 (item2) that was missing called "item3", just do…
phpanswered Ivan Ferrer 12,096 -
1
votes2
answers174
viewsA: Add consecutive fouls
I don’t know exactly how your database structure is, but I would do something like this: $where = array(); $where[] = "`d_matricula` = '{$res_['matricula']}' "; $where[] = "`d_ano_semestre` = '$sem'…
-
1
votes0
answers182
viewsQ: Help with Codewars partitionOn KATA
The exercise I’m doing did not give error in the tests, but when I give Ubmit, it gives error, and I don’t know where I’m going wrong, someone could help me?…
javascriptasked Ivan Ferrer 12,096