Posts by Seu Madruga • 2,481 points
88 posts
-
0
votes2
answers32
viewsA: for in loop resuming the "length" index of a nodlist, is that normal? any tips to solve this?
NodeList attributes are treated as indexes by the loop. Transform the NodeList in a Array in fact through the function Array.from: for(let iBox in Array.from(boxSlider)){ let boxMain =…
javascriptanswered Seu Madruga 2,481 -
0
votes1
answer201
viewsA: Chatbot not understanding registered phrases
This code should remove 'Joker' from the message to be parsed. def respond(self, message): """ Receive message from user and returns corresponding answer. """ if re.search("joker", message,…
-
2
votes1
answer355
viewsA: Chatbot respond only when a specific word is contained in the sentence
What I notice in your code is that the first condition does not check if there is "Joker" in the message. I assume he’s always tinkering "Hm, you’re talking about ..." To correct this only, change…
-
1
votes1
answer194
viewsA: How do I search something in html css js?
There it is. The logic is simple: every time a key is pressed inside the input, the Javascript code generates a regular expression with the value of input, expression that is compared to the text of…
-
8
votes2
answers5568
viewsQ: How to interpolate string in Python?
For example, in PHP, we can do so: $preco = 200; $unidades = 10; $texto_final = "O produto custa {$preco} reais e restam {$unidades} unidades."; You can do something similar in Python or you must…
-
0
votes1
answer103
viewsQ: Equivalent to the "console.dir()" function in Python
There is, in the Python language (v3.6), some function that serves to display attributes and methods of an object, such as the console.dir() in Javascript? I would like to get an output similar to…
-
1
votes2
answers98
viewsA: Functions in PHP... How to use?
To import/merge code in PHP, there are functions: require 'caminho/para/seu/arguivo.php' require_once 'caminho/para/seu/arquivo.php' include 'caminho/para/seu/arquivo.php' include_once…
phpanswered Seu Madruga 2,481 -
1
votes0
answers137
viewsQ: Google indexes images with "display: None"
As Google Search uses deep Learning in your searches, if you search for, for example, a poem, in google images, it will pick up an image that contains the poem (if there is). Several websites, such…
seoasked Seu Madruga 2,481 -
0
votes1
answer32
viewsQ: Time for transitions to be ready for execution
The problem is that when I assign a transition to an already "painted" element in the DOM, it is not yet ready to perform in the following statement. I will illustrate: Suppose I have the "cheer"…
-
7
votes1
answer801
viewsA: Execute function by clicking on any element of type
When you select multiple elements, you are returned an object array-like with all the elements that correspond to the search. In the case, document.getElementsByTagName('a') will return a…
javascriptanswered Seu Madruga 2,481 -
1
votes2
answers1380
viewsA: How to find the nearest number with JAVASCRIPT
This function finds the nearest value, both the smallest and the largest, respectively. In the function has 2 parameters, ideais and valor, where ideais is an array with ideal values, and valor is…
-
2
votes1
answer35
viewsQ: Difference between these two declarations of immediate functions
What’s the difference between: (function() { console.log('Hello :)'); })(); and: (function() { console.log('Hello :)'); }()); ? The two snippets of code do the same thing, so I was wondering if…
javascriptasked Seu Madruga 2,481 -
3
votes1
answer23
viewsQ: Question about assigning variables in Ecmascript 5
My doubt is related to the behavior of a variable, since it is assigned a dynamic value in it. For example in the code: var x_position = window.getComputedStyle(elemento).marginLeft; Doubt: every…
-
11
votes5
answers1530
viewsQ: Do programs written in C# depend on the . NET Framework to run?
Once compiled a C# code depends on the . NET Framework installed on the machine to run, similarly to Java?
-
2
votes1
answer544
viewsQ: Array.splice does not work as expected
For example: var frutas = ["goiaba", "manga", "laranja", "abacate"]; frutas.splice(1, 1); This code, instead of removing 1 item from the second index of my array (1), only returns the item I want to…
javascriptasked Seu Madruga 2,481 -
1
votes0
answers168
viewsQ: Doubt about javascript modularization
For a while I’ve seen in codes, including large Javascript libraries, more or less like this: if (module.exports) { // faça algo } //##### define({/* parametros */}) //##### import algumacoisa from…
javascriptasked Seu Madruga 2,481 -
1
votes1
answer30
viewsQ: Calculation of event latency load with window object.performance
The time between the attribute window.performance.timing.connecStart and window.performance.timing.loadEventStart would be the time it took for the event window.onload was fired? I mean, from the…
javascriptasked Seu Madruga 2,481 -
1
votes1
answer118
viewsQ: How do I get the name of a callback function in javascript?
For example: function ola() { console.log("Olá =)"); } function executar(callback) { // quero descobrir o nome deste callback que é passado para cá callback(); } executar(ola); Thus, the execute…
javascriptasked Seu Madruga 2,481 -
6
votes2
answers216
viewsQ: How to select only the characters I want from a font?
I would like to decrease the font disk size so that the page loads faster. It is the font of Font Awesome icons. I want to know if there is any tool so I can remove the characters I don’t use and…
-
2
votes1
answer219
viewsA: Form does not receive registered data
Hello. I noticed two things there in your code. The first is the line: //$up = mysql_query("UPDATE retex SET dataedicao(...) Is this line really commented on? Try removing the "/", as this indicates…
-
0
votes2
answers79
viewsQ: Construct/start object via string parameter in a function
I need to start objects dynamically with Javascript Ex: Example class: function sayhello() { this.init = function() { alert('Hello'); } } Function to dynamically load and instantiate classes:…
-
4
votes2
answers52
viewsQ: Access this inside event
How can I access the this concerning my object, when it calls an event? When the event is called, the this becomes the event itself, the window.event Ex: function Foo() { this.bar = function() {…
javascriptasked Seu Madruga 2,481 -
1
votes1
answer1016
viewsQ: Django runserver does not work
The command: python Manage.py runserver 80 Returns the following: (I put screenshot, because the text is defaced here) The localhost address is inaccessible regardless of the port (8080, 8000, 80)…
-
3
votes1
answer111
viewsQ: Difference of parameters in Python
In Python, what’s the difference between Funcao(param='value') and Funcao(value)? Or else Funcao(u'value')? I’m starting with Python and I’ve seen codes with these three forms. I don’t know if they…
-
1
votes1
answer126
viewsQ: Make element expand from its center
The problem is, I have a div centralized with that container trick (Trick) in position: absolute or fixed and the div internal in relative. As you can see, when the animation is executed, div…
cssasked Seu Madruga 2,481 -
4
votes2
answers742
viewsQ: What is Python’s native support for database manipulation?
I found things about a module called mysqldb, but I couldn’t find documentation available on Docs.python.org Please disregard responding with frameworks such as Django.…
-
0
votes1
answer70
viewsQ: How to change the host address where requests "src" and "href" go?
Example: I give one file_get_contents('http://youtube.com') and then, should we src and href html does not have the whole path, but only src="/pasta/arquivo.ext", instead of…
-
2
votes1
answer190
viewsQ: "margin: 0" does not Zera fully
I have a problem and, although "half solved" (gambiarra), I would like to know what causes it. I have a ul with white-space: nowrap; and the li's her in display: inline-block; The problem is that…
cssasked Seu Madruga 2,481 -
1
votes3
answers937
viewsQ: Does the attribute "async" serve to execute dynamically loaded scripts? (AJAX)
I have a problem with content loaded in AJAX. Is the following: when I load scripts via ajax, I don’t have the events "onload" or similar to trigger the loaded script. The attribute async on the tag…
javascriptasked Seu Madruga 2,481 -
1
votes1
answer293
viewsQ: Function that passes arguments dynamically to callback
How to pass arguments in a callback function (usually anonymous function)? It may get hard to understand, so I’ll give you an example here. I always see this in libraries like jQuery, but I don’t…
-
0
votes2
answers3154
viewsA: Sum values of a TD with Avascript
Try this: function calculaTotal(){ var colunas = document.querySelectorAll('#products-table tr td'); var numColunas = colunas.length; for (let i=0; i<numColunas; i++){…
-
2
votes1
answer83
viewsQ: Reallocate elements in the DOM
How do I remove an element from your position and relocate it in the DOM? For example: in a <ul>, bring the last <li> to the top/first position. I saw it in jQuery, with the function…
javascriptasked Seu Madruga 2,481 -
0
votes1
answer61
viewsQ: How to block page scrolling without hiding the bar?
How do I make it so that when the user tries to scroll the page, there is no effect, but without hiding the scroll bar? All I know is overflow: hidden , but it hides the bar.…
-
0
votes1
answer426
viewsQ: Is php not good for real-time applications?
I’ve been doing some research and all I can find is Nodejs, socket.io and so on, but nothing related to php’s native socket functions. Why does this happen? There is no way to do something like a…
phpasked Seu Madruga 2,481 -
2
votes0
answers71
viewsQ: Is it possible to set a task in the task scheduler using php?
I’m not talking about running a php, but creating a new task in the scheduler, using php script executed by the user, when browsing the site. Is it possible? If not, what alternative do I have to do…
-
0
votes2
answers234
viewsA: How to show a json with jQuery and PHP?
Try this: $.ajax({ type: 'post', data: $( this ).serialize(), dataType: 'json', url:'simulacao/dados.php', success: function(data){ alert(data); // passa a resposta de string para JSON var resposta…
-
1
votes2
answers10552
viewsQ: How to take the position X and Y of an element, relative to the screen?
I would like, when an element is clicked, to get its coordinates on the page. The issue isn’t even the onclick event, but how do I get these coordinates? No libs/frameworks, please.…
javascriptasked Seu Madruga 2,481 -
3
votes2
answers146
viewsQ: A notification system using setInterval + AJAX is bad?
Because there are several requests to php+myql, little interval (millisecond thing), multiplied by several users online at the same time, this is not feasible, in the sense of computational…
-
5
votes1
answer433
viewsQ: How to select multiple columns using the table prefix only once?
In relational model condition, I have to specify the prefix of the table, I’m sure? Example: SELECT c.nome, c.idade, a.nome, a.idade FROM... What I wanted to know is if you can’t do something like…
-
2
votes6
answers28831
viewsA: How to limit an input of type Number to only 3 characters?
Well, I tested the maxlength here and it didn’t work, not the way I expected. (I thought it would block typing) I made a js function to limit the number of characters: function limitar(el, limit){…
-
0
votes2
answers319
viewsA: Hide div with fadeToggle when click out of it
Use the function .not() jQuery. It serves for you to delete elements from a selection. So if you do so: $('body').not('.dropdown-login').click(function(){ $('.dropdown-login').fadeToggle(200,…
-
2
votes0
answers27
viewsQ: What is php ob_start for?
I saw that it puts all the processed data in buffer, and releases when complete. What exactly is buffer? I only saw this name on players, which is the size of the file that will be allocated in…
phpasked Seu Madruga 2,481 -
4
votes1
answer84
viewsQ: How to know how much of the content was downloaded in an Ajax request?
I need to do that little animation, like on Youtube, of the progress bar that appears at the top. How do I know how much content has been downloaded, to have a basis for the progress bar? I didn’t…
-
4
votes2
answers181
viewsQ: How does an automatic categorization algorithm work?
I have that doubt. I’ve noticed on sites like Yahoo Answers, that there’s a recognition of the semantics of the questions and they’re categorized automatically. Sure, there are mistakes, but it’s…
-
1
votes0
answers32
viewsQ: How to make responsive texts?
I know that for normal elements, we can use the percentage, so that they are proportional to the screen resolutions. But what about the texts? What is the relative unit of measure, so that it is…
cssasked Seu Madruga 2,481 -
1
votes3
answers663
viewsA: Method Object.values( ) does not work in internet explorer 9
This method does not work in some browsers. Try: var array = Object.keys(obj).map(function(key){ return obj[key];});
javascriptanswered Seu Madruga 2,481 -
0
votes1
answer45
viewsQ: How to set an attribute by its name contained in a variable?
For example var attr = 'background'; elemento.style.attr = 'blue'; The problem is that when I pass the second line statement, the JS understands that I seek the attribute "attr" in the style of…
javascriptasked Seu Madruga 2,481 -
1
votes1
answer837
viewsQ: How to get the indexes of a json with javascript?
For example: var carro = { "modelo": "celta", "ano": 2007 } How can I make a generic function that returns the index names of that json, in this case, "model" and "year"? Something like:…
javascriptasked Seu Madruga 2,481 -
4
votes0
answers72
viewsQ: Can you explain to me what is prototype in Javascript?
I’ve seen several explanations, but I don’t quite understand. Can you give a light there? It can be really high.
javascriptasked Seu Madruga 2,481 -
0
votes1
answer174
viewsQ: Toggle text color according to background color
How can I change the color of a text according to the background color in which it is inserted? I’ve seen this a few times. It works like this: if the background is clear, the text turns black, and…