Posts by Mansueli • 3,734 points
79 posts
-
2
votes3
answers302
viewsA: How to separate a file with multiple FASTA into different variables
As in Fasta files there are the headers and suspicious contents it would be interesting for you to keep them separate and recover what you want from each of them: #!/usr/bin/perl use strict; use…
-
3
votes3
answers20150
viewsA: Converts negative number to positive
The big trick is to use the module mathematical function or absolute value to print what you want. Because it is a fairly common function it is possible to find it in most programming languages in…
-
1
votes3
answers517
viewsA: Comparing matrices of different sizes in R
#define as matrizes all_sec <- matrix(c("SEC1","SEC2","SEC3","SEC4","SEC5"),ncol=1) portfolio <- matrix(c("SEC2","SEC4",0.45,0.55),ncol=2) #define o tamanho das matrizes (melhor…
-
2
votes3
answers1951
viewsA: How to search for ID in Mysql
How do you not define the id in the code it must be auto-incremented in the database, so what you’re looking for is probably the highest value: $sql1 = mysql_query("SELECT MAX(id) FROM entrada");…
-
2
votes2
answers114
viewsA: cho-han bakuchi in basic C
Your code is almost correct, just put this part inside the while: srand(time(NULL)); while(cred!=0) { die1=1+(rand()%6); die2=1+(rand()%6); sum=die1+die2; //... Because you set the random numbers…
-
1
votes2
answers1316
viewsA: How to Inhibit Display of Information on the Eclipse Console using Hibernate
If it’s only Eclipse and you have the file persistence.xml look for this line <property name="eclipselink.logging.level" value="ALL"/> And change your ALL for FATAL or some flag with less…
-
2
votes4
answers15159
viewsA: C language - Prime numbers in vectors
You generated an infinite loop and so can’t continue to check the next numbers. #include <stdio.h> #include <locale.h> //para usar acentuação em português #include <math.h> //…
-
3
votes1
answer256
viewsA: How to allow just one instance of a program made in Python?
Form 1 Save a file somewhere, and you can check if the process is running if pid already exists in the file. Note that you will need to delete the file after running. Save the Process ID in a…
-
6
votes1
answer303
viewsA: if/Else statements and time.Leep()
No, note what happens if you run the following code: #!/usr/local/bin/python2.7 import time var = time.sleep(2) print(var) Exit: None Therefore, it cannot be used because the time.Sleep() method…
-
5
votes1
answer394
viewsA: How are the standard library functions of different programming languages implemented?
Where to start: Always look for open implementations of the languages you want to find out how something works. In general for each platform things are implemented differently and in the case of C,…
-
1
votes1
answer443
viewsA: Permissions and antivirus issues to run the application
It all depends on how your Jar is. There are several ways to get a result similar to what you want. 1. Download Executable Files Most sites that distribute executables do so in the form of…
-
4
votes2
answers157
viewsQ: You can distribute program with GPL License along with GPL
I believe this is part of our scope (penultimate item). My question is this:: If I create a program (Graphical Interface) that communicates (dynamically) with a GPL program, I could distribute the…
-
1
votes1
answer406
viewsA: Run Graphviz (dot.exe) through Java application
Always try to encapsulate everything that links to external programs in separate classes. Your mistake is that you cannot use the command cd when calling the console in java. I believe you’re…
-
1
votes1
answer2089
viewsA: Edge effect of a Jbutton component
I believe you’re looking for something along these lines: package br; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.FlowLayout; import javax.swing.*; import…
-
1
votes1
answer150
viewsA: Doubts with generation of random values
Not quite, see your example with very detailed comments: { Cria 5 (cinco) Submarinos. } for Conta := 1 to 5 do // laço para o número de submarinos begin repeat //seleciona um número aleatório dentre…
-
1
votes1
answer611
viewsA: Compare each word of the given text and save the lines in which the text appears
Since you have not posted a compileable example, I will pass more or less what must be done to get the list the way you want: public Collection<String> split(String book){ try{ FileReader path…
-
2
votes1
answer95
viewsA: Android API used for program that cuts music
I believe you will have two options that are the most viable, I recommend analyzing both and checking which one is the most recommended for your project: musicg-api great API but has a serious…
-
1
votes2
answers344
viewsA: link factoring
Notice what you’re doing: Suppose in a = 5; for(i=num;i>=1;i--) { aux=i; fat=aux*i; printf("\n%d ", fat); } Take the test table: i=5 | i=4 | ... aux=5 | aux=4 | fat=5*5??? | fat=4*4 | What you’re…
-
2
votes2
answers2257
viewsA: How do I get the class name in a static context?
stack.Leading package stack; public class Principal { public static void main(String[] args) { //Dinâmico A a = new A(); B b = new B(); a.getClasse(); b.getClasse(); //Estático A.getStaticClasse();…
-
1
votes1
answer772
viewsA: Get system resource within Jar file (getSystemResource)
I had a similar problem and in this case I recommend using this.getClass().getResourceAsStream("") to be able to manipulate without problems. Example stack.Config.java: package stack; import…
-
1
votes1
answer606
viewsA: Selecting data in Java Curl
As I don’t have an API key to test, I checked the past site and saw that everything is in one single line. So you wouldn’t even need GSON for parse (don’t use libraries if you don’t need them)…
-
1
votes1
answer2615
viewsA: Adjust Image Size with Java Imagery
BufferedImage imagem; Icon novaImg; try { String caminho = "file:///" + aleat(); // carrega imagem aleatória int largura = 200, altura = 300; imagem = ImageIO.read(new URL(caminho)); novaImg = new…
-
5
votes3
answers8167
viewsA: When to use recursion and when to use loops?
Where possible avoid this feature. Recursive calls are interesting and elegant plus they spend more memory (Because you have to store the N recursive calls and return them respectively) and on more…
-
4
votes1
answer698
viewsA: Does Prolog have static or dynamic typing?
The typing used in Prolog is dynamic in the same way as most dynamic languages, for example Python. (And yes, all nonstatic languages are dynamic as long as there is variable typing) Extending a…
-
4
votes3
answers2685
viewsA: Algorithm C language - Multiplication
If you want logic: Enquanto numero < 100 : numero = numero * 3; Imprime( numero) ; I suggest you check if the entry is less than 0, as you should have a different treatment for it. Or change all…
-
2
votes2
answers3335
viewsA: Print special characters on windows console
There are three ways to use these special characters in windows : Swiping the code right into the printf: printf("isto \x82"); //imprime isto é (This code above assumes the Codepage 850 ) Creating a…
-
5
votes1
answer586
viewsA: Interpretation of an algorithm
As shown in the example: (6,8) The programmer lives in house 6 of 8, so: //Right: {7,8} -> 7 + 8 = 15 Left: {1,2,3,4,5} -> 1 + 2 + 3 + 4 + 5 = 15 Pseudocode Inteiro esquerda = 0 Inteiro…
-
1
votes1
answer87
viewsA: How to call the Linux sendemail program from within Oracle
There is unofficial documentation on this page: And I make a point of setting the example they provide here by believing to be a great example: The easiest way to send an email is through the…
-
3
votes1
answer12458
viewsA: Devc++ returns "uncompiled source file". Why?
Dev-C++ is an obsolete IDE and so I don’t recommend using it due to various project bugs that occur. If you really like Dev-C++ I suggest you install wxDev-C++ because it is a software that is still…