Posts by Luis Henrique • 697 points
44 posts
-
0
votes2
answers475
viewsA: Connection error with SQL Server 2012 with Python
Speak Will, you can test the following: engine = sa.create_engine('mssql+pyodbc://server/database') or engine = sa.create_engine('mssql+pyodbc://user:password@server/database')…
-
-1
votes1
answer66
viewsQ: Convert JSON from graphql API to array
I have a research connection to a API graphql, this search returns a JSON, where I store it in content and then turn it into an array, but this array is not showing the values contained in it, keeps…
-
0
votes3
answers222
viewsQ: re.error: bad escape c at position 0
I’m trying to make a search between arrays, and return the value when it is corresponding, and when it is not. import re array = ['brasil','argentina','chile','canada'] array2 =…
-
2
votes2
answers120
viewsQ: Capture time range in UNIX
I am trying to capture in UNIX data format the 1 day time range: #!/usr/bin/python # -*- coding: utf-8 -*- import time import datetime from datetime import datetime now = datetime.now() dateNow = ''…
-
1
votes2
answers145
viewsQ: SELECT RANGE 1 IN 1 HOUR - POSTGRESQL
GOAL I’d like to make a SELECT within a range of 1 hour in 1 hour DATA TABLE CREATE TABLE t ( t_id INT PRIMARY KEY, time TIMESTAMP ); INSERT INTO t VALUES (1, '2019-10-28 08:00:00'); INSERT INTO t…
-
0
votes0
answers87
viewsQ: Perform telnet using proxy with python
I’m trying to accomplish a telnet at the door SSH 22, using the pysocks, but it seems that the SOCKS not connecting, but if I use the program Open Text Socks Client Dasboard it connects, but I need…
-
2
votes1
answer72
viewsQ: Select desired value with REGEX for two different standards
I have the following data entry: INSTANCE-hostname:Sys INSTANCE-hostname-INSTANCE_00:Ins You will always follow this case, where only what interests me is the value hostname, that is, my OUTPUT…
-
-1
votes2
answers176
viewsQ: Get how many times each element of a list repeats
I have the following array: CLIENTE = ['MARIA','JOAO','MARIA','JOAO'] I’d like to do the following: {'MARIA' : 2, 'JOAO': 2} I tried to use the library from collections import Counter, but made a…
pythonasked Luis Henrique 697 -
0
votes1
answer33
viewsQ: Concatenate two 2D arrays in parallel
How to concatenate two 2D arrays in parallel by returning an array 1D, example: ARRAYS/LISTS lista 1 = [['a'],['b'],['c']] lista 2 = [['A'],['B'],['C']] GOAL: lista 3 = ['a:A','b:B','c:C'] Trying:…
-
1
votes2
answers1459
viewsQ: Traverse two arrays in parallel
Want to traverse two arrays in parallel by adding : among them: Arrays NOME = ['CARLOS','JOAO','PEDRO'] IDADE ['30','25','22'] DESIRED OUTPUT CARLOS:30 JOAO:25 PEDRO:22 Trying rows = len(NOME) for i…
-
1
votes1
answer474
viewsQ: Remove with regex everything after two points in the SQL query
GOAL I want to remove with regex in SQL query everything after two points, can anyone help me mount this query? I made several attempts, but without success. Normal query Remove with Regex Desired…
-
0
votes1
answer62
viewsQ: return specific content with regex - POSTGRESQL
I have the query below, where are captured the 3 largest memory consuming processes on the machine. I would like my select to display only the pid and the name of the process contained in {name: }…
-
-1
votes1
answer223
viewsQ: LIMIT TO TWO OUTPUT CHARACTERS WITH REGEX - POSTGRESQL
I have the query below that returns me only the numerical values of my string field, I wanted to limit it to two output characters. QUERY SELECT NULLIF(regexp_replace(temperature, '\D','','g'),…
-
0
votes1
answer1605
viewsQ: ERROR: more than one Row returned by a subquery used as an Expression
GOAL I have two tables (tb_get_gap, tb_getCountSRVS), where in the first table count to get the desired values and in the second I have integer values, I just want to take the values of the two and…
-
1
votes1
answer1140
viewsQ: ERROR: column Reference "Customer" is ambiguous
GOAL I’m holding an accountant in the host name column for every customer equal to BRASILFOODS, the only thing I wanted, was for next to the count to appear the name BRASILFOODS QUERY SELECT…
-
0
votes0
answers25
viewsQ: Update item value inside python dictonary
SCRIPT for row in result_psql: if row in lds_data: print(lds_data[row]['status']) else: continue OUTPUT NO GOAL I would like to update the value IN THE for YES STRUCTURE OF THE DICT lds_data =…
pythonasked Luis Henrique 697 -
0
votes1
answer212
viewsQ: Request in graphane API with PHP
I’m trying to create a PHP file that does direct authentication on GRAPHANA and displays the DASHBOARD on my page, but is not displaying anything with the structure below: <?php //Server url $url…
-
0
votes1
answer108
viewsA: Select within another select using the LIKE operator
SOLUTION: LIKE '%' || (SELECT ...) || '%'
-
0
votes1
answer108
viewsQ: Select within another select using the LIKE operator
GOAL I need to make a select inside another select using the LIKE operator converting the value of the other select to LOWER, but it is returning error QUERY select * from tbl_client where "NODE"…
-
3
votes2
answers536
viewsQ: Add values between ICT
GOAL: I am trying to add the values between Dict ct_db and ct_db2, whenever the keys are equal. Example: RR-00 == RR-00, so make 14 + 223 Problem: It is not being compared all Dict keys, the…
-
0
votes2
answers647
viewsA: Calculate how many times the values are repeated inside a dictionary KEY - PYTHON
I resorted to ask in the gringa, the solution is below: Solution ct = {} for _, value in lds_data.items(): if value['code_client'] in ct: ct [value['code_client']] += 1 else: ct…
-
0
votes2
answers647
viewsQ: Calculate how many times the values are repeated inside a dictionary KEY - PYTHON
I have a dictionary that is created from a select in the database, what I needed was to generate a metric from that dictionary Dictionary # cria dicionário do banco de dados com os valores lds_data…
-
1
votes1
answer126
viewsQ: Select with LIKE operator using an array
I am trying to select with LIKE operator using an array, but it is returning error when forming the string. SCRIPT placeholder= '?' placeholders= ', '.join(placeholder for unused in NAMES) query=…
-
5
votes1
answer54
viewsQ: Match between dictonary and array
GOAL: I’m trying to match one dictonary and a array. I want to check if the contents of the array are contained in KEY NAME dictonary, if it is it should return me the whole line of dictonary.…
-
4
votes2
answers95
viewsQ: Remove specific set from the end of the regex array
GOAL I am trying to remove all elements of the array from the contents ":PM" with regex, but is returning me error. DETAILS The array will always contain ":PM", and it is only this part that I wish…
-
2
votes1
answer61
viewsQ: Insert SQL with 3 arrays in the same table - PYTHON
I have the following structure of INSERT to the database POSTGRES: for first in nomes: for second in quantidades: for third in produtos: cursor.execute(first,second,third,str(timestampInitial))…
pythonasked Luis Henrique 697 -
7
votes4
answers138
viewsQ: Count inside an array with values from another array
I would like to realize a Count of the values contained within the array1 with the array values nomes, but he’s returning me an output with the strange values SCRIPT array1 = [ 'VALUE1', 'VALUE1',…
pythonasked Luis Henrique 697 -
2
votes1
answer50
viewsQ: Find diff between different arrays
GOAL I have two arrays where it contains different formatted information, but the data is the same, for example on ARRAY1 the CLIENTE1-00 and the same as CLIENTE1 of ARRAY2, I just need to do a…
-
4
votes1
answer36
viewsQ: Save difference between arrays in a new array
The Script below returns the intersection between arrays within a new array, I wanted to save the difference, in case what does not belong, how to modify this script ? SCRIPT: values = [] a =…
pythonasked Luis Henrique 697 -
3
votes1
answer97
viewsQ: List exiting order while looping
The script below captures the INTERFACE network of a HOST, and inserts into the database (POSTGRES), I swapped the cursor method for a print to check how it was being inserted into the database, and…
-
1
votes0
answers93
viewsQ: Typeerror: expected string or buffer
I’m trying to make an intersection between two arrays using the lib re, but is returning me the following output: OUTPUT: selectobj = filter(regex.search, result_psql) Typeerror: expected string or…
pythonasked Luis Henrique 697 -
1
votes0
answers90
viewsQ: Openhardwaremonitor: Python.Runtime.Clrmodule.Addreference(String name)
My script is returning the output below: OUTPUT OpenHardwareMonitor: Traceback (most recent call last): File "sensors.py", line 62, in <module> HardwareHandle =…
pythonasked Luis Henrique 697 -
2
votes1
answer198
viewsQ: Thread with python loading
I’m trying to run two threads where one is an animation of loading, and the other a print, but when finished executing the thread work which is the print, the loading keeps running, I’d like it to…
pythonasked Luis Henrique 697 -
0
votes1
answer30
viewsQ: Array saving only the last inserted value (PYTHON)
I have a script that captures all processes from the machine, using the library PSUTIL, But when you put it inside an array it is only saving the last value in memory, not all values. OBS: I need…
pythonasked Luis Henrique 697 -
1
votes0
answers43
viewsQ: Send button value to data table filter
I have the following data table: Data Table: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>A Pen by Jason</title> <link…
-
1
votes1
answer54
viewsQ: Button continue loading while loading PHP
I have an html page, where when the button UPDATE is performed a loading action, what I would like to do is that this loading only finished running when the file PHP finished running, because the…
-
0
votes2
answers33
viewsQ: List array within exceptions (IF) and generate new status array
I created an algorithm that checks an array of percentages and returns a status according to the value, but my array STATUS is returning me only the last value. I would like the status array to…
-
1
votes2
answers50
viewsA: Return filtered values in Shell Bash for insertion in BD
I modified it according to my need, if I help someone in the future: import psutil, datetime process = [] veryConsumeCPU = ("None",0.0) veryConsumeRAM = ("None",0.0) cpu_count = psutil.cpu_count()…
-
2
votes2
answers50
viewsQ: Return filtered values in Shell Bash for insertion in BD
I’m writing a script on python who captures the TOP 5 ram and CPU memory consumption processes of the machine, so far the script is functional only for LINUX, goes below: Script: #!/usr/bin/env…
-
1
votes1
answer112
viewsA: Return table row ID within Function JS
Solution: JS function reply_click(clicked_id) { alert(clicked_id); } HTML <li id="'+meta.row+'" onClick="reply_click(this.id)"><a href="#">Delete Row</a></li>…
-
1
votes1
answer112
viewsQ: Return table row ID within Function JS
i have the following script below: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>A Pen by Jason</title> <link rel='stylesheet'…
-
2
votes2
answers90
viewsQ: Use Javascript function within a PHP table column
Hello, I am calling a JS file in my index.php: <script src="./Arquivos/js/ddtf.js"></script> And within an echo I need to apply the function that exists within it: <td><?php…
-
1
votes1
answer104
viewsQ: Mysql - Duplicate SELECT?
Can anyone tell me why you’re doubling the SELECT? CREATE TABLE tb_grupos( id_tbl_grupos int(3) NOT NULL AUTO_INCREMENT PRIMARY KEY, id_grupo int(50) NOT NULL, hostname_grupo varchar(50) NOT NULL);…
mysqlasked Luis Henrique 697 -
1
votes1
answer150
viewsQ: Mysql - Error performing INSERT with FOREIGN KEY
Hello, when performing an insert in the database Mysql returns the following error: ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`zabbix`.`tb_hosts`,…