Posts by Wallace Maxters • 102,340 points
1,984 posts
-
0
votes1
answer41
viewsA: Use the __get method inside the controller
The method for calling methods that does not exist is not the __get, is the __call. __get is to call an action when a property does not exist. __call is to call an action when a method does not…
-
2
votes2
answers2327
viewsQ: Is there any way to make a "git pull" without conflicts?
After much in the life of programming break the head doing FTP to update the system that is running in production, I decided to adopt as default the use of GIT. When I have a new update tested, I do…
gitasked Wallace Maxters 102,340 -
3
votes1
answer559
viewsA: Laravel - Not log in after registration....?
It would be easier for you to take the model that is responsible for authentication and use the method create. But I can say that, in Laravel, the method responsible for the login is the…
-
1
votes3
answers109
viewsQ: How to display the excerpt from the script where the exception was released in PHP
PHP, when an exception is released, is informed the file and the line where the exception was launched. Example: try { throw new Exception('Só para mostrar a linha'); } catch (Exception $e) { echo…
-
4
votes1
answer717
viewsQ: How to disable file mode (permission) in GIT?
I’m working with the GIT here at the company where I work, along with two more programmers. Every time I make one git pull, whose changes were sent by these two programmers, I always have trouble…
-
3
votes1
answer1057
viewsA: How to keep data already filled in the textarea and select option after submitting a form?
You must use the function old. She is responsible for bringing back data from the previous disappearance stored in a Session Flash. So you can just do it like this: <input type="text" name="nome"…
-
4
votes2
answers1356
viewsA: Convert a list list into a single list
I would do it using the method chain of itertools from itertools import chain Resultado = [['A','B','C'],['D','E','F'],['G','H','I']] Lista = list(chain(*Resultado)) print (Lista); # ['A', 'B', 'C',…
-
12
votes3
answers5129
viewsQ: What is the difference between using single and double quotes in C#?
In PHP, when we use single quotes or double quotes, both forms have the functionality to declare a string. There is only one small difference. I am now starting a study with C#. When I went to try…
-
7
votes3
answers1496
viewsQ: Why is it possible to define two or more methods with the same name in the same class in C#?
I’m starting my C# studies with ASP.NET MVC today. I’m still adapting to some things I’m not used to seeing, because I know languages like PHP, Python and Javascript. I realized that in a code that…
-
8
votes1
answer152
viewsQ: Library for data validations in Brazilian Portuguese for Laravel
Whenever I need to use cpf or telefone in Laravel, I need to use the method Validator::extend to add these validations. Validator::extend('cpf_real', function($attr, $value) { $c =…
-
1
votes1
answer109
viewsQ: Error trying to install Visual Studio 2013: Acess Denied KB2829760
I’m trying to install Visual Studio from ISO vs2013.5_ce_enu I went down so I could continue my studies in C#. However, when I try to install, an error appears: KB2829760 Access Denied The operating…
visual-studioasked Wallace Maxters 102,340 -
6
votes2
answers12143
viewsQ: How to change the Linux time by the command line?
I can see Linux time from the command line like this: >date Qua Mai 25 14:49:58 BRT 2016 But now I need to change the Linux time by the command line, because as I use a Linux server, I only have…
linuxasked Wallace Maxters 102,340 -
3
votes1
answer51
viewsA: Bring Existing and Non-existent Records
I’m realizing you’re wearing one hasMany from Dealer to Dealerservice. I believe you will probably have a relationship to Dealer inside DealerService. So you can use the method whereDoesntHave to do…
-
2
votes1
answer2494
viewsQ: How to install dependencies from Composer, but ignoring require-dev?
Here in the company where I work we use the git for versioning the application. They all use Composer to install dependencies. Because it is the most correct approach, removing the vendor generated…
commiserateasked Wallace Maxters 102,340 -
3
votes2
answers1007
viewsA: How to Filter Multiple Fields in the Query?
Petter, if the logic of the query is going to repeat, there is no reason to fill "the parade" of if. I recommend that you simplify your code by encapsulating the query logic within a loop. For…
laravelanswered Wallace Maxters 102,340 -
3
votes1
answer112
viewsQ: Is it safe to use the new syntactic sugar for Javascript callbacks?
These days I was testing some Javascript features on Google Chrome 50 and I realized that it’s already been added to arrow function for callbacks. Thus: $.each([1, 2, 3], x => x * 2); // [2, 4,…
-
7
votes4
answers742
viewsA: What is the difference between PHP’s "Exception"?
The purpose is for you to be able to capture a specific exception. All Exceptions in PHP derive from the class Exception. When you capture Exception you are capturing any exception that occurs while…
-
1
votes2
answers52
viewsA: Column Not Found With Inner Join
The method with Laravel’s sole and exclusive purpose is to bring results related to relationships. In the context you are using the function order_avgseems to me much more like a Query Scope than a…
-
3
votes2
answers62
viewsA: Callback in Having
In Laravel, some consultation methods do not accept callbacks. It seems to me that you are trying to utilize the same functionality in whereSub, where you pass a Closure as argument and thus you can…
-
2
votes2
answers1341
viewsQ: With setting the deadline in the bootstrap datepicker?
When I use the Jquery Ui DatePicker, I can set a maximum date using the attribute maxDate. Thus: $('#data-solicitacao').datepicker({maxDate: 'now'}) I thought the Datepicker on Bootstrap 3 was the…
-
2
votes1
answer785
viewsQ: With creating a Request with namespace in Laravel
I tried to create a Request with a subnamespace in Laravel 5, but to no avail. When I turn the remote php artisan make:request Temp\OsRequest, instead of creating a file called OsRequest inside a…
-
2
votes1
answer785
viewsA: With creating a Request with namespace in Laravel
Yes, there is. Remember that in many cases the character \ represents an escape from some character. If you add two bars (\\), the command will work as expected, and the folder Temp will be created…
-
3
votes3
answers1413
viewsA: How to check if a snippet of a string is in an array item
In your example the function strstrdid not work because it works to return an excerpt of a string contained in another, not valid for array. So what to do? If the need is to check whether within the…
phpanswered Wallace Maxters 102,340 -
0
votes2
answers5715
viewsA: Is it possible to call a modal without a click?
Not to complicate too much, I would do as follows: Simulate a button click event that opens the modal to trigger the modal opening. There may be a better way to do it in bootstrap, but if you want…
bootstrap-3answered Wallace Maxters 102,340 -
1
votes0
answers425
viewsQ: How to use a credential in the url when the user’s name is an email? Is it necessary to escape?
For you to make connections via SSH, usually use credentials directly in the url not be necessary to set the user and password all the time. Example: ssh://login:[email protected]/repos/repositorio.git…
-
1
votes2
answers2258
viewsA: How can I calculate the width when resizing an image that must be 3 X 4, knowing only the height?
Thanks for the answers, but I would like to leave a simple way. P When I went to research this calculation, I saw accounts back and forth so I could do this, but it can be solved in a much simpler…
-
1
votes2
answers2258
viewsQ: How can I calculate the width when resizing an image that must be 3 X 4, knowing only the height?
Use the PHP to be able to process images in a given system. I need the photos to contain the 3x4 ratio. That’s how the system works: 1 - User takes webcam photo. 2 - An ajax is sent to PHP to…
-
0
votes3
answers1814
viewsA: Sort a multidimensional array with numerical values
Another way would also be using the function uasort, where you order the arrayaccording to a past callback. We use count us array internally compared the callback to determine which position will be…
-
3
votes2
answers1117
viewsA: How do I return a new instance of the python class itself dynamically inside it?
I ended up figuring out how to solve this problem. Just use the special attribute __class__ of the current class, which can create a new instance. Example: class Time(object): def diff(self, other):…
-
5
votes1
answer63
viewsA: Regex that captures date informed by user, typed in a sentence
You can do this using the method String.match. You need to pass a regular expression which, when evaluated, will return a array disputes the values that matched the expression passed. Example: var…
-
4
votes2
answers1117
viewsQ: How do I return a new instance of the python class itself dynamically inside it?
I’m giving a study in Python and for this I am building a class in Python that I had already done in PHP. For example, in a given method in PHP I needed to return the same instance of the class,…
-
0
votes1
answer357
viewsQ: How do I list all unstable controllers in Laravel?
On Laravel 5, we have a folder called Http\Controllers that has the controllers used in the application. There is also a controller called Controller, which is abstract, i.e., is only used to be…
-
2
votes2
answers14161
viewsA: What is the shortcut for code execution in Sublime Text?
There are some ways to do this. I usually squeeze CTRL+SHIFT+P and type until the option appears Build: With Python. Another way is you select Tools > Build System > Automatic. When you need…
-
3
votes2
answers217
viewsA: Risk in allowing developers to upem files. Blade
In addition to the risk already mentioned above, there are numerous others. When you use $this within a view blade, you have access to the Illuminate\View\View. Without contraring other methods he…
-
13
votes2
answers618
viewsQ: How to list methods of a class in C#?
Again I have to say this: I come from PHP and am learning C# now. I usually like to list the methods that the class has, because I always did this in PHP, to test or debug. $a = new ArrayObject();…
-
10
votes2
answers153
viewsQ: Is there any way to run C# from the command line in interactive mode?
I’m used to using PHP and Python, languages that allow you to run on the command line in interactive mode, so it’s easier to test or learn something new, since I won’t need to compile all the time…
-
9
votes2
answers228
viewsQ: Is there any functionality similar to Assert (affirmations) in C#?
In languages like Python there is an assertion mechanism (assert) which aims to state whether an expression is true and, if there are failures, throws an exception. In most cases, I think it’s best…
-
40
votes2
answers1642
viewsQ: Is Eval a good guy or a bad guy?
They talk a lot about eval, but sometimes I wonder if he really is the problem or is the person sitting in front of the computer (the supposed programmer). My whole life (in programming) I have…
evalasked Wallace Maxters 102,340 -
4
votes3
answers2493
viewsA: How to check if a string has only uppercase letters?
There is yet another way, which is to compare whether the string is equal to itself in the call of strtoupper. $upper = 'TUDO UPPER'; $non_upper = 'Nem Tudo UPPER'; if (strtoupper($upper) ===…
-
3
votes1
answer902
viewsA: How to get information from inside the image in PHP?
Use the function exif_read_data The function exif_read_data() reads the EXIF headers of a JPEG or TIFF image file. Returns an associative matrix where the indexes are the header names and the values…
-
0
votes1
answer617
viewsA: Problems configuring routes on apache2 server with Laravel 5.1
You should pay attention (especially if you are a Windows user) that Linux servers (which in this case is the majority, especially shared ones) make a difference between upper and lower case, unlike…
-
1
votes3
answers1379
viewsA: How can I see upgraded package versions via Composer?
The answer above said very well, just use the command composer show, and a list of packages will appear. I realized that sometimes it is necessary to filter in order to find a specific package, so…
-
4
votes1
answer214
viewsQ: Why does javascript "{} + []" equal 0?
I was watching a video that was shown to me by the user @CiganoMorrisonMendez, called WAT. There were some examples where they showed some bizarre things present in some languages. In particular…
-
5
votes1
answer104
viewsQ: In PHP 7, can the class method contain a keyword name? Is that good or bad?
PHP 7 has launched a number of innovations for the PHP language. I even noticed that classes can now have keyword named methods. The strange thing is that classes cannot have, but methods can (see!)…
-
1
votes1
answer573
viewsA: Regular PHP expression, how to remove open html tags?
According to this Stack Overflow Response in English, you can do so: $html = preg_replace("/<([^<>]*)(?=<|$)/", "$1", $html); # remove '<' os não fechados $html =…
-
2
votes2
answers40
viewsA: Final value of the array?
Use the function end to take the last value of array. $valor = end($cliente->cobrancas)->valor; I, for safety, would take care to check if that value really is an object. $ultima_cobranca =…
-
1
votes1
answer175
viewsA: Error while uploading site
That function that is giving error is not the PHP MBSTRING. Notice that there is a namespace before: Symfony\Polyfill\Mbstring\icon_strpos() This is a library of Symfony which provides functions if…
-
5
votes1
answer347
viewsA: Two __Construct() Functions in the Same Project
Wouldn’t it just be doing this? class PaginaController extends Controller { public function __construct() { // Faz alguma coisa diferente parent::__construct(); } } From what I understand your…
laravelanswered Wallace Maxters 102,340 -
6
votes4
answers845
viewsA: Is it possible to access an object within itself?
With that with a little gambiarra it is possible yes. Use a self-invoking Function making and use the this, so you will reference the object itself. I used the property __init to be able to refer to…
-
1
votes2
answers718
viewsA: How to open a file using php?
To read the files TXTfrom a directory, use the function FileSystemIterator combined with CallbackFilterIterator. Behold: $files = new FileSystemIterator(__DIR__ . '/files'); $txts = new…