Posts by DaviAragao • 2,912 points
56 posts
-
16
votes5
answers639
viewsA: Complete number with "zeros" until the total size is 9!
One way to do this is by using the padEnd. The function serves exactly what you want to do. It takes as its first parameter the final amount of characters that a String must have and the character…
-
1
votes1
answer31
viewsQ: Difference between Activitycontext and Applicationcontext
What’s the difference between ActivityContext and ApplicationContext? The following code, executed from a Fragment, log the message "are different": if…
-
0
votes3
answers3930
viewsA: Difference between setImageResource and setImageDrawable
To documentation of setImageResource says that it reads and decodes Bitmap in the UI thread. So this method is slower than setImageDrawable. The documentation suggests the use of setImageDrawable…
-
1
votes1
answer250
viewsA: How to get a return from a foreground nodejs
Since the rest of the code is correct, you just have to wait for the promise to come true. When it fulfills its code it will be called back both in the case of a success, first parameter, and in the…
-
1
votes2
answers145
viewsA: How to create a single page in Wordpress for a post-type?
Yes. His structure is identical to a single.php. <?php get_header(); ?> <div id="main-content" class="main-content"> <div id="primary" class="content-area"> <div id="content"…
-
1
votes2
answers211
viewsA: Select next elements
The problem is that the input are inside td. To documentation of .next() says the method catches the immediate brother element to the informed on its selector. A simple solution to the problem using…
jqueryanswered DaviAragao 2,912 -
1
votes2
answers3929
viewsA: How to position the placeholder
A ìnput text type does not have space on the sides between its contents and the border. This behavior is the result of padding: 3% 20%, that is "flooding" its element in 3% for top and bottom and…
-
2
votes2
answers137
viewsA: Wordpress - How to include new fields in the user table?
Use the table wp_user_meta. Wordpress manages the database for you so that it is neither accurate nor advisable to change the structure of existing tables. To associate new information to the user…
-
2
votes1
answer257
viewsA: Instantiating objects dynamically
The error happens because the condition of the if is not met in all cases and so $thumb does not always have an object and method getUrl() does not exist. To solve the problem just ensure that…
-
3
votes1
answer257
viewsQ: Instantiating objects dynamically
When I create a new object within the repeat loop, it has the name in $sizeName, and try to access the method getUrl() get: Fatal error: Call to a Member Function geturl() on a non-object in ... on…
-
3
votes3
answers6206
viewsA: How to set a Struct as NULL in C?
stddef.h defines NULL as: #define NULL ((void *)0) So do a cast of NULL for Fila, which is neither a type in this code, or assign NULL for a primitive type variable is "wrong". "NULL is not a value,…
-
1
votes0
answers34
viewsQ: mousedown in select Firefox
At the time of click in a <div> the <select> should open. That way I can open the <select>. $('.teste').click(function(){ var element = $('#select')[0]; var ev = new…
-
0
votes0
answers33
viewsQ: Struct in a pack?
What happens when I put an attribute packed in a struct? What is the difference of struct that has that attribute? struct test { unsigned char field1; unsigned short field2; unsigned long field3; }…
-
2
votes2
answers80
viewsA: Stopped running when I added the printf
The problem with the code is that you’re passing %s(string) in printf when the variable is a char(%c) do so printf: printf("a resposta%c", resultado);…
-
4
votes4
answers2951
viewsA: What ways to measure the performance of an algorithm?
There are two major ways to quantify the efficiency of an algorithm, the empirical method and the analytical method. These shapes may vary according to the aspect of efficiency you want to measure.…
-
4
votes2
answers1763
viewsA: Comparing user typed variable with file variable
The @pmg response eliminates the Warning when compiling. But there is a logic error in your code. When reading the files in the file you are overwriting the values that the user reported as usuario…
-
0
votes1
answer420
viewsQ: Minimize jfx window
My window is without the edges of the system. primaryStage.initStyle(StageStyle.UNDECORATED); I created a button to minimize the window but I find Exception by assigning to my stage: @FXML void…
-
10
votes2
answers6497
viewsA: What is pointer to pointer?
A pointer is a variable that stores the memory address of another variable, both of the same type. A pointer to a pointer consists of a variable that stores the address of another, the other in turn…
-
4
votes1
answer21773
viewsA: What is the linux command to copy contents from one folder to another folder
This way you are taking the folder with the files inside. Try this way to take only the files. cp caminhoDaPasta/* caminhoDoDestino/ The * indicates that all files will be copied.…
linuxanswered DaviAragao 2,912 -
4
votes2
answers109
viewsQ: Unix and linux are reserved words?
Even if the variables are not declared unix and linux and even without including anything in my teste.c compiling with the GCC on Linux have: Compilation gcc teste.c -o teste Execution ./teste Exit…
-
45
votes6
answers2425
viewsQ: Arrays are pointers, right?
After all, in C, an array a[] becomes a pointer *a? If not, what are arrays? What are the differences between them? How arrays work internally?
-
3
votes1
answer149
viewsQ: Increase the reliability of random numbers
I have a function that generates pseudo-random numbers with rand who has a Seed which is a publicly known time. Change the Seed is not an option. The application needs a more accurate degree of…
-
3
votes1
answer646
viewsA: comparison using characters in c
What happens is that stdin is with the character you had typed in the main function to choose the function q311, a "enter". And a enter really is not a "t" or a "q". The simplest way to fix this is…
-
2
votes1
answer924
viewsA: Arrange search function in double chained circular list
As @mgibsonbr said, in the search function the return type and the name check were wrong. celula *Busca(celula *lista, char nome[]) { celula *achado = NULL; celula *aux = lista; while(lista->seg…
canswered DaviAragao 2,912 -
2
votes2
answers129
viewsA: How to do operations between functions in C?
The variables in question exist only within their respective functions, they are local variables, and it is not possible to manipulate them from outside the functions. To solve your problem there…
-
2
votes1
answer877
viewsA: Problem creating C search function
The function of busca need to receive beyond the list one sobnome which remains to be passed as a parameter at the time it calls. And if your intention is for her to return NULL have to change the…
canswered DaviAragao 2,912 -
2
votes1
answer2274
viewsA: Chained list without head in c
I see in your code that you already have two removal functions, but both are with the wrong return. The function remover is returning an entire, you declare the return of the same as void. Take out…
-
6
votes1
answer119
viewsA: I’m in doubt how to do
To calculate the module of any number check two cases being the positive number, your code does nothing, and the negative number make it positive. #include<stdio.h> int modulo(int num); main()…
-
1
votes3
answers1025
viewsA: problem in C with rest of the division
resp = indice %; The line is not valid, the expression is incomplete, an argument is missing. From the statement of the question I suggest number 2 because there is a need to find out if the number…
-
4
votes3
answers18598
viewsA: How to find the rest of the division?
The reason your code doesn’t work has already been covered, use variables like int so that the division returns the rest and not a number with decimals. Another interesting way to solve this problem…
-
2
votes2
answers1697
viewsA: Remove element from a chained list
Creating an additional pointer and causing it to point to the position of atual before atual receive the next you isolate the memory address to be released, then you can use the free normally.…
-
4
votes4
answers658
viewsA: How to test the condition on a vector?
If you need to put * in the first position of each word of a string read from the input try so: #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 500 int…
-
2
votes1
answer5699
viewsA: Problem compiling: no input files Compilation terminated
If this error occurred after you entered the command gcc in the cmd your installation is correct. But it is necessary to complete the syntax so that the gcc work by passing the file name to be…
-
3
votes1
answer9288
viewsA: Store data in STRUCT and print data on screen - 3 people
In addition to the use of fgets() recommended by @pmg I found two errors in your code. First you make a vector of structs but does not access the elements of struct as vectors. Second at the time of…
-
5
votes2
answers330
viewsA: Dynamic allocation and runtime of functions
The memory really remains allocated at the end of the function execution. To clean it use free, as already said by @Rodrigo Vieira. To be able to manipulate the elements allocated in memory within…
-
3
votes2
answers1313
viewsA: C++ - Stop condition in repeat structure
In this case the most advisable structure is the {} while();, because you avoid a check that is unnecessary before the first execution of the code, since the program has a menu and this will be…
-
0
votes2
answers72
viewsA: Code compilation
There are no syntax errors in the code. C code is legitimate, compiles, and executes. The code executes and writes an integer on the screen the number 7. Perhaps the problem lies in some peripheral…
-
4
votes1
answer629
viewsA: Open a file using secondary function
The problem is not the opening or writing function in the file but the passing of parameter by reference that you are trying to do. The variable arq is a pointer to a file and when passing a pointer…
-
3
votes4
answers255
viewsA: How to read an input in the loop
As @Daniel Gomes said, take out the simple quotes. For this type of construction in which the loop should repeat at least once use do{} while(); and avoid unnecessary checking: #include…
canswered DaviAragao 2,912 -
2
votes1
answer286
viewsA: What is the best way to create a binary tree in C language?
There are some factors that may interfere in the performance of both cases. The form of implementation and what is the content of this "head" can interfere in the analysis of the performance of the…
-
1
votes1
answer623
viewsA: Decomposition into primes
The code really is a bit confusing. It’s going into infinite loop because divisoes starts at 24, then becomes 12, then 6 and finally 3. When divisoes has 3 does not enter this condition: if…
-
1
votes3
answers272
viewsA: Problems with "strcpy" locking program
Within the structure aluno was declared that name a pointer to a character. The problem is that you are trying to copy the nome file and put on pointer name, which does not accept character type…
-
4
votes3
answers6933
viewsA: Rotate matrix by 90º
The simplest way to do this is to rotate the screen when printing. For a 3x3 integer matrix, i are the lines and j are the columns, you can display it "tipped" so: for(j = 2; j >= 0; j--) { for(i…
-
1
votes1
answer1643
viewsQ: Android Studio freezes in Gradle: Resolve dependencies ':app:_debugCompile'
When I open Android Studio Gradle runs several processes. When arriving in Resolve dependencies ':app:_debugCompile' he hangs and even telling abort does not respond. This is my build.gradle: //…
-
30
votes2
answers1875
viewsQ: Code plagiarism
In the academic world, plagiarism and referencing are taken seriously. And when it comes to our intellectual creation, to what extent would it be plagiarism to copy and paste snippets of another…
licenseasked DaviAragao 2,912 -
2
votes4
answers456
viewsA: Memory allocation for pointers
In fact what the author tried to say is that in a pointer it is not possible to store a value of an integer type, character, real... because in fact a pointer has a space in memory, but to store the…
-
38
votes2
answers1031
viewsQ: Why use "while(0)"?
In Linux code I saw some macros with: do { }while(0) Is there a reason? Because there seems to be no logic in a repeat loop where the code repeats only once.
-
5
votes1
answer819
viewsQ: How does "printf()" work?
How the code works behind the function printf() do C? I am aware of what this function does, I want to know how it does.
-
1
votes1
answer805
viewsQ: Develop in C# using Mono Develop Linux
I need to program in C# and use Linux. I read a little about Mono Develop, I would like to know in what functional aspect Mono is owed or stands out in relation to Visual Studio and if there are…
-
4
votes1
answer610
viewsA: Sequential Static List
When did you declare lista *li you just said that you will get a pointer of type list. It would be the equivalent to say int *i. This last statement does not say that you have an entire variable,…