Posts by Guilherme Nascimento • 98,651 points
2,383 posts
-
11
votes3
answers619
viewsA: What is String.raw for in Javascript?
The String.raw serves to avoid escaping strings like: \n \r \0 \x01 \u000A That is, if I do this: console.log(`foo\nbar`); It will show a line break, but if you do this:…
-
7
votes2
answers2309
viewsA: What is the isset equivalent of PHP in Python
Natively has not. If the need is to check only if the variable exists I recommend starting all variables with some value, such as None or False (depending on the need), there is no need to create…
-
3
votes1
answer33
viewsA: How to disable conversion ";)" to emoji in Wordpress?
You can add the plugin: https://wordpress.org/plugins/emoji-settings/ and then in the settings remove the option Enable emoji support: And click on Save Changes Note: If you’re using Rocketcache or…
-
1
votes1
answer47
viewsA: Warning illegal string offset
The mysqli_fetch_assoc does not return all values from the bank, it only returns one row at a time, when used foreach the value of $anuncio were actually strings, because the foreach was only a row…
-
1
votes2
answers37
viewsA: Enabling and disabling input
Simply your dial is wrong: $("nome").prop("disabled", false); Should be: $("input[name=nome]").prop("disabled", false); The selectors in the jQuery and in the document.querySeletor are similar to…
-
2
votes1
answer102
viewsA: class does not open
Your namespace is VISTAS, so you have to use the use in the index.php also: <?php ini_set("display_errors",true); error_reporting(E_ALL|E_STRICT); use VISTAS\Planos; require_once…
-
3
votes1
answer537
viewsA: sqlsrv_num_rows does not work
This is because it uses by default SQLSRV_CURSOR_FORWARD, in accordance with https://docs.microsoft.com/en-us/sql/connect/php/cursor-types-sqlsrv-driver?view=sql-server-2017, as indicated in the…
-
6
votes1
answer134
viewsA: Larger bass padding than defined in CSS
This is because the tag img by default uses display: inline;, so the behavior is not as of blocks, this spacing would be a spacing as occurs in texts, ie the <img> accompanies the alignment of…
-
3
votes2
answers764
viewsA: Automatic click along with full screen
This is unfeasible, first because if it were possible I really as a user would refuse to browse several websites, which would use this indiscriminately, many lay users would get lost without knowing…
-
3
votes2
answers2891
viewsA: Make page zoom default
The metatag: <meta name="viewport" content="width=device-width, initial-scale=2.0"> not for all environments and on desktop maybe this will not work. The estate zoom: ...; is not standard and…
-
5
votes1
answer866
viewsA: Reduce the size of a video with PHP
There is nothing like this with native PHP, no site uses the language itself to do the process, what they use is own software for conversion installed on the server, the software that will probably…
phpanswered Guilherme Nascimento 98,651 -
1
votes2
answers3562
viewsA: How to connect to Xampp Mysql from another server with Linux installed?
Phpmyadmin has no connection to access Mysql through Apis: mysql_ mysqli PDO As I have explained in: What’s the difference between Mysql and phpMyAdmin? mysql is a server that works by TCP, but not…
-
1
votes1
answer192
viewsA: Error in including file . js in wordpress theme
I believe that the "problem" is partially in the use of Rocket (https://wp-rocket.me), which is a plugin for caching and optimization of scripts injected into the page How can you read in their…
wordpressanswered Guilherme Nascimento 98,651 -
0
votes1
answer121
viewsA: namespace php7 does not find url?
Your PHP just doesn’t do anything, use it’s not like import java or using of C#, he is not a include, it is only a part of the language to reference a "namespace" with a nickname. As I explained in:…
-
1
votes1
answer894
viewsA: How to send PHP emails using port 587?
The function mail has to be configured in the back end of your server and your server has to have an SMTP email service, on Linux servers probably use the sendmail, but I’m going to the point where…
-
3
votes1
answer517
viewsA: How is a Nodejs application distributed to customers?
With Node.js (which allows you to create applications for server-side) and assuming you have control over the following aspects of your server: Entry and exit doors SSH (or can directly install…
-
1
votes1
answer262
viewsA: I want to take a current balance and add with previous balance
Your code is wrong mysql_query does not return data, it returns the handler of the executed query, so one must use mysql_fetch_assoc to take the values, for example: ps: add isset to check if the…
-
0
votes2
answers62
viewsA: PHP syntax error when inserting an image
Your error is in the upload line: if(move_uploaded_file($_FILES['imagem']['tmp_name'], "images/Produtos/".$nome_img){ There’s one missing ), should be:…
-
1
votes1
answer79
viewsA: Validating registration with filter validate regexp
Is because of the . in the beginning, which is considered the search for "a character" and more [a-zA-ZÀ-ú\s]+, that would be the second or more characters, see the difference: With .:…
phpanswered Guilherme Nascimento 98,651 -
1
votes2
answers32
viewsA: Search with regular expressions
Passing the parameter directly into the expression will cause problems: "/(\W|^){$urlHost}(\W|$)/i" You must escape the characters with preg_quote (as quoted by @W.Faustino with delimiter /),…
phpanswered Guilherme Nascimento 98,651 -
1
votes1
answer856
viewsA: What causes the error "(.text+0x5b5)Undefined Reference to 'printf'"?
The 130 line you wrote prinf instead of printf: if(espar>=(x*y)/2) { prinf(ESPARSA); } this is a typo, if there are other error messages it is probably due to the way you are compiling. For the…
canswered Guilherme Nascimento 98,651 -
1
votes2
answers54
viewsA: Take name via regex
I think the best way is to use DOMDocument PHP, which is properly for working with HTML, example: $get = '<!DOCTYPE html> <html> <head> <title></title> </head>…
phpanswered Guilherme Nascimento 98,651 -
0
votes2
answers4599
viewsA: Open a modal that comes from a different PHP page
Iframe is probably the solution (probably combined with .embed-responsive): <div class="embed-responsive embed-responsive-16by9"> <iframe class="embed-responsive-item"…
-
4
votes1
answer150
viewsA: Error importing class with use
This "class" needs to be in the composer.json, PHP cannot guess where it is located and the use is not equal to include as I explained in: /a/151492/3635 The Composer (which Slim uses), makes use of…
-
5
votes1
answer388
viewsA: Async Attribute and Defer Javascript - Async Pause Rendering?
HTML is not necessarily "paused", in fact what should be occurring is that some script execution that is manipulating the DOM of your pages, so it is not necessarily the async who paused something.…
-
1
votes1
answer1554
viewsA: Convert a word(DOC,DOCX) document to PFD using PHP or Javascript
phpgearbox/pdf Requires: http://phantomjs.org You can use the https://github.com/phpgearbox/pdf, shall install via Poser: composer require gears/pdf:* Then in his composer.json add: "scripts": {…
-
5
votes1
answer219
viewsQ: Is it incorrect (or problematic) to create a string array struct?
I’m not sure what’s the ideal way to create a structure (struct) that contains a array of string, in case I have a structure like this: #include <stdio.h> #include <stdlib.h> typedef…
-
6
votes2
answers198
viewsQ: strcpy is merging numeric format with other chars
I don’t know if I made myself clear in the title, but when using strcpy() to copy a char* to another when I put a format like this "teste" it works normally, but when I put a string 3 letter format…
-
1
votes1
answer1764
viewsA: Create word file in PHP
Use the PHPOffice/PHPWord, it is necessary to use composer, read about this: Then in the project folder run: Composer require phpoffice/phpword Then in your file you will run: <?php require_once…
-
1
votes1
answer214
viewsA: PHP$_SESSION is not recognized on the same server at a different URL
The session_start must come before any use of the variable $_SESSION, you’re using it wrong: <?php if( !isset($_SESSION['usuario']) ) { @session_regenerate_id(true); unset($_SESSION['usuario']);…
-
3
votes3
answers330
viewsA: How to return type radio value
Instead of using a for complex to do this, just use querySelector to get the item you want, like this: document.querySelector('input[name="credit-card"]:checked').value; If it’s jQuery, like this:…
-
1
votes2
answers138
viewsA: How to make an input redirect (equivalent to "<" on Linux) with Powershell?
Like alternative you could use your own mysql-client for this: mysql -u root database_name mysql> tabela /caminho/para/o/arquivo.sql
powershellanswered Guilherme Nascimento 98,651 -
1
votes2
answers91
viewsA: Unicode troubleshooting when trying to save a picture with latex text in Matplotlib
Probably the plot.pdf contains accents, maybe setting yourself at the top of the document: # -*- coding: utf-8 -*- import numpy as np from matplotlib import pyplot as plt ... If you are running via…
-
5
votes1
answer246
viewsA: Why does this string interpolation generate error
Because function does not run inside string (inside the quotes) the way you used: echo "$this->getNome() está andando."; So it’s like the string thought parentheses were not part of the method…
phpanswered Guilherme Nascimento 98,651 -
3
votes2
answers97
viewsA: Create a program that is usable on Windows
Programs created in the Java language run on the Java Virtual machine, so they are not stand-alone, they depend on the user having Javavm installed, it is impossible to run a program written in Java…
-
0
votes2
answers630
viewsA: Regex or Replace in Jquery
There are 3 errors in your script: $(#number) missing quotation marks in #number $(...) returns a jQuery OBJECT, so there is no method .replace, this method belongs to the String.prototype…
-
1
votes2
answers145
viewsA: create_function can be a risk to my code?
From my point of view the premise of using eval() and create_function() is basically the same as what I have answered in: Why do they say $_GET in PHP is insecure against sql Injection? The…
-
2
votes1
answer427
viewsA: Is there any way to detect the second monitor/screen with Javascript?
There is no, it is almost impossible to move to the second screen, must have a half dozen gambiarras that promote around claiming to work, but it is not something that responds correctly, ranging…
-
2
votes2
answers84
viewsA: How do I remove a git file with word spacing?
You probably have to put it in quotes, like this: "Novo Documento de Texto.txt" Assuming you’re talking about rm, should look like this: git rm "Novo Documento de Texto.txt" git commit -m "arquivo…
-
2
votes1
answer104
viewsA: PHP error after query in table "Call to Undefined Function mysql_error()"
First of all, PHP 5.2.4 is quite old, it would really be better to update it, download a newer version of Xampp or Wamp. Second, your title speaks mysql_error but in your code this mssql_error, soon…
phpanswered Guilherme Nascimento 98,651 -
4
votes2
answers269
viewsA: What is the __defineSetter__ and __defineGetter__property for?
So much Object.prototype.__defineSetter__ how much Object.prototype.__defineGetter__ are obsolete methods (and also were not standardized), in their places can use the method: Object.defineProperty…
-
3
votes1
answer4210
viewsA: Save contact, email and phone by clicking a link
Is not possible, HTML5 and Javascript Apis do not allow such interaction, it would be cool if there was a window that opens asking if the user would like to save, but there is no such functionality.…
-
1
votes4
answers208
viewsA: Identify missing value in numerical sequence
Based on the excellent suggestion of Anderson, however instead of thinking about the number of cards fixed the idea is to see the card of higher value, assuming that this is an exercise based on…
-
0
votes1
answer51
viewsA: Send an e-mail message to customers who responded to my website form
The From: should be the sender and not a fixed email: $headers .= 'From: Meu Site <[email protected]>'; Should be: $headers .= 'From: ' . $n_nome . ' <' . $n_email . '>'; Note that…
-
2
votes1
answer96
viewsA: Creating a CLI tool with NODEJS
Has 2 things strange in its code, which may be the problem. First your syntax shebang seems wrong to me (I’m not sure): #! /usr/bin/env node It should probably be without space after the #!…
-
4
votes2
answers1509
viewsA: Accountant of Visits
There are good services that already do this, such as Google Analytics, which in addition to giving you the total of visits in real time will also provide you: Visits from previous days Visits by…
-
1
votes2
answers96
viewsA: What’s wrong with this print line = ('Hello,' + full_name.title() + '!')?
In python 2 print is a language statement, not an object, or is to use the equal operator = doing with print as if it were a variable will cause error: Traceback (most recent call last): File…
-
2
votes2
answers253
viewsA: Problems with querySelectorAll
The protocol FILE:/// is not allowed to interact with fetch and neither Ajax (XmlHttpRequest), put to run on a local HTTP server such as Apache, there are many programs such as: Wamp Xampp Easyphp…
javascriptanswered Guilherme Nascimento 98,651 -
2
votes1
answer2183
viewsA: How to add javascript
Probably one of them is string and not a Number, see the difference: //Com string var currentUser = { profile: { hp: "300", attack: 100, luck: 10 } }; console.log(currentUser.profile.hp +…
javascriptanswered Guilherme Nascimento 98,651 -
2
votes4
answers71
viewsA: Repeat zebra style color only 5 by 5
Since you included the tag css then my suggestion is that you take advantage of this by using the selector :nth-child(...), similar to what Sveen fez. However I think you need an explanation, I made…