|
Yeah, that doesn't replicate what happens with an actual DNS entry.
It's not the SignalR client that handles the resolution and caching of the IP address from the host name. It's the TCP/IP stack that does it.
|
|
|
|
|
i cant seem to get my array to work,i am creating the gae hammurabi, and each button click creates a number for an amount of people starved, what im trying to do is save the data each year into its own index so that at the end of 10 years i could display each years starved aswell as the average ie.
year 1 = 0 starved
years 2 =3 people starved
etc
this is the code for the array i have so far which doesnt work
int[] starved = new int[10];
int average, sum = 0;
for (int i = 0; i<10; i++)
{
sum = sum + starved[i];
}
if (year == 11)
{
average = sum / 10;
label11.Text = average + " people died on average each year";
}
this is the whole code for the game
// variables int year = 1; int arrivals = 0; int popu - Pastebin.com[^]
any help would be appreciated
|
|
|
|
|
You are initialising your array but, in your code snippet there, you don't actually save any data into your array. In year 2, for instance, you don't have a corresponding
starved[1] = 3;
This space for rent
|
|
|
|
|
so i need to add
starved[0] =
starved[1] =
etc? if so what do i add after = each one? the value i need snt calculated until after the user as entered the info and clicked the button
thanks for the reply
|
|
|
|
|
So read the values from the user in a loop (Prompt him for each year's data), convert it to an integer:
string numberAsString = "12345";
int numberAsInteger;
if (!int.TryParse(numberAsString, out numberAsInteger))
{
Console.WriteLine("{0} is not a number!", numberAsString);
}
else
{
starved[i++] = numberAsInteger;
}
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
the original game doesnt ask you to input years or anything like that so i should need to either
also i need to use the values from each year to enter into a chart
|
|
|
|
|
So where does that information come from then?
.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with. Anything you don't tell us, we don't know ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Member 14139197 wrote: the original game doesnt ask you to input years or anything like that so i should need to either From what I remember, the game uses random numbers for these values. That's the solution for you - use a random number.
This space for rent
|
|
|
|
|
hi, i need to display the y values of user given x axis values, i don't know how to write a code for this
|
|
|
|
|
Nor do we, since we have no idea of the relationship of y to x. Nor do we have any idea where you want to display these values. Please edit your question and add some proper details of your problem.
|
|
|
|
|
If you're still using the chart, then you are already providing an y for every x.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
You could try this little snippet in a button click event handler to see if it works.
You must use a valid "X" value and it must be a double data type.If "X" is not valid it will give an exception.
DataPoint myDatapoint;
Double myXvalue ;
myDatapoint=chart1.Series[0].Points.FindByValue(myXvalue, "X");
MessageBox.Show(myDatapoint.YValues[0].ToString());
modified 4-Feb-19 12:40pm.
|
|
|
|
|
Y values usually go along the "Y Axis".
You could start looking under: Chart - Y Axis.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
i use the one timer in program i set 100ms intravel for that timer.every 100ms i need to increment the values and plot in chart.now my problem is the timer is got slowed when iam using the chart in my application without chart the working of timer is fine.
this is my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace chart
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
double a,b = 0;
private void Form1_Load(object sender, EventArgs e)
{
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
a = a + 1;
b = b + 3;
timervaluee.Text=a.ToString();
chart1.Series[0].Points.AddXY(a, b);
}
}
}
|
|
|
|
|
Mohamed Fahad wrote: chart1.Series[0].Points.AddXY(a, b);
It adds a Point to a collection every 100 ms, until the list is so large it slows down the entire application. If it could keep up with allocating new memory, you would eventually run out of it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
i don't know how to do that there is any example for that
|
|
|
|
|
It is a logical problem; as long as the series keeps growing, the more time it requires to organize it internally and to draw it.
Have you considered removing the first point whenever adding a new one?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
May make the situation worse: List<T> - Is it really as efficient as you probably think?[^] - removing the head item requires moving all the others every time.
If the chart draw time starts to exceed the timer Tick interval you're going to have problems regardless.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: If the chart draw time starts to exceed the timer Tick interval you're going to have problems regardless. Could easily be handled by looking if painting happened, and if still busy, skip updating.
Still, if it needs to move, I'd prefer drawing it myself instead of using a chart
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I'd agree - Chart is a bit of a sledgehammer, when you need a crosshead screwdriver.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
How much did it "got slowed"?
Thread switching incurs overhead.
A timer will never go off on time unless it could predict the future.
Have you measured the length of the intervals in relation to when the timer fires?
What is the relationship between the number of ticks it takes the timer handler to execute versus the duration of the subsequent interval?
Or is there none?
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Can I use Clang in C# project to find all function calls and their argument from input text that was written in C++. how can I do that. The steps please
|
|
|
|
|
Start with a Clang tutorial, and work your way from there: clang tutorial - Google Search[^]
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I cannot decipher what that question is intended to answer.
Far as I can tell Clang has nothing to do with C#.
You can certainly use Clang just as you can any other compiler in a Visual Studio (not C#) solution/project to do custom stuff, for example creating a dll from C++ code.
But in that case the specifics of that are in the csproj file. I suppose that the project file could be mapping the C++ code files so you could look in that project and see those files. But Clang also does C and I am not sure Visual Studio is going to take to that. Might though.
Other than that I couldn't tell you how to find (list) all methods in a C# code base. I suspect there is probably a VS addin for that that. If so there might be a C++ one also and if your code base is in the project and is C++ then that would do it. If it exists.
But not sure what the point of that is. Conversely if what you want is the exposed API of the dll that is constructed by the build then there are tools that do that. Those don't care how you built it originally. So that would give you a starting point to find those in the code.
|
|
|
|
|
in fact i need just a library or tool that find function calls and their parameter. the code will be as text input. and the project will be in c# or java. so I did not know yet how to do that I need just to understand if there is anything already done like that before
|
|
|
|