Posts by Brumazzi DB • 4,345 points
175 posts
-
0
votes1
answer913
viewsA: Lists of dictionaries
In Lista2 the first courses Nome do Dono has space, this can disturb the time of consultation. Try using this code snippet item = int(input("Numero da pessoa: ")) animal = lista2[item-1]['Nome do…
python-2.7answered Brumazzi DB 4,345 -
0
votes2
answers212
viewsA: How to escape special characters?
You need to install the library with support for UTF-8, otherwise you won’t be able to use. If you are going to do the installation by luarocks, check the library directory of Moon, the files may…
luaanswered Brumazzi DB 4,345 -
1
votes1
answer945
viewsA: How do you assign data to a struct by reading from a CSV file?
I think the best command to collect data from files and play straight on variables is the fscanf, post it is possible to determine the input format. The file was opened with the fopen, I think using…
-
1
votes1
answer96
viewsA: Two functions on one button
As well as you are submitting a form, the redirect should be done by Backend of its application (It is possible to Frontend). There are 2 ways to redirect. The first is with the use of the method…
-
13
votes3
answers4376
viewsA: What is the purpose of the return of the main function and the importance of this function?
Usually languages need a starting point. In java, c, c++, ada, pascal, assembly, etc, a method or a block (in the case of pascal) is used to know where the application will start. In Assembly the…
canswered Brumazzi DB 4,345 -
0
votes2
answers76
viewsA: Strict Aliasing do c
If I’m not wrong, Strict Aliasing refers to the passage of variable values or struct of different types. Ex: #include <stdio.h> #include <malloc.h> #include <string.h> typedef…
canswered Brumazzi DB 4,345 -
0
votes2
answers3669
viewsA: Decoding of file in Python
A bad thing in Python is to work with string, I’ve had a lot of headaches with Unicode and utf-8. Getting to the point. In interpreted languages, header comments are often used for "settings" (Do…
-
2
votes1
answer73
viewsA: Type error in return of a derivative function
Your problem is related to syntax of your code. In C, the method type declaration is very important, as its methods f and derivatef does not have a defined type, the compiler defines the return of…
-
0
votes2
answers484
viewsA: how google sees dynamic pages
For google to find your page just register it, on google. But for it to appear between the first pages, is used Search engines, which are techniques to improve the ranking of your page. Structure of…
-
9
votes4
answers870
viewsA: Why can an if be redundant?
You could say that Netbeans is a very boring IDE because it doesn’t let you program and does it all yourself. kkkk The thing is, some Ides are smart and do their best to reduce code or fix possible…
-
0
votes1
answer153
viewsA: Pass C struct to lua script
Problem solved! lua_pushvalue(lua_lib, data); was replaced by: lua_pushlightuserdata(lua_lib, data);
-
3
votes2
answers16389
viewsA: Remove Python punctuation and symbols
You can select the characters one by one to remove them. def chr_remove(old, to_remove): new_string = old for x in to_remove: new_string = new_string.replace(x, '') return new_string so you can…
-
1
votes1
answer153
viewsQ: Pass C struct to lua script
When I got past my frame Book to the script in Moon, the method writes the value as nil. How I pass the structure Book to my moon code? main. c: #include <lua.h> #include <lualib.h>…
-
1
votes1
answer2416
viewsA: remove a specific item from a chained list in c
To remove an item from the list, you first need to check if it is 0 or if it is N. When position is 0, you have to go through the value with its original list. When position is n, can use an…
canswered Brumazzi DB 4,345 -
0
votes3
answers103
viewsA: C pointers, error calling the relocation function
In his statement: pessoa* alocarEspaco(pessoa p, int tam) It’s not necessary pessoa p because the method will already allocate do the memory allocation. And when using size to count or allocate…
-
0
votes1
answer167
viewsA: list has not been declared
You forgot to put the namespace in No.h. And in the archives No.h and No.cpp you must define the type of the list list<No> #ifndef NO_H #define NO_H #include <list> using namespace std;…
-
7
votes3
answers747
viewsA: Is malloc typecast recommended?
As many authors and as written in the article C-Faq Malloc Cast, everyone says that the typecast in C, is not necessary, and due to automatic treatment of types void * for other types, then suggest…
-
1
votes1
answer49
viewsA: Help in function with pointers
To insert the value into the variable n within the main, you need to pass her memory address, and you do it just like in scanf: chamar(&n); and in the call method, as the parameter is already a…
-
4
votes4
answers715
viewsA: What’s wrong with the c-code?
From the conditions of your code, I can tell you’re just counting the symbols, and printing S|N according to the quantity within vetor. You should stack the character inside p and pop when I find…
-
0
votes2
answers48
viewsA: for() is showing the same array value
His method selectProdutos returns only the first product. The mysql_fetch_assoc returns a value each time you use it, so you must store all the data in vectors. /*...*/ while($line =…
-
1
votes2
answers622
viewsA: Repeat loop for in C
The best solution is the use of vectors. Follow the example: To use the code, just copy the snippets inside the code boxes and paste them in order. #include <stdio.h> int main(int argc, char…
-
1
votes1
answer337
viewsA: Error importing structs from a header file
What happens is that when you have a pointer and you take a position on that pointer, it ceases to be a pointer and becomes a variable. In other words, the pointer stores the memory address, when…
-
0
votes1
answer32
viewsA: List printing problem because of repeated values
Always before entering the value, you should check if it exists within your list. To add the function n_exists: char n_exists(int n){ lista *swap = raiz; while(swap){ if(swap->valor == n) return…
canswered Brumazzi DB 4,345 -
2
votes2
answers10981
viewsA: Concatenate char variable text in printf
There are several methods to concatenate strings into C, you can use the sprinf, or the strcat. The sprintf, works the same as printf, the difference is the string parameter that you will insert the…
-
5
votes6
answers41177
viewsA: How to find the position of an item on a list?
#!/usr/bin/env python #*-* coding: utf-8 *-* numbers = raw_input() # gera um vetor de numeros atravez da string n_list = [ int(x) for x in numbers.split() ] n_min = min(n_list) n_pos =…
-
3
votes2
answers356
viewsA: Make a Jquery script to run only on mobile phones
This method checks if the device being accessed is PC or MOBILE, but would recommend using viewport and mobile first (technique for creating responsive websites), facilitate much more your life and…
-
4
votes1
answer278
viewsA: Copy Cate and ls file
First the command cat does not serve to make file copy, its real functionality is to show the contents of the files, if you want to use it to create copies of files the correct is cat arquivo.txt…
linuxanswered Brumazzi DB 4,345 -
1
votes1
answer675
viewsA: Copy files in c
Try this: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <malloc.h> int main(int argc, char *argv[]){ // aloca um texto para o system() char *command =…
-
1
votes1
answer1109
viewsA: Vector return and matrix of a function in c!
I fixed the return of the method, as for the order of the values, I do not know if it should return the exact inverse of the original, or some order in its calculations. First on the file main.c the…
canswered Brumazzi DB 4,345 -
9
votes1
answer23399
viewsA: Pick up "child" element from a DIV
The hierarchy of objects, and structures html, xml, etc, follow a logic very similar to that of a person (or any object). The component has a "parent", or if, some component that gave rise to it or…
-
0
votes1
answer87
viewsA: Pydev no Eclipse: Unable to get project for the run
In compiler/interpreter settings, you must pass the python interpreter path. Pydev does not see fully configured. Follow the image template below and the link to Handbook:…
-
3
votes4
answers1442
viewsA: Document.writeln() is in disuse javascript
<script> var imprime_1 = function(){ document.writeln("Valor"); } var imprime_2 = function(){ var x = new String("var String"); document.writeln(x); } </script> <form> <input…
javascriptanswered Brumazzi DB 4,345 -
1
votes1
answer324
viewsQ: Problem with reading Bitmaps in C
I’m having trouble reading files Bitmap. Results not as expected. The size is always the same regardless of which image I open Height and width do not match the size stated in the image viewer The…
-
2
votes1
answer854
viewsA: How to calculate test scores?
In the question, it is a quantity x of students passed through the exercise, that’s where you’re missing. When taking the amount of students who answered the feedback, have to enter a repetition…
-
0
votes1
answer216
viewsA: Html does not render radio button value
The inputs of the type radio are best used for the submission of a form, because the name both must be equal. To pay the value dynamically, the best way is to use the tag select, she replaces the…
htmlanswered Brumazzi DB 4,345 -
1
votes2
answers1652
viewsA: Send specific branch with Git to Github
When you already have your repository empty on github, you can take the reference in two ways. Cloning the repository Thus, you use the url to clone (download) the repository to your computer using…
-
1
votes2
answers617
viewsA: addslashes is the basic for security?
In part yes, the addslashes protects against most codes of SQLInjection but not all, its only feature is to transform the quote into character by adding an arrab (\). Apart from these commands of…
phpanswered Brumazzi DB 4,345 -
2
votes2
answers2706
viewsA: How to use vector to store a class?
You are assigning the class to your vector pointer, so you will not have an array but an allocated class on the pointer. You must create pointer instance first of all. class C{ C(){ std::cout…
-
0
votes2
answers38081
viewsA: Calculate vector size
The vector inside the method is now a pointer, so the size will always be 8 (if your file is 64x), to calculate its size, you must create a method that traverses the pointer and count the positions.…
-
5
votes1
answer66
viewsA: Why doesn’t my Return return the i do for?
Your way int BuscaLinear(int *sequencia[], int tamanho, int valor) is receiving a vector pointer. Declare so: int BuscaLinear(int *sequencia, int tamanho, int valor) //ou int BuscaLinear(int…
canswered Brumazzi DB 4,345 -
0
votes3
answers3725
viewsA: Convert "Floating" to Decimal
Dodging a little theory and going right to practice. #include <string.h> #include <stdio.h> int bin2des(unsigned long long bin){ int x; int y; char num[18]; sprintf(num,"%d",bin); x =…
canswered Brumazzi DB 4,345 -
3
votes1
answer385
viewsA: Multiple Python input factorial
by what you said you want, it should be +/- so the code numb = "\n" while True: n = int(raw_input()) if n == -1: break numeroCalc = n fatorial = 1 while numeroCalc > 0: fatorial = fatorial *…
pythonanswered Brumazzi DB 4,345 -
1
votes1
answer148
viewsA: Javascript script help Syntaxerror: Missing ; before statement
Any condition in the if must be in parentheses. It is allowed to use multiple parentheses within the if, as long as it has one encompassing everything Your comparisons are wrong, some languages…
-
0
votes1
answer112
viewsA: Pass by reference of a vector structure in C!
The statement of struct does not need a size, as it is instantiating a struct vector in main, or read and write methods must receive vectors (pointers), when picking the position of a…
-
0
votes1
answer2375
viewsA: Socket/Threads (Client/Server) Java
I did an exercise like this last year. You’re not specifying whether you can have multiple clients connected at the same time, but if you have. An extension to the thread. public class Server{…
-
1
votes3
answers958
viewsA: Query in two fields of a table
There are several ways to perform this search, "key equality" and "Inner Join". //inner join select count(providencia.cod_provid) from providencia inner join ocorrencia on occorencia.cod_ocorrencia…
sqlanswered Brumazzi DB 4,345 -
3
votes2
answers7033
viewsA: What is to bind?
There is Dynamic Bind and Static Bind. In the static bind, you have methods within your main class and call them straight into the main (the methods have to be static), e.g.: public class Main{…
javaanswered Brumazzi DB 4,345 -
1
votes2
answers87
viewsA: How to remove an Alert after selecting another in a select
You’re not taking the display, when you put with the display = "block" it is necessary to put display = "none", so go hide the message. $('#select-category').change(function(){ for(var…
javascriptanswered Brumazzi DB 4,345 -
1
votes1
answer305
viewsA: how to import a play framework 2.5 project into the eclipse
After starting the play console, call it eclipse in the project folder: $ play new projeto_01 $ cd projeto_01 $ play [projeto_01] $ eclipse the eclipse command will generate the files to import the…
-
2
votes2
answers1837
viewsA: Desktop Friendly Web Application
Most graphic libraries have components for uploading web pages, with support for css, sessão, javascript, etc... If you are developing in C++, the Qt graphical library has all the components you…
web-applicationanswered Brumazzi DB 4,345