Posts by Wallace Maxters • 102,340 points
1,984 posts
-
3
votes2
answers4279
viewsQ: Can setting run-time to infinity affect server performance?
Generally, I see many people (including myself) have run-time problems with a PHP script. This is because, by default, PHP sets a deadline for running a script in 30 seconds. These problems usually…
-
2
votes4
answers469
viewsA: json_encode returning HTML tags
Let me translate what happened: 1 - This HTML with this class x-debug it’s not strange to me. You’re probably using the Xdebug extension in PHP. 2 - This HTML only appears when it is in error. 3 -…
-
2
votes2
answers247
viewsA: Send parameter from one route to another
There’s nothing wrong with your redirect. In fact, the method with¹ stores the value temporarily passed in the session, until it is accessed. This is called "Session Flash" in most frameworks. 1 -…
-
1
votes2
answers497
viewsA: Recording data from a SESSION in the BD
If you intend to put the value $userRow['nome_funcionario'] in the field cadastradopor, just put a line in your foreach before the $stmt->execute($usuario);: $usuario['cadastradopor'] =…
-
3
votes1
answer77
viewsA: How to configure Fuelphp in Ubuntu 16?
When you install Apache2 on Ubuntu, it usually comes with the mod_rewrite disabled. In that case, you can enable it like this: sudo a2enmod rewrite…
-
13
votes3
answers890
viewsQ: Is it wrong to use more than one <thead>, <tbody> or <tfoot> in a table?
I have a table that gets a certain formatting when the elements have a tbody. Because of this formatting, I thought to use the tbody twice on the same table, but I wondered if this would be valid.…
-
4
votes1
answer1373
viewsQ: What is a memoisation?
I saw in the question How to implement memoization in a PHP function? the term "memoization". The first impression I had was that this term was related to "memorizing" or "avoiding reprocessing".…
terminologyasked Wallace Maxters 102,340 -
4
votes2
answers7935
viewsQ: Install specific version of a library with NPM
How do I choose the version of a library I want to use, with NPM? For example 1.0.0 1.0.1 1.1.0 1.1.1 1.2.0 If I roll npm i nome-do-package, he will install the version 1.2.0, for being the last.…
npmasked Wallace Maxters 102,340 -
10
votes3
answers218
viewsA: Doubt javascript Function t(n,t,i,r)
Probably, this was code generated by a Javascript minificador. When using mini-directors, in addition to winning in performance because of decreasing the size of the codes, you still have the…
javascriptanswered Wallace Maxters 102,340 -
5
votes1
answer107
viewsQ: Why is it possible to access array indexes with "{}" keys?
In some tests I did with PHP, I saw that it is possible to use keys ({}) to access indexes of arrays. Example: $array = ['a' => 1, 'b' => 2, 'c' => ['d' => 4]] echo $array{'c'}{'d'}; //…
-
4
votes2
answers3075
viewsQ: How can I see the structure of a table in Sqlite?
In Mysql, we can use the command DESC <table> to discover the structure of a table. And in Sqlite? How could I do that?
-
0
votes1
answer784
viewsQ: Is there any way to change a column from an existing table to "auto increment"?
I created a table in Sqlite3, but forgot to add AUTO INCREMENT in the column id. I tried to use ALTER TABLE to solve the problem, but I haven’t been able to. In SQLITE, it is allowed to set a column…
-
4
votes1
answer48
viewsA: Can I use a function in the declaration of an attribute in PHP?
No, there’s no way. PHP does not allow you to define dynamic values in class attributes literally. You need to use the constructor for this: class Net { public $ip; public function __construct() {…
-
5
votes4
answers3460
viewsA: Take letters from name string
You can do it like this: $partes = explode(' ', $nome); echo $partes[0][0] echo $partes[1][0] Example in IDEONE But as the first letter may contain an accented character, it could give some encoding…
phpanswered Wallace Maxters 102,340 -
7
votes1
answer109
viewsQ: Why set a 0 or 1 output at the end of a program?
I have noticed that some programs always have a code snippet, which is always executed last, which takes as a parameter a number, usually 0 or 1. For better understanding, I put this example of a…
operating-systemasked Wallace Maxters 102,340 -
4
votes2
answers1855
viewsA: Is there any way to download a Youtube video using urllib?
It seems that according to the Term of Use, it’s not nice to download videos from Youtube. Read item 5 with the title: "Use of content", item B. There probably won’t be any (at least politically…
-
15
votes3
answers243
viewsQ: Does C# have native serialization?
In PHP there is a language proper data serialization feature. I mean: I’m not talking about using JSON or XML, but I speak of a serialization in a format that is proper to the language. For example,…
-
3
votes2
answers609
viewsA: Randomly position div when loading page
Use Math.random to do this: $(".bloco").css({ marginLeft: (Math.random() * 1000), marginTop: (Math.random() * 1000) }) Note: I put the multiple per 1000, because Math.random generates a random…
jqueryanswered Wallace Maxters 102,340 -
5
votes2
answers1198
viewsA: Dynamic tables with Jquery, Javascript and Mysql
First, to insert multiple values via PHP form, you need to define a particular format for this action. The way you did, you will really always only insert one file. For example, if I have these…
-
6
votes4
answers8334
viewsQ: How to list all tables in a Sqlite database?
In Mysql, when I run the command SHOW TABLES I can see all tables present in a given database. And in the case of Sqlite? How can I do this?
-
7
votes2
answers701
viewsQ: What would be DSN?
Whenever I see someone preparing some configuration for database, I see appearing the term DSN. I see it happening in the parameters of PDO (class to connect to PHP Database). Example: $dsn =…
-
6
votes1
answer607
viewsQ: What are the "bind" and "bindTo" methods of an Closure for?
I was running some tests with anonymous functions in PHP. I already knew that the anonymous functions were an instance of an internal class called Closure. I ran a test to see if she had any…
phpasked Wallace Maxters 102,340 -
2
votes2
answers643
viewsA: AJAX request with form is updating the page
You can use the event.preventDefault() or else give a return false in the function of submit. This serves to prevent page submission Behold: $(".enviamensagem").submit(function (e){…
-
0
votes1
answer136
viewsA: Call Laravel 4 method using Angularjs
Will give 404 error even if you are not called that url from the main page. When you use api/usuarios/dados, you are defined as making a relative call. This may be the problem. If you are on a page…
-
1
votes2
answers1798
viewsA: How to update the PHP version in Laravel?
There is a way to update the php version on composer.json? There is no way to "update PHP" through Composer. What can be done is to change the version required for the operation of the application.…
-
3
votes1
answer141
viewsA: Is it mandatory to visit Mutator/Accessor?
A little correction: It’s not called Mutator, and yes Accessor. Mutator is to set the attribute, Accessor is to access. In some frameworks that have the same purpose as a Accessor provides, this is…
-
2
votes1
answer127
viewsA: Is it possible to customize the return of the Laravel validation when using Request?
Change the file app/Exceptions/Handler.php and add the following lines: public function render($request, Exception $e) { if ($e instanceof \Illuminate\Validation\ValidationException &&…
-
10
votes3
answers935
viewsA: Why does Javascript allow using variables without declaring?
When you stop using the var in a variable declaration, you are declaring it in the global context, independent of the scope in which you declared it. Behold: function call_me_baby() { a = 1; var b =…
-
2
votes1
answer306
viewsA: Files in public folder using Laravel 4.2 are inaccessible
There is no need to define the routes for each download. You can access the static files using Laravel 4 normally. You should first keep in mind that the root of an Laravel 4 application is not in…
-
6
votes1
answer1322
viewsA: How to change the color of buttons when selecting a radio input?
You don’t need to use ng-if in this case. You can create a parent class for your buttons inside. When the checkbox is activated, you use ng-class to add a class to the parent container in case the…
-
12
votes1
answer148
viewsQ: When it comes to Python’s "list", is it wrong to call it an "array"?
In an answer given to a question I asked here on the site, I fixed a user who wrote "array" when referring to a Python "list". I did this because it is a common nomenclature to be used in Python,…
-
3
votes1
answer5730
viewsQ: Please provide a Valid cache path
I just made a git clone (copy) a newly made Laravel application in the company where I work. I surrounded the composer update and artisan key generate to make initial settings as well as edited the…
-
3
votes3
answers460
viewsQ: How do I create a directory through the Harbour language?
How do I create a directory through the Harbour language? For example, I want to create a folder temp within the current directory from which the program is running.
-
15
votes3
answers7080
viewsQ: In a list, what is the difference between append and extend?
Num list in Python, there are the methods append and extend. What’s the difference between them and when to use each?
-
5
votes2
answers572
viewsQ: Difference between Compact function and literal array assignment
According to the PHP documentation, the function compact. For each of the parameters passed, compact() looks for a variable with the name specified in the symbol table and adds it in the output…
-
2
votes2
answers610
viewsA: How to pass several variables to a View in Laravel?
In your case, you can also use the function compact. This function captures the names of the local variables and creates an associative array with the appropriate values. So it could be done like…
-
9
votes1
answer955
viewsA: What are Events in the Flat for?
It’s a feature of Laravel that provides a way for you to "listen" to events that occur internally within your application. The application written in Laravel (as well as other applications) have…
-
12
votes5
answers15940
viewsQ: How to create a directory in Python?
How can I use Python to create a certain directory? For example: app/ main.py How could I create a directory called temp inside app through Python main.py?…
-
1
votes2
answers2187
viewsA: The/ python library
This error is happening because the directory pythontest there is no. You can create it if it does not exist by the application itself: if not os.path.exists(directory): os.makedirs(directory)…
pythonanswered Wallace Maxters 102,340 -
3
votes1
answer472
viewsA: Upload images using PHP?
In my opinion, it is not a good thing to use PHP to upload images. If you do so, you will be causing PHP to have to process all the contents of an image and then send a response to the browser. This…
-
7
votes1
answer1202
viewsA: How can I differentiate authentications in the Standard? Example: Administrator and Common User without using multauth
You can do this through a Middleware. You can create a middlewareto verify that the current user is of a certain level. So, you can set this middleware on the routes you set and want only the…
-
1
votes1
answer112
viewsA: The /e Modifier is deprecated
According to the PHP Handbook: PHP 5.5.0: The modifier e is obsolete. Use preg_replace_callback() as an alternative. View documentation PREG_REPLACE_EVAL for additional information on security…
-
0
votes1
answer66
viewsA: Only register once and then stop
Generally, this type of error of not being able to register more than one record in a table is occasioned when you define a Primary key (for example, in the field id) and forgets to put it as…
-
6
votes3
answers833
viewsA: Balloons with tips for using the system (Tour)
In doing a little research, I’ve come to the conclusion that this is called Tour. The Tour may use different types of dialogs, such as Modals or Tooltips. Modals are those dialogues aimed at…
-
5
votes1
answer94
viewsA: Upgrade to PHP 7 Ubuntu
First of all, it has to be said that after the PPA update, PHP is being installed as multiple versions. In my case, I have installed PHP 5.6 and PHP 7.0. You probably installed the new PHP, but did…
-
44
votes4
answers3861
viewsQ: What are the risks of using permission 777?
Always when I have folder permissions problem on my Ubuntu operating system, I usually give permission 777 for a particular folder. I usually do this in the development environment. In some…
-
3
votes1
answer10517
viewsA: Folder permission /var/www/html
Whenever I have a file reading problem, I use the command sudo chmod with the option -R. Behold: cd /var/www/html sudo chmod -R 777 . In that case, you’re telling him to do it recursively (the…
ubuntuanswered Wallace Maxters 102,340 -
16
votes4
answers30006
viewsA: Limit text display in PHP
For cases where an indicator is required that the string has been truncated, there is another option (which is almost unknown), which would be the function mb_strimwidth. It seems she was already…
phpanswered Wallace Maxters 102,340 -
9
votes1
answer120
viewsQ: Why in PHP is it possible to access the functions before the line they were declared?
Why in PHP it is possible to call a function before the line in which it was declared? echo ah(); // 'Ah!' function ah() { return 'Ah!'; } Notice that I called ah() first, then I declared. Even so,…
-
5
votes1
answer87
viewsQ: Why can I access normal functions before the declaration, but not anonymous functions?
In Javascript, you can use/use a function before its declaration. MyFunc(); function MyFunc() { return console.log('blah!'); } However, when it comes to anonymous and closures functions, it is not…