Posts by gato • 22,329 points
373 posts
-
9
votes1
answer3041
viewsA: What is the __new__ in python method for?
According to the definition below: Use the __new__ when you need to control the creation of a new class instance. Use the __init__ when you need to control the initialization of a new instance. The…
-
10
votes2
answers424
viewsQ: What is the purpose of empty command blocks or which do not belong to any command?
A command block is composed of two or more commands between keys {...//Comandos}, I can use them for the following situations I already know: In a if: if(codicao){...//Comandos}. In a for:…
-
3
votes2
answers1420
viewsA: Read numbers separated by commas
Create a program that asks you what is the position of the value (element) you need, and search for this value according to the chosen position, it also separates the values by comma "," as your…
-
1
votes4
answers3830
viewsA: Compare number within a numerical range
Here an example for you to check if the numbers are in the range 1 to 25, see below: using System; public class Test { public static void Main() { if (comparaNumero(90)) Console.WriteLine("Dentro do…
-
13
votes1
answer1093
views -
4
votes1
answer19917
viewsA: How to read text files and put words into an array?
You have to keep in mind that a string vector on C is actually a matrix of char, See the example below: char* palavras[50]; Above I declared a vector with a pointer pointing to the word. This vector…
-
1
votes1
answer368
viewsQ: How to implement product returns?
I am having difficulties in implementing a requirement in database modeling, this requirement corresponds to product returns. This is the scenario that occurs the returns and the different modes of…
-
5
votes2
answers78
viewsA: Difficulty to query in Mysql
Just use the operator IN in the query: SELECT psi.product_id FROM products_search_items AS psi INNER JOIN products ON products.id = psi.product_id WHERE search_item_id IN (20,14) The result…
-
3
votes5
answers42959
viewsA: Function equivalent to Trim (function to remove extra spaces at the beginning and end) in Python?
Complementing. To remove all blanks you can use the join and the split as suggested in the comments by Guilherme Lima, take the example: s = " Stack Over Flow " s = ''.join(s.split()) print s…
-
3
votes2
answers2854
viewsA: Choose folder to save a file
If you want to choose the location where the file will be saved you can use the method asksaveasfile module tkFileDielog, simply import the necessary libraries from the TKinter. Here is an example…
-
21
votes2
answers8871
viewsQ: How and when to use Interface?
When should I use an interface, in which situations its use is feasible and which is not feasible and how to use it correctly? I developed an example to illustrate a situation, below: using System;…
-
10
votes3
answers1938
viewsQ: Test case is a use case?
I have doubts about use case and test case. In my understanding both are the same things, just a diagram of UML, but in college my teacher said that a test case is not a diagram nor a use case, but…
-
8
votes1
answer452
viewsQ: What is a type class "class Minhaclasseexample<T> Where T: new(){}"?
A class class ExemploClass<T> is a list? See the example class below: public abstract class MinhaClasseExemplo<T> where T: new() { public T value {get; set;} } Which means every part of…
-
4
votes2
answers3235
viewsA: How to call a form and hide the previous one in C#?
Use the property Visible of your form which serves to return or define if an object is visible, see the example: private void button1_Click(object sender, EventArgs e) { this.Visible = false; Form2…
-
18
votes3
answers8119
viewsQ: What are the best practices in field validation?
I created an example to illustrate my doubt regarding field validation, the example is composed of two classes Pessoa and ModelPessoa. The class Pessoa has the following attributes: Nome, Idade,…
-
1
votes1
answer32
viewsA: Study of "interaction simulation" on android
One can use the PackageManager to get a Intent for a package, example: PackageManager pm = getPackageManager(); Intent intent = pm.getLaunchIntentForPackage("com.exemplo.pacote");…
-
8
votes3
answers524
viewsQ: What is Front-end and Back-end?
I’m starting to study WEB and I still lack much knowledge, and early on I came across the terms that are highly used in this world of development WEB, who are Front-end and Back-end, I have read…
-
1
votes2
answers230
viewsQ: How to implement and use the Binarysearch method?
How to implement and use the method BinarySearch of a List<T>? I’m having difficulty implementing and also how to use it in a practical way. Follow the example for illustration: int…
-
3
votes1
answer1889
viewsA: Break line when typing entries
To fix the problem of skipping line it is necessary to clear the keyboard buffer with the __fpurge which is left by scanf, look at the modifications: void cadastrarPessoa(Pessoa *pessoa){…
-
1
votes1
answer106
viewsA: How to make it redirect
From what I understand, you can use the class Process to create a process and the Processstartinfo that will specify and define the properties when your process is initialized, in which case the…
-
6
votes1
answer1209
viewsQ: Software license registration file issuance and control
I have a system to control and issue electronic license registration files, so I have control of how many machines my software can run. My teacher advised me to use the CPUID processor to validate…
-
7
votes1
answer451
views -
1
votes1
answer1720
viewsA: How to add columns and values in columns in a Listview at runtime?
First I had to create the columns: listViewListaChamada.View = View.Details; listViewListaChamada.Columns.Add("Aluno", 490); listViewListaChamada.Columns.Add("Presente", 100); Set the above routine…
-
2
votes1
answer1720
viewsQ: How to add columns and values in columns in a Listview at runtime?
I own a ListView listViewListaChamada and I am trying to add columns and values to the columns corresponding to my ListView listViewListaChamada, however I did not succeed. I created the function…
-
3
votes2
answers642
viewsA: Error while trying to update table using C#
One should give a space between the table Cliente and the command set: cnxCli.sel =/*"set dateformat dmy \n"+ */ "update Cliente" + "set Nome = '" Change to: cnxCli.sel =/*"set dateformat dmy \n"+…
-
8
votes2
answers2568
viewsQ: What is the purpose of the size_t and ssize_t commands in C?
What is the purpose of commands size_t and ssize_t? What kind of data they represent? size_t minhavariavel1; ssize_t minhavariavel2;
-
2
votes2
answers1914
views -
3
votes2
answers1914
views -
12
votes3
answers13730
viewsQ: What is the difference between simply-chained and double-chained list?
I’m having a hard time understanding the functioning and difference of a simply-chained list and a double-chained list, the two seem to have the same purpose and functioning. I know that both are…
-
1
votes2
answers386
viewsQ: Join commands (Join) in SQL
I have some doubts about the commands inner join, left join, right join and full join, I don’t know if it’s just the join that makes the junctions between the tables, but along with it comes these…
-
8
votes1
answer460
views -
5
votes1
answer246
viewsQ: How do I set up a project in Git and Github?
I own a project on Github called ProdRegex it does not contain any file, I have saved the project on my PC in the following path ~/Projetos C/Feichas Aula/ProjetoProdRegex where is all the files of…
-
3
votes2
answers4252
viewsA: Error: Undefined object reference for an object instance, how to resolve?
Following Maniero’s recommendations I made the changes in my method ChamadaEfetuada() : bool and removed the method ChamadaEfetuada(MAluno) : bool. Replaces the array MAlunos[] alunos by a list…
-
3
votes2
answers423
viewsQ: How to manipulate instance properties of a class that is in a List<T>?
I have a class called Pessoa, this class has two properties Nome and Idade, I am using a List<T> to manipulate data, I know I can manipulate data like string or int creating a…
-
4
votes3
answers972
views -
13
votes2
answers241
views -
4
votes2
answers4252
viewsQ: Error: Undefined object reference for an object instance, how to resolve?
I have the method ChamadaEfetuada(MAluno) : bool checking whether the call was made to a particular student, this method is used in another method ChamadaEfetuada() : bool that instead of checking…
-
33
votes4
answers41801
views -
6
votes2
answers2267
viewsA: What is the __init__.py file for in python modules?
It is part of a package. See the python documentation. The archives __init__.py are required to make Python handle directories containing packages, this is done to avoid directories with common…
-
8
votes1
answer1947
viewsQ: How to drag form without border?
I’m trying to implement a way to drag my form no edge while clicking and holding down the left mouse button on it, however I did not succeed. Below follows the example of my attempt at…
-
9
votes1
answer3112
viewsQ: Debug and Release mode in Visual Studio, what is it for?
In my Visual Studio I’ve noticed that there are two configurations that I can’t understand what they’re for, it’s them Debug and Release, is part of the option Solution Confugurations. Could someone…
-
2
votes2
answers577
viewsA: how to compare null/null value when type character in C
If you want to ensure that the user only type numbers you must do the treatment of scanf as follows: #include <stdio.h> #include <stdlib.h> int clean_stdin() { while (getchar()!='\n');…
-
4
votes2
answers133
views -
4
votes2
answers783
viewsA: How to pass a . sh file as parameter to a C code?
You can use the arguments argc and argv[] of function main. The parameters argc and argv give the programmer access to the command line with which the program was called. The argc (argument Count)…
-
2
votes2
answers582
viewsA: Doubt pointer cast
char c = '5'; A char has the size of 1 byte and its address is 0x12345678. char *d = &c; You get the address of c and keeps in d and d becomes real 0x12345678. int *e = (int*)d; You’re making…
-
1
votes1
answer346
viewsQ: Error: Undefined reference to 'sqlite3_open'
I am creating a software in C that uses Sqlite 3 as database, however, when compiling the project Codeblocks returns me the following error message: createdata. c|| undefined reference to…
-
2
votes3
answers1472
viewsA: Problem using if Elif Else (Else error)
No condition is used in else because the else becomes valid when the other conditions are not true. See below: if media >= 6: print ("{nome} sua média em Biologia é {media} você foi…
-
1
votes2
answers698
viewsA: Python clock does not update
You have to give a chance to the GTK redesign the updates on label and also create a thread to get the current time. Look at your code: #!/usr/bin/env python2 # -*- coding: utf-8 -*- import…
-
11
votes1
answer3723
viewsQ: Methods Executereader(), Executenonquery() and Executescalar(), what are the differences and how to use them?
I’m working with a database SQL Server in C#, but I noticed that the object SqlCommand has several methods to execute a query, are they: ExecuteReader(), ExecuteNonQuery() and ExecuteScalar(). My…
-
2
votes2
answers630
viewsA: Java Fork/Join Does it work the same as C Fork?
The Fork is a function that is a system call. That is, it invokes the operating system to do some task that the user cannot. In this case, Fork is used to create a new process on Unix-like systems,…