Posts by Wallace Maxters • 102,340 points
1,984 posts
-
0
votes0
answers181
viewsQ: What is an iterator?
In PHP , when I need a certain class to have a certain behavior in the call foreach, i implement an interface called Generator. In Python seems to exist as well __iter__, that changes the behavior…
-
2
votes3
answers939
viewsA: What is the difference between Directoryiterator and Filesystemiterator?
DiretoryIterator and FileSystemIterator are two iterators belonging to the SPL library of PHP. Directoryiterator DirectoryIterator implements the interface SeekableIterator and extends SplFileInfo.…
-
2
votes3
answers2344
viewsA: List folder files with PHP
Use Filesystemiterator. The class FileSystemIterator is an iterator whose purpose is to iterate over a directory structure. Unlike DirectoryIterator and Diretory, this class does not consider . or…
phpanswered Wallace Maxters 102,340 -
2
votes1
answer2182
viewsQ: How do I check for errors in Apache configuration before restarting?
Several times I needed to restart Apache after making some settings, I had the dislike of receiving a failure message, because there was an error in the configuration. A colleague here at the site…
-
4
votes1
answer160
viewsQ: How to improve log file visualization?
I am trying to analyze some logs files generated on Linux and have noticed that it is very boring to understand where a line is starting/ending. I wonder if there is some kind of command or tools…
-
31
votes2
answers1602
viewsQ: What is Inter Process Communication (IPC)?
In a discussion with experienced programmers here on the site regarding competition control, the terms arose traffic lights, mutex, shared memory, monitor, and still others, which I’m beginning to…
-
15
votes2
answers410
viewsQ: What is competition control?
About the studies I was doing at the time I asked What is a traffic light?, informed me that, in order to better understand this term, I should study about Control of Competition. Could someone…
-
3
votes1
answer61
viewsQ: What is the purpose of these functions prefixed by "msg_" in PHP?
As I quoted in my previous question on traffic lights, I had a question regarding to that answer, because when the author of the answer quotes about Traffic lights, he references this documentation…
phpasked Wallace Maxters 102,340 -
13
votes4
answers2530
viewsQ: What are Traffic Lights in Programming?
In a series of questions I asked to ask questions about parallelism, asynchronism, threads and the like, I came across several new knowledge, and also several new terms. In that reply for example,…
-
4
votes1
answer137
viewsQ: How to make an appointment to get the dates according to the weekdays?
How to make a certain query in MYSQL by picking the dates according to the day of the week? For example: +-------+---------------------+ | id | created_at | +-------+---------------------+ | 49185 |…
mysqlasked Wallace Maxters 102,340 -
3
votes1
answer377
viewsQ: What are files with extension "Sock" for?
Some applications, such as PHP-FPM and MYSQL, usually use in their settings a file with the extension .sock. I always see this in Linux operating systems. Example: /var/run/mysql/mysql.sock As far…
-
1
votes2
answers633
viewsA: Problem with routes in the Laravel
In your case $result_categorias->slug is returning NULL, so the error is generated. Probably some other factor is making Laravel not find that $slug at the bank. Note that when you use first, you…
-
8
votes1
answer638
viewsQ: What is the pcntl_fork function for?
I was looking for some solution in PHP, where I could run a script without waiting for a certain function that processes time-consuming things to be expected to finish the execution of it. I came…
-
7
votes2
answers2120
viewsA: What’s the difference between "this" and "$Scope"?
Basically, both the use of $scope like the this is intended to share information between view and controller. The difference is, when you use this, you need to use an alias for the controller in…
-
29
votes1
answer3524
viewsA: What does the asterisk in "* {}" mean in CSS?
* is called universal selector. This selector represents all elements will be affected by the style settings placed there. For example, I usually use a lot to apply a certain stylization to all…
cssanswered Wallace Maxters 102,340 -
7
votes3
answers4863
viewsQ: Install with PIP through the Resets.txt file inside Virtualenv?
I learned these days that through command pip freeze > requirements.txt, i can generate a list of dependencies of a specific project where I am using VirtualEnv. How do I install all the…
-
5
votes3
answers44552
viewsA: How to connect Python to Mysql database?
Only one addendum: Who had difficulties installing the Mysql Connector library through the virtualenv, as I had, you can use the following command: $ pip install mysql-connector-python-rf The other…
-
13
votes2
answers2425
viewsQ: What is a state machine?
I’m doing a tour on the site, researching on asynchrony, threads, parallelism and the like. Upon finding this reply, I noticed that the author makes a quote about state machines. I didn’t understand…
-
5
votes1
answer1242
viewsQ: Are there differences between the terms Thread, Multithread, Async and Await?
I asked that question here at Stack Ooverflow: What is the solution for asynchronous PHP processes? I did it because I wanted that in the middle of a process execution, I wanted to have a certain…
-
2
votes1
answer685
viewsQ: What is the difference between stopPropagation and stopImmediatePropagation?
I realized a while ago that it was possible to use these two functions, but what would be the difference between them? What’s the difference between event.stopPropagation() and…
-
11
votes3
answers2839
viewsQ: What is the solution for asynchronous PHP processes?
In PHP many times, in the middle of an operation, I need to send an email, make a call webservice or register a log, and these can sometimes take a while to process, but without having to wait for…
-
4
votes1
answer1524
viewsQ: What is seeder and Migration?
When it comes to database updating in a project, I always understand the term Migrations being used to keep the bank update among those involved in a particular project. I’ve also come across the…
-
1
votes2
answers302
viewsA: Is it possible to add the td values using querySelectorAll?
You need to convert the value "R$ 200,00" to be converted by Number. Use the replace to remove the R$ and transform , in .. Behold: var texto = 'R$ 200,00'; var numero = texto.replace(',',…
javascriptanswered Wallace Maxters 102,340 -
5
votes3
answers1214
viewsQ: How to style the input type search "clean" icon?
I need a way to stylize the icon at the end of input[type="search"]. The input type search when focusing on the element, it displays one if it has a value filled. Example: I realized that by styling…
-
1
votes1
answer423
viewsA: Form on Laravel 5.4?
The second parameter of email, text or textarea will always receive the current value that fills the input. In that case, replace it with Form::text('nome', null, array('class' => 'x')) Here’s a…
-
7
votes2
answers2154
viewsQ: How do I convert a date into American format in Angular?
I’m using a Json No Laravel 5 response, where I use Angular to display this data. The date in Laravel is returned in format 2017-05-17 15:56:46. When trying to use filter date at the angle,…
-
8
votes3
answers799
viewsQ: How to sort by the relevance of Like?
I’m making an autocomplete that makes a request to a url, which in turn queries in the database. This consultation is made with the LIKE. I use %$termo% to be able to consult, but I would like to…
-
3
votes1
answer75
viewsQ: What is the difference between $Animate and ngAnimate?
At Angular 1, we have a service called $animate. This comes by default in Angular. But we also have a library, which is optionally added to the project, called ngAnimate. This is intended to add…
angularjsasked Wallace Maxters 102,340 -
3
votes1
answer165
viewsQ: Is there any way to manipulate the brightness of the image through Canvas?
I am developing a system where the user can make small adjustments in images, and can rotate and cut currently. Before this whole part was being done through coordinates, where I sent the parameters…
-
3
votes1
answer81
viewsQ: How to perform a function optionally if the page is loaded within an iframe?
You can tell if a particular page is being opened inside a iframe? I want that page to run a function when it is loaded through a iframe. Otherwise, I don’t want you to. Is there any way to do that?…
-
0
votes2
answers623
viewsA: apt-get install -y <program> What is the -y option for?
I believe that the -y could be translated as "install without confirmation". When you use it there is no need to press "S" or "Y" to confirm the installation procedure.
-
1
votes2
answers397
viewsA: Problems with HTTPS and WWW Redirection
Buddy, I wouldn’t wear it htaccess to redirect to HTTPS no. I find it easier for you to do this by the application itself, through a Middleware (if using Laravel 5). The code comes down to this: if…
-
0
votes0
answers50
viewsQ: PHP does not display accept UTF-8 character input (accented characters) in interactive mode (REPL)
I’m trying to make use of the command line to make a small change to the server, namely I’m using PHP in the command line in interactive mode, but I noticed that PHP is not accepting accented…
-
0
votes1
answer329
viewsA: How to sort a select option alphabetically with jquery?
Maybe just using sort solve your problem! data.parents.sort(function (a, b) { if (a.username === b.username) return 0; return a.username > b.username ? 1 : -1; }) $.each(data.parent, function ()…
-
3
votes2
answers374
viewsA: Error installing Laravel phplegends/en-Validator
According to the documentation of Phplegends, this library was moved to another organization, called Laravellegends. Whenever you install this library, use these steps:…
-
1
votes2
answers1022
viewsQ: How to update a v-for variable in Vue JS?
I have the following code in my view: <div> <div v-for="(solicitacao, $index) in solicitacoes"> <div class="box-image" :class="{'box-rejected' : solicitacao.$$reprovado}"> <div…
-
2
votes1
answer137
viewsA: How to treat each value of an array without knowing the index name?
Simple, use array_map. It maps every item of array applying the desired function: $post_array = array_map('mb_strtoupper', $dados); The way you tried to foreach would have worked if you had used…
-
0
votes2
answers2971
viewsA: Line break
Maybe the problem is you use '\n' instead of "\n" double-quote. There’s a small difference between the two. Another solution is to concatenate with the constant PHP_EOL. echo…
-
20
votes5
answers2915
viewsQ: What is actually the array?
Initially, it seems a silly question. But my goal here is to come up with a more concrete concept regarding the array. In languages such as Javascript, the array is an object that accepts you to add…
-
1
votes4
answers1886
viewsA: How to make an input not accept blank input?
If I understand correctly, you don’t want the input is not empty or contains only space. I’d do some simple like that: $('#buscar').click(function () { var $palavra = $('#palavra');…
-
2
votes1
answer306
viewsA: Problems when defining url string whose query string parameter contains the dollar ($) character
From what I understand, the url parameter has a value called $filter. In the section where you try to make the request with file_get_contents, you are using double quotes. When you do this, PHP…
-
1
votes1
answer52
viewsQ: How to put data in the session flash when redirecting to Silex?
Some frameworks have a feature called Session Flash, where it is possible to store a certain value in the session and when it is accessed, it is immediately removed from it, which is useful to show…
-
0
votes0
answers146
viewsQ: How to create a switch button like Android with CSS?
How can I create a switch button like the one on Android with CSS? You need Javascript to do "on-off", or I can do this only with CSS?…
-
3
votes2
answers1526
viewsA: How to remove a character that is not a letter in a string?
You can use preg_replace to remove characters that are not letters from a string. Then you can combine with array_map. $callback = function ($value) { return preg_replace('/\W+/u', '', $value); };…
phpanswered Wallace Maxters 102,340 -
3
votes2
answers798
viewsA: python - Delete string end characters
Do so: a_cortado = a[:len(b)] By doing so, you will be cutting the string of a exactly the same size as b.
-
3
votes2
answers1109
viewsQ: Number divided by a divisor greater than it returns zero?
I went to do a calculation on Python 2.7 and got scared when I saw the result: val = 1 / 16 print(val); # 0 Example in IDEONE That is, when we make a division where the divided number is less than…
-
2
votes1
answer1348
viewsQ: How to put the scroll of an element to the left
Usually when you use overflow-y: scroll or overflow-y:auto, the scrollbar appears to the right of the element. .scroll-me{ height: 80px; width: 200px; overflow-y: auto; overflow-x: hidden;…
-
23
votes2
answers9761
viewsQ: What is an overhead?
I see that term used a lot when it comes to the excessive use of memory, but I don’t know in depth if that’s really it. I noticed that here on the site this term was used in some questions: The size…
-
4
votes2
answers405
viewsA: Why is the route not recognized by Silex when there is a "/" bar at the end of the requested url?
Actually, that seems to be a known problem between users of the Symfony. I use a framework called Laravel that seems to know this bar problem well at the end of the url. Using the HTACCESS The…
-
4
votes1
answer223
viewsA: What is the overhead when using Doctrine?
I do not believe that a library has only negative points, but also not only positive points. When I see programmers making this kind of comment, I usually ignore it. The important things to ask is:…