Posts by Ivan Ferrer • 12,096 points
772 posts
-
0
votes2
answers268
viewsA: Close button in <Md-select>
You can use the ng-click just denying his condition in the click, and use the ng-show, or ng-hide, however you prefer: angular .module('MyApp', ['ngMaterial']) .controller('MyCtrl', function…
-
0
votes2
answers2249
viewsA: How to release CORS to a particular address?
Try adding headers to your app: $http.post("http://localhost:9991/login", credentials) .header("Access-Control-Allow-Origin", "*") // acesso total //.header("Access-Control-Allow-Origin",…
-
3
votes3
answers619
viewsA: Urls array - Next button
Capture the elements through the ID, and create an action on the button, checking which next index should be clicked, at each click, sum a position, if it is equal to the url total, it restarts to…
-
2
votes2
answers672
viewsA: Remove comma out of square brackets - Regex
A simpler way to remove the comma by ignoring the rule of square brackets in the sentence, using regular expression, as below, it replaces: (comma + number) /first house, by (number) / second box:…
-
0
votes3
answers88
viewsA: Insert non-existent months into the array
Another way to do this is by filling in the gaps of a second object: var el = [{4:3094}, {6:9873}, {7:6531}, {12:10937}]; var complete =…
-
2
votes1
answer1414
viewsA: Filter php mysql table by date
What you need would be something similar to this, I believe: $dataInput = '31/10/2016 10:20:00'; //equivalente -> $dataInput = $_POST['data_automovel']; //ou somente a data $dataInput =…
-
3
votes3
answers3050
viewsA: How to change the color of the input using jquery Validate?
One simple way to do this is to assign the classes through the object parameters, using errorClass or validClass, and set the color of these classes in the CSS: jQuery: $("#my-form").validate({…
-
1
votes1
answer832
viewsA: How to run the same php script via cron without overloading?
You don’t need to create 200 cron entries, to do the same thing, it will affect your server’s performance, causing even unnecessarily overload, even more using Curl. First, through the notepad,…
-
3
votes1
answer545
viewsA: Problems when exporting from PHP to CSV
A solution to avoid this type of problem is through a very well developed library PHP Excel: 1) After downloading the library PHP Excel 2) Just use it as follows from your code:…
phpanswered Ivan Ferrer 12,096 -
2
votes1
answer84
viewsQ: Error when injecting googlemaps script source via method
I would like the geocomplete not this error, however, to work, it depends on the google maps API. I removed from the header the following script and passed via method: <script id="id_script"…
-
0
votes4
answers654
viewsA: Pass parameters in JS functions
The problem is that your vetor[j] is an array with object, and in setAttribute, you are setting a string of the method. In this case, the object was not recognized as a string, you need to convert…
javascriptanswered Ivan Ferrer 12,096 -
0
votes1
answer158
viewsA: Validate fields with javascript in Safari browser
Try closing the script like this: HTML: <div class="modal fade" id="remarcar" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document">…
-
1
votes1
answer920
viewsA: How to sort a foreach by an array value?
Two ways to solve the problem: in the SQL query, place at the end of your query order by Score DESC. order your array, picking the collection before the loop: asort() is decreasing, sort() is…
phpanswered Ivan Ferrer 12,096 -
1
votes1
answer137
viewsA: Autocomplete + PHP + MYSQL
You can already see that there is an error in the variable of your query: numMatricula => $numMatricula: "SELECT * FROM DBWEBCAD WHERE MATRIC LIKE '%$numMatricula%' OR DTADM LIKE…
-
10
votes3
answers9006
viewsA: How can I make a Brazilian time clock in real time
A very simple way to do this, using Timezone: var myVar = setInterval(myTimer ,1000); function myTimer() { var d = new Date(), displayDate; if (navigator.userAgent.toLowerCase().indexOf('firefox')…
javascriptanswered Ivan Ferrer 12,096 -
1
votes4
answers2211
viewsA: JSON Object Object Object
I believe it’s something similar to what you want: function createMyObject(myKey, myCollection) { var myObj = new Object(); myObj[myKey] = myCollection; return myObj; } var objName =…
-
0
votes2
answers1268
viewsA: Add Date methods using typescript
You can do something like just that: class DateFormat { private data:Date; private dateFormatted:string; private masc:string = 'Y-m-d H:i:s'; private dia:any; private mes:any; private ano:any;…
-
2
votes2
answers2343
viewsQ: How to convert a javascript file to ts format?
I know that the Typescript language is used to compile Javascript files. But I wonder if there is any tool that makes it possible to do the reverse. Is there any way to convert a Javascript file to…
-
0
votes1
answer103
viewsA: Scroll through a.txt file and extract a "PK" from the file
If it’s just to extract the number from the string, you can do just that: $value = 'a:1:{s:5:"items";a:1:{i:0;a:1:{s:2:"pk";i:1338838365890273563;}}}'; preg_match('/"pk"\;i\:([0-9]+)\;/', $value,…
-
4
votes4
answers3012
viewsQ: How to convert scientific notation to full number string
What php function should I use to do this type of conversion? Convert: 1.3388383658903E+18 to: 1338838365890273563 I tried that, but it didn’t work: echo sprintf(sprintf('%%.%df', 0),…
-
1
votes0
answers202
viewsQ: Security of the HTTP authentication method
A colleague once told me to use that method of authentication is very insecure. And proved putting user as: true and password: true, within a system that used it and got through. But I believe the…
-
0
votes2
answers351
viewsA: Identify differences between two similar projects
To solve the problem using PHP Storm follow this tutorial, within the project, I clicked CTRL+D, and in the window that opened, I selected the directories of the two projects, placing each side by…
-
2
votes1
answer64
viewsA: Unknown error caused by videojs library
I solved the problem by changing the "autoplay" rule, because in Chrome I was not running "autoplay", without first completing uploading in the video Dom: $(function() { var myPlayer =…
-
0
votes1
answer30
viewsA: Wrong route request when placing Ionic-slide-box on home
I discovered the problem, I had to change src: <img src="{{slide}}" width="100%" height="100%" border="0"> For ng-src: <img ng-src="{{slide}}" width="100%" height="100%" border="0">…
-
2
votes1
answer64
viewsQ: Unknown error caused by videojs library
The script works normal, but the console is giving the following error: '//@ sourceURL' and '//@ sourceMappingURL' are deprecated, Please use '//# sourceURL=' and '//# sourceMappingURL=' Instead.…
-
0
votes1
answer30
viewsQ: Wrong route request when placing Ionic-slide-box on home
I have the service in this file www/app/home/home.service.js: angular.module('app.home') .service('services', ['$http',services]); function services($http) { var service = {}; var self = this;…
-
1
votes2
answers43
viewsQ: How to extract the link title from a responsive menu?
I have the following menu structure: <ul id="responsiveAccordion" class="showedmenu"> <li><a title="Página Inicial" href="/">Página Inicial</a></li> <li…
-
3
votes2
answers351
viewsQ: Identify differences between two similar projects
I have two projects in PHP: one is a store in Rio, and another is the store in São Paulo. Basically, the SP is at the root, and the Rio is "almost" as a clone of the SP project. Each project is…
-
2
votes3
answers230
viewsA: Extract data separately from a date in string format
If the idea is to present a more beautiful date to the user, there is a simpler way to do, in a similar but different format: //se a data fosse: new Date('Tue Aug 02 2016 15:28:14 GMT-0300 (BRT)');…
-
4
votes3
answers3129
viewsA: How to list the properties of an object in php using foreach?
You can create a method to list attributes internally, nothing prevents you from using a foreach this way: class Usuario { private $nome; private $profissao; public function setNome($nome) {…
-
11
votes1
answer1156
viewsQ: Difference between Pipes, Fork and Threads
From of that question, I was curious to learn more about the subject, so researching further, I came across more doubt on the subject. Because I saw that there is a string of ways to use Threads. We…
-
3
votes1
answer197
viewsA: Direct with htaccess without changing the url
put a file . htaccess in the folder "crm": http://www.site.com.br/crm/ Like the code below: RewriteEngine On RewriteRule ^crm/(.*)$ ./sistema/$1 And inside the folder "system", put another file .…
-
1
votes1
answer392
viewsA: Filter with chekbox mysql php
Apparently $table.$key would be nome_tabela.campo and $value the table value, then the correct one would pass an array structure similar to this format: $table = 'imovel'; $arrIn = array(…
-
1
votes4
answers2583
viewsA: Can PHP’s unset() function improve performance?
The builder unset(), does not have much effect or impact on the performance itself, but can improve performance, over a process that is being used later, such as session use for example, if you…
-
0
votes2
answers863
viewsA: Calling function after choosing date
I believe that would solve your case: $( "#input" ) .datepicker({ //regras do datapicker aqui }) .on( "change", function() { //this é o elemento input, o valor seria: this.value…
-
1
votes2
answers115
viewsA: Converting two Mysql selects to one
In your case, as you are not injecting any code, I do not see the need to pass a variable at the risk of sql Injection for no reason. /* Isso "t1.*,t2.*,t3.*" é o mesmo que isso "*", mas se você, de…
-
0
votes3
answers2128
viewsA: Send PHP variable to Shell Script
In the shell file script.sh do the following: #!/bin/bash NAME='filename' DIR='path' echo $NAME echo $DIR tar -zcf $NAME.tar.gz $DIR In PHP do so: $file = "script.sh"; if (file_exists($file)) {…
-
0
votes5
answers1390
viewsA: Page redirection according to access country
One way to do this is by using an API, which identifies the country, see the example below: function isBrazil() { $location = file_get_contents('http://freegeoip.net/json/'); if ($location) { $data…
-
1
votes3
answers1248
viewsA: How do I redirect the site when it’s a mobile?
Based on Sergio’s response, I’m going to publish here how I managed to solve the problem: function redirectIfWidthLargeSize(e) { var w = $(e).width(); var mobile = e.matchMedia("only screen and…
-
5
votes3
answers1248
viewsQ: How do I redirect the site when it’s a mobile?
I have the following code that should work, but on mobile does not work in Chrome browser: var permitir_mobile = true; var mobileUrl = 'http://m.meusitemobile.com.br'; $(document).ready(function() {…
-
2
votes2
answers285
viewsQ: How to align text with the image when the image has a vertical format
I have the following CSS: .logos { max-width:1024px; vertical-align:middle; align-items: center; justify-content: center; margin:auto; } .logos img { max-width: 100%; max-height: 100%; } .logos…
-
1
votes5
answers14748
viewsA: Take part of a string delimited between characters
Try it like this: $string = 'Lorem ipsum /dolor sit amet/, consectetur /adipiscing elit/.'; function removeParseContentBar($string) { $arr = str_split($string); $i = 0; foreach ($arr as $k =>…
-
1
votes1
answer73
viewsA: How to take each value of a jquery object?
The structure is similar to the PHP array: var result = { "status": "accept", "info": "", "message": { "row": { "1": { "id": "1677", "state": "AC", "stateid": null, "address": "RUA MARIA LUCIOLA DA…
-
0
votes1
answer413
viewsA: Check array keys
If the idea is to check a key from an external collection and if it is equal to the value, you can do so: foreach ($chaves as $key => $chave) { if ($row['chave'] == $key) { echo 'ok, é igual'; }…
-
2
votes1
answer649
viewsA: update multiple records with php mysql
The solution to the problem is very simple, so also you avoid sql Injection: <?php function submitList($post = array(), $con) { if (count($post['id'])) { foreach ($post['id'] as $k => $id) {…
-
4
votes1
answer93
viewsA: How to add an HTML code inside an <ol> tag using Javascript?
Use the jquery append method: $(document() { $('#demo').append('<li><table> ... </table></li>'); }); Example in Jsfiddle Or direct Javascript: // criando um nó do tipo…
-
1
votes2
answers591
viewsA: Send SMS by PHP
One way to do this is by creating a loop, and a check by sending status: 1) In your bank’s select, create a field: status_envio with the value 0 by default. 2) Then make a select with the condition:…
-
1
votes1
answer142
viewsA: PHP functions adapted to Mysql
To record you can do the following: INSERT INTO tabela (id, content) VALUES (1, AES_ENCRYPT('seu conteúdo aqui', 'senha123_hash')); And then recover like this: SELECT CAST(AES_DECRYPT(content,…
-
3
votes2
answers155
viewsA: Make a function that generates the XML string and not the XML itself PHP
Doing this doesn’t solve the case? function convertXML($dados) { $xml = new SimpleXMLElement('<tag_header/>'); array_walk_recursive($dados, array ($xml, 'addChild')); $dados =…
phpanswered Ivan Ferrer 12,096 -
0
votes1
answer97
viewsA: Send two inputs for verification, ajax and php!
$(function() { var user_us = $("#fone"), user_us_ramal = $("#ramal_tel"); $("#resposta").hide(); $("#fone,#ramal_tel").blur(function() { var valA = user_us.val(), valB = user_us_ramal.val();…