Posts by Marcelo de Andrade • 7,261 points
255 posts
-
0
votes1
answer93
viewsA: Organize Chart bar by date
The solution was to go through the array date and verify which days there was no payment recorded, assigning the value zero. So that the amounts were interspersed according to the payment day:…
-
0
votes1
answer93
viewsQ: Organize Chart bar by date
Using the Chartjs, I am generating a bar graph comparing the current and previous month, the day and amount of the payment made. The problem is that the Labels have a range from 1 to 31, the chart…
-
0
votes2
answers130
viewsQ: How to use the find with sum method?
Using Yii2, I want to get the result of the following consultation: SELECT data_pagamento, sum(valor_pago) FROM tbl_finlegado_titulo_parcela_baixa WHERE MONTH(data_pagamento) = 10 GROUP BY…
-
3
votes2
answers1618
viewsQ: Sort array by key, being a string
I have a random array containing in its keys, an alphanumeric sequence. Using the function ksort, get the following result: array(22) { ["A1"]=> string(2) "A1" ["A10"]=> string(3) "A10"…
-
8
votes2
answers193
viewsQ: How does a variable point to a pointer?
Reading this answer on pointers and arrays in C, there is the example below where the variable ptr points to the first element of this array. int array[42] = {42}; int *ptr = a; How this pointer…
-
1
votes5
answers446
viewsA: How can I capture a favicon from a site via PHP?
Using Stackoverflow as an example: <link rel="shortcut icon" href="//cdn.sstatic.net/br/img/favicon.ico?v=c6678b633455"> $html = file_get_contents('http://answall.com'); $dom = new…
-
0
votes2
answers230
viewsA: Search with date range
Using between: SELECT Id, data_inicial, data_final, valor FROM periodos WHERE PasseioId = 1 AND (data_inicial BETWEEN '2014-12-18' AND '2015-12-18')…
-
3
votes1
answer538
viewsQ: Angularjs + PHP: How should data be consumed?
Starting some readings on the Angularjs for a possible future project, it came to my mind some doubts regarding the client/server integration and the consumption of the data provided by the server.…
-
10
votes4
answers989
viewsA: Read input value type file doubt
With Wallace replied, he returns a jQuery Object. Thus, you are accessing the first ( and probably unique, in your case ) DOM element that returned from the object. You can access an element as…
-
2
votes2
answers182
viewsA: preg_split is not breaking the strings in the array
$foo = "<:termo.9:><:termo.10:><:termo.11:><:nome.2:><:text.4:><:codigo.5:>"; preg_match_all("/<:[a-z]+\.[0-9]+:>/s", $foo, $bar); print_r($bar); Will…
-
1
votes1
answer3090
viewsA: PHP site is downloading
As Vinicius remarked, the estate Location stays inside server. As answered in that matter soen, Change your code to: server { listen 80; root /usr/share/nginx/html; index index.php index.html…
nginxanswered Marcelo de Andrade 7,261 -
5
votes4
answers31386
viewsA: Sending email via Phpmailer to Gmail
Without any error information it is very difficult to treat the problem. Suppose you are using version 5 of Phpmailer. Include in your file the call from autoload :…
-
2
votes1
answer371
viewsA: Recover Item json - Facebook API
The way you’re doing, you’re saying access all values of date. If you want to display only the key message, access it: foreach ($json['data'] as $data) { print($data['message']); } If you…
-
0
votes1
answer276
viewsA: Pagination of products with PDO
To limit the amount of records of a query, use the clause LIMIT. SELECT * FROM `produtos` ORDER BY `id` ASC LIMIT 10…
-
1
votes1
answer269
viewsA: Place Portuguese posting date using [processwire]
According to this discussion, you can do this by setting the language in your config.php: $config->timezone = 'America/Sao_Paulo'; setlocale(LC_ALL, 'pt_BR'); And display the date as follows:…
-
3
votes1
answer79
viewsQ: How to organize arrays
In the documentation of Pear, it sets a pattern for how to mount the structure of an array: $some_array = array( 'foo' => 'bar', 'spam' => 'ham', ); This way, which I already use, separates in…
-
11
votes2
answers6946
viewsA: What is the difference between Template and Layout?
The concepts for Template and Layout apply beyond the web, and are used by N areas. Focusing on web development as your question: Template It is a set of files and instructions, containing only the…
-
5
votes2
answers1004
viewsA: How to put » and « in :before?
You can use hexadecimal code. &xxxx codes are HTML entities and not CSS, you must use alternative code. ul.breadcumb > li:after{ content: '\00BB'; /** Isso aqui funciona **/ } <ul…
-
3
votes1
answer48
viewsA: Syntax error in PHP reset() command
A tip is to activate the error display while developing, makes it easier to find the problems. If you want to try another way with the reset() function, you can assign the return in a variable and…
phpanswered Marcelo de Andrade 7,261 -
0
votes2
answers118
viewsA: Website, mobile version
You can detect the useragent and redirect it however you want. Take a look at Detect Mobile Browsers, using it would be as follows: In index.html, add the script detectmobilebrowser.js Open the file…
-
0
votes2
answers241
viewsA: Convert string into array along with delimiter
preg_split('/(com|para|by|por)/', $string, false, PREG_SPLIT_DELIM_CAPTURE );
-
3
votes2
answers241
viewsQ: Convert string into array along with delimiter
I am separating a string in array if there is a certain preposition in it ('com', 'for', 'por'), but I want the return of this string also containing the delimiter, ie the preposition. Using the…
-
1
votes2
answers79
viewsA: Refresh with php
You need to make an asynchronous request, known as AJAX. Using jQuery, it would be something like: jQuery(document).ready(function($) { $('#fav-add').on('click', function(event) {…
phpanswered Marcelo de Andrade 7,261 -
0
votes4
answers255
viewsA: How to read an input in the loop
The scanf is out of the loop. In order for each check of the number, it asks the user to type again, it must be next to the loop: int main () { int num; while(num!=7) { printf("Informe um número…
canswered Marcelo de Andrade 7,261 -
5
votes2
answers733
viewsQ: How to make a full date common?
I receive a string with a date, and unfortunately there is no way to change it, in the format: 1 de September de 2015 And make it into: 01/09/2015 The only way I could do this would be to break the…
-
1
votes1
answer162
viewsQ: How to check items in Hover?
I have a list of elements belonging to a gallery, where the elements outside the Hover will have a new class. The problem is when Hover occurs directly from one element to another and the class is…
-
8
votes2
answers1212
viewsQ: What does the application gain by using Type Hint?
In PHP 5 we know that the hinting type and now we can declare and force the type of parameter a function will receive. I believe it will help in the processing of the data more precisely, but what…
-
4
votes1
answer2364
viewsQ: How to notify the tracking of the post office to the user?
I own a eCommerce which are part of Post office, except the tracking system which only includes the tracking code in the order. I need every change in status to notify the customer via email. With…
-
16
votes1
answer12629
viewsA: Why should we use "IS NOT NULL" instead of "<> NULL"?
You cannot use arithmetic comparison operators to validate the NULL for they will always return NULL. To verify a value NULL use to operators IS NULL and IS NOT NULL. An example: mysql> SELECT 1…
-
0
votes2
answers285
viewsA: Google Maps API V3 Invalid Key
As the error itself informs: Invalid or unauthorized key By checking your script call, you forgot to add the parameter identifying the API: ?v=3 Exchange the: <script type="text/javascript"…
-
3
votes2
answers4716
viewsQ: How to force HTTP access (Unsafe)
When accessing https://domain.com or https://www.dominio.com, the below security error is displayed: I do not have SSL certificate and have no need at this time. When trying to force redirect to…
-
3
votes1
answer102
viewsA: What is this script running?
The script returns the current directory where this file is located, checks whether it is manipulable, and creates a new index.html file. Mass Defacement the defacers aren’t Selective in their…
-
3
votes1
answer179
viewsQ: How to redirect through a notification?
I’m sending notifications to registered users via Facebook about new events. How do I redirect the user to the event URL, sent via the Facebook API? private function sendNotification($userFbId,…
-
13
votes4
answers2688
viewsQ: How to add the ninth digit, fixed, using jQuery Mask?
How to add the ninth digit, in a fixed form, using the jQuery Mask? $('#telefone').mask('(00) 90000-0000'); This way I use is only optional.…
-
0
votes1
answer75
viewsA: Problem with generating txt via PHP
Make a replace before writing: str_replace("quote;", '"', $texto); Or str_replace(chr(39), '"', $texto);
-
0
votes1
answer311
viewsQ: Google Translate script does not translate and does not generate error
I am using the following script to translate a website. <div id="google_translate_element"></div> <script…
-
0
votes2
answers418
viewsA: Cakephp Does Not Redirect on the Online Server
This problem is common when there are sent headers. In place of redirect, try using the following and see which error is returned: <?php header( 'Location: http://www.google.com/' ) ; ?> When…
-
1
votes1
answer179
viewsA: Cakephp 3 - Vendors
Starting with version 3, the Vendor directory has been moved to the application’s ROOT. You can set a constant in bootstrap.php for the vendor directory, since this constant is no longer standard in…
-
8
votes2
answers3046
viewsQ: jQuery validate submitHandler does not work on firefox
With the following function below, I can send the data via ajax quietly in Chrome, but when testing in Firefox, no error occurs and the data is not sent. $('#form_lista_amiga').validate({ rules : {…
-
3
votes5
answers14567
viewsQ: How to access index from a javascript array
In giving console.log in the variable overlays, I have the following return: [Oh, 36: Oh, 37: Oh, 97: Oh, 98: Oh, 99: Oh, 100: Oh, 101: Oh] 0: Oh 36: Oh 37: Oh 97: Oh 98: Oh 99: Oh 100: Oh 101: Oh…
-
0
votes1
answer102
viewsA: How to handle a feed with . rss extension
$curl = curl_init(); curl_setopt_array($curl, Array( CURLOPT_URL => 'http://www.feedaqui.com.br/recent.rss'; CURLOPT_USERAGENT => 'spider', CURLOPT_TIMEOUT => 120, CURLOPT_CONNECTTIMEOUT…
-
1
votes1
answer102
viewsQ: How to handle a feed with . rss extension
I receive an XML via a feed URL with extension .RSS. I am trying to read the XML and was not successful. I tried it in the following ways: $url = 'http://www.feedaqui.com.br/recent.rss'; $xml =…
-
0
votes3
answers211
viewsA: How to go through the tuples for an ID and check their values?
Resolved as follows: SELECT * FROM `tabela_parcelas ` A1 WHERE NOT EXISTS ( SELECT * from `tabela_parcelas ` A2 where A1.id = A2.id and A2.situacao <> 0 ) ORDER BY id desc…
-
1
votes3
answers211
viewsQ: How to go through the tuples for an ID and check their values?
In a table where I record the amount of plots and the situation of each of them, I need to go through it and find the sales orders where all plots are paid. Ex: SELECT * FROM tabela_parcelas WHERE…
-
8
votes1
answer152
viewsQ: How to return an object by calculating dates?
I am calculating the difference between dates in a period. From today until x previous days: hoje = new Date(); periodo = new Date().setDate(hoje.getDate() - 5); That way the output is as follows:…
javascriptasked Marcelo de Andrade 7,261 -
-1
votes1
answer464
viewsQ: Magento does not load layout
By following the Magento documentation, I can’t change the content of a custom controller. It looks like the file. xml is not read but it does not return me any error and the route is working…
-
4
votes1
answer398
viewsQ: Paypal receive transaction update
I am integrating the Express Checkout API and there is a problem regarding the update notification for any transaction made. How Paypal will send me the notification? If a transaction has not been…
-
3
votes2
answers112
viewsQ: How to add offset in array for newsletter sending?
I have to send a newsletter to all network users. The problem is that the array, containing the result of the query, has about eight thousand records. How can I optimize it so that it does not…
phpasked Marcelo de Andrade 7,261 -
2
votes1
answer986
viewsQ: How to change the value of the meta tag?
I am trying to change the value of meta tags with data coming from the database but they are not filled inside the tags. The value is recovered normally and displayed within the script when the…
-
0
votes2
answers233
viewsQ: How to reload a page with load.gif?
Dear, how do I make the page reload so it doesn’t "blink"? I can leave a GIF on the screen while the page is reloaded? $('#objetivos-form').live('submit',function(){ var form = $(this); // validando…