Posts by Christian Beregula • 1,512 points
68 posts
-
0
votes1
answer11
viewsA: Render image in graphical display
Seems to me a problem of Undefined behavior along those lines uint16_t color = word(FileRead.read(),FileRead.read());//lê 2 byte If you leave the reading order defined via code will probably solve…
-
4
votes1
answer50
viewsA: Who is the instance, who is the instance? Java
I know the object is x, but is it the instance? If so, is the instance of what class? Professional or Blacksmith? I wouldn’t say that x is the object, I would say x is a reference to the object. The…
-
0
votes1
answer31
viewsA: How to spin a Gameobjet without spinning his son?
I’m not 100% sure of the answer but I have almost the answer to your question is no. Probably the easiest way would be to create another gameobject that is your parent player3 and remove the Canvas…
-
0
votes1
answer42
viewsA: Menu with pushbutton Arduino (esp32)
It seems to me it’s just a logical error in the code. void loop() { int button1 = digitalRead(but1); int button2 = digitalRead(but2); // esse while esta travando seu programa // por que só realiza a…
-
0
votes0
answers45
viewsQ: php datetime returning wrong date
Until last midnight the code $atual = new DateTime("now", new DateTimeZone($timezone)); returned the normal schedule, same as the server, but today presented something strange. 2020-11-01 09:00:30…
phpasked Christian Beregula 1,512 -
7
votes2
answers88
viewsA: When compiling the code, both numero1 and numero2 display the same value even having an increment
It’s simply a question of where the ++ Integer numero2 = ++numero1; It turns into that: numero1 = numero1 + 1; Integer numero2 = numero1; Now if you put: Integer numero2 = numero1++; Turn that…
-
1
votes1
answer51
viewsA: Android socket does not come out of the while, why?
You can use getReceiveBufferSize() to know how many bytes you have available in the socket buffer before reading. byte[] receivedBytes = new byte[len]; // len é o tamanho da resposta esperada int…
-
1
votes1
answer274
viewsA: Problem creating Minimax in chess game
First of all you need to implement the position analyzer. It is the real intelligence of your game. The better you make it, the better the decisions will be when making the move. void…
-
1
votes2
answers455
viewsA: Calculate memory address by pointer arithmetic
The v + 3 will result in the memory position of v[3]
-
0
votes1
answer588
viewsA: SELECT with PDO and PHP OO
Your connection function returns nothing. $con = $cn->connect(); Then it is assigned null to $con public function connect(){ try { $this->conexao = new…
-
1
votes1
answer61
viewsA: Save formula postgresql
The problem was not in pgAdmin as I said, but in the php page that received the POST and performed the insertion. The + is converted to <espaço>, to use the character + it is necessary to…
postgresqlanswered Christian Beregula 1,512 -
1
votes1
answer61
viewsQ: Save formula postgresql
I have the following query UPDATE teste SET equacao = 'X*254/1024+15.2', zerar = False, MinValid = 0.00 WHERE id = 1 RETURNING * It runs normally, but when I get to the database the plus signal +…
postgresqlasked Christian Beregula 1,512 -
3
votes2
answers315
viewsA: Change button name in event
Just go on the tab eventos from your button and find the event click, and put the name you want, and then modify the event name in your code to leave it equal.
-
1
votes1
answer1711
viewsA: Android - How to call a method from another class from onCreate()?
Unless that method is static or you create a class of which your activity derivem, you will need to implement this method in both. Your log error is derived from the fact that you tried to…
-
1
votes1
answer302
viewsA: Call a function based on the struct passed in the reference?
Despite his 3 struct have exactly the same format, they are declared to be different so you will not be able to pass them to their function, the compiler will accuse as error. You can create a…
-
1
votes1
answer392
viewsA: I am creating a game, how to implement a pause menu?
To pause within the game a simple way would be to create any variable and check inside the loop of your game. Ex: @Override public void run() { while (isRunning) { if(isPaused) continue; // Aqui…
-
1
votes1
answer43
viewsA: Doubt - Project to the secondary screen and Form
There are many ways to do this. What I imagine is easier is to pass an object to your new Form than you need to use in your Form1 //form1 Form2 form2 = new Form2(seuResultado); if(form2.ShowDialog()…
-
0
votes4
answers3505
viewsA: How to generate random characters or string?
That should solve public static Random random = new Random(); public static string Sortear() { // posição 0, 2, 4 int a = random.Next(6); //posição 1, 3, 5 int b; do { b = random.Next(6); } while(b…
-
0
votes1
answer235
viewsA: Arduino serial communication
From the little experience I have with Arduin, this part is likely to give error, because the execution of the loop will probably be faster than the serial transmission. Then it will read the two…
-
2
votes1
answer106
viewsA: Unity C#Object Selection
If I understand correctly you want to make it go selecting one by one as a row, the one studied in the code that is very simple to understand. public void ProximaSelecao() { ObjetosSelecionado…
-
2
votes1
answer74
viewsA: How to split an integer number into a string?
You can use something like this: public static Tuple<int, string, bool> CustomSplit(string text) { int val = 0; string aux = ""; string res = null; for(int i = 0; i < text.Length; i++) {…
c#answered Christian Beregula 1,512 -
1
votes3
answers86
viewsA: find reference in another table
I guess that should do it select * from lotes where lotes.id_cadastro not in (select id_cadastro from cadastro)
mysqlanswered Christian Beregula 1,512 -
1
votes1
answer912
viewsA: How to record a student’s grades using the List array
From what I understand you need to use the method registrarNota right? He asks for a double and an object Discipline. public Nota registrarNota(double valor, Disciplina nomeDisciplina) { //primeiro…
-
3
votes4
answers196
viewsQ: Get the id of where max(value) was found
I tried it like this, but it’s not the right amount SELECT id, data, max(valor) FROM teste WHERE data BETWEEN '2017-03-01 00:00:00' AND '2017-04-01 00:00:00' The maximum value comes perfect, but it…
mysqlasked Christian Beregula 1,512 -
0
votes3
answers876
viewsA: How to repeat a minute-to-minute notification
You can also use the AlarmManager to manage the sending of notifications. First create a class that extends BroadcastReceiver import android.content.BroadcastReceiver; import…
-
1
votes2
answers1854
viewsA: How to receive data using Firebase
The problem was trying to use an instance of the old Firebase to try to receive notifications from the server. It is still functional on the Firebase server, but only applications that existed…
-
1
votes2
answers129
viewsA: How to create a text file with the client’s IP
If you know the IP address you logged on to use something like this: function getIp() { $ipaddress = ''; if (getenv('HTTP_CLIENT_IP')) $ipaddress = getenv('HTTP_CLIENT_IP'); else…
phpanswered Christian Beregula 1,512 -
4
votes1
answer1020
viewsA: How to fix the size of a button on android?
Only modify "wrap_content" to the desired size or remove layout_weight <Button android:text="Onde ir?" // altere para o tamanho que você quizer android:layout_width="300dp"…
-
0
votes0
answers152
viewsQ: Apk read external script and runs it
In C# it is possible to compile at runtime external code written in C# and run it inside the application, without having to use some Script language. But I’ve never used anything like this with…
-
0
votes2
answers858
viewsA: Keydown + Enter event. Clear keyboard buffer
Why not just put a control variable? Something like: int ok1 = 0; private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (ok1 > 0) return; ok1++;…
-
-1
votes2
answers71
viewsA: Use a Textfield to describe a path to save the files
public static bool CreateFolder(string folder) { if (Directory.Exists(folder)) return true; else { try { Directory.CreateDirectory(folder); return true; } catch (Exception e) { return false; } } }…
-
1
votes2
answers172
viewsA: Sum mm:ss of a jtable column
You got off to a good start, you just got stuck handling the data I guess.. Tentei criar um conversor para mm:ss com SimpleDateFormat e armazenar as informações em um vetor, onde apos isso tentaria…
-
3
votes2
answers696
viewsA: Calculate the smallest element of a list
The initial value of int menorValor = 0; is the problem, for this value to be changed it is necessary to enter a negative value. And here is not an array System.out.println (menorValor(i)); The…
-
1
votes3
answers219
viewsA: How to reuse event code?
I believe that the ideal would be to use inheritance itself, but if you don’t want to use inheritance, then you can create a class with a static method, something like: public static void…
-
4
votes2
answers1854
viewsQ: How to receive data using Firebase
I made a small test app using Firebase. Everything works great when I leave the rules for anyone to have access to the database ".read":"true", ".write":"true" But when I added permissions in the…
-
0
votes1
answer50
viewsA: Is it possible to install an apk without user intervention by putting prompt commands in the codeword or something?
Only possible on routine devices. public static boolean InstallAPK(String filename) { File file = new File(filename); if(file.exists()) { String path = file.getAbsolutePath().replace(" ", "\\ ");…
androidanswered Christian Beregula 1,512 -
2
votes1
answer187
viewsQ: Problem accessing List from a query
I’m starting today with Entity-Framework but I came across a problem that I believe is simple, but I couldn’t find the answer anywhere, perhaps because I’m not sure what to look for. The code is as…
-
1
votes0
answers45
viewsQ: Discover ips from other devices connected to an android
The problem is more or less the following, sometimes I need to use an Android device to generate a network, but I don’t know how to get the ips of connected clients. I saw some examples using ping,…
androidasked Christian Beregula 1,512 -
2
votes1
answer345
viewsA: Drawing of predefined values
place dates within an array and draw an integer to match the index of the array. string[] datas = new string[] { "data 1", "data 2", "data n" }; Random r = new Random(); txtUM.Text =…
-
1
votes0
answers31
viewsQ: Check if another Application is alive
I have an application that runs 24 hours a day generating some data, and it used to crash from time to time when it needed to send the data to a web server. Then came the idea of dismembering into…
androidasked Christian Beregula 1,512 -
0
votes2
answers1621
viewsA: Non-static method cannot be referenced from static context?
static double CasaRet(double l_sala, double c_quarto) { double area_s; //área da sala double area_q; //área do quarto double area_t = 0; //área do total if(l_sala < 0 || c_quarto < 0)…
-
3
votes1
answer1531
viewsA: How to use more than one extends?
Java does not support more than one "parent class", the closest you will get is to derive extends of a class and implement implements how many interfaces you need.
-
0
votes1
answer95
viewsA: Solve color problem in richtextbox in C#
If it’s something simple like just looking for a character and modifying the color from it, da para você fazer algo como: int inicio = richTextBox2.Text.IndexOf('|'); if(inicio >= 0) {…
-
6
votes4
answers114
viewsQ: How to make a query that returns the last record of each day?
The doubt is simple, but unfortunately I don’t think the resolution. I have a table with several records, and I need to perform a query that returns the last record of each day of the last 20 days…
mysqlasked Christian Beregula 1,512 -
0
votes0
answers155
viewsQ: Options of multimedia databases
I know there is blob type in the most common databases on the market to save files, but there is some other database developed specifically to work with multimedia files? ps: I have no purpose for a…
-
4
votes1
answer290
viewsA: Calling up graphical interface in java
Create another constructor in Cadasgui with parameter for your arraylist: CadastroGUI(ArrayList<Cadastro> co) { CadastroGUI(); //aqui você faz o preenchimento dos campos. int a=0; for (a=0; a…
-
0
votes3
answers155
viewsA: Why should I use the typeof keyword to assign a data source to a Bindingsource.Datasource?
You must assign an object to bs.DataSource. With the typeof(object) you make the "conversion" of the Class object for an object of the type Type. Use only the object would be interpreted by the…
-
0
votes2
answers1984
viewsA: C# - How to close the login form(initial program form) after calling another form?
I did something kind of like this on my show. //dentro da classe base do programa public static bool reconect = true; public static Usuario usuario = null; //metodo Main() while(reconect) { reconect…
-
4
votes2
answers3096
viewsA: How to put wipe button on android
First in xml add event to button <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Limpar" android:id="@+id/Limpar" android:layout_below="@+id/button"…
androidanswered Christian Beregula 1,512 -
4
votes3
answers177
viewsA: Create a table with dates
If I understood your problem then I would say it is simply the parameter dia that you are going through. You are not going through it by marking a Monday, so the "mistake" occurs of not starting on…