Posts by Francisco • 7,472 points
260 posts
-
4
votes2
answers1105
viewsA: Algorithm implementation in Visualg
I don’t really know how to program in VisualG no, but I believe that’s the logic: Variaveis: inteiro num1 inteiro num2 inteiro opcão Inicio Leia num1 Leia num2 Leia opcão Escolha opção Caso 1…
-
3
votes2
answers59
viewsQ: How to change the way a class/structure is printed?
I have the following structure: struct cores { int r, g, b; public cores(int r, int g, int b) { this.r = r; this.g = g; this.b = b; } } If I had a new structure printed, it would look like this:…
-
3
votes2
answers59
viewsA: How to change the way a class/structure is printed?
To do this you can give one override in the method ToString in its structure: struct cores { int r, g, b; public cores(int r, int g, int b) { this.r = r; this.g = g; this.b = b; } public override…
-
2
votes2
answers1339
viewsA: Check the internet connection
You can use the navigator.online, he returns a Boolean about his connection to the intenet: var online = navigator.onLine; Using the alert: alert(navigator.onLine == true ? "Conexão OK" : "Você não…
javascriptanswered Francisco 7,472 -
1
votes3
answers535
viewsA: Finding pg_dump and pg_restore (Postgresql) on my C#PC
You can use the Directory.GetFiles() combined to a SearchOption to do this, see how it would look: string[] arquivos = { }; string[] filtros = { "pg_dum.exe", "pg_restore.exe" }; foreach (string…
-
2
votes1
answer282
viewsQ: How to get a specific Json/XML object?
I need to get the contents inside <extract> to use in my application, but I’m not getting it. I tried to create a class with the same objects, I tried to use regex, but without success. I got…
-
0
votes3
answers898
viewsA: Validation and counting of days of a date
To count the days, you can use the .TotalDays, see: static int dias(DateTime data) //Pede uma data como parâmetro { DateTime data2 = new DateTime(data.Year, 1, 1); //Cria uma data nova, com base no…
-
12
votes3
answers172
viewsQ: What is the difference in the 3 types of variables and how do they behave in the compiler?
For test questions, I made the following code: static int valor1 = 10 / 5; static int valor2() => 10 / 5; static int valor3 => 10 / 5; public static void Main() {…
-
7
votes2
answers5648
viewsA: How to change the name of a column in a select in the database?
Although your question is not clear enough, I believe that’s what you want: SELECT nome AS 'Nome do Cliente', endereço AS 'Endereco do Cliente' FROM clientes The AS causes you to rename the column…
-
0
votes2
answers245
viewsA: String Manipulation in VB.Net
I believe you can use the .Split() to do this, see how it would look: Dim nomeArquivoArray() As String = NomeArquivo.Split("\") nomeArquivo = nomeArquivoArray(nomeArquivoArray.Count - 1) See working…
-
2
votes2
answers2423
viewsA: What is an offset?
What is an offset? Offset, as already answered, is where is allocated a process information relative to a position. In written form this is, but for the subject, I prefer to give examples and show…
-
1
votes1
answer74
viewsA: Select and display data from a position in the database table
You can use the LIMIT to do this kind of thing too, see how the query would look: $sql = 'SELECT id_agenda, hr_agendamento, nome_cliente, realizado FROM agenda WHERE nome_cliente="nome_cliente" AND…
-
1
votes1
answer80
viewsQ: Error trying to log in with mysql
I am trying to log a user to my system using a Mysql database, but it is returning me a Nullreference error. I tried to check if it was null before converting to string, but the error persists. Why…
-
1
votes2
answers84
views -
1
votes2
answers84
viewsQ: Error while trying to deserialize JSON from a web page
I’m using Luis.ai to create my neural network of intents and Microsoft Bot Framework to create my chatbot, but I’m not able to read a json that luis is generating for me. Luis' class: public static…
-
2
votes1
answer31
viewsA: How to run the same query for different "ids"
There must be some easier way, I don’t know, but you can do it with the implode(): Using the OR: $ids = implode(" OR ID=", $array); //Concatena os arrays com uma string no meio de cada $query =…
-
2
votes4
answers1643
viewsA: Variable in message box c#
Complementing a little the answer of Thiago Lunardi: Your code does not work because the variable is being created within a scope, in this case, the public Form1(), and is being called in another…
-
2
votes1
answer182
viewsQ: How to serialize a color with Json?
I have the following code, where I’m trying to serialize and deserialize a class that has two variables Color: static void Main(string[] args) { Color cor = Color.FromArgb(255, 255, 0, 0); Color…
-
2
votes2
answers1699
viewsA: Find out if it is even or odd in array
You can use the % 2 (MOD) to make this check, if return rest 1, is odd, otherwise is even. I also improved a little its current code: using System; using static System.Console; public class Test {…
-
0
votes1
answer559
viewsQ: Is it possible to connect to a Mysql database without Mysql.Data.dll?
Whenever I will use a Mysql database in a console or windows Forms application, you need to have the dll MySql.Data.dll inside the application folder. With that, I wonder, if you have any way to use…
-
3
votes1
answer171
views -
1
votes1
answer4296
viewsA: Concatenate String into C without using strcat() function
There’s no reason to use the do_while and then increment, if the was made for it, your code is a little confusing for me, I did it in a slightly simpler way: char* ptr(char *string_a, char…
-
1
votes1
answer35
viewsA: Doubt about vector
You can use a foreach to do this: int[] atividade = new int[6]; for (int i = 1; i < 6; i++) { Console.WriteLine("Insira o " + i + "° numero: "); atividade[i] = Int32.Parse(Console.ReadLine()); }…
-
0
votes2
answers398
viewsA: Log in with user or email in the same field
If I understand your question and your code correctly, just put one OR: $userq = mysql_query("SELECT username, password FROM users WHERE (username = '{HoloText($_POST['credentials_username'])}' OR…
-
1
votes2
answers61
viewsA: Restart low-priority service on the third core in C#
You can try using namespace System.Diagnostics to do the reboot: foreach(Process proc in Process.GetProcessesByName("nome do processo")) { proc.Kill(); } Process.Start(@"diretório do serviço"); And…
-
1
votes1
answer616
viewsQ: What is the difference between Getkeystate() and Getasynckeystate()?
I’ve always used the GetKeyState() to know if the user is pressing a key, but I see that many people use more the GetAsyncKeyState(). With that came to me the following doubts: What is the…
-
2
votes2
answers78
viewsA: Grouping Array Results out of Loop
To do this, the best way is with the implode(), it concatenates everything and puts a string in the middle of each array value, in case the ',', would look like this: $stringconcatenada =…
-
2
votes3
answers390
viewsA: Get specific application memory usage
I’m not sure, but I believe you should use "Processor Information" instead of "Process" in the first parameter: cpu = new PerformanceCounter("Processor Information", "% Processor Time", "Servidor -…
-
0
votes1
answer250
viewsA: How to test my Xamarin app in Visual Studio emulator?
Yes, that’s a bug, I was using the SDK’s Android Marshmallow 6.0 and decided to install a different (Android Nougat 7.1). To change, just follow the steps: In Visual Studio go to > Ferramentas…
-
1
votes2
answers44
viewsA: Persistent error in C# database
The problem is that you declared the variables dr_reg_notas and dr_alu as variables OleDbConnection and is trying to use them as variables OleDbDataReader. The right thing to do would be to create…
-
0
votes1
answer250
viewsQ: How to test my Xamarin app in Visual Studio emulator?
I made an android mobile application using Xamarin and tested it normally, made some modifications and when I went to compile again, the emulator of the visual studio remained with the old version,…
-
2
votes3
answers103
viewsA: How to treat the value field?
I recommend doing what Rovann Linhalis mentioned in his comment, but if you want to continue with the idea, you can do it as follows: //Vamos supor que você colocou o valor do option na variável…
-
1
votes2
answers3167
viewsA: Operations with C++ matrices
I made a code here, it’s much simpler, there’s not much to explain: int matriz[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; int somaP = 0, somaS = 0; for(int i = 0; i < 3; i++) { somaP +=…
-
4
votes2
answers2391
viewsA: In PHP, is there a difference between Double and Float?
There is a difference between Double and Float or Real? No, there’s no difference between double, float or real in php. Is there any special reason for it? Yes! Practicality and to simplify things…
-
2
votes1
answer464
viewsQ: Error returns when trying to start some threads in a list
I need to create a function for my program, which when the user is pressing the NUMPAD_8, he shut down all the thread, and if he squeezes again, he turns them back on. How I’m creating the thread…
-
0
votes2
answers111
views -
11
votes1
answer112
viewsQ: Does creating local variables all the time generate extra cost for the software?
I made a program of which he writes variables all the time, and with that generated me a doubt, instantiating a variable all the time generates more cost than just assigning the value to an existing…
-
1
votes1
answer71
viewsQ: I’m not able to add a reference to my program
I need to use this structure. The problem is that I’m unable to find it in the . NET Framework. I’ve already added a reference to System.Numerics and put the using, but I still can’t use it. I also…
-
4
votes1
answer108
viewsQ: How to detect the mouse wheel?
I need to detect if the user is scrolling down the mouse scroll. I tried with the GetKeyState, but it seems that there is no way to pass as parameter the scrolling of the mouse scroll. I also found…
-
1
votes1
answer1481
viewsQ: How to compile/buildar a DLL?
I made a program in C# in Visual Studio 2017, but by default, when I compile the code, it creates a file .exe, but I would like the code to compile a file .dll. How can I do that? Example: I created…
-
2
votes3
answers78
viewsA: Return Most recent date per Column?
No need to subquery, just do everything together: SELECT * FROM mercado WHERE nome_mercado LIKE 'extra' ORDER BY data_compra DESC LIMIT 2;
-
3
votes3
answers1895
viewsA: Progress bar with css
There’s probably a better way to do this, but one of the ways to do it, based on your code, is to put the degrade without transition between one color and another: .notification { padding: 15px;…
-
6
votes1
answer231
viewsQ: What are they for and when to use the Preprocessor directives?
Some time ago I had seen the use of #define in C#. Today I searched about it and found its documentation here, but did not answer all my doubts. Code example with Preprocessor directives: #define…
-
3
votes1
answer105
viewsQ: How does the use of other numerical bases in C#work?
When I was learning the basics of variables in C#, I learned that the whole numerical statements (Int32) used the numerical base 10, which is what we use most commonly in our day to day life. A…
-
3
votes3
answers968
viewsA: How to use SHA1 in login with PHP picking up parameters?
You don’t have to decrypt anything, just encrypt more! That one sha1(senha) that you put in your select will not work, because it is inside a string, so that php will not recognize that you are…
-
0
votes2
answers969
viewsQ: How to position one element in relation to another easily?
I’m creating kind of an online store, but I’m not getting to stylize my HTML right, I’d like to <div>s empty (I put div in the example just to illustrate, but in fact are images), stay with…
-
2
votes3
answers330
viewsA: Listbox selection
You can use the listBox.SetSelected() to select the item back: public void MoveItem(int direction) { if (listBox.SelectedItem == null || listBox.SelectedIndex < 0) return; int newIndex =…
-
1
votes1
answer42
viewsA: Check URL to include metatags
Use the variable $_SERVER['REQUEST_URI'], it takes the given URI to access the current page: if ($_SERVER['REQUEST_URI'] == "/agenda"){ echo"<meta name='description' content='Agenda…
-
1
votes1
answer1246
viewsA: Display login user name
That’s why you didn’t start the session, do it with the session_start(): session_start(); $usuario = $_SESSION['usuarioSession']; $senha = $_SESSION['senhaSession']; I also recommend that you make a…
-
0
votes3
answers186
views