Posts by Marcos • 1,407 points
59 posts
-
0
votes2
answers41
viewsA: Can I name folders in Gtihub with special characters?
Github has supersede Unicode characters. But to avoid problems it is recommended to avoid special characters.
-
1
votes4
answers1580
viewsA: Is this a common practice in object orientation?
Yeah, it even has a name anemic model. Which doesn’t mean you’re right. Your second example is already more aligned with the idea of object orientation. A link to understand a little more:…
-
0
votes1
answer40
viewsA: Generate sql from a js return
PHP can look like this: $filtro = "Cadastro Iniciado,Aguardando aprovação de cadastro,Cadastro Aprovado,Carta Solicitada,Desistência de Cadastro,Carta Negada,Carta…
-
1
votes1
answer3960
viewsA: How to resolve Illegal offset type message
All indicates that the variable $id is not a valid index for the array $_SESSION["quantidade"]. Do so only to run this line if it is a valid index. session_start(); $acao = $_POST['acao']; if (…
-
0
votes1
answer510
viewsA: How to decrease the amount of if
A good start is to extract the logic that is in PHP for small functions. For example, codes like the below can be changed as follows: if ($data_confirmacao != 0) { $data_confirmacao_inativa = ''; }…
-
2
votes1
answer2193
viewsA: Json with Array within PHP array
The problem is using the array inside the string. PHP is trying to convert $cliente->addresses for string and not the full expression $cliente->addresses[0]->city Switch to any of the…
-
0
votes1
answer73
viewsA: Save user id automatically to entities with Doctrine
After the persist Doctrine populates the entity id: $em->persist($account); $em->flush(); $account->getId(); The $account->getId() will return to you the generated id.…
-
0
votes1
answer475
viewsA: Duplicate Bulk Records - Run a query for each displayed record
You can continue using your query that does an Insert at a time, just by placing it inside a loop that goes through all items. $query_itens = $tPdo->prepare("SELECT ID FROM tab_contas WHERE…
-
0
votes2
answers451
viewsA: Hover one element and capture another tag
In that order - the element with hover affect an earlier element is not possible, only a later one. But since what matters is the order in html, nothing prevents you from changing the visual…
-
4
votes3
answers289
viewsA: Condition Yoda, good reason to use?
The advantage of Yoda conditions is to expose possible bugs by typos, replacing a == for =. In the code below, the condition will always return true, causing unexpected application behavior - which…
encoding-styleanswered Marcos 1,407 -
1
votes1
answer74
viewsA: "A data type is an abstract concept defined by a set of logical properties." - What does that mean?
He means that a type of data is defined by the rules we set for it during its implementation. It is a structure with predefined rules - in the implementation - for which data can be stored in it or…
-
1
votes2
answers178
viewsA: Identify the right textarea to send when pressing Enter?
The problem is that javascript is referencing the textarea #texto_coment, but in the textarea the id is another texto_coment_<?=$post['id']?> The solution is to make javascript reference the…
-
5
votes1
answer4783
viewsA: How do I make an infinite loop without bursting the memory?
Memory is increasing because every iteration is adding a value to the variable quote. One solution is instead of Ravas this data collected in memory is to save to disk. It may be in some file or in…
-
0
votes2
answers83
viewsA: How to instantiate an object according to a Front End event?
From HTML you cannot run a PHP code. What you can do is use javascript to make an http request for a PHP script that runs what you want. You can make a call as in the code below in the action you…
-
1
votes1
answer87
viewsA: Show fields if different from 0 (zero)
You can check if the produtoN exists in the array with the isset() and also check if it is different from 0: <?php if(isset($customer['produto4']) && $customer['produto4'] != 0) { ?>…
-
0
votes1
answer77
viewsA: How to update the PDO database after running a Javascript (Countdown) function
The if (count == 0) because he must be out of if ((count -1) >=0): var count=new Number(); var count=10; function start(){ if ((count -1) >=0) { count=count - 1; } if (count == 0) { $.ajax({…
-
4
votes1
answer168
viewsA: Cannot import urlencode name on program run
It is a compatibility problem of Python2.x with Python3.x In python 2.x o urlencode was in the package urllib, 3.x is in the urllib.parse, exchange import should solve your problem: from…
-
2
votes1
answer1331
views -
1
votes2
answers123
viewsA: Using External Variable in Javascript/Jquery
The error message is warning the syntax {{order_total}} is wrong, that should not have the { there. If the variable exists in the scope you are in just use like this: var valordopedido =…
javascriptanswered Marcos 1,407 -
1
votes2
answers259
viewsA: Python/Postgres
On your machine? Yes. On Hostgator? Probably not, you can chat with their support to see if they don’t have any plans that meet your requirements. To install on your machine just download the…
-
2
votes2
answers316
viewsA: json_encode returns the asort() order
The problem is not in the json_encode, as you yourself showed in the preview comes in the correct order. The problem happens because in Javascript only arrays have defined order, but have no…
-
1
votes3
answers689
viewsA: phpMyAdmin is insurance against bruteforce?
One option is to use fail2ban to block certain access patterns. Having fail2ban installed, the configuration is more or less like this, it may vary depending on your server: /etc/apache2/conf.…
phpmyadminanswered Marcos 1,407 -
1
votes1
answer1006
viewsA: git does not eat charset changes
GIT does not alter the encoding of the file in any way. If the file is in ISO-8859-1 the commit will write the file that way, same thing to UTF-8. When a file conversion is done git will identify…
-
0
votes1
answer445
viewsA: View Mysql Related Tables Query
The JOINswould look like this: SELECT * FROM cliente c JOIN cliente_sistema cs ON cs.id_cliente = c.id JOIN sistema st ON st.id = cd.id_sistema JOIN servico sv ON sv.id_sist = st.id JOIN numero n ON…
-
3
votes1
answer920
viewsA: Download a PDF received from an API with Angularjs
The responseType in the request. The problem was not at this point, but at the request call, where the GET was made, it was missing to specify the responseType. That’s how the code works:…
-
2
votes1
answer920
viewsQ: Download a PDF received from an API with Angularjs
I have an API that returns me a PDF file. I want to make the angle hit this route and force the download of the PDF file. Today I do so: var blob = new Blob([arquivo], {type: "application/pdf"});…
-
1
votes1
answer59
viewsA: Angular ui router plus PHP
Have a group of extra double quotes, try without them: <a href="#" ui-sref="ver({parametro:<?php echo json_encode($array) ?>})"> clique aqui </a> Dare they are necessary, use…
-
1
votes2
answers44
viewsA: Invoke a page click and commit
PHP does not do this, but it is possible to make PHP call who does - Javascript with Jquery. PHP runs on the server, click happens on the client - in the browser. What you can do is PHP generate a…
-
3
votes2
answers263
viewsA: How do I make mysql_num_rows of various results
The mysql_num_rows will not solve easily. You can do a normal query that returns the total of each item: SELECT nomeitem, COUNT(iditem) as total FROM tabela GROUP BY nomeitem; This query will return…
-
1
votes2
answers1028
viewsA: How to perform an Insert or update of a JSON object
First you have to convert JSON to a PHP object or array using the json_encode() - http://php.net/json_encode Then check in the bank if the ids exist, if they already exist in the bank make a UPDATE,…
-
1
votes2
answers303
viewsA: How to recover data from an invalid form? PHP
If you are using the $_POST or $_GET to send the data, when you validate the data, identify that it is invalid and display the form again, the data is still available to you. So depending on how it…
-
1
votes2
answers323
viewsA: Syntax error in file . py
Missed a parentheses, stay like this: print ("Trying password => " + str(String_7)) It is a compatibility problem between Python 2 and Python 3, 2.x works, 3.x does not.…
-
2
votes1
answer1223
viewsA: Is it possible to run a different PHP in a given folder?
You can install more than one version on the same server yes. After installing the two versions of PHP, in the Apache configuration, on httpf.conf you can configure an extension for each version:…
-
0
votes1
answer86
viewsA: Module and hierarchies import - Python
Inside the module imprimir just import as follows: from operacao import soma
-
1
votes1
answer114
viewsA: Robo_feed routine of checking if loop giving dick in python
I managed to make the code run, the problem that was happening was the coding for base 64, which only works for ASCII characters, just convert to ASCII before converting. Another problem was in the…
-
0
votes1
answer213
viewsA: Problem with CIELO certificate using Django
It is a problem with SSL certificate. You should check if the SSL certificate was generated for the domain you are using. Another way is to ignore the certificate check - but make it clear that this…
-
-1
votes3
answers1160
viewsA: Meta tag for geolocation
From what I researched the tag exists, the point is that it is not an official standard. In Wikipédia explains a little about the pattern: https://en.wikipedia.org/wiki/Geotagging#HTML_pages Due to…
-
0
votes3
answers452
viewsA: There is a useful way to highlight an HTML element/tag(a) in a certain color
You can define a CSS rule for the tag itself. p { color: #F00; } So all the tags p will turn red color.
-
10
votes2
answers8121
viewsA: What is a Multi-tenancy?
Summarized multi-tenancy is when you have a system that accepts several users, where each user uses the system in isolation. An example is the wordpress with. where each user has their blog…
-
2
votes2
answers483
viewsA: Why was password_hash’s "salt" option discontinued in PHP 7?
It is safer to use a random salt. Now the function itself generates a random salt whenever it is called, before it was possible to prevent this by passing a less secure static salt. Source:…
-
0
votes1
answer196
viewsA: Php file to work alone automatically
You can run this PHP script by command line. Just run the following command on the terminal: php caminho/para/o/arquivo.php There you have 2 options, in this script create an infinite loop and let…
-
1
votes3
answers752
viewsA: How to format Date field in Ionic Form / Angularjs
The bank saves the date and international format year-month-day 2017-01-12. If the form is being completed in Brazilian format 12/10/2017 you must convert the date before sending to the bank. A…
-
3
votes2
answers47
viewsA: Problem with sending email with php
You are preparing the header correctly, but a few lines later you are rewriting the variable $header. The problem lies in that line: $headers = 'From: '.$user_Email.'' . "\r\n" . 'Reply-To:…
-
1
votes1
answer359
viewsA: Error while deleting file with unlink
Check before if the file exists using the command file_exists The code would look something like this: if(file_exists($caminho_para_arquivo)){ unlink($caminho_para_arquivo); } More information here:…
-
1
votes2
answers54
viewsA: Error using libraries in PHP
Namespaces are supported as of php 5.3, you’re probably using an earlier version.
-
0
votes4
answers127
viewsA: Redirecting in PHP
The error is happening because it is not possible to send the header after the contents of the file. Somewhere before the header() exists or an html tag, a echo or even a blank space outside the…
-
7
votes2
answers1168
viewsA: What defines a clean code?
There are several factors that define clean code, some that I consider important: Each function/method has a single well-defined responsibility, carrying out a single action. The use of variable…
-
1
votes1
answer103
viewsA: Swiftmailer - Corrupted HTML on receiving
Without seeing your code gets kind of hard, but I had a similar problem. Was using so: $html = $this->renderPartial('view',array(),true); It was resolved by changing the renderPartial() for a…
-
1
votes3
answers255
viewsA: Select with joins return last result per date
Instead of a JOIN how about a subselect with LIMIT 1 and ORDER BY vigencia?
-
7
votes2
answers1682
viewsA: How to make a "JOIN" in two Colections in Mongodb?
Mongodb can’t stand it joins. Unfortunately its structure does not match the functioning of Mongodb. Mongodb is a non-relational database, you must centralize the data of each query in the same…