Posts by Gabriel Hardoim • 586 points
38 posts
-
2
votes2
answers145
viewsA: how to avoid EOL in python
The error is Porq vc is escaping the single quote character at the end of the function input Try this: chute = input('quanto é 2+2?:') In addition, python has features different from other languages…
pythonanswered Gabriel Hardoim 586 -
1
votes1
answer60
viewsQ: convert java projects to Maven
I have some java projects and would like to convert them pro Maven. Is there any command maven for conversion of existing java projects? If I just add the pom.xml it will become a Maven project? I…
-
-1
votes1
answer121
viewsA: Process automation - Excel - VBA
If I understand your question correctly, you want to take the form information and play in cells. But right now you’re doing the opposite. ... HTMLDOC.getElementsByid("txtCNPJNome")(0).Value =…
-
0
votes1
answer40
viewsQ: Chaining of pipelines
I’ve got two Jenkins (A and B). What I need is that job A, after finishing, start the job execution B. Since I need a user’s approval for this to happen. //algo do tipo executarJobB = input(…
-
1
votes0
answers50
viewsQ: Is it possible that a script knows where it was called?
I have a script.sh and I wonder if there’s any way he could know where he was called. ex: comando=$(existe algum comando pra isso?) variavel=$AlgumaVariavelDeAmbienteTalvez if [[ $comando == "x" ]];…
-
3
votes1
answer47
viewsQ: How to concatenate columns identified by surname?
I have the following appointment: select case when datediff(...) > 0 then month(tblData.data1) when day(tblData.data2) > 10 then month(tblData.data2) when month(tblData.data2) = 1 then 12 else…
-
1
votes1
answer30
viewsQ: How to call a function more than once in a lambda Expression?
In Jenkins I’m trying to read a file with groovy and for each line check if it contains any of the information I need. Given the following content of arquivo: amarelo verde vermelho azul The code I…
-
-1
votes1
answer137
viewsQ: Container Jenkins cannot find Docker command
in short, I’m trying to run one container inside another. Where the first container to go up is based on a Jenkins image and the second on a gcc image (which is only for testing). this is the step…
-
0
votes1
answer456
viewsQ: Apply a regex to the result of a select
I am making a query to get all the projects that are being executed: SELECT p.id FROM projetos p WHERE p.status LIKE 'Execução' An example of the result: COD00012347 COD00012348 COD01212349…
-
0
votes1
answer90
viewsQ: Replacing and concatenating the contents of a cell
First I filter the contents of a table column to get everything that does not contain /. ActiveSheet.Range("A1").AutoFilter Field:=3, Criteria1:="<>*/*" With this result, I would like to…
-
0
votes1
answer53
viewsQ: json manipulation via command line
I’m using the jq to manipulate json via command line. Having as input a json obtained via gitlab api: [ { "id": 001, "description": "Uma descrição teste", "ssh_url_to_repo":…
-
2
votes2
answers186
viewsQ: Unexpected output when printing substring
I’m doing a file search in a given directory and printing its respective path. find ./ -exec sh -c "echo $(dirname "{}")" \; Output: ./algo/desse/tipo Since in some cases this path is a little big,…
-
0
votes1
answer69
viewsQ: Result of a command in a variable
When I run the following code it stores the output status of the command wc -l which has value 0 as it has been successfully executed. #include <stdio.h> #include <stdlib.h> int main() {…
-
1
votes2
answers1023
viewsQ: Reading on the same line
I have a struct to define the type DATA. typedef struct data { int ano, mes, dia; }DATA; DATA nasc; Now, I will read this information from the user input. printf("Digite sua data de nascimento");…
-
0
votes0
answers70
viewsQ: Upload.properties file
I’m having trouble reading a.properties. file.I created a separate class with a static method. However, it throws an exception and returns null. Follow my code below. public class LoadLog4jProperty…
-
1
votes2
answers162
viewsA: How do I set up Git to ignore trivial changes (for example, file timestamp) in a file?
Come on, I’ve been doing some research and I’ll try to summarize it here. First: Create the file .gitattributes at the root of the project or create the file attributes in the directory .git/info/.…
-
0
votes1
answer39
viewsQ: Checking the existence of a file
Given a file url: URL pomUrl = new URL("https://gitlab/grupo/projeto/blob/develop/pom.xml"); How can I verify the existence of a sister file to this? Something like: public boolean temIrmao(String…
-
0
votes2
answers83
viewsA: Sort files in shell
You can use: find . -iname '*.py' -type f -print0 | xargs -0 ls -lS Completing: find . -iname "*.py" -exec sh -c 'procura=$(grep "SHAZAM" {}); if [ $? -eq 0 ]; then echo {};fi' \; | xargs ls -lS…
shell-scriptanswered Gabriel Hardoim 586 -
0
votes1
answer252
viewsQ: Conditionals in xml
I’m working on a arquivo.xml and I need to declare a property if the string I receive as parameter nay be empty. <condition> <property name="SHAZAM" value="Esse é o conteúdo…
-
1
votes1
answer560
viewsQ: Map returning repeated values
I’m making a foreach in a hashmap on the basis of the following arquivo.txt: chaveA;6 chaveA;4 chaveB;3 chaveB;7 chaveC;1 chaveC;1 chaveD;5 For now my code is like this: Scanner scanArquivo = new…
-
1
votes1
answer63
viewsQ: Information of a specific tag
I am looking for information present in the tags of a repository with the following command that returns the information depending on the parameter I pass in the flag --format. git tag…
-
0
votes1
answer34
viewsQ: Next element of the loop
I’m trying to implement a commit search algorithm between two tags with the command git log tag1...tag2. For this I used the command git tag that returns me the tags of a repository. With this…
-
3
votes2
answers67
viewsQ: nextInt() after the third integer
Given the example.csv: nome;idade;10;21;32;43;54 I can use the class Scanner to read such a file. Using the method .useDelimiter() and taking advantage of the ; to pick up each value. So I use the…
-
1
votes1
answer100
viewsQ: File Additions and Deletions in a commit
I’m using the remote git log --stat <commit> to get additions and deletions made to a commit. Ex: commit 1a1a Author: Gabriel Hardoim Date: 2018-08-20 20:30:40 arquivo.java | 3 +++ arquivo.css…
-
5
votes1
answer68
viewsQ: Gitlab does not display all changes
In one of the Gitlab repositories it turns out that 93000 lines were added in a commit. When I search for this commit locally, using commands like git log, git show for example, I have a return,…
-
3
votes1
answer649
viewsQ: Diff between two commits
I’m making a git diff between two commits and in general it shows me the difference between the files that were modified in these commits. EX: git diff 1a1a1a 4d4d4d + Essa linha foi adicionada -…
-
1
votes1
answer131
viewsQ: Find substring in recent commits messages
I’m looking for a substring in the most recent commits from my repository. I use the command git log -n1 --grep='${subString}'. But using the flag -nI’m just gonna get the last commit, which is…
-
3
votes1
answer91
viewsQ: Diff changing lines
I’m comparing two files, which are updated daily, with the command diff -y in order to obtain two results: The first are the lines that have been modified overnight:…
-
1
votes1
answer39
viewsQ: Append lines in an existing file
I’m trying to add lines to a report, but the new lines are overwriting the old ones. Class with main method: import java.io.FileNotFoundException; public class TesteInscricoes { public static void…
-
-2
votes3
answers262
viewsA: Batch programming
What you can do is scan the file line by line and where the lines are equal, increment a contactor and add it at the end of the file. #!/bin/bash qnt_de_linhas=$(cat arquivo_origem | wc -l)…
-
2
votes3
answers3476
viewsQ: Grep with multiple parameters
I need to select the lines of a file that contains the characters | or \ diff -y ontem.csv hoje.csv | grep -e "|" -e "\" How to tell pro grep to return the lines it contains or a pipe | or a bar \…
-
2
votes2
answers1211
viewsQ: Execute bash commands in C
I’m using the function system("comando"); to execute bash commands in a C program. However, I am having difficulty printing the value of a variable. #include <stdio.h> #include…
-
0
votes1
answer92
viewsA: How do I store data in a structure and then use it in different functions?
Since you used a sequential list, in the function that displays the information you also need to use it. void VisualizarDados(cliente *kirito) { int i; for(i=0; i<50; i++) { printf("%s",…
-
2
votes2
answers109
viewsQ: Find and Replace in bash
I need to find outdated lines in a csv file and replace them with new lines. These are the commands that find the lines that will be replaced(old) and that will replace(new). linhas_antigas=$(diff…
-
0
votes1
answer237
viewsQ: Find a sub-string in the first column of a csv file
I am starting learning in python and do not know how to continue this code. I need to check the first column of a csv file, and if I don’t have a date in a cell in that column, insert the one that…
-
3
votes2
answers902
viewsQ: Ignore the first line
I am using the following command to organize a file: sort -u arquivo.csv -o arquivo.csv But I need to ignore his first line, in case the header. How can I do that?…
-
1
votes2
answers54
viewsQ: Unexpected exit
I am running this command to remove repeated lines from a file: cat arquivo.csv | (read;echo "$REPLY"; sort) | uniq > arquivo.csv But when I look at the file, it’s blank instead of just the lines…
-
0
votes1
answer20
viewsQ: Output redirect
comando | tee -a saida.txt How do I redirect only part of the output of a command?