Posts by Pedro Pinto • 336 points
23 posts
-
1
votes2
answers1086
viewsQ: Adding list elements during a Python loop always returns the same value
I have the following code: current = [0, 1] someList = [] while True: for n in range(0, 2): current[n] += 1 print(current) # [1,2] and [2,3] someList.append(current) if current == [2, 3]: break…
-
0
votes1
answer69
viewsQ: Update nested array in mongodb
Hello, I have been looking for a solution to my problem, which I will mention below, but I still haven’t found the right way to solve it, the solutions I find usually update the whole array rather…
-
0
votes1
answer106
viewsA: Python - Scan File and Extract Data from Sticky Tags
From what I understand, you want to have a set of tags and from these tags, check if in each row of a respective file they exist and then write those lines in another file. This can be easily done…
pythonanswered Pedro Pinto 336 -
0
votes1
answer76
viewsA: Spotify API: this.state.data.map is not a Function
According to the official documentation of Spotify the type of variable of data.artists that you refer to when you are modifying the state of the component is actually an object, but what you want…
-
0
votes0
answers32
viewsQ: Why should I use Reflection in Javascript?
I wanted to know why I should use Reflection in Javascript instead of normal operators. I only knew it existed Reflection today and I wanted to know why it would be more useful to use Reflection…
javascriptasked Pedro Pinto 336 -
2
votes1
answer72
viewsQ: It is possible to name a python module using the __import__function
I have the following code __import__('some_module') And I wanted to know if it was possible to do something like this: __import__('some_module') as some_name…
pythonasked Pedro Pinto 336 -
0
votes1
answer72
viewsQ: Giving Hover one element and changing the other is not working
I looked for all the ways to give hover one element and change another and some of them already knew and had tried but it wasn’t working, so I went looking for others and I tried everything…
-
1
votes2
answers170
viewsQ: Avoid duplication in Mysql
Duplication of mysql ? I’ve been searching and nothing fits my case, every time I try to duplicate it. I’m trying to import it on the table: INSERT INTO profiles (id, rep, gems, plevel) VALUES (id,…
-
5
votes1
answer563
viewsQ: Javascript Image Handler
Is there any image handler similar to canvas or jimp for node.js? Explanation of why you don’t want to use either: So I was trying to use canvas as a test, and it’s taking too long to compile the…
-
0
votes2
answers1188
viewsA: Method to exchange Javascript / html images
Well, the mistake you’re trying to find is in the trocar[whichquote] swap for trocar[whichtrocar]. And start analyzing errors by browser with CTRL+SHIFT+I and click on the tab Console there will…
javascriptanswered Pedro Pinto 336 -
1
votes1
answer2605
viewsA: Take data from a json file by the url (javascript)
Like you already do jQuery you can use a function that is jQuery.getJson() Example: $.getJSON(url, function(result){ // result é o json obtido }); Practising:…
-
0
votes3
answers2646
viewsA: How to disable an input field?
To block the change in that input, use jQuery to assign readonly (read-only) to the countryside. Code: $('#nome').prop('readonly', true);…
-
1
votes2
answers50
viewsA: Open window 1 single time
This is simple to declare a variable at the beginning type var click = false and when the person clicks you put this variable to true and put a if statement to check if the variable is false, if it…
-
1
votes2
answers4846
viewsA: How to take 2 decimal places
For it to stay two decimal places you need to just put .toFixed(2) after the amount received.
-
1
votes2
answers420
viewsA: Uncaught Typeerror: Cannot read Property 'split' of Undefined at Xmlhttprequest.alertContents
It may be that: requestatual may not be a string requestatual is Undefined httpRequest is not receiving information Obs: Show more code next time.…
-
1
votes1
answer158
viewsA: Problem validating form fields as mandatory
ForEach in each input form and check if they are required $('#form').find('input').each(function(){ if(!$(this).prop('required')){ // É required } else { // Não é required } }); So that with the…
-
1
votes2
answers5049
viewsA: Check if record exists in the table and return in mysqli
To check whether the row there is just do this: $sql = "SELECT * FROM logs WHERE usuario_id = '{$user}'"; $result = mysql_query($sql); if(mysql_num_rows($result) > 0) { echo 'font-weight: 300;';…
-
-1
votes1
answer51
viewsA: How and how best to calculate a net value
Well, to automatically appear you can use an html event like onkeypress think. Now, to calculate discount of % and of R$ you can give a name the input and with jQuery when the html event is…
-
0
votes2
answers1176
viewsA: Generate a JSON from a converted XML with Javascript
I found an online code that I think can help: function xmlToJson(xml) { // Create the return object var obj = {}; if (xml.nodeType == 1) { // element // do attributes if (xml.attributes.length >…
-
0
votes0
answers307
viewsQ: Is it possible to return a value within a callback without another callback?
Well, I have a function that returns a value for a callback, but I wanted it to return without that callback, this is possible? Function in question: function getProfile(id, fn) { var sql = "SELECT…
-
2
votes1
answer284
viewsQ: Add variables to columns (Mysql)
I have a question, it is possible to add variables in a column? Codigo Test var sql = "INSERT INTO sometable (someparam) VALUES (varToParam)"; con.query(sql, function (err, result) { if (err) throw…
-
-1
votes2
answers647
viewsA: Read JSON and show in html using Angularjs
From what I understand it must be this: var info = null; $http.get('algumacoisa.json').success(function(data) { info = data; });
-
-1
votes2
answers890
viewsA: Notice: Undefined variable
Try to get the ['id'] of $row because in the foreach($sql as $row) $row will receive the last property of the array. Then $row will be a string…
phpanswered Pedro Pinto 336