Posts by Wallace Maxters • 102,340 points
1,984 posts
-
2
votes2
answers307
viewsA: Best practice for client to choose response format (JSON / XML)
According to the Documentation for Silex 2, you can use the method Silex\Application::view to set the data presentation configuration for the user. $app->view(function (array $controllerResult,…
-
10
votes1
answer338
viewsQ: What is the purpose of the "Image" input?
Only now have I realized these days that there is one input with the attribute type equal to "image". I saw this being used on some site (very old by the way) to submit a form. I have the following…
-
28
votes5
answers2672
viewsQ: What is the </datalist> tag for?
When I was using Sublime Text to edit a file html, I realized that he suggested a tag with the name of datalist. I had never seen about this tag before, but it seems that really exists. As I did not…
-
13
votes2
answers640
viewsQ: What’s the clip property for?
I was taking a look at a code where I taught some techniques to create a responsive table. I came across the use of property clip, followed by the value rect(0 0 0 0);. Then I had this doubt: What…
-
2
votes2
answers153
viewsA: Print the minimum number on the list?
Use filter to remove the non-integer values from your list: list1 = [1, 2, 3, 'b'] result = min(filter(lambda x: isinstance(x, int), list1)) print(result) The function filter return all items from…
python-3.xanswered Wallace Maxters 102,340 -
4
votes2
answers3746
viewsQ: How to make a vertically zebrad table (switch column colors)?
I know how to make a table horizontally zebrad, ie, each row with alternating colors (the famous color yes and color no). I wanted to know now how I could by css switch the colors of the columns:…
-
11
votes1
answer1015
viewsQ: Calculations used to rotate an image on canvas
I have the following code below to be able to rotate an image through the canvas. function qs(selector) { return document.querySelector(selector); } function rotacionar(canvas, image, angle) {…
-
3
votes1
answer42
viewsA: How to make this variable global?
... When I call the type variable outside of this function it is given as undefined. The problem is not whether the variable is global or not, but when its value is assigned. It is no use to want to…
-
1
votes1
answer51
viewsA: Multiple automatic wheres
Some have spoken of method linkages, and that’s correct. But I also think it’s important to mention that it can also be called Fluent Interface. But speaking more specifically of Codeigniter’s…
-
8
votes2
answers1163
viewsA: Security Application Angular
From what I understand from your question, it seems that you are displaying some information to the client via interface, but the returned JSON is showing more than it should! I work with Angular in…
-
0
votes1
answer195
viewsA: How to make jquery stop in a loop
It seems your check is wrong. Instead of checking out $('...').val() === 'undefined' You should use $('...').val() === undefined Or typeof($('...').val()) === 'undefined') Another thing: Are you…
javascriptanswered Wallace Maxters 102,340 -
0
votes0
answers516
viewsQ: How to set up SSL (HTTPS) in Apache locally?
For testing purposes, I need to locally configure my Apache to accept access to a particular site configured in Virtualhost with SSL. I believe that knowing somehow configure SSL in a local…
-
2
votes1
answer136
viewsA: How to make the checkbox 'checked' after saving in the bank?
In a project I used the Laravel 5, I also had a similar scenario. I had a belongsToMany relationship and needed to check the checkbox for what items existed in the relationship. I used the method…
-
2
votes1
answer1056
viewsA: How do we know where the route came from and redirect it back?
If the goal is to know where the route came from, you could capture globally or in a controller-specific method which is the current url and send it to session. session(['url.previous' =>…
-
0
votes2
answers883
viewsA: How to check if a method exists in a Python class?
You can use the call function hasattr to know if a certain property exists in the class and then use callable if the property exists to know if it is something "invocable" (in this case the method):…
-
5
votes2
answers3927
viewsA: How to edit the routes created by make:auth?
This will depend on the version of Laravel you are using. Laravel 5.2 You need to add property $loginView in class AuthController. Thus: protected $loginView = 'nome_da_minha_view'; In the source…
-
3
votes2
answers883
viewsQ: How to check if a method exists in a Python class?
How to check if a method exists in a Python class? Is there any function that does this? class Test(object): def method(self): pass For example, I would like to check through a condition if a…
-
1
votes4
answers100
viewsA: function_exists fatal error
You’re confusing some things. The function function_exists receives a string which would be the name of the function to be able to assess whether a function with that name exists or not. In your…
-
9
votes1
answer272
viewsQ: What do the terms "forward Compatibility" and "backward Compatibility" mean?
I have seen these two terms, in English, being used to refer to the compatibility of some functionality of a given language, library and the like. What it really means forward Compatibility and…
terminologyasked Wallace Maxters 102,340 -
2
votes2
answers593
viewsQ: What is the difference between project ("project") and application ("app") in Django?
I had done some tests as Django framework a while ago, and only now that I tested it again, I noticed that there are two commands, which ended up confusing me: django-admin startproject…
-
5
votes1
answer762
viewsQ: What is a Shim?
When asking about "what is a Polyfill?", bumped between comments and searches with the term Shim. What would be a Shim? What is the relation of the term Shim with the term polyfill? Shim is directly…
-
17
votes3
answers13710
viewsA: What is a Polyfill?
As already mentioned, Polyfill is a code snippet used to "plug hole" old browsers, aiming to add more current functionalities. An example of this can be seen on the MDN website, for some functions…
-
32
votes3
answers13710
viewsQ: What is a Polyfill?
I’ve seen that term Polyfill being used several times when it comes to a new function that is not available in older versions of certain languages and the like. But after all, Polyfill is simply…
-
4
votes1
answer219
viewsQ: What is an inert element?
I asked a question about tabindex here on the site and ended up bumping into the term inert elements. I realized it’s something that’s in specification of w3c, and on top of that there is a Polyfill…
html5asked Wallace Maxters 102,340 -
0
votes1
answer45
viewsQ: What is the difference between sublime_plugin.Textcommand and sublime_plugin.Windowcomand?
When we create a plugin, Sublime Text usually creates a sample using the class sublime_plugin.TextCommand. import sublime import sublime_plugin class ExampleCommand(sublime_plugin.TextCommand): def…
-
20
votes2
answers5894
viewsQ: How and where does tabindex work?
Since I started programming, I’ve observed the use of tabindex in some specific elements. I understand perfectly that it has to do with pressing the button tab and the focus of the elements, but I…
htmlasked Wallace Maxters 102,340 -
0
votes2
answers73
viewsA: How to use an angular service outside the angular structure?
Suppose you want to use the $http outside the angular internal structure, you use the method angular.injector: var $http = angular.injector(["ng"]).get("$http");…
angularjsanswered Wallace Maxters 102,340 -
7
votes7
answers1017
viewsA: Is there any way to know if an array is associative or sequential?
A nice thing that can be done to know if the array is or is not associative is converting it to JSON and checking whether the first item of it equals the character [ instead of {. When a array in…
-
6
votes1
answer3403
viewsQ: How does any and all work in Python?
How the functions work any and all in Python and what are the differences between them? They happen to be functions equivalent to Array.prototype.some and Array.prototype.every javascript?…
-
10
votes5
answers10407
viewsA: Identify if there is an uppercase letter in the string
Perhaps comparing the converted string to lower case would be easier. texto = 'não tem maiúsculas' if texto.lower() == texto: print("não tem maiúsculas") Another way would be using the function any…
pythonanswered Wallace Maxters 102,340 -
0
votes3
answers234
viewsQ: Should I set the background on TD or TR?
I have this question ever since. I wanted to know what is the most recommended way, if is to define the background in tr or in the td. Example 1 .table > thead > tr { background: red; }…
-
8
votes1
answer2605
viewsA: What is Service Container?
What is a Service Container? Service Container. It is a mechanism created by Laravel that facilitates the management of dependencies between classes. This subject is directly linked to Addiction…
-
2
votes1
answer159
viewsQ: Is it mandatory to use the pyqtSlot decorator?
When I want to connect a QPushButtonto an event, for example, I use a method and add it as event callback clicked.connect For example: def buildUi(self): self.buttonSubmitText =…
-
2
votes1
answer850
viewsQ: How to submit when pressing ENTER on a Qlineedit?
I have a certain QLineEdit in my application that when a QPushButton is clicked, the text of it is sent to the database. But I wish I could add that same event by pressing the ENTER key on that…
-
2
votes2
answers513
viewsA: How to open file by separating each line into an item from a list/tuple?
There’s an answer I saw in Stackoverflow English which is simply fantastic. Behold: lines = tuple(open('hello.txt', 'r')) Simple and in a row!…
-
2
votes2
answers513
viewsQ: How to open file by separating each line into an item from a list/tuple?
In PHP, we have a function called file which, when opening a file, causes each line to be placed in an item of a array. Example: hello.txt olá mundo php script file('hello.txt'); // array('olá',…
-
9
votes2
answers1038
viewsQ: How to remove tags in Python text?
In PHP we have a function called strip_tagsthat remove HTML tags from a given text. Example: $text = "meu nome é <strong>Wallace</strong>"; strip_tags($text); // 'meu nome é Wallace' How…
-
0
votes1
answer49
viewsA: How to escape HTML from an entry in Pyqt?
I ended up solving the situation using the module html python3. import html text = html.escape(self.textChat.text())
-
0
votes1
answer49
viewsQ: How to escape HTML from an entry in Pyqt?
Both Pyqt4 and Pyqt5 can interpret HTML entities. I have a place where the text is displayed in HTML format. However at the time of sending a text made by a certain QLineEdit, I need this text to be…
-
0
votes3
answers392
viewsA: How to open remote content with python?
This answer will depend on the Python version. The @sergiopereira response works perfectly for Python 2. But in Python 3, for example, I couldn’t find the urllib2, and yes urllib3, which is a little…
pythonanswered Wallace Maxters 102,340 -
2
votes1
answer940
viewsQ: How to know which is the PID of a currently running Python script?
I have a certain Python script that I want to know what is the current PID of it, through the script itself. How can I do that? Through this too, I can determine that it be executed only once?…
-
7
votes1
answer6958
viewsQ: What would be a PID?
I’m starting to study desktop applications. I had a certain question about how I could know if a particular application is running and I was told that I could use the PID, as a solution, to detect…
-
24
votes5
answers8944
viewsQ: What is an SDK?
Until recently, I always saw SDK as something related to the Android universe. But I have noticed some PHP libraries that also use the name SDK. For example: pagseguro-php-sdk facebook/Graph-sdk But…
-
0
votes1
answer123
viewsA: How to define providers that only work in a local environment with Laravel 4?
In Laravel 4, there is a function called append_config, that reindexes a array for a high numbering, starting from the 99999. This happens because the class Config by default override the arrays…
-
7
votes1
answer9516
viewsQ: How to change the version of PHP in which Composer runs on Linux?
I installed Composer on my Ubuntu via the following command: apt-get install composer Ubuntu currently supports multiple installed PHP versions. I have PHP5.6, PHP7.0 and PHP7.1 installed on my…
-
12
votes1
answer9516
viewsA: How to change the version of PHP in which Composer runs on Linux?
In my case, I solved it this way. When giving a which php, the same points to the way /usr/bin/php. I found that this is actually just a link to the latest php installation. So I deleted the link…
-
9
votes1
answer151
viewsQ: What is "global::" in C#?
I was editing a source code for an application I’m writing in C#, which uses GTK+. I have some knowledge of C#, but did not understand why some variables were written when I mounted the UI in "drag…
-
1
votes1
answer301
viewsA: Case-sensitive query in sql server with Laravel 5.4
If it is complicated to compare passwords by SQL server, you can do it by PHP. $result = DB::table('users') ->where('acc', $request->input('account')) ->first(); if ($result &&…
-
32
votes1
answer3647
viewsQ: What is shadow DOM?
When I was reading about some Javascript frameworks, for example the React, I read the expression a few times shadow gift in some articles. It even seems that it is possible, in Chrome console…
-
18
votes2
answers5391
viewsQ: What is the HMAC?
When working on a project that uses sha256 and security keys, I came across the term hmac. I’m still not quite sure what this is about, and I’d like to understand a little more. I have the following…