Posts by Icaro Martins • 4,187 points
141 posts
-
2
votes2
answers81
viewsA: How to sort a string by initial fragment?
Maybe this code can help you. = D In it I used the parameter key of function sorted to pass a function that returns the value that will be used for sorting. In this function I will use regular…
-
1
votes1
answer65
viewsA: Convert jquery object to html DOM
So I guess what you’re trying to do is add the element to the page. To do this you can use the .append as you did in your element <a>, only this time with an item that is already on the page.…
-
5
votes4
answers6855
viewsA: Execute function when losing focus of an input
You can use the event onblur that is triggered when an element loses focus, see the example below: let el = document.getElementById("hLane1"); el.onblur = function(){ console.log("blur", "saiu do…
-
3
votes1
answer260
viewsA: Call method with defined vector elements parameter
I did not find the error in your code, but I leave some tips. Usually class name starts with uppercase letter. The functions and variables of your class media are all static then you don’t need to…
-
3
votes1
answer90
viewsA: How do you order the list, no repeat numbers?
One way to do this is to transform your list in a set, which is a type of list whose characteristic is to have unique elements, then use the function sorted that will return you a list orderly lst =…
-
1
votes2
answers105
viewsA: How to recover an input value by button
A way to do this and putting a container outside the input and button to group, and modifying your javascript a little see below function getValor(button){ var $button = $(button), $input =…
javascriptanswered Icaro Martins 4,187 -
6
votes1
answer166
viewsA: When trying to create an object using `this` the console says that the property is Undefined
Part of your problems and understanding some things in your code, the first one I see is your understanding of the this. The this is the object of execution context, its use is a little complicated…
-
2
votes2
answers339
viewsA: Dynamic select with Javascript
It seems to me you’re just trying to change the text of option, then we can do it this way: function mudaCivilF(){ var opt_F = new Array("-----------", "Solteira", "Casada", "Separada",…
-
0
votes1
answer99
viewsA: how to sort csv files in python by column values? Giving error
You can use the sort using the parameter key to spend a lambda Function, leaving +/- as shown in the example below: lista = [ ["Maria", 15], ["João", 26], ["Jonas", 14], ["Fernando", 23] ] ordenar =…
-
1
votes3
answers55
viewsA: Jquery.text does not work
It seems to me that your script is inside the file index.js. Instead of including him inside the <head> put it before the </body>, like you did with the bootstrap.min.js. It’s probably…
jqueryanswered Icaro Martins 4,187 -
7
votes2
answers2343
viewsA: How to change the value of the key in a Python dictionary?
You can use the del to remove after placing the value in a new key leaving +/- like this: RE2 = { "Nome": "Leon Scott Kennedy", "Ocupação": "Oficial de Polícia (R.P.D)", "Nascimento": 1977 }…
pythonanswered Icaro Martins 4,187 -
0
votes3
answers2910
viewsA: How to delete the first line in a python CSV file
From what I’ve seen in the documentation you can use your own read_csv of pandas to make a ignore the line. df = pd.read_csv( "meu.csv", skiprows=[0] ); # ^ lista com as linha que devem ser…
-
0
votes1
answer68
viewsA: how to access the webview inside the onBackPressed method on android
So its class was commented this +/- so public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // ... setContentView(R.layout.activity_main);…
-
0
votes1
answer30
viewsA: out of the unexpected program
The problem is he’s never getting in if if(jogador.pontuação > jogador_com_maior_pontuacao) { /// ... } if(jogador.pontuação < jogador_com_menor_pontuacao) { /// ... } This is happening…
javascriptanswered Icaro Martins 4,187 -
1
votes1
answer47
viewsA: Nullpointerexception error in the Java language using Android Studio
I believe the problem is occurring because you are trying to get the elements at the root of the class, before the onCreate, that is, before executing the setContentView(R.layout.activity_main);…
-
1
votes3
answers3072
viewsA: How do a div or span occupy only the size of its internal content?
If I understand correctly you must want to use css display with the value table or inline-table .teste1{ display:table; border: 1px solid red; margin-bottom:4px; } .teste2{ display:inline-table;…
-
1
votes2
answers784
viewsA: Email form validation with javascript
I looked at your code I changed the way you’re trying to do the submit and fixed some problems and put some comments to explain what I did, I hope it helps you. = D function checkEmail () { var frm…
-
2
votes1
answer42
viewsA: Child element count returns 'Undefined' in jQuery
You put lenght instead of length /// var qtdGrid = $('div.dataGrid div.dataGrid-item').lenght; /// ^ console.log( [1,2,3,4].length ); /// ^ exemplo…
-
0
votes1
answer31
viewsA: Not passing id via get
I think your problem is that you put the value of id outside the url string, look at the example below //<a href='../model/patient-delete.php?id='<?php echo $id['id_paciente']?> // ^ // a…
-
0
votes3
answers1214
viewsA: bs4.Featurenotfound (Beaultifullsoup and parser error)
From what informs the error it seems that you do not have lxml installed, to install you can use one of the console commands below. pip install lxml # ou python3 -m pip install lxml # ^ # python que…
-
3
votes1
answer202
viewsA: Problem when displaying image between html tags
From what you explained, I imagine your variable $result['imagem'] has the 'binary' of the image, to make a quick comparison would be as if you were running a file_get_contents('minhaimagem.gif')…
-
1
votes1
answer24
viewsA: Remove with php line in mysql
Your $_POST['ids'] is an array where every item of it looks like the string '33,Rute', by what it seems you want to make a explode in an item of his or is the correct code would be: $partes =…
phpanswered Icaro Martins 4,187 -
2
votes1
answer106
viewsA: Do not access image by url
Disabling the Directory browsing of apache2, you can use one of the options below. Option 1: Via command: a2dismod autoindex After that the apache2 /etc/init.d/apache restart Option 2: Editing…
-
1
votes1
answer725
viewsA: Uncaught Typeerror: Cannot read Property 'appendchild' of null
Looking at your code the problem is that c_form_cad (form) was created but was not added to the page yet document.getElementById will return null. Another point is that in this case the c_form_cad…
-
2
votes3
answers710
viewsA: Take text area values separated by line
Another option with regex. function texto(){ /// a chamada `texto.call(this)` faz com que nexte momento this seja o textarea var value = this.value, dest = document.getElementById('etxt'); //…
javascriptanswered Icaro Martins 4,187 -
0
votes1
answer59
viewsA: What is the error in the Python chart
I think that might be your problem ... df_dolar = df_dolar.loc[data_inicial:data_final] #df_divida = df_dolar.loc[data_inicial:data_final] # ^ # Voce esta utilizando `df_dolar` acho que você queria…
-
1
votes3
answers1465
viewsA: Itemgetter - Sort list of dictionaries - Python
You can use the parameter reverse of sorted to do the Sort and create a new list with the result, leaving +/- as shown in the example below: lista = [{"nome": "Maria", "idade": 15}, {"nome": "João",…
pythonanswered Icaro Martins 4,187 -
6
votes1
answer223
viewsA: PHP in_array()
This is happening because you’re doing the check with a string. //in_array('Air bag',$tx['tax_val']) // é isso que o php está vendo in_array('Air bag', 'Air bag' ); // ^ // ou seja $tx['tax_val']…
-
0
votes1
answer19
viewsA: Write data to file giving UP on last post
This is happening because you’re putting the file_get_contents at first. <?php $file = 'abc.html'; // Open the file to get existing content $current = ""; // adicionar os dados do arquivo antes…
-
3
votes1
answer1093
viewsA: List folder and subfolders in a PHP foreach
I created these scripts to run result of BDECODE and create an array, maybe one of these options will help you. = D This option creates an array where the key is the file path. require_once…
-
0
votes3
answers347
viewsA: Import csv as float
You can try using the method pd.to_numeric() passing the parameter errors as follows: df['suaColuna'] = pd.to_numeric(df['suaColuna'], errors='coerce') // errors = 'coerce' -> se tiver um valor…
-
2
votes1
answer182
viewsA: Format currency to select from JSON
You can try as shown below, basically the conversion was made to float and then used the function toLocaleString function loadItens(){ $.getJSON("https://api.myjson.com/bins/10hz22",function(data){…
-
1
votes4
answers2332
viewsA: Print String vertically in Python
You are concatenating string instead of summing in its variable cont and wasn’t getting the size of nome print("-"*30) nome = str(input("Digite seu nome: ")) cont = 0 # era '0' string while cont…
-
3
votes1
answer194
viewsA: Variable errors at the beginning of PHP
If I’m not mistaken that Undefined var error actually is a notice. Options: If it’s really the notice you can configure php to delete // No seu script.php // Assim error_reporting(E_ERROR |…
phpanswered Icaro Martins 4,187 -
0
votes2
answers82
viewsA: Differences between event definitions
Calling him that way .click(function(){}) you’re wearing a shortcut for the call .on('click',function(){}). Already calling him without passing a function, ie this way .click() you’re making a…
jqueryanswered Icaro Martins 4,187 -
1
votes1
answer555
viewsA: Error Trying to get Property 'num_rows'
I think the problem might be this part $numRows = $result->num_rows; if ($result->mysqli_num_rows== 1) { return true; } According to the documentation the msqli::query can return false or…
phpanswered Icaro Martins 4,187 -
0
votes2
answers94
viewsA: how to handle JSON Array in PHP
As you yourself put in your code commentary //a opção true vai forçar o retorno da função como array associativo. //a opção true vai forçar o retorno da função como array associativo. $conteudo =…
-
3
votes2
answers73
viewsA: How to recover the class of a div by clicking on it?
You can use the this.className, or this.classList See the example below. document.querySelectorAll(".btn").forEach(function(elem,idx){ elem.onclick = click }) function click(){ /// neste contexto…
-
1
votes2
answers253
viewsA: Add item to an Array coming from an Htmlcollection
You’ll have to rotate the Array.from( variavel ) again, another option is you also add the value in the variable that was generated with the Array.from. When you call the Array.from you are creating…
javascriptanswered Icaro Martins 4,187 -
4
votes2
answers640
viewsA: How to allow white space in any part of the sequence in a regular expression?
Putting the \ at the end within the [] should work. var filter = /^(?=.*?[a-z])(?=(?:.*?\d){9})[a-z\d\ ]{12,}$/i; ^ # inicio (?=.*?[a-z]) # procura por caracteres `a` atá `z` pelo menos 1…
-
1
votes1
answer57
viewsA: Toggle elements inside elements with jQuery
Basically I changed the javascript, you’re a selector who was picking everyone up, you’d have to pick up the relative event click for that I used the this of the event which at that time is the…
-
1
votes1
answer37
viewsA: innerHTML error
The mistake is here /// retorna null, pq nao existe elemento <pontuacao></pontuacao> const scoreBoard_div = document.querySelector("pontuacao"); /// retorna null, pq nao existe elemento…
-
0
votes3
answers100
viewsA: Change position HTML element with each (or other hint) on page load
See if the example below can help you. $("button").on('click',mudarPosicao); function mudarPosicao(){ // pega cada elemento DIV dentro do id='list' $("#list > DIV").each(function(i,el){ var pai =…
-
2
votes2
answers2605
viewsA: How to access the Android Studio Theme Editor in version 3.3.1?
Updating According to the replies of problem reported in Issue Tracker the Theme Editor has been disabled from the version 3.3 Beta android Studio. One of the answers still cites a post on Ddit,…
android-studioanswered Icaro Martins 4,187 -
0
votes1
answer200
viewsA: Upload external content with AJAX to global Javascript variable
I think you can use the $.get, if the file is on the server. Case local you are referring to the computer of who is accessing the page you will have to use another method, in that reply shows how to…
-
2
votes3
answers1169
viewsA: Calculator in php using buttons
I’m seeing some problems in your code: $op = $_GET['escolha']; # esta jogando o escolha para a var $op switch ($escolha) # esta usando $escolha que não existe # case = 'Soma': # errado case 'Soma':…
phpanswered Icaro Martins 4,187 -
0
votes3
answers888
viewsA: How to use relative path in HTML using /
Let’s say you’re accessing the site www.meudominio.com/dirA/dirB if there is a link to this page / will make you go back to the www.meudominio.com/ which is the root directory, the same applies when…
htmlanswered Icaro Martins 4,187 -
1
votes1
answer80
viewsA: Error loading an image from a file
As already commented the value that is in the input.value of a <input type='file'> is the fake path per security measure. If you want to upload the file to the page without having to go up to…
-
8
votes3
answers820
viewsA: How to exit the FOR loop within the Switch structure?
You can try to put another condition on for bool forceExit = false; for (int i = 0; i < length && !forceExit; i++) { ... } When you want to get out of it forceExit=true…
-
4
votes1
answer49
viewsA: Add Class if it matches a pattern
I put the function in the event of onkeyup, I switched the guy from input was number for text. Motive: Like number every time a character other than a number enters, the value of the input, how do…