Posts by Guilherme Nascimento • 98,651 points
2,383 posts
-
1
votes1
answer373
viewsA: How to change link from my htaccess page
Create the htaccess file inside the folder ./paginas and write the following contents: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule…
-
4
votes1
answer80
viewsA: Verification of Browser Versions
Use the http://modernizr.com Add this to the header: <script src="/js/vendor/modernizr.min.js"></script> And at the bottom of the page this: <script> // Detecta se o navegador é…
cross-browseranswered Guilherme Nascimento 98,651 -
1
votes2
answers2351
viewsA: mysql file download
Public directory The briefcase ./upload being "publish" then we can access your files, the files being static just list the mysql data and create a .htacces in the briefcase ./upload to force the…
-
6
votes2
answers874
viewsA: Is it possible to prevent injection of external resources and requests for greater security?
Through the headers it is possible to configure the CSP (Content Security Policy) and with it it is possible to block external requests and even other types of security "problems". Example of CSP…
-
1
votes1
answer75
viewsA: Don’t let connected connect, PHP
When the third one connects the same process has to be done, but the first two don’t need to re-connect to each other again, they just need to connect to 3 and vice versa.. for everyone to be…
-
9
votes2
answers874
viewsQ: Is it possible to prevent injection of external resources and requests for greater security?
I understand that we can create and search javascript plugins, analyze the code and make sure that it will not inject anything on the outside page. But supposing there is some library from which…
-
7
votes1
answer16066
viewsQ: Why do some domains use www2 and www3 in the prefix?
Why some domains use www2 and www3 in the prefix? For example: www2.exemplo.com www3.exemplo.com I noticed that some websites like the government use, but I don’t know the exact reason.…
-
2
votes2
answers4562
viewsA: Count number of files in folder
You can increment a variable like this: <?php $pasta = 'imagens/'; $arquivos = glob("$pasta{*.jpg,*.JPG,*.png,*.gif,*.bmp}", GLOB_BRACE); $i = 0; foreach($arquivos as $img){ echo '<img…
phpanswered Guilherme Nascimento 98,651 -
11
votes4
answers1737
viewsQ: How to use "wildcard" in "CLASS" selectors with jQuery.expr?
The class selectors as .exemplo or sorted selectors by spacing [atributo~=valor] behave totally different from selectors like: [atributo=valor] [atributo*=valor] [atributo^=valor] The .exemplo and…
jqueryasked Guilherme Nascimento 98,651 -
3
votes2
answers124
viewsA: Problem with access limit by refresh JAVASCRIPT account
Like I said in the other answer, setInterval does not wait for the load to finish, so use the setTimeout: Load Chatbox message notifications function setLoop(de, para, nome) { var url_s =…
-
2
votes4
answers3411
viewsA: Set generic "date - * " attributes with javascript;
The function jquery.data don’t arrow the attribute data- it just writes to "memory". In case you can create a function using jQuery.fn.extend, thus: jQuery.fn.extend({ "dataAttr": function(name,…
-
4
votes3
answers138
viewsA: How to include decimal in PHP condition
I don’t quite understand what you want, but I believe you can use str_replace or strtr, for example: function normalizarFloat($numero) { if (strpos($numero, ',') !== false) { $data = trim($data,…
phpanswered Guilherme Nascimento 98,651 -
2
votes1
answer82
viewsA: Load Chatbox message notifications
PHP is back-end, there is no way he can make such a direct interaction with the front-end. You have two options: Ajax + setTimeout No reason not to want to use the setTimeout (he is your friend), an…
-
4
votes3
answers1614
viewsA: How to increase session time in phpMyAdmin on Ubuntu?
If you will use only in local development I recommend not using authentication to facilitate work For this go to the folder of phpmyadmin for example /var/www/phpmyadmin or…
-
7
votes1
answer1160
viewsA: Compare File Extension
The file extension does not always refer to the file type, it is best to detect mimetype, for example this function provides compatibility for older versions of PHP: function mimeType($file) {…
phpanswered Guilherme Nascimento 98,651 -
7
votes2
answers1040
viewsA: When and why to create a mobile app?
App vs Responsive Site The only advantage of actually developing an app in addition to or in place of a mobile (or responsive) site would be that mobile browsers have more limitations. The three…
-
1
votes1
answer186
viewsA: leave / at the end of the url
This is more than leaving the / at the end and remove the .php. You can try something similar to this Hide domain directory using htaccess or cakephp router I believe your .htaccess would look like…
-
1
votes1
answer175
viewsA: Problem with PHP and Mysql
The problem is in your query, mysql no use apostrophe (') where we make references to the columns, the correct is: INSERT INTO logs (`username`,`msg`) VALUES ('$uname','$msg') It might be a…
-
3
votes1
answer439
viewsA: PHP generating image with accents "buggers"
I really will need another function, in this case use the imagettftext: array imagettftext ( resource $imagem , float $tamanho, float $angulo, int $posicaoX, int $posicaoY, int $cor , string $fonte…
-
1
votes2
answers1234
viewsA: Calculate hours in PHP?
I did not understand well the use of the negative hours, in my view it would be better to have the number of hours you had access and deduct from the daily, weekly or monthly hours. Seems like that…
-
3
votes1
answer1651
viewsA: PHP as "draw" an image
For this task you can use GD or imagemagick/Imagick, example drawing with GD: Drawing a rectangle with GD Source: http://php.net/manual/en/function.imagerectangle.php <?php // cria uma imagem de…
-
2
votes2
answers603
viewsA: Convert file to txt
Convert binary files to .txt will not make a search work, each file has its own format. For each file type you will have to use a method to extract the data and save them in one .txt, some example:…
-
2
votes1
answer261
viewsA: How to run multiple FOR at the same time
You can create 4 Threads with Runnable. Note that nay will be exactly at the same time, but one need not wait for the other, example: new Thread(new Runnable(){ @Override public void run() { for(int…
-
1
votes2
answers186
viewsA: How to modify an existing System.out.println
If the intention is to show only the last result, then you can set a variable and run the System.out.print in the end: private string resultadoFinal: ... public static void teste(int maximo) {…
javaanswered Guilherme Nascimento 98,651 -
2
votes1
answer620
viewsA: How to center a binary tree?
If I understand correctly you want to center the element .root inside .container, in case I believe you can use margin: 0 auto and instead of position: absolute;, use relative as in the example in…
-
1
votes1
answer220
viewsA: Flush frontend data output
The customer even receives the data each flush supposedly, however ajax only delivers the end result, ie ajax will only give you something when readyState is equal to 4 (equals complete). To receive…
phpanswered Guilherme Nascimento 98,651 -
3
votes1
answer1845
viewsA: How to Force Download UOL Online Video Files
The file has not been damaged, if you open the downloaded file will notice that instead of binary data there will be a message, probably HTML with some detail of error, this occurs because you have…
phpanswered Guilherme Nascimento 98,651 -
1
votes1
answer149
viewsA: Profiling php (debug + run time)
As the author found an alternative solution is the brackfire.io. Prerequisites Before installing Blackfire, some technical settings are required: Probe, Agent and Client should work on Linux and…
-
3
votes1
answer335
viewsA: Check for visible items within a div
With the comment of the friend @marcelobonifazio The author managed using: var divFilho = divPai.find('ul:visible').length; if(divFilho === 0){ divPai.hide().addClass('hidden'); }…
-
1
votes2
answers447
viewsA: I cannot read the json PHP-encoded array
If I understand well the problem may be in PHP, so add the header in your PHP like this: dadJSON.php: <?php header('Content-Type: application/json; charset=utf8'); //Resto do seu código PHP…
-
2
votes1
answer294
viewsA: How do I track php file execution through the console?
As this question in Soen there are some tools for this, such as: monolog Installing with Composer: $ composer require monolog/monolog Basic example of use: <?php use Monolog\Logger; use…
-
3
votes1
answer1768
viewsA: What is the difference between Savedialog and Filesavedialog in Delphi?
The difference is that TSaveDialog uses standard windows and TFileSaveDialog uses the visual of Vista. According to the website http://docs.embarcadero.com the following information: Tsavedialog…
-
0
votes4
answers1914
viewsA: Take accent from a string
An alternative may be to use iconv, in case you can use a method like this: function translitAscii($texto) { $encode = mb_detect_encoding($texto, mb_detect_order(), true); return 'ASCII' === $encode…
-
1
votes2
answers194
viewsA: Convert PHP TIME() to Datetime with Javascript
Alternative similar to that of @Lucky boy, but in this case we get days and months, days, hours, minutes and seconds below 10 will have a 0 in front: var date = new Date(<?php echo…
-
1
votes1
answer159
viewsA: Error while retrieving content from external website
Possible problems: file_get_contents is not enabled to access external urls, to fix use: Edit php.ini and change it allow_url_fopen=0 for allow_url_fopen=1…
phpanswered Guilherme Nascimento 98,651 -
1
votes1
answer1040
viewsA: Error 503 "No 'Access-Control-Allow-Origin' header"
As per this link CORS on Datasnap REST Server you should wear it like this: procedure TWebModule1.WebModuleBeforeDispatch(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled:…
ajaxanswered Guilherme Nascimento 98,651 -
2
votes2
answers11114
viewsA: Pass parameters via GET and include more parameters
If query came by GET at an address similar to this: http://site/page.php?b=1&c=2 And you want the link <a href="?cor=verde">Verde</a> receive together b=1&c=2, you can use…
phpanswered Guilherme Nascimento 98,651 -
3
votes1
answer1464
viewsA: Error 500 Request exceeded the limit of 10 Internal Redirects
This is because you have not added a configuration to check if the page is already index.php. In case this ^(.*)$ means any page must be directed In case I believe you tried to use RewriteCond…
htaccessanswered Guilherme Nascimento 98,651 -
1
votes2
answers2341
viewsA: Htaccess is not redirecting to 404 error page
I always recommend using RewriteBase, this avoids some problems if index.php is in the root folder: ErrorDocument 404 /erro404.html <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /…
-
2
votes1
answer1829
viewsA: Hide domain directory using htaccess or cakephp router
What you want is not to necessarily hide the directory, but to direct the access from the root folder to from the cake folder. Create the . htaccess file in the root folder and add the following…
-
2
votes2
answers2392
viewsA: How to make setTimeout run "infinitely"
For the event to occur infinitely without the mouseover, just remove it. See: function Temporizador(initiate) { if (initiate !== true) { alert("Olá mundo"); } setTimeout(Temporizador, 5000); }…
-
1
votes3
answers73
viewsA: What is the best option to use in relation to performance
Single selectors as .produto will always be faster than complex selectors to search for But to change properties is likely to [invisible=false] is faster, since changing DOM elements that are…
-
1
votes2
answers4960
viewsA: Add Header and Footer to all pages
include virtual is supported in IIS, but has cases that do not work in files .php, php itself already has two functions to include files, include and require. For example: <?php require…
-
2
votes2
answers117
viewsA: Is it correct to use $(selector). not(':Visible') here?
In case the correct would not be #box-confirm:not(:visible), but yes #box-confirm:visible for :not() with style*='display: none;' looks for visible elements as told by @falsarella. :Visible vs…
-
0
votes5
answers409
viewsA: Today (06/30/2015) we will have a second more, what could be the consequences for our systems?
According to the very link you passed, there is the following information: The correction of the "Second Intercalated" is determined by the International Service of Earth Reference and Rotation…
-
1
votes2
answers205
viewsA: How to sort items with floating numbers in WHERE
As stated in the Soen Change to decimal and uses CAST: SELECT * FROM table WHERE CAST(numero AS DECIMAL) = CAST(101.31 AS DECIMAL); However you may consider changing the "column" of your table to…
phpanswered Guilherme Nascimento 98,651 -
1
votes2
answers903
viewsA: How to force the download of an AWS Bucket S3 object with PHP?
The author received a reply from Soen, imported to here by chance help other users. Use the S3 class standalone (which I found is not much different from the AWS SDK) with the getObject: /** * Get…
-
3
votes3
answers880
viewsA: How to remove file including with include according to conditions
The PHP process is not something "asynchronous", the included file runs as if were part of the file that is including it. Supposing that you have a.php: <?php echo 1; And b.php: <?php include…
phpanswered Guilherme Nascimento 98,651 -
4
votes2
answers703
viewsA: How to save multiple users to an account like Netflix for example
If daughter accounts log in You can use n:m for a table to relate to itself, I cannot say that this is the best way, however this way you can have "infinite" levels (children, grandchildren,…
-
1
votes1
answer211
viewsA: QT + Opencv on Mac Os 10.10.3 with error: Symbol(s) not found for Architecture x86_64
Situations you can try for problem with Openvc: Add to LDFLAGS as suggested in this reply Soen LDFLAGS = -I/usr/local/include/opencv -lm -lopencv_core -lopencv_highgui -lopencv_video…