Posts by Guilherme Nascimento • 98,651 points
2,383 posts
-
7
votes2
answers4778
viewsA: How to load default image if src="" does not find?
Other fallbacks simpler than you can try, with javascript: <img src="imagem-nao-existe.png" onerror="this.src='fallback.png'"> An example in @Randrade jsfiddle:…
-
9
votes1
answer971
viewsQ: How do "Docker" and "containers" (LXC, LXD) work?
I saw this question Difference between VM and LXC Containers, but her focus is a comparison between VM and containers. What I’d like to know is a little more about containers like Docker, LXC and…
dockerasked Guilherme Nascimento 98,651 -
8
votes1
answer677
viewsA: PHP works with cache?
PHP does not use cache by default, it can be done using the function header();, but as you said you removed the browser cache and still continued to display the same results then the problem must be…
-
2
votes1
answer120
viewsA: While saving file in server folder keeps asking root access
It’s not about Nginx, actually editing the file on the machine is not about servers. The problem of asking "password" is that the folder that this php scripts are do not belong to your linux user,…
-
16
votes1
answer2302
viewsQ: Difference between normal request/response, long-Polling, websockets, Webrtc and Server-Sent Events?
I had the wrong idea long-time, I started to notice that in fact it is a "technique" that runs on top of a normal request, I started researching and noticed several questions on the site, but most…
-
3
votes1
answer795
viewsA: Upload PHP does not work
Has two mistakes: You put the $index variable instead of $destination here move_uploaded_file($arquivo['tmp_name'][$k], $diretorio) is_dir should be checked only in the mkdir part Extra: I don’t see…
-
9
votes4
answers11013
viewsA: Validate phone number with optional ninth digit
Since 2013 cell phones with DDD 21 started to have the ninth digit, I do not see why be optional, if you are saying that the input can be fixed phone as much as mobile I recommend you do not do…
-
7
votes1
answer514
viewsQ: Is there any project organization standard for C++?
In Java and Actionscript3.0 we use namespaces based by directory path, I see much use of namespace, but are not based on the "location" path of the class in the folder. I searched a lot if there was…
-
5
votes1
answer866
viewsA: Delete parentheses with php
Can use preg_match thus: <?php $var = '(1) - (2)'; preg_match('#\((\d+)\) - \((\d+)\)#', $var, $output); array_shift($output); //Remove o primeiro item, pois não vai usa-lo print_r($output); echo…
phpanswered Guilherme Nascimento 98,651 -
0
votes1
answer538
viewsA: Share webview url
To get the url just use WebView.getUrl(), but first we need to change some things Then put WebView as an accessible variable between methods, thus: public class MainActivity extends Activity {…
-
5
votes1
answer756
viewsA: Remove "public" directory from Laravel 5 by IIS web.config
I even made a GIST to help with this https://gist.github.com/brcontainer/c2b3c75439fa3e4905e9 found it strange not to find it through the web search, but ok, I’ll bring it here. You can put all the…
-
8
votes4
answers544
viewsA: Error set getElementById?
The problems are: Variables cannot be composed only of numbers var 1; var 2; The parameter in getElementById must be string Extras: HTML4.01: The ID attribute can never be repeated and must start…
javascriptanswered Guilherme Nascimento 98,651 -
6
votes1
answer65
viewsA: How to shuffle this array within itself?
From what I’ve noticed there’s no pattern at all, so just use shuffle(...) must solve: <?php $img = array( array("1.jpg","Logo","Tigre"), array("2.jpg","Logo","Cão"),…
phpanswered Guilherme Nascimento 98,651 -
8
votes3
answers665
viewsA: What does the term "routing" mean in the context of MVC architecture?
You don’t need frameworks to create anything, you only need a framework if you don’t have the time or think the framework is "good" and suits you, frameworks were created by people just like us, but…
-
7
votes2
answers2165
viewsA: Mac Address validation algorithm
Cannot detect if the address of MAC is real, first you need to understand what is an address of MAC, according to wiki: The Address MAC (Media Access Control) is a physical address associated with…
-
4
votes1
answer153
viewsA: Why use __debugInfo()?
When we use the var_dump without the method __debugInfo will be displayed at the output the data, including the private and protected variables, as cited in the documentation: This method is called…
-
4
votes4
answers199
viewsA: Difference between syntax to declare a function
Just an addendum to explain about the difference of other functions of any kind against: function testar() { console.log('Teste Dois'); } Unlike the above, almost all other forms will be anonymous…
-
3
votes1
answer84
viewsA: Is it possible to shorten the path of files . h included by file . pri?
To solve just use the INCLUDEPATH +=, in the specific case just point the way with $PWD INCLUDEPATH += $$PWD SOURCES += $$PWD/foo/foo.cpp \ $$PWD/bar/bar.cpp HEADERS += $$PWD/foo/foo.h \…
qtanswered Guilherme Nascimento 98,651 -
8
votes3
answers2721
viewsA: How to join several Python dictionaries?
As demonstrated in this response from Soen, can be used z = {} z.update(a) z.update(b) z.update(c) Or something like: def merge_dicts(*dict_args): result = {} for dictionary in dict_args:…
-
2
votes1
answer3772
viewsA: Where is the error? "system is not declared in this Scope'
To use the system add the stdlib. h I switched the switch because it was unnecessary. Change scanf("%c", &nome); for scanf("%s", nome);, note that I switched %c for %s and removes the & in…
c++answered Guilherme Nascimento 98,651 -
6
votes2
answers1270
viewsA: Why is the NAN constant evaluated as True when testing it with is_numeric?
The NAN (NAN or -NAN) is a non-zero value with a floating point, i.e. 0.0, which is different from 0 This is due to the level is more a matter of "low level" (or "lower level"), it is something like…
-
2
votes1
answer127
viewsA: Store amount of values in a PHP txt
Its value came out a little different from what you quoted, here it appeared like this: array(2) { ["500038;204932"]=> int(2) ["100398;204932"]=> int(4) } I think there are several ways to do…
-
2
votes2
answers2570
viewsA: Error "Class 'Mongodb Driver Manager' not found"
No problem in Laravel, it’s missing the Mongodb module in PHP. Note that there are two versions of the module /a/143674/3635 To install the Mongodb module you will need: php 5.4 or HHVM 3.9 libbson…
-
4
votes2
answers298
viewsA: How to run audio with Pyqt?
Apparently, QMedia is only available on Pyqt5 (since QMedia requires Qt5), but Python itself can do a few things without Pyqt. There is the lib playsound, which has no dependencies, can be installed…
-
5
votes1
answer859
viewsA: How to repeat a function call every X seconds in Pyqt?
One can use the QTimer of Qt. In the Pyqt4 documentation I did not find examples, but I believe it should look like this (every 1 second): from PyQt4.QtCore import QTimer def chamar(): print 'Foo'…
-
2
votes1
answer321
viewsA: Error selecting database "Error in database Selected"
Try this: $link = mysqli_connect("127.0.0.1", "root", "", "bdcomentario"); And use this only if you need switch between the seats: mysqli_select_db($link, "OUTRO BANCO"); An example: <?php $link…
-
6
votes2
answers2055
viewsA: hide variable in htaccess url
First I recommend you learn regex, yours is wrong (and is running by "lucky"): [a-z,0-9,A-Z,-] Within [...] not using comma to separate, all values are detected, the correct would be something like:…
-
35
votes2
answers6387
viewsQ: What is Android NDK?
From what I understand Android NDK is focused on development with c or c++, despite supporting Java through JNI (Java Native Interface), but I would like to understand some things: When we compile…
-
6
votes1
answer1057
viewsQ: How to detect if the system supports hardware acceleration?
Currently I do this so that one of mine activity that require acceleration work: <application android:hardwareAccelerated="true"> <activity ... /> <activity…
-
89
votes4
answers38157
viewsA: What is XGH (Extreme Go Horse)?
The Go Horse or Go Horse Process is a criticism shown in a way to satirize the misuse of certain "methodologies", as well as the "agile methodologies", or no use of them. It is actually a criticism…
terminologyanswered Guilherme Nascimento 98,651 -
1
votes1
answer84
viewsA: Download great with Qnetworkreply::readall freeze for a few seconds
I noticed that readyRead is high only at the end, maybe it is the application or the network that tries to advance the download process, this varies from network to network and according to the…
-
3
votes0
answers131
viewsQ: loadUrl finishes (crash) the app on Android
When using WebView.loadUrl(url); on Android or in some versions of Android the application finishes alone ("crash"), in case the failure occurred in versions 6 and 7 of Android. Notes: The Host GPU…
-
3
votes1
answer84
viewsQ: Download great with Qnetworkreply::readall freeze for a few seconds
When using QNetworkreply::readAll to save the data to a QFile, the moment the download arrives at the end occurs a quick freezing of 2 to 4 seconds and also varies according to the network or site I…
-
7
votes1
answer11725
viewsA: CLSID component COM class factory recovery failure
Errors similar to this may occur due to following factors: Missing Dlls not registered on the server Not having Office installed on the server. The Office installed is 32bit and the 64bit server…
-
5
votes3
answers1521
viewsA: How to Put Music on Console Aplication with C#
As an example from the documentation of MSDN you can use something like: Matter: using System.Media; And use it like this: SoundPlayer player = new SoundPlayer(); player.SoundLocation =…
-
5
votes5
answers7032
viewsA: How to return the sum of numbers of an array with indices of value greater than or equal to 2
This is just an alternative suggestion and contains an example performance test that you can use in all scripts (although performance in this kind of thing will be totally imperceptible) You could…
-
7
votes5
answers3011
viewsA: How to run a PHP function multiple times?
Web is something that will always have the complete answer, if using a sleep you will have problems, headaches, especially if you have session_start, understand that I am not saying that Sleep is…
phpanswered Guilherme Nascimento 98,651 -
0
votes2
answers1086
viewsA: How to maintain scroll position within a div after dynamically upgrading with AJAX?
You must record the contents of window.scrollTop in a variable before opening the edit field and after saving or reloading something with ajax, you can also use via jQuery (since you used the tag…
-
1
votes1
answer84
viewsQ: Is it possible to shorten the path of files . h included by file . pri?
I’m trying to separate my application from a small open lib I created, so I put the files on .pri and includes in the .pro, the structure of the folder was like this: c:/projetos/ ├── minhalib │ ├──…
qtasked Guilherme Nascimento 98,651 -
5
votes1
answer82
viewsA: CSS renderiza tag BODY even without the TAG
Even if it doesn’t add the tag <body> the browser tries to fill in what is missing from the document, that is even if I just do this in HTML: <p>teste</p> Will be generated…
-
4
votes2
answers4217
viewsA: Roadblock on Apache Gate 80
The answer Forbidden means that you are accessing yes Apache, but the page is not authorized, I mean this is not a problem with the port, it is just a permissions problem. Wampserver You’re probably…
-
3
votes1
answer311
viewsA: How to protect upload php files against shell script
Instead of checking the extension you can check the contents using the PHP API called fileinfo, as I showed in this reply /a/73497/3635 Note that in PHP5.3 (although rare some servers still use it)…
-
4
votes1
answer1791
viewsA: Is it possible to make a "text for voice" with Pyqt?
I believe that Pyqt4 does not have support for this, and pyqt5 may only come in more support in the future (apparently Qtspeech is quite recent), so using Pyqt is not an option, however I found…
-
1
votes1
answer1822
viewsA: How to use the PHP COM class to access SAT Emulator dll functions?
To use the class COM it is necessary to activate the extension php_com_dotnet.dll in php.ini (clearly this is only for Windows), something like this: extension=php_com_dotnet.dll After this you need…
-
2
votes2
answers79
viewsA: Show items in jQuery, using internal loop
I recommend that you read the documentation and understand the functions, what you are doing is meaningless: for (var i = 0; i <= quantidade_dividida_acima; i++) {…
jqueryanswered Guilherme Nascimento 98,651 -
23
votes2
answers11436
viewsA: What is the difference between Boolean and Boolean?
Boolean capital letter at the beginning is a class, it is the same as java.lang.Boolean boolean is a primitive type of comparison of two values, true or false. You can use both for the same purpose,…
-
3
votes1
answer150
viewsQ: Is it possible to determine the hardware address of the router?
I’m trying to get the hardware address of another device (actually the equipment connected directly, like a modem/router) on the same network, I was able to do this: foreach(QNetworkInterface…
-
13
votes2
answers2517
viewsA: What are Web Components?
The Web Components consist of several separate technologies, you can understand a Web Component as being a widget that can be used several times. They do not need external/additional libraries like…
-
2
votes1
answer414
viewsA: Is it dangerous to leave mod_mime_magic active in Apache?
I can not see a security fault in this module, as according to the documentation https://httpd.apache.org/docs/2.4/mod/mod_mime_magic.html#mimemagicfile the context to use MimeMagicFile is only…
-
3
votes1
answer229
viewsA: Phpstorm , How to change the user name?
According to this response from Soen Go to Settings > IDE Settings > File and Code Templates Then on the tab Includes select PHP File Header. You can customize or remove as you wish.…