Posts by BrunoVdutra • 471 points
29 posts
-
0
votes1
answer889
viewsA: Convert string to json [Python]
Since you trust the source of the information (the string that contains json is always correct), can use this: import json import requests json_string = """{ "contrato": { "atb1": "013128415879",…
-
3
votes1
answer154
viewsA: Extracting email addresses from a web page using regular expressions in python
Use the following regular expression /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/ soon your code gets: from urllib.request import urlopen from re import findall def emails(url): content =…
-
0
votes1
answer138
viewsA: When clicking on given th, open a Modal
Here’s a simple way to do it: $(function(){ $('#trigger').click(function(){ $('#myModal').modal('show'); return false; }) }); <!DOCTYPE html> <html> <head lang="en"> <meta…
-
4
votes2
answers420
viewsA: Regular expression that recognizes Portuguese words (accented) using Python
The easiest way to accept accentuation is this: [A-zÀ-ú]+ // aceita caracteres minúsculos e maiúsculos [A-zÀ-ÿ]+ // como acima, mas incluindo letras com um trema (inclui [] ^ \ × ÷) [A-Za-zÀ-ÿ]+ //…
-
-3
votes3
answers360
viewsA: I can’t find the code error
An alternative way with format # -*- coding: utf-8 -*- valor_hora = float(input('Valor da hora trabalhada: ')) qtd_horas_trabalhadas = int(input('Quantidade de horas trabalahadas: ')) salario_bruto…
-
2
votes1
answer44
viewsA: MYSQL - select that returns everything you have before a '-' or '/'
Return to substring before first occurrence of delimiter "-": SELECT SUBSTRING_INDEX('foo-bar-bar', '-', 1) as result; Outputs result = "foo"
-
1
votes4
answers264
viewsA: R - How to replace "." (dot) with " (space) in the column names of a Data.Table?
Example 1 The first example shows how to change column names in a data table. This starts with the first column and goes up to the names you provided. For example, if there are eight columns in your…
ranswered BrunoVdutra 471 -
0
votes1
answer96
viewsA: Django connection to sql express 2017
How are you putting the HOST name ? It needs to contain the name or address of the computer and an instance ID defined during the installation procedure (SQLEXPRESS by default). Use: 'HOST':…
-
0
votes2
answers116
viewsA: Read multiple tag attribute in an XML
Suppose you have XML, an implementation can be: <?php class simple_xml_extended extends SimpleXMLElement { public function Attribute($name) { foreach($this->Attributes() as $key=>$val) {…
-
1
votes1
answer188
viewsA: How to limit the click of a button?
If you just want to prevent the value from increasing a possible implementation can be: var Price = document.querySelector('.price'); //Processor var Config1 = document.querySelector('.Hz14');…
-
1
votes3
answers322
viewsA: how to take the value of the option that was chosen?
Imagine you have a select: <select id="cmbTempo" name="cmbTempo"> <option>Selecione:</option> <option value="old" >Antigas</option> <option value="new"…
-
0
votes2
answers5942
viewsA: How to allow special characters in Python?
Hello, you can try to find the character code you need here https://unicode-table.com/pt/#ipa-Extensions and so do the following: For example for the python character ' 2: print u"\u00a9"…
-
7
votes4
answers951
viewsA: Foreach in PHP reverse process
I believe that’s it, $i = 100; foreach($listagem as $valor){ echo $i; // O que vai me retornar: 100, 99, 98 ... $i--; }
phpanswered BrunoVdutra 471 -
3
votes5
answers1258
viewsA: How to open a new background tab and redirect the current tab?
It’s very simple, just add Javascript: <a href="https://answall.com" target="_blank" onclick = "window.location.href = 'http://www.google.com';">Visite o Stackoverflow!</a> worked, one…
-
0
votes2
answers569
viewsA: Dictionary file
Buddy, your mistake is on the line chave, valor = linha[:-1].split() such allocation is not permitted for that particular case Well I tested the assignments separately and it worked out that way…
-
0
votes1
answer973
viewsA: Connect via SSH to another machine and run script
I imagine you want to make an SSH connection via python. If so, the pxssh module does exactly what you want. For example, to run 'ls -l' and to print the output, you need to do something like this:…
-
0
votes1
answer1023
viewsA: Password Reset
My friend, the second option is certainly the safest and most recommended. Sending an email from the server via Php is relatively simple... <?php include('../conexao/conexao.php');…
-
0
votes2
answers186
viewsA: Why do you accept values beyond the size of the vector?
Understand that you have to be careful when indexing containers. What can happen when you try to access elements outside the limits of the variable depends on some factors. Why you are trying to…
-
1
votes1
answer557
viewsA: Error "expected an indented block" in my Phyton Calculator
Face by image can not see right, but you are not indenting the code correctly. For example when you set the btnClick function(): ... def btnClick(numbers): global operator operator = operator +…
-
0
votes1
answer292
viewsA: How do I create a shortcut on a website’s desktop when using Chrome?
Man, if I were you I’d make a file .bat and would call his execution with Javascript. The Javascript file: var objetoMan = new ActiveXObject("Scripting.FileSystemObject"); var WshShell = new…
-
1
votes1
answer924
viewsA: How to make an alert in the browser, using Node.js
If you use the ajax you can do so: In the server-side res.send(500,'Errooooou') and in the client side error: function(error){ if(error.responseText == 'Errooooou') alert("Sua resposta está…
-
0
votes3
answers366
viewsA: Python does not return files inside a directory
Friend you forgot a 'i': import os def rename_files(): #(1) Obter nomes de arquivos de uma pasta file_list = os.listdir(r"C:\Users\Goku\MaisdeOitoMil") print (file_list) rename_files()…
pythonanswered BrunoVdutra 471 -
-1
votes2
answers38
viewsA: How to make constant member functions in Php?
Well after some research I saw in a book that is not possible, at least it is not trivial, create such functions in Php. You can create methods that don’t make changes in attributes, but cannot…
-
0
votes2
answers49
viewsA: Auto-Complete with database values in input text type
I did something similar like this function pesquisa() { var substringMatcher = function (strs) { return function findMatches(q, cb) { var matches, substringRegex; // an array that will be populated…
-
-1
votes2
answers38
viewsQ: How to make constant member functions in Php?
I was studying what my book called "constant member functions" in C++. i.e., functions that cannot change any class attribute or call other methods that are not constant. So, I made this code in…
-
-1
votes2
answers88
viewsQ: Is it possible to view all the content of a C++ namespace?
When you make the directive: using namespace std; //primeira forma You get direct access to all elements of the Std namespace. But imagine that you want to use only the std::cout or std::endl so it…
-
0
votes1
answer1474
viewsA: Is it possible to generate log files from a Python file that has been transformed into an executable?
I added the code line below to solve the problem #!/usr/bin/env python
-
-1
votes1
answer1474
viewsQ: Is it possible to generate log files from a Python file that has been transformed into an executable?
Hello, I create the Python code executable below with the module pyinstaller. import urllib import urllib2 import webbrowser import re import popular4 import logging from datetime import datetime…
-
0
votes1
answer365
viewsQ: How to create an SQL function that calls a script in python?
I need to create a software that at each insertion in a table a python script detects that there has been a change in this table and execute certain commands. I have done an implementation that is…