Posts by Beto • 937 points
57 posts
-
0
votes0
answers15
viewsQ: How to view the value of a selector in Django’s Forms.py?
I have a field that must be validated from a selector that is a foreign key in the model. py.models class NyModel1(models.Model): field1 = models.CharField(max_length=50) description =…
-
-1
votes2
answers50
viewsQ: How to send text via the template via url in Django?
I want to send text to a view through the template. I have two different types of clients that will be processed differently, to take advantage of code I put in one view and the specific part I…
-
1
votes1
answer120
viewsQ: How to verify null value in rows in a dataframe column?
I’m looking to replace the null values with the value of the year. Given the following dataframe : year value 2000 1 NaN 2 NaN 3 NaN 4 NaN 5 NaN 6 2001 1 NaN 2 NaN 3 NaN 4 NaN 5 NaN 6 ... 2020 1 NaN…
-
-1
votes1
answer38
viewsQ: How to know which lines are not in certain groups?
I would like to know which ids are not present in certain groups for a certain period of time. For example: SELECT id from table1 Results in the following exit: id 1 2 3 4 5 And the consultation :…
-
1
votes0
answers37
viewsQ: How to change a form dynamically?
I have two models, Empresa and Funcionario. I would like when the user selects the company the employees are dynamically set in the employee form as both Forms will be shown on the same page. So…
-
0
votes1
answer103
viewsQ: How to save updates to object via the Django form?
I have an application and when I send the data in the form to be updated it works ( the data are shown in the form) but when I click save the update it repeats the initial data and saves nothing.…
-
-1
votes1
answer67
viewsQ: Difference between saving the form directly and creating model instance
I have been having some problems when I will insert or modify some value that was not passed to the user in the form and then save it. For example I have a Local model : models.py class…
-
1
votes2
answers1413
viewsQ: How to turn list into array
I have a csv which contains 2 columns one with a list of 200 numbers (0.3,0.4,08...) and the other a name. This file has 50 rows of this type. I would like to turn this list of number lists into an…
-
1
votes1
answer56
viewsQ: Find file in templates directory
In versions up to 2.2.5 of Django I put my html files that were passed in the view as follows : myapp templates myapp index.html But in Django 2.2.6 and 2.2.7 when I do this gives the following…
-
1
votes1
answer70
viewsQ: How to show certain amounts of lines?
I have a query that takes the highest sales values of a given product per year . The query follows this structure : select ano , descricao, sum(valor) as valor from produtos group by descricao, ano…
-
0
votes2
answers467
viewsQ: How to check query with empty return?
I have a query with many columns and when I return empty I want it to show 1. However, I cannot do the check due to the many columns and the GROUP BY. A simple example follows below : SELECT ISNULL(…
-
1
votes2
answers597
viewsQ: How to enter data at runtime?
I would like to write while running a bat file. I have to enter user and password after executing a command. When executing the command I have the following output : Você foi direcionado com…
-
0
votes1
answer126
viewsQ: How to create a CNN model correctly in Keras?
I want to make a convolutional neural network model using Keras. Input is a set of images of size 360,640,3 and the exit shall be 720,1280,3. So I made the following model : w,h,c=x_train[0].shape…
-
1
votes1
answer45
viewsQ: How to find only the distinct paths up to the specific directory?
I want to find only separate directories with the same name. If I use the locate to find the path of a given directory : locate mydirectory : /var/lib/meu_diretorio/arquivo1…
-
2
votes1
answer146
viewsQ: How to use Conv2dtranspose from Keras?
Does anyone know how to use the Conv2DTranspose Keras found in this link : https://keras.io/layers/convolutional/#conv2dtranspose ? Could you explain to me what each parameter of this function does…
-
2
votes2
answers689
viewsQ: Using self-free method in Python
I saw in other topics some discussions about passing the self as argument. But it was not very clear to me. Even though my function has no argument to be started I still need to pass the self as a…
-
0
votes1
answer209
viewsQ: Backup in Postgres
postgres has some system table you can select to find out when the last backup was done just like its status (it ran normal or failed) ? That is, how to remove as much backup information in postgres…
-
1
votes2
answers616
viewsQ: Problem showing image in imshow
I have a function that opens an image and sums with a random matrix but the function cv2.addWeighted generates the following error even though the types of the two matrices are equal : Traceback…
-
-2
votes1
answer226
viewsQ: Problem with strcpy
I’m trying to fill in the fields of a struct with strcpy but I’m not getting the expected value, as for example: #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include…
-
0
votes2
answers139
viewsQ: Raw socket in C
I’m looking to make a Sniffer in C using the Socket API. I saw that a good solution was to use the raw socket: sock_raw = socket(AF_INET , SOCK_RAW , 'Tipo do protocolo aqui UDP/TCP/ICMP'); But I…
-
1
votes1
answer388
viewsQ: How to generate graphana container correctly?
I installed the graphite container via Docker as follows : docker run -d --name=grafana \ --restart always \ -p 5000:3000 \ -e "GF_SERVER_PROTOCOL=http" \ -e "GF_SERVER_ROOT_URL=http://meuIP" \ -e…
-
1
votes1
answer628
viewsQ: How to get the size of a string array in the shell script?
I have a string that I pass as a parameter, for example : "2,3,4,5" To pick up every item of it I make : #!/bin/bash for ((i=1; i<=4; i++)) do echo "$1" | cut -d "," -f $i done But I would like…
-
0
votes1
answer26
viewsQ: Array size in a JSON in Shell Script
I would like to take the size of a vector in a JSON in the scriipt shell but I’m only able to get the size of each vector string, that is, for the example : #!/bin/bash j='{"Nomes": { "nome":…
-
1
votes1
answer415
viewsQ: How to insert a query value into a variable in the Shell Script?
I have a JSON in an archive nomes.txt. the JSON is : {"p": { "nome": ["josé","Maria", "carlos","Artur"] }} I want to play the value of his query in a variable. Show result works fine : #!/bin/bash…
-
1
votes1
answer115
viewsQ: How to pass vector as argument in shell script?
I would like to pass a JSON-style vector as an argument for a script. Example : #!/bin/bash vetor[]=$1 echo ${vetor[*]} i=0 for nomes in ${vetor[*]} do i=$(($i+1)) echo "Nome $i é $nomes" done And I…
-
0
votes2
answers378
viewsQ: Socket between 2 devices
I would like to send data between different machines, between two computers, between a computer and a Android for example. I did the example internally, on the same computer, but when I separate…
-
1
votes0
answers121
viewsQ: How to properly connect bluetooth server in C to Android?
I am trying to connect an application between the computer and an android app. The app will be the client and the computer will be the server. Using Bluez( C library for bluetooth on linux) for…
-
3
votes1
answer1406
viewsQ: How to see which tables are accessed in postgresql?
How to view the tables being accessed by the select command ? EX: select *from pg_stats I would like to get the tables that are having more access on a given day in the database.…
postgresqlasked Beto 937 -
2
votes2
answers26
viewsA: Problem with sharing
To solve this problem you must open the sharing options to choose which app you want to share the text with. That way the code below works for what has been proposed. Intent sendIntent = new…
-
0
votes2
answers26
viewsQ: Problem with sharing
I used the following code to capture a text and share. Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); String texto = "Olá sou um texto compartilhado"…
-
0
votes1
answer202
viewsQ: How to insert onCreateOptionsMenu into a Java class?
How to insert the onCreateOptionsMenu and the onOptionsItemSelected within a Java class not to be repeating in all Activity calling it ? I have to pass only the ids and classes I call when clicking…
-
1
votes2
answers133
viewsQ: How to read the size of a mat file?
I have a mat file with certain data. It has 10 rows per 500 columns but when I do: matriz = load('Planilha.mat'); disp(size(matriz)); The result is 1 by 20. Which is totally different from the…
-
1
votes1
answer60
viewsA: Return message from Else
Probably doing something like: url(r'^algo/(?P<idade>\d+)/$', views.index) When passing the value by a regex it may not be in the desired type even if you use the \d+, for example. To solve…
-
2
votes1
answer60
viewsQ: Return message from Else
I’m making a very simple example using Django. In my view I have the following : def index(request,idade): string = ''' {% if idoso >= 65 %} Você já é idoso {% else %} Você não é idoso {% endif…
-
-1
votes1
answer1409
viewsQ: How to create a tree with n children per node?
I would like to know how to implement a tree where each node can have n children? As in the example below: Only in case the nodes would be an instance of a class. EDITED I’m trying to do this with a…
-
1
votes2
answers411
viewsQ: Problem with push and pull on github
I’m trying to do a git pull and git push to upload files to my repository on github but in both cases it gives this error : error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol…
-
4
votes2
answers947
viewsQ: How to convert gray image to RGB?
To convert a RGB image to grayscale is relatively easy, just do a linear( or average) combination of the 3 channels. For example : Gray = 0.3*R +0.59*G +0.11*B By the expression above you get a…
-
6
votes2
answers1725
viewsQ: How to increase number to fractional power?
I would like to know how to raise a number to a fractional power, for example 2^2.5, 3^0.7 ? For positive integers it works more or less like this : #include <iostream> #include <math.h>…
-
0
votes2
answers415
viewsQ: Problem with ternary operator
I have a problem with the ternary operator. I want to use it to make the code more elegant because it is simple. But it’s as if it doesn’t work because it doesn’t update the variable. The following…
-
0
votes2
answers190
viewsA: Read an integer value from a file
A possible solution would be to go through the vector and compare when aux[i] = 'A' aux[i+1] = 'D' e aux[i+2] = 'D' you would save the other two values after the blank space that exists between the…
-
2
votes0
answers250
viewsQ: Help with bicubic interpolation algorithm
I’m trying to implement the bicubic interpolation algorithm but I’m having a lot of difficulty with the correct interpolated values( is not related to taking the values of the original matrix but…
-
1
votes1
answer162
viewsQ: How to modify dynamic matrix?
I’m having trouble modifying a dynamic matrix already created. The following example depicts my problem. In this example the program compiles but gives error of execution ( nothing appears and shows…
-
1
votes1
answer318
viewsQ: How to return integer value in pthread?
How to return an integer value and be able to show with printf using pthread ? Follow an example of the problem : #include <stdio.h> #include <unistd.h> #include <stdlib.h>…
-
1
votes0
answers133
viewsQ: Problem connecting to Beaglebone Black
Does anyone know how to connect to BeagleBone Black ? The Linux that had in it was very old, so I decided to do a new boot and install a newer Linux that was the debian-9.1-console-armhf-2017-09-21…
-
1
votes3
answers1047
viewsA: Python Indentation Problems in Geany
Python usually presents these errors because the compiler relies heavily on indentation. It is recommended not to use copy and paste too much by grabbing code from other corners or websites because…
-
4
votes1
answer395
viewsQ: How to vector code in C++?
Would you like to know how to vector code in C++ ? because the material I found on the internet is a bit excasso. I understand as vectorization the use, not only of vectors, but of doing in a single…
-
4
votes1
answer421
viewsQ: How to copy integer matrix for Mat type in Opencv?
Would you like to know how to copy an integer array to an Opencv Mat type data ? The following is an example I created to illustrate my goal, which corresponds to a given user generated matrix (…
-
0
votes1
answer641
viewsQ: How to show image in Opencv?
I would like to take a part of an image play it in an array pass some kind of filter on it manually( without using the Opencv functions) and show the result in a window for the user. For that I want…
-
0
votes2
answers2922
viewsQ: C/C++ library for manipulating images
I would like to know which library to use, which is easy to install for both Windows and Linux, to manipulate images ( png, jpg, etc) in C/C++ ? I would like to open and save it in an array to work…
-
1
votes1
answer1292
viewsQ: python library for working with video capture
Is there a Python library that is efficient( more than Opencv) to work with video capture and resizing its size ( change the image view size without changing the quality ) ? EDITED : In my case I…