Posts by Wallace Maxters • 102,340 points
1,984 posts
- 
		7 votes2 answers8606 viewsA: What is the difference between the angular foreach and the javascript map functionThe map Javascript will only work in type values Array, because it is part of your prototype. That is, the map what you are referring to is Array.prototype.map. Already the angular.forEach (which is… 
- 
		0 votes1 answer63 viewsA: How to display different categories lists on the same page using Laravel 5.3You will probably use the GroupBy to solve this. I’m not talking about the GroupBy Eloquent Query Builder, and yes Collection (the outcome of its consultation). Example: $produtos = Produto::get();… laravelanswered Wallace Maxters 102,340
- 
		5 votes2 answers2166 viewsA: Check Empty Fields - Orange 5.3I will pass some solutions below that the framework itself offers: Model Mutators It is possible to define a behavior for the definition of a certain attribute of a Model in Laravel. For example,… 
- 
		4 votes2 answers334 viewsQ: Sentence separated by comma in an IF Javascript would have what purpose? " if (1, 2) {}"By accident when I was changing a Javascript code I made, I put a comma instead of the || in an expression if. I altered if (that.busy || that.completed) return; for if (that.busy, that.completed)… 
- 
		1 votes2 answers485 viewsA: Laravel 5.3: Auto_increment jump (id) (Gaps)It has already been explained very well in a reply that this is an expected behavior. Answering the other two questions: This happens to all systems or only Eloquent? As stated, this is how Mysql… 
- 
		1 votes1 answer724 viewsQ: Ignore http error code when using file_get_contentsI’m using file_get_contents to make a request to a url. This request can return an error 422. When that mistake 422 is returned, I need to capture the body, which comes in format JSON. But the… 
- 
		31 votes2 answers843 viewsQ: Is it really necessary to put "text/javascript" in the <script> tag?We are in 2016. I have read in some places on the internet that it is no longer necessary to use this statement type="text/javascript". In fact, use the tag script without declaring this excerpt… 
- 
		2 votes1 answer160 viewsA: Creation of dynamic ThumbsIf you have in hand the current time information from video to mouse over the video duration progress bar, you could send this information to the server with Ajax and use ffmpeg to capture Thumb… 
- 
		1 votes1 answer612 viewsA: Read word file in Laravel 5.3You can use the library Phpword to do this. Just install it via Composer and use it together with Laravel (on the library link there are better installation and use instructions). Following are… 
- 
		11 votes2 answers502 viewsQ: What is the difference between "String(1)" and "new String(1)" in Javascript?Why in Javascript it is possible to call String as a function and also instantiating? Take the example: var str1 = new String(1) var str2 = String(1) console.log("Valor é %s e o tipo é %s", str1,… 
- 
		3 votes2 answers996 viewsA: Display the contents of Object NodelistThe estate innerHTMLexpecting a String. That’s why it’s not working. You can go through titulos and use appendChild to insert each element found in your desired element: function final(){ var… javascriptanswered Wallace Maxters 102,340
- 
		1 votes2 answers3568 viewsA: PHP - Parse error: syntax error, Unexpected 'public' (T_PUBLIC) inIs missing close the else, right after the closure of the foreach. See how your code is: if (empty($url_cliente)) { $url = "Erro - URL cliente não cadastrada"; } else { foreach ($url_cliente as… 
- 
		5 votes1 answer363 viewsA: Problem with wherein Eloquent LaravelYou missed that part: ->whereIn(function ($query) use ($disciplina){ $query->whereIn('modulos_questoes.banco_disciplinas_id', $disciplina)… 
- 
		0 votes2 answers87 viewsA: How to not load the page by clicking on the select option?Add a condition for the execution of your function. <select id="filtro" name="filtro" class="form-control" onchange="this.value !== 'nAtualiza' && this.form.submit()"> <option… 
- 
		2 votes1 answer650 viewsQ: Is there any way to submit the form to an Iframe (without Javascript)?Is there any way to make a form submission where the action, instead of updating the page, be submitted to a iframe? I’ve seen it somewhere, but I didn’t know how the magic was done. It was done… 
- 
		1 votes1 answer650 viewsA: Is there any way to submit the form to an Iframe (without Javascript)?Yes, there is a way to submit a form to a iframe, no need for Javascript. A lot of people don’t know, but it’s possible. First you need to define the attribute target in his form. That one target… 
- 
		3 votes2 answers238 viewsQ: What happened to Unicode in Python 3?I’m starting to use the Python3 little by little. I ran a certain code that I used to run with Python2.7 and got the following error: Nameerror: name 'Unicode' is not defined So I understand that… 
- 
		12 votes4 answers3402 viewsQ: How to detect the operating system with Python?How can I do in Python to identify which operating system is being used? 
- 
		5 votes2 answers1043 viewsQ: What is the default value for the "position" attribute?In CSS, I know the property position can receive the values fixed, absolute and relative . Each has a different effect on the position of the element. But I was in doubt when I was asked the… cssasked Wallace Maxters 102,340
- 
		3 votes1 answer122 viewsA: Do a Hasmany per date with Laravel 5.3?Definition in the relationship In Laravel, you can add a Where clause to a method that defines the relationship between entities. Behold: public function despesas() { return… 
- 
		2 votes3 answers1420 viewsA: How to get only the month of a date with Laravel 5.3?Use the method DateTime::createFromFormat to instantiate an object DateTime from the date in the desired format. Behold: $vencimento = \DateTime::createFromFormat('d/m/Y',… 
- 
		26 votes5 answers1574 viewsQ: Why do "Alert", "confirm" and "prompt" lock the loading independent of the definition order?I’d like to understand why, when we use the functions alert, confirm or prompt, they always cause a kind of "freeze" on the screen. For example, I have a alertand then I have a div with a defined… 
- 
		3 votes4 answers320 viewsA: What is .= in php?I would say that .= is a form of contraction (a shortening) to the concatenation syntax in order to make it simpler. In PHP, the operator of . is responsible for the concatenation of strings.… 
- 
		3 votes2 answers1052 viewsQ: How to set a timeout for a request?I’m making a requisition JSONP for a webservice. But sometimes the request takes too long. As I am showing the user a loading status, I would like to abort the request if it is more than 10 seconds.… 
- 
		7 votes2 answers293 viewsQ: How to destroy a $Scope. $watch?I have the following $scope.$watch in the controller of a directive I created: var interval; $scope.$watch('active', function () { if ($scope.active == true) { interval = $interval(function () { if… angularjsasked Wallace Maxters 102,340
- 
		8 votes3 answers665 viewsA: What does the term "routing" mean in the context of MVC architecture?"Routing" translating is "Roteamento". From what I understand of MVC, the term Routing is related to the route control/definition of an application. Those routes are usually used to define an action… 
- 
		3 votes1 answer340 viewsA: Search image tags inside PHP stringYou can do something similar to that answer from SOEN: $doc = new DOMDocument(); $doc->loadHTML($string_com_img); $imageTags = $doc->getElementsByTagName('img'); $srcs = []; foreach($imageTags… phpanswered Wallace Maxters 102,340
- 
		30 votes5 answers7016 viewsQ: How to delete all duplicates except one?I have a table that has duplicate records. They shouldn’t be duplicated. Some records duplicated two, five and even thirty times by accident. I need to remove these duplicate records, but I need to… 
- 
		5 votes1 answer153 viewsQ: Why use __debugInfo()?I saw that PHP 5.6 has now created the new magic method called __debugInfo. This method aims to return a array, which will be printed in the var_dump. That one array returned obviously must offer… 
- 
		13 votes4 answers199 viewsA: Difference between syntax to declare a functionThe biggest difference I see is in the statements. In option 1, you used a function, and in option 2, an anonymous function. I believe the main difference in this case is that, with the stated… 
- 
		3 votes1 answer58 viewsA: How to define the semantics of downloaded packages with Composer?According to the composer documentation: Caret The Operator behaves very similarly but it sticks Closer to semantic versioning, and will Always allow non-breaking updates. For example 1.2.3 is… 
- 
		2 votes2 answers2110 viewsA: Laravel - Route with variableYou only need to specify in your route expression which parameter will be variable in the url. Then, in your controller, you set the desired parameter to capture the url parameter in your specific… 
- 
		4 votes2 answers223 viewsQ: Is there a performance difference between Tuple and List?In Python, I know there’s a difference between Tuple and a List. To Tuple is immutable, and the List, mutable. You even have that question here: What is the main difference between a Tuple and a… 
- 
		12 votes3 answers7194 viewsA: What is a method " __contruct()"?Every class will have a constructor method? Not necessarily. A constructor is responsible for initializing the class in the instantiation act. That is, when the operator new is invoked along with… 
- 
		5 votes3 answers2721 viewsQ: How to join several Python dictionaries?In some languages, it is possible to unite objetos/array in one. For example, in PHP, I can join several arrays thus: $userInfo = ['name' => 'Wallace'] $jobInfo = ['job' => 'Developer']… 
- 
		4 votes1 answer580 viewsA: How to make available a package created with Composer?Standard provision of a package First, you need to have an account on Packagist. Currently (year 2016), you can use your Github to create it. Then you need to have a public repository to be pointed… 
- 
		5 votes1 answer648 viewsQ: How to read Yaml with Python?How do I read a Yaml file or code with Python? You need to install something, or you can do it natively? Example: fruits: - Apple - Orange - Strawberry - Mango… 
- 
		13 votes2 answers1270 viewsQ: Why is the NAN constant evaluated as True when testing it with is_numeric?I was doing a test with the constant NAN in PHP, because until then I had never used it. I did tests out of curiosity. I noticed something interesting. When calling the function is_numeric in NAN… 
- 
		6 votes2 answers298 viewsQ: How to run audio with Pyqt?Is there any way to run an audio file with Pyqt? You can do this only with Pyqt or you need to install another library? 
- 
		3 votes1 answer415 viewsQ: How do I set a Tray Icon (tray icon) in a Pyqt application?I’m still a beginner in Pyqt and would like to clarify a question: Is there any way to define a Tray Icon (Tray Icon) in a Pyqt application? If so, how can I do it? I need to set some options on… 
- 
		4 votes1 answer859 viewsQ: How to repeat a function call every X seconds in Pyqt?I am developing a small application in Pyqt4 where I need to upload the data to a table coming from a Webservice. This I managed to do quietly. However, now, I need that every 1 minute, these data… 
- 
		2 votes1 answer238 viewsQ: How to get all parameters in a GET request with Silex?I’m having my first contacts with the Silex framework. I have the following script to capture a parameter GET: $app->get('/', function (Request $request, Silex\Application $app) { return… 
- 
		6 votes1 answer96 viewsQ: What is the purpose of "X" at the beginning of some header names?There are specific HTTP headers that have the purpose of passing some information. As for example the Content-Type that informs the mime of the content you want to receive or send. We also have the… 
- 
		10 votes2 answers16210 viewsA: Mysql returning "Group By" error after upgrade to version 5.7I solved the problem by disabling the sql_mode. I did so: mysql > SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); According to this reply from SOEN… mysqlanswered Wallace Maxters 102,340
- 
		3 votes2 answers16210 viewsQ: Mysql returning "Group By" error after upgrade to version 5.7I had a certain MYSQL query that was working correctly. This is the consultation: SELECT *, count(*) as count FROM `post_hashtags` WHERE `created_at` BETWEEN ? AND ? AND (SELECT count(*) AS… mysqlasked Wallace Maxters 102,340
- 
		6 votes1 answer278 viewsQ: Importing specific modules is faster/performative than importing everything (with the asterisk)?In Python, since I realized that it is possible to import specific functions or classes from a module, I chose to always do so. One of the reasons is legibility. The other reason I’m not sure, so I… 
- 
		8 votes3 answers463 viewsA: What is the correct option to instantiate a PHP class?In the context of the question would be the second option: $atleta = new Atleta(); But remember that in PHP, it is not necessary to use parentesis () when the class has no constructor or does not… 
- 
		79 votes4 answers38157 viewsQ: What is XGH (Extreme Go Horse)?I see some people in the middle of programming referring to this term whenever a code appears with a strange solution or medium "entwined". By doing a quick Google search, I’ve come to the… terminologyasked Wallace Maxters 102,340
- 
		4 votes2 answers315 viewsA: Problem in a foreachI know you’ve already posted an answer, but another legal solution in the Laravel would be using the or in the desired expression: {!! $user->empresa->razao_social or "Sem empresa" !!}… 
- 
		6 votes2 answers2567 viewsQ: How to format a date displaying the month name in angular?I have an object Date on my Angular controller. $scope.date = new Date; I would like to format this date in the view to display the name of the month in full. I want the name to be displayed in… angularjsasked Wallace Maxters 102,340