Posts by Guilherme Nascimento • 98,651 points
2,383 posts
-
2
votes1
answer366
viewsA: How jquery events work
To first is a shortcut to $("button").on('click', function(){ $("button").click(function(){ alert('ok 1'); }); You can check in the source of the official repository alias.js#L10, this: jQuery.each(…
-
3
votes2
answers500
viewsA: How to add invalid status in html input fields?
Is not possible check emails in the database only using the "HTML API" (pattern=""), in WEB communication is all done via HTTP, so you need a request. You will need to do this using Ajax for…
-
3
votes1
answer319
viewsA: Preview PDF file on website developed with PHP, Jquery and CSS3
Use the PDF.js First download the PDF.js and take all scripts and add to your project, then on your page, on <head> should add: <script src="build/pdf.js"></script> To get the…
-
4
votes2
answers127
viewsA: Retrieve URI and Fragment Identifier (#)
It is not possible, the hash/hashtag (Fragment Identifier) cannot be recovered in the back-end, regardless of the language/technology you use, whether PHP, Asp.net, or JSP. This is because the…
phpanswered Guilherme Nascimento 98,651 -
1
votes2
answers621
viewsA: Do not let browser save password
I can not say, but I believe that in most browsers put themselves in the tag <form> should work: <form action="baz.aspx" method="post" autocomplete="off"> Of course regardless of this,…
-
2
votes1
answer31
viewsA: Identify which page requests another via require_once
You can in all page scripts create a constant like this: <?php define('PAGINA', basename(__FILE__)); require_once 'header.php'; And in the header.php use if, switch or anything else, something…
phpanswered Guilherme Nascimento 98,651 -
3
votes1
answer60
viewsA: Doubt - Mobile Site
If it is Node.js with Express (from what I’ve noticed it looks like it’s what you use) or for the front-end you can then use the: https://github.com/hgoebl/mobile-detect.js/ Node.js/Express: First…
-
0
votes1
answer87
viewsA: Error sending ajax request
In PHP: /modulos/index.php must change from: header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token'); To: header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token,…
-
1
votes1
answer72
viewsA: How to upload an Error 404 page to the website and another to the HTACCES application?
Both directives are wrong: ErrorDocument 404 /http://localhost/www.meusite.com.br/404.html And: ErrorDocument 404 /http://localhost/aplicacao/404.html The accepted formats are: Errordocument 404…
-
4
votes1
answer340
viewsA: Ajax request with unexpected return
The function json_encode converts objects and arrays into a JSON string, but it makes no sense to convert a normal string into JSON, i.e.: $foo = array( 'bar' => 'Olá', 'baz' => 'Mundo!' );…
-
3
votes2
answers169
viewsA: JSON Openload PHP
Using curl or file_get_contents and then using json_decode. The result of this:…
-
0
votes2
answers83
viewsA: Insensitive search when typing in INPUT
The way you used regex new RegExp($(this).val(), 'gi'); For sure the use of regex so will give problem always, because you have no control over value val() Even the problem of "Tomato" finding…
-
2
votes2
answers80
viewsA: how to make a substring in an int in PHP
000, 001 is not int and for sure $_REQUEST['chk_selectes'] does not bring values int If the front end in the form is actually sending exactly 000, then it will come 000, like string, so if 000…
-
14
votes3
answers767
viewsA: Escape Single and double quotes from the text area even giving Crlt+V
The problem of keypress is that will not recognize if the data comes from other sources, IE, will not work with Ctrl+V or right mouse click. I recommend first use .on('input') and instead of having…
-
2
votes1
answer179
viewsA: Concatenate two functions! (Mysql/PHP)
Could simplify using associative array, this just: public function getStockName() { $query = "SELECT * FROM `produtos`"; $results = mysqli_query($this->_con, $query) or die(mysqli_error());…
-
1
votes2
answers100
viewsA: Install Composer in Windows 2012
No need to delete php5, except if it is deleted then you will not be able to test in your Apache with it. The problem is that probably both versions of PHP are in the variable PATH of environment…
-
1
votes2
answers91
viewsA: How to create the <!DOCTYPE html> tag in Beautiful Soup (bs4)
If in fact the intention is to generate files .html I believe that You can install html5lib with Pip: pip install html5lib And then use the html5lib, thus: from bs4 import BeautifulSoup soup =…
-
2
votes3
answers52
viewsA: Set variable according to number record up to number
Simply use if, which would have the same effect as your switch, only that the code would probably get a little smaller (no need to break of case): $valor = <valor inicial aqui>; $quantidade =…
phpanswered Guilherme Nascimento 98,651 -
2
votes3
answers459
viewsA: Is there a specific event in Javascript to detect when a <option> of a <datalist> is selected?
I believe there is no I’d say you have to check with querySelectorAll to check all options Change event function qs(query, context) { return (context || document).querySelector(query); } function…
-
3
votes1
answer92
viewsA: Arrow keys on QT
Yes, using QKeySequence with QAction for example if you need to fire a SLOT specific, example in MainWindow.h would have the following slot: private slots: void meuEvento(); And in the…
-
1
votes1
answer865
viewsA: My code for this error Fatal error: Call to a Member Function fetch_assoc() on Boolean
It’s simple, $resultado= $con->use_result(); returned FALSE, soon if $resultado has FALSE as value is not object and it is impossible to access ->fetch_assoc() Then it would be enough to deal…
-
1
votes2
answers1595
viewsA: Youtube API V3 Information
To take the title and duration in the parameter part= it is necessary to pass the snippet and contentDetails, should look something like: https://www.googleapis.com/youtube/v3/videos?id={ID DO…
-
0
votes2
answers858
viewsA: Flask - sending form back to another function
One space left at last return, this: @app.route("/output", methods=["GET", "POST"]) def output(): return render_template('output.html') Should be: @app.route("/output", methods=["GET", "POST"]) def…
-
0
votes1
answer768
viewsA: PHP require() giving error 500
Error 500 is generic, that is no use to search specifically about it, you have to read the error message of the LOG. The error in PHP Fatal error: require(): Failed Opening required…
-
1
votes1
answer77
viewsA: Python - I would like some examples of using "APLICATION/LD+JSON"
JSON-LD is nothing more than a JSON, obviously its keys follow a specified format. Usually it is embedded in HTML pages, something like: <script type="application/ld+json"> { "@context":…
-
2
votes1
answer51
viewsA: Click on dynamically generated element does not work
Have to use .clone(true) as described in the documentation: https://api.jquery.com/clone/ .clone( [withDataAndEvents ] ) A boolean indicating whether event handlers should be copied together with…
-
3
votes4
answers26369
viewsA: Find certain text in a string
A suggestion for with regex would be to use the meta-character \b, example: import re nome = input('Qual o seu nome completo? ') if re.search('\\benzo\\b', nome, re.IGNORECASE): print("A string tem…
pythonanswered Guilherme Nascimento 98,651 -
4
votes2
answers1431
viewsA: Download file directly from FTP
You can use "protocol" php:// for example the php://temp, thus: <?php $fcon = ftp_connect($ftp_host); $conecta = ftp_login($fcon, $ftp_username, $ftp_senha); ftp_pasv($fcon, true);…
-
4
votes1
answer1732
viewsA: How to put an iframe on fullscreen (full screen)?
You can use the fullscreen API: https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API However it is worth noting that this API still uses prefixes for different browser engines, so you…
-
1
votes2
answers5448
viewsA: Is it possible to mirror an image horizontally (flip) with Canvas?
An additional suggestion to the existing answer would be to use the context.translate to adjust the whole canvas instead of fixing the position in the image X, this because when using the…
-
2
votes1
answer791
viewsA: Function to allow only one vote per piece of equipment
It is impossible differentiate two equipments that use the same network using only your website, regardless of the programming language you use on your server, there are still some alternatives,…
-
6
votes2
answers116
viewsA: Is there an alternative to using for in php?
I didn’t quite understand the question, but if the idea is to have 1 to 10, or 1 to 100, or 50 to 200, always based on numbers and incrementing then you can simply use the range() of PHP itself,…
-
0
votes1
answer19
viewsA: Seriealize() Aajax with problem
Probably the variable formDetails has not been declared or is not within $(document).ready(function() { ... }); it has failed to catch the FORM, you can solve simply by using:…
ajaxanswered Guilherme Nascimento 98,651 -
2
votes1
answer204
viewsA: Banco do Brasil, segunda Viua de boleto: não consegue enviar POST para https://www63.bb.com.br/portalbb/boleto/boletos/hc21e,802,3322,10343.bbx
This probably indicates that there was a 302 HTTP redirect: This Document you requested has Moved temporarily. How did I respond in: /a/71283/3635 Must use the CURLOPT_FOLLOWLOCATION, example:…
phpanswered Guilherme Nascimento 98,651 -
0
votes2
answers86
viewsA: as "cachear" css concatenated via GET
If you are talking about HTTP, use is simple: $expira = 3600; //Expira em uma hora por exemplo header("Content-Type: text/css;X-Content-Type-Options: nosniff;"); header('Expires: ' . gmdate('D, d M…
-
0
votes1
answer91
viewsA: Adobe Flex for HTML
Not "technically". However there is a project called Flexjs that should already adjust enough (I can’t state details of the compatibility and support of Flexjs for Flex):…
-
2
votes1
answer368
viewsA: Formatting of float types
Because 2.5 equals 2,500, just take the test: print(2.5 == 2.500) Will return True The point is used as separate from the "floating point", That is why it is called "floating point", then the right…
-
0
votes1
answer34
viewsA: How to do an sql query in Moongodb with php?
First (even if your problem is not current) your query is "wrong": select * from myDB WHERE nm_pesquisa LIKE "%SAO%" AND tp_m = "A" OR tp_m = "H"; You have a OR next to a AND, mysql might even work,…
-
1
votes1
answer66
viewsA: How to scan data like google?
You can use the API https://developers.google.com/custom-search/, so can use with "any language", since it works via HTTP request. Reference:…
-
3
votes1
answer43
viewsA: PHP - accept break Lines
It would probably be \n what you want, so: preg_match('#^[a-z0-9\-+, .\#*()\\/\n]+$#i', $ads_description) Of course you can use the \s which will amount to \n, to space and tab (\t), so summarize…
phpanswered Guilherme Nascimento 98,651 -
4
votes2
answers948
viewsQ: How to get random results in SQL with different Dbms?
Based on this existing question on Soen and wanting to bring interesting and useful content to Sopt I ask this question: How to get random results in SQL with different Dbms? I’m leaving an answer…
-
3
votes2
answers948
viewsA: How to get random results in SQL with different Dbms?
Some of the examples were obtained in this reply from Soen of @Yaakovellis I warn you that this has not been done performance testing, which can probably be a little tricky if you need to consult a…
-
0
votes1
answer39
viewsA: The page takes time to mount a JS that mounts a <div class='Marquee'>
If you have many messages it will take even, so in Sqlserver there is the OFFSET FETCH or row_number(), to limit even, imagine if the sites did not have paging, it would take hours to download the…
-
2
votes2
answers121
viewsA: Why does Firefox not support form type="time"?
Chrome also has no menu, what it has are arrows and a kind of mask in the field to type. In Firefox since version 57 (both Firefox Desktop and Mobile) there is the mask and arrows to control the…
html5answered Guilherme Nascimento 98,651 -
2
votes2
answers1873
viewsA: How to center the text of the select option?
Is not possible!. Doing this should work in "some" browsers and others not (I assume only Firefox Desktop): .main { width: 100px; } .main option { text-align: center; } <select class="main">…
html5answered Guilherme Nascimento 98,651 -
2
votes2
answers54
viewsA: Reload Automatico without being precise
First a suggestion to work better with Ajax that is in "loop", change setInterval for setTimeout, so will not conflict two requests at the same time, because the setInterval does not wait for the…
-
1
votes2
answers280
viewsA: Hover in html and css navigation
Could use the pseudo element ::before and ::after combined and apply the background: radial-gradient(...) (the same was done on the site) in these elements. It will also be necessary to put the…
-
3
votes2
answers731
viewsA: Anti-adblock which replaces div
You can use the Blockadblock (or Fuckadblock) as I replied in: /a/87992/3635 If you have jQuery (usually wordpress uses) can do so: <script src="blockAdBlock.js"></script> <script>…
-
3
votes1
answer241
viewsA: Print Javascript Object
I think it’s enough to iterate like this with for ... in and to the planos have to use a for iterated with increment (i++), example using console.log: var data = { email:{_empty: "Email é…
-
2
votes1
answer43
viewsA: How to change the behavior of an HTML tag
Just correct the use of :target, this is wrong: # strike{ color:#888; } And this is forcing strike to be invisible (display: none) at all times: #view strike { color:#888; display: none; } Correct…
css3answered Guilherme Nascimento 98,651