Posts by Ícaro Dantas • 1,088 points
53 posts
-
-1
votes1
answer128
viewsQ: Why do I have to run this code twice to rotate the 3d object?
My code’s a bit tricky, but I only got it the way it’s down. Plus I have to run twice to be able to turn the object and I don’t know why. I’d like to understand what’s happening here. var device3d =…
-
1
votes2
answers169
viewsA: Write program in another’s textbox
I managed to solve with the idea of Felipe M. Martins, but I will post here the way I left to be very clean: Process processo = Process.Start("SICON.EXE"); IntPtr h = processo.MainWindowHandle;…
c#answered Ícaro Dantas 1,088 -
2
votes4
answers843
viewsA: How to limit the generation of pseudo-random numbers to non-zero and non-repeating numbers?
See if this solves your problem: from random import randint lista = [] n = 40 for i in range(n): num = randint(1, 60) # Intervalo de 1 a 60. while num == 0 or num in lista: num = randint(1, 60)…
-
2
votes2
answers169
viewsQ: Write program in another’s textbox
Hello! I used the program "Exe Lock" to block some files of mine, everything works perfectly, the problem is that I was trying to open the locked file with a program in C# and the program itself…
c#asked Ícaro Dantas 1,088 -
1
votes1
answer241
viewsQ: Accent problem when running python script straight from C#
I’m using this to run the code: processo.StartInfo = new System.Diagnostics.ProcessStartInfo { FileName = @"\Python27\python.exe", Arguments = arquivoResposta, UseShellExecute = false,…
-
1
votes2
answers233
viewsQ: How to know how many "black" pixels you have in a letter x, using an x font?
The question already says it all, in the way I was doing, I wrote several characters, printed and put the program to tell from one to one :/
c#asked Ícaro Dantas 1,088 -
1
votes1
answer104
viewsQ: How to block a file temporarily?
I’m trying like this: OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.ShowDialog(); string filePath = openFileDialog.FileName; Process processo = Process.Start(filePath);…
c#asked Ícaro Dantas 1,088 -
0
votes3
answers1521
viewsA: How to Put Music on Console Aplication with C#
First include the using System.Media; at the beginning of the code, after that, to differentiate from the other responses, you can include a Resource of a Sound (go to Project > Properties...…
-
9
votes1
answer273
viewsQ: How do I know that the sum of two double’s will be greater than the limit of one double?
Is there any way to know if a sum between two values in the format double will exceed the variable limit double? Example with integer: 2147483648 + 1. In this case it exceeds the limit of an…
-
4
votes1
answer1419
viewsA: Access a specific row and column from a C#list
I made a very good example here with Datatable: // Creating the table. DataTable table = new DataTable("Alimentos"); // Adicionando as colunas e seus respectivos tipos de dados.…
-
-1
votes3
answers468
viewsA: Search for word in the first array column
First this is wrong: string array[,] = new string[1,6]{{"texto","","","","",""}}; Should be: string[,] array = new string[1, 6] { { "texto", "", "", "", "", "" } }; Here the function you seek:…
-
2
votes1
answer75
viewsQ: Reduce code that refers to the same object?
Here the code, would you have any way to reduce it? (Just for learning reasons) worksheet.Row(1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White; worksheet.Row(1).Style.Font.Bold = true;…
-
3
votes1
answer307
viewsA: How to concatenate data from a Datagridview and Save to a single database field
I don’t quite understand it, but I think you’re trying to do it this way: Replace that: strQuery += ("'1'"); therefore: strQuery += (_código.ToString());…
-
-3
votes1
answer64
viewsQ: How to leave new form without depending on each other?
Here is the code that opens my Form4: Form4 form4 = new Form4(); form4.Show(); // Aqui um código gigantesco que demora aproximadamente 1 minuto para ser executado. form4.Close(); The problem is that…
-
2
votes1
answer96
viewsQ: How to read one struct inside another with Json.Net?
I need the program to read this information: {"kiseryota":{"id":15031780,"name":"Kise Ryota","profileIconId":1374,"summonerLevel":30,"revisionDate":1475089675000}} Here’s what I’m doing: Structure:…
-
1
votes1
answer121
viewsQ: Convert UTF-8 string to C#standard format
I’m downloading a string via WebClient() and I get a string with the badly formed accents. Example:…
-
-1
votes1
answer141
viewsA: Detect collision from a rotated rectangle?
I found the solution: First you measure the angle of rotation of the rectangle from the top left, then just rotate the point in a direction contrary to the direction of the rectangle also from its…
-
1
votes1
answer141
viewsQ: Detect collision from a rotated rectangle?
I’m using the following code to know if a point is inside a rectangle: public bool Intersect(ÍcaroDantasCollisions.Rectangle rectangle) { if(x >= rectangle.x && x <= rectangle.x +…
-
3
votes1
answer46
viewsA: New position X and Y depending on direction and distance?
I found the answer: newX = X + (raio) * cos(ang); newY = Y + (raio) * sin(ang); Source: Click here…
-
1
votes1
answer46
viewsQ: New position X and Y depending on direction and distance?
I’m doing a mini shooting game on XNA but I’m not able to imagine how to calculate the following: Knowing the position of the center of the image, the direction in which it is pointing and the…
-
0
votes1
answer166
viewsQ: Error ordering Gridview with empty row column
There is an error here that I am not knowing how to get around, as my program reads a site, sometimes the site can escape from the pattern and end up leaving some empty things, so when my Gridview…
-
0
votes1
answer114
viewsA: Transferring image via socket, image turns black
Solved! The server buffer was limited to 1024 bytes, so when the message was sent, it barely fit the first rows of its array within 1024 bytes :)
-
-2
votes4
answers5604
viewsA: Call function at each time interval efficiently
I’ve used Timers, for me it worked, here an example of code: Timer timer = new Timer(); timer.Interval = 1000; //1000 milésimos = 1 segundo timer.Enabled = true; timer.Elapsed += new…
-
0
votes1
answer114
viewsQ: Transferring image via socket, image turns black
My server sends a command to the client and the client sends a Printscreen to the server using this code: Image printScreen = new Bitmap(monitorWidth, monitorHeight); Graphics graphics =…
-
0
votes1
answer106
viewsQ: Send multiple variables at once socket
Using the method Socket.Send would have some way to send a package with for example an integer and a string at once? I saw such a Packet which apparently was all I needed, because I can turn it into…
-
0
votes0
answers243
viewsQ: Client can connect to server but crasha when will receive data
Here’s the part of the code that misses: private void buttonAbrirConexão_Click(object sender, EventArgs e) { try { socketOfServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream,…
-
-1
votes2
answers112
viewsA: What’s wrong with my Quicksort code in C?
You are doing things in the wrong order, the right one would be: mix >> sort >> print; Or you could do so: mix >> printar >> sort >> printar;
-
2
votes1
answer293
viewsQ: What if I want to send and receive a "package"?
I put a mini server test online and everything worked out, the problem is that I want to send integers, booleans, strings, etc... So far I only know how to send string, how to take the first steps?…
-
3
votes1
answer115
viewsQ: How do I know the client sent me something?
I made this code here following some tutorials over the internet. buttonAbrirConexão.Enabled = false; TcpListener servidor = new TcpListener(6554); servidor.Start(); while(true) {…
-
0
votes1
answer59
viewsQ: Select only one item amidst two listboxes
Oops! Guys, I wanted to select only one item in the middle of two listboxes, imagining the listbox as a radiobutton, if I select an item in one, it is no longer selected in the other. I tried so:…
-
4
votes2
answers182
viewsQ: Exit multiple loops without using goto
Oops! The title says it all! Someone knows an interesting way to get out of more than one loop without using goto?
-
1
votes1
answer133
viewsQ: Is there any way to access a position by string?
There would be no way to access a position using a string? Example: int vetor[1000000]; vetor["abc"]++; I know it’s crazy of me, but... "abc" = 01100001, 01100010, 01100011, 00000000 (null…
-
0
votes1
answer96
viewsA: Object reference undefined, what could it be?
I decided! Before the three lines mentioned I put the following: botoes[i, j] = new Button();
-
-2
votes1
answer96
viewsQ: Object reference undefined, what could it be?
"Undefined object reference for an object instance." Button[,] botoes = new Button[(int)numericUpDownLinhas.Value, (int)numericUpDownColunas.Value]; for(int i = 0; i <…
-
0
votes1
answer226
viewsQ: Draw outside a form area
Using C# with Windows Forms Application project type is it possible to draw things out of the form? I would like to draw a square that can be stretched by the mouse and repositioned, where I should…
-
0
votes1
answer75
viewsQ: Enable variable spacing Code::Blocks
I love Code::Blocks, only that there is a problem, I wanted it to already space the instructions as soon as I put ';' the same as Visual Studio. Ex: for(int i=0;i<n;i++)`` >> ``for(int i =…
-
0
votes1
answer17
viewsA: Catch lower_bound from a Multiset in Indice 0 mode
Solved, I used a distance(mult.begin(), first) and pro last too :D
c++answered Ícaro Dantas 1,088 -
0
votes1
answer17
viewsQ: Catch lower_bound from a Multiset in Indice 0 mode
Here comes the code: first = mult.lower_bound(c); last = mult.upper_bound(c); if (first == mult.end()) { printf("%d not found\n", c); } else { printf("%d found from %d to %d\n", c, first, last); }…
c++asked Ícaro Dantas 1,088 -
1
votes1
answer60
viewsQ: Giving Ctrl + f in webbrowser by code
They know some way to give Ctrl + f something by the code in an instance of Webbrowser?
-
1
votes0
answers53
viewsQ: How to make Visual Studio not let use functions without including headers
In C++, the printf() and scanf() command needs the cstdio library to work, but in Visual Studio I can run without including them. As I send my programs to a site that doesn’t allow this, I wanted…
-
0
votes3
answers134
viewsA: Understand "," as "." when formatting
I got it this way: First I declared use of these two: using.System.Globalization; using System.Threading; Then before I started printing on the console, I declared it:…
-
3
votes3
answers134
viewsQ: Understand "," as "." when formatting
My Visual Studio is getting a little wrong what I type (console): using System; namespace Uri_CSharp { class URI { static void Main(string[] args) { double raio = double.Parse(Console.ReadLine()),…
-
0
votes1
answer37
viewsQ: Clean Form1 and add new things like the game maker’s Rooms system
Oops! Guys, how do I clean a form and put new elements inside? For example: Something like an installation screen when we click Next. Edit1: For example, this screen: Flip this screen by clicking on…
-
2
votes2
answers544
viewsQ: Return id or know name of the dynamic object that was clicked
Hello! I am learning now to create dynamic objects in C#, my question is how to return the Text from the button I clicked for example. Let’s say I created 10 numbered dynamic objects (in this case…
c#asked Ícaro Dantas 1,088 -
0
votes1
answer33
viewsQ: string.find(), what if I want to create something similar?
Guys, I’d like to know how these "things" work in which I don’t know the name, in the case string.find(), string.copy(), string.Rase(); All I know how to do is stringpick(string). Remembering that I…
-
3
votes3
answers199
viewsQ: A mathematical method for knowing how many carrys in a sum
I saw today on URI (website programming problems) a question in which your program should read two values and say how many carrys (or "will one"s) happen in the sum of them. Ex: 555 + 555 = 3 carrys…
-
20
votes2
answers540
viewsQ: + 3 overloads - What would that be?
In some functions appears such a quantity of overloads, That means the higher that number, the slower it is? Note: I used tag C++ and C# why I saw these overloads in these languages. Microsoft…
-
0
votes2
answers9722
viewsA: Square root C#
I don’t understand why that Convert.ToSingle. Faster alternative(not tested): private void btn_raiz_Click(object sender, RoutedEventArgs e) { resutado = (float)Math.Sqrt(primeiro); //A variável…
c#answered Ícaro Dantas 1,088 -
2
votes2
answers286
viewsQ: Convert an Ipaddress to string
This code retrieves the gateway standard, but I can’t convert the result to string and put on a label. public static IPAddress GetDefaultGateway() { var card =…
-
0
votes3
answers2573
viewsA: Is it possible to avoid using ifs in these cases?
What this "overwhelming majority" meant is that it’s better to do so: It’s better to do it like this: player_x += Sign(player_direcao); //Caso a direção seja 10 retorna 1, caso seja -20 retorna -1 e…