Posts by Igor Gabriel • 530 points
35 posts
-
0
votes1
answer26
viewsQ: How to make a remote backup of Postgresql by saving the file on my machine?
I have a machine that I need to backup the Postgresql database, it is in a Docker container on a server, to backup tried the following script: docker exec -t postgresDB pg_dump -U usuario_banco -h…
-
0
votes0
answers56
viewsQ: How to create a table with Crosstab in Postgresql?
I have a table tbexame and I want to create another one from a Crosstab, while studying I did the installation of the extension but I am not able to create a select so as to leave the result as…
-
3
votes1
answer99
viewsQ: What is the difference between ng new and ng generate application?
I know that the ng new nome-projeto creates a directory with the project inside, but I’m not able to understand the difference between it and the ng generation application. In the Angular…
-
0
votes1
answer36
viewsQ: What are the advantages of using a Current status in applications?
It is common that during certain moments an application goes off the air for an important update or for some reason it is already slow. Companies that have many services choose to use a status that…
-
0
votes3
answers983
viewsA: Check if an element exists if the page is loaded. (Selenium)
Based on the answer from Zesousa I was able to solve the problem by replacing wait.Until(...) for wait.Until(ExpectedConditions.visibilityOf(elemento)) without affecting other timeout. But I found a…
-
0
votes3
answers983
viewsQ: Check if an element exists if the page is loaded. (Selenium)
I am testing a piece of my application, so I created the following method to check if the element exists on the page: public boolean existe(){ try{ driver.findElement(elemento); return true; }…
-
4
votes1
answer182
viewsQ: How to improve angular performance with webpack or demand loading?
I have a large project with angular and need to leave the pages loading with a good performance, at first I set up a Customized Webpack for the application. But by applying it the downloaded files…
-
5
votes5
answers691
viewsA: How to delete a deleted Github repository?
There is no way to delete the repository before 90 days of backup, but I advise starting the project from scratch so you don’t have to wait as long. Just start a new local project: git init…
githubanswered Igor Gabriel 530 -
2
votes1
answer58
viewsQ: How do I use ngFor with a Javascript dictionary?
I’m trying to generate a dynamic page with Angular 9, my idea is every key in the dictionary create an optgoup tag and each value an option, but I’m not able to access the values of the Dict object.…
-
3
votes2
answers1229
viewsA: Catch tags within tags in Beautifulsoup
The easiest way is to search inside the element h3 the tag a: from bs4 import BeautifulSoup code = '''<a href="https://g1.globo.com">Globo</a> <h3 class="b"> <a…
-
0
votes2
answers179
viewsA: Encoding problem while extracting zip file - edited
One solution is to use Encode and Decode: import io import requests from zipfile import ZipFile response = requests.get(url) for i in sys.argv[1:]: with ZipFile(io.BytesIO(response.content)) as…
-
0
votes1
answer768
viewsQ: Get the logged-in user id of a nodes.js session
I am using the Passport with Session and need to get the user id of a session. I tried to use: router.get('/', (req, res) =>{ execSQLQuery('SELECT * FROM users WHERE id=' + req.user.id, res); })…
-
2
votes1
answer820
viewsQ: Encoding problem in Git
I did clone a large project but many of the files were in unstage and Deleted. I realized it was the file name encoding so I set it in utf-8 like this: git config gui.encoding utf-8 After that the…
-
-1
votes1
answer75
viewsQ: Remove tags within tag using Beautiful Soup
I need to remove all span tags inside the p tags keeping their content. Html code: <p>Conceito <span>e</span> <span>Signi</span>ficado<span> </span>de…
-
0
votes1
answer136
viewsQ: Trasformar Datraframe in Dicionario
I ran a df from that dictionary: data = { 'Nomes': ['produto1','produto2'] 'Links': ['link1.html', 'link2.html'] 'Valores': ['R$00,00','R$00,00'] 'Tipos': ['brinquedo','aparelho'] } My doubt is how…
-
0
votes1
answer135
viewsQ: Merge a dictionary with list inside
I have to join two dictionaries with list inside, the problem is pq both have list inside. Code: valores = {'valor':[1,2,3], 'valor2':[10,20,30]} valores2 = {'valor':[4,5,6], 'valor2':[10,20,30]}…
pythonasked Igor Gabriel 530 -
1
votes1
answer39
viewsA: Get duplicate files in two lists
A solution not very Pytonica is as follows: unicos = [] repetidos = [] relatorio = ['~/file1.html', '~/pasta/file1.html', '~/file2.html'] for x in relatorio: if x.split('/')[-1] not in unicos:…
python-3.xanswered Igor Gabriel 530 -
0
votes1
answer39
viewsQ: Get duplicate files in two lists
I have a report with links and I need to get duplicates, the problem is getting the two locations of file1.html files relatorio = ['~/file1.html', '~/pasta/file1.html', '~/file2.html'] Code: for x…
python-3.xasked Igor Gabriel 530 -
-4
votes1
answer190
viewsQ: What’s the difference between Django and Flask
What is the difference between Django and flask framework benefits and which one is currently most used in the market?
-
0
votes1
answer76
viewsQ: Fix files not tracked or deleted in cloned repository
I cloned the branch of a project, upon completion some files unaccompanied by git and some with changes. Examples: Changes not staged for commit: (use "git add/rm <file>..." to update what…
gitasked Igor Gabriel 530 -
0
votes2
answers94
viewsA: Error closing browser in Selenium-webdriver
In linux the execution occurs carretamento, in windows the compatibility of Marionette not so it was necessary to change the standard of the capabilities disabling the Marionette. Answer: firefoxbin…
-
-1
votes2
answers94
viewsQ: Error closing browser in Selenium-webdriver
Code: firefoxbin = os.path.abspath(os.path.join(os.path.dirname(__file__), 'drivers', 'geckodriver')) assert os.path.isfile(firefoxbin), "Driver \"{}\" não disponível.".format(firefoxbin)…
-
0
votes1
answer2054
viewsQ: Accessing an element in pandas dataframes
I would like to access the first element of the pandas dataframe. import pandas as pd data = [['2019', '0000', 'protocolo'], ['2020', '1111', 'pedido']] df = pd.DataFrame(data) Trying: df =…
-
1
votes0
answers40
viewsQ: How to apply the patch to a specific file?
I managed a patch of master branch and would like to apply it to a secondary branch, but the error, I believe, happens because it was created by master branching patch: error: patch failed:…
gitasked Igor Gabriel 530 -
2
votes4
answers1138
viewsQ: Delete the last line of a txt file
I need to delete the last line of a txt file. I found the last line like this: with open('arquivo.txt', 'r') as content: line = content.readlines() last_line = line[len(line)-1] Note: you can change…
pythonasked Igor Gabriel 530 -
2
votes1
answer276
viewsQ: Ensure that the unit test is validated in an IF. Unit Test
I need to create a unit test that validates the following code. But how can I guarantee that the test validates the downloaded and downloaded content? if not (os.path.exists(filename)):…
-
0
votes1
answer140
viewsA: Remove text from parent element keeping daughters in BS4 in Python
In a simple way just get all tags and generate a new html with them. As the Improper text is not tag, it is not put in the new code. That’s all it takes: codigo_html = '' for i in soup.find('body'):…
-
-1
votes1
answer140
viewsQ: Remove text from parent element keeping daughters in BS4 in Python
How to remove improper text by keeping the title, paragraph, and link. Code: <html> <body> <header> <h1> Titulo </h1> </header> <p>Hello World</p>…
-
0
votes2
answers618
viewsQ: Compare Hash of two files in Python
I need to compare the hash of the files a.txt and b.txt using a python3 native library. I tried to do so: import hashlib file_0 = 'a.txt' file_1 = 'b.txt' hash_0 = hashlib.new('ripemd160')…
-
2
votes4
answers197
viewsA: Remove comment tag and your content in Beautifulsoup 4
I found a simplified solution based on the answer to the question How to find all comments with Beautiful Soup First import the Beautifulsoup with the necessary methods. from bs4 import…
-
0
votes4
answers197
viewsQ: Remove comment tag and your content in Beautifulsoup 4
How do I remove the comment tag along with its content with bs4 ? <div class="foo"> A Arara é um animal voador. <!-- <p>Animais Nome: Arara Idade: 12 anos e 9 meses Tempo de Vida: 15…
-
1
votes1
answer278
viewsQ: Beautiful Soup - Remove a tag keeping Text
I have the following tags: <p>Projeto N <sup>o</sup> 00.000, DE 00 DE JANEIRO DE 0000.</p> I would like to remove the tag keeping the text. I needed it to stay that way:…
-
0
votes2
answers382
viewsQ: Regular expression that finds patterns in which some terms can change?
I need to find a pattern within a text. Example: PROJETO Nº 1.100 DE 28 DE DEZEMBRO DE 2018. Within this pattern, the word PROJETOS may also be PROTOCOLOS and the character º can be o. Thus, the…
-
3
votes1
answer104
viewsA: offline maintenance of Python modules
One solution is to use the tool minirepo that allows you to download Python packages from Pypi no internet. The easiest way to install it is to use the pip: $ pip install minirepo Or download the…
pythonanswered Igor Gabriel 530 -
1
votes1
answer58
viewsQ: How do I call file.Setter using Python to normalize the path name
Code: class Arquivos: @property def file(self): return self._file @file.setter def file(self, arquivo): if arquivo: self._file = os.path.abspath(arquivo) Calling for: Arquivos.file('usp/dados.json')…