Posts by Dalton Menezes • 718 points
19 posts
-
2
votes1
answer62
viewsA: How to control the contrast of videos using Electron?
The problem is that Electron uses webm in Chromium. The python Webkit application uses mp4. Because it is a proprietary format, mp4 is not available on Electron. The solution I found to control this…
-
2
votes1
answer62
viewsQ: How to control the contrast of videos using Electron?
On the left side is my Electron app with a youtube video. On the right side is my app created with pygtk2 and Webkit. The contrast is better with the Webkit. With the Electron, the blackboard around…
-
0
votes1
answer179
viewsQ: Set the behavior of the Python window when the mouse is over and outside it
I am using Pygtk in Python 2.7 and would like to set win.set_decorated(False) when the mouse is outside the window and win.set_decorated(True) when the mouse is over the window. How to do?…
-
1
votes4
answers2514
viewsA: Is there a difference between the is_file and file_exists function?
is_file checks if the file is a valid/existing file. But it doesn’t work if you check only directories. var_dump(is_file('a_file.txt')) . "\n"; var_dump(is_file('/usr/bin/')) . "\n"; return:…
phpanswered Dalton Menezes 718 -
4
votes4
answers1277
viewsA: View last 5 lines of a PHP file?
The best performance solution I could come up with was this: $file = new SplFileObject('text.txt'); $file->seek(PHP_INT_MAX); $linesTotal = $file->key(); $startLine = $linesTotal - 5; for ($x…
-
8
votes1
answer627
viewsA: What is the difference between reset and clear in Terminal?
clear Eliminates the content of the visible area. What it actually does is scroll the bar so that you only see the clean area. But if you give a scroll up you will see all the previous content…
-
2
votes1
answer1888
viewsA: table html printing
In the head of your page put: <link rel="stylesheet" href="print.css" media="print" /> Create the file print.css and style the elements of your table the way you need and give display:none in…
-
0
votes1
answer80
viewsA: Comparison of Array() Results
I noticed that you succeeded with @rray’s suggestion, but it follows a form alternative to make the snippet comparison algorithm. $trechos = array( array("cidade" => 1), array("cidade" => 1),…
phpanswered Dalton Menezes 718 -
2
votes3
answers2984
viewsA: The ideal way to build forms is to use table or div?
The tag <table> is for tables, anything other than this is semantically wrong, and semantics is one of the main points of HTML 5. Utilize divs for generic containers with no special meaning.…
htmlanswered Dalton Menezes 718 -
1
votes3
answers267
viewsA: I’d like to know how Vagrant works
Vagrant helps you to have a development environment closer to that of production. And if - for example - an employee enters your company, just take this box box (system image, already configured for…
vagrantanswered Dalton Menezes 718 -
2
votes6
answers896
viewsA: Rewrite and close array of a file
One of the ways to do this is to: Setting the settings. Where $current_db_type is the line you want to change in the file. And $new_db_type is the change you want to make. $current_db_type =…
phpanswered Dalton Menezes 718 -
4
votes2
answers2452
viewsA: How to make a database connection using the Singleton design standard
Singleton Intent: Ensure a single instance and provide a global access point throughout the application’s use cycle First, Singleton is not for database use. If you need to use multiple databases,…
-
2
votes1
answer1713
viewsA: Accentuation of files in directory reading
There are a few ways to solve it. The one I most recommend is renomear os arquivos with a hash in sha1 or remove accents at the time of inclusion. This will solve problems with accents and special…
phpanswered Dalton Menezes 718 -
1
votes2
answers194
viewsA: How to get query result separated by columns?
Simply print the column by its respective index. print ( $row['name']."\n".$row['origin'] ); I don’t know on Linux, but on Windows for \n break the line, it needs the function nl2br. Staying: print…
-
5
votes4
answers917
viewsA: How to check for value in a PHP array?
The isset has a problem, it informs only if the variable was started, in your case if the variable is set to empty '' the code will be executed. I recommend using !empty, which in turn checks…
phpanswered Dalton Menezes 718 -
0
votes5
answers7269
viewsA: Use if inside foreach
A simpler way to solve this, taking into account that the important thing is to select from the largest to the smallest and gain performance: $numeros = array(1, 2, 3, 4, 5, 6, 7, 8, 9);…
-
11
votes3
answers57228
viewsA: What to use require/include/require_once/include_once?
require is identical to the include, except in case of failure that will also produce a fatal level error E_COMPILE_ERROR. In other words, it will stop the script while the include only issue a…
-
2
votes3
answers1195
viewsA: Call php code on button
To call a PHP code after clicking this button, use an AJAX request for the desired PHP file. If the code should be executed in iframe, then use the src for the PHP file or integrate it to the page…
-
1
votes1
answer868
viewsA: UPDATE does not update table
From what I understand, $_GET['id_destination']; is not being set. Do this and check if there is any value being returned: var_dump($_GET['id_destino']); If it is empty, you should (if you really…