|
Instead using `XmlDocument` use AngelSharp library to parse the HTML and extract first paragraph.
AngleSharp - Home[^]
|
|
|
|
|
I have a Yaxis_bufferList, which gets updated with new data. My Xaxis_bufferList is fixed and always contains same values.
I need to plot these values on a graph. whenever i plot the new graph, the previous graph is lost. how do i retain the data? How do i plot all the graphs.
|
|
|
|
|
How are you plotting them now?
There are many ways to plot graphs, and some depend on the environment you are working in - so explain where you are and show us the relevant code fragments.
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I have this Show graph function which i used to plot the data
ShowGraph(int flag, int number, List<double> XAxisWavelengthSValues, List<double> YAxisValues, Form1 fi)
{
fi.chart.Series.Add("T Chart");
fi.chart.Series[number].ChartType = SeriesChartType.Line;
fi.chart.Series[number].YAxisType = AxisType.Primary;
fi.chart.Series[number].BorderDashStyle = ChartDashStyle.Solid;
fi.chart.Series[number].Color = Color.DarkRed;
fi.chart.Series[number].BorderWidth = 1;
fi.chart.ChartAreas[0].AxisY.Title = "Transmittance[%]";
fi.chart.Series[number].Points.DataBindXY(XAxisWavelengthSValues, "Wavelength(nm)", YAxisValues, "T[%]");
}
It plots the Line graph for X and Y data. I would like to retain the previous graph and plot the new graph on top of the previous graph.
How do i do it.
Each time i call this show graph function, my Y axis values change, X axis remain same.
|
|
|
|
|
You add a new "series line" for the new numbers (if that's what you mean by "retain the old graph" / series).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I have a long string like
<abcd><xyz>testingmessage like this</xyz></abcd><abcd>
<xyz>testingmessage like this</xyz></abcd><abcd>
<xyz>testingmessage like this</xyz></abcd><abcd>
<xyz>testingmessage like this</xyz></abcd>
I want to create a separate xml file based on <abcd><xyz> and </xyz></abcd> these xml tags eg : <abcd><xyz>testingmessage like this</xyz></abcd> consider as one xml file . I know it's a substring search in a string in C# but is there any fastest way to do this or any other way to achieve this . Any clue regarding this will be helpful . Please help . I have to do this in C# or can I do this using javascript .
EDIT I want to create separate xml file based on <abcd><xyz> and </xyz></abcd> these xml tags in a string .
modified 21-Jul-18 2:12am.
|
|
|
|
|
sudipta saha wrote: I want to create a separate xml file based on <abcd><xyz> and </xyz></abcd> these xml tags eg : <abcd><xyz>testingmessage like this</xyz></abcd> consider as one xml file . Yuck.
sudipta saha wrote: I know it's a substring search in a string in C# but is there any fastest way to do this or any other way to achieve this . There is no competition in which we determine which algo is "the fastest". Search for Boyer Moore, there's examples on Google.
"Inserting" will always be slow, as the entire file has to be written for every change that is not simply appended. If your dataset changes often, you should use a (portable) database, not XML. That would also simplify querying your data.
sudipta saha wrote: I have to do this in C# or can I do this using javascript . Any language that supports string-manipulation.
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.
|
|
|
|
|
Wrap your string in a "root element" (which you are missing); and then start parsing using XElement:
LINQ To XML Tutorials with Examples | DotNetCurry
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Hi
I am new to C#. I am an SQL DB programmer.
We have a DB application written in C#, there is no front-end. Its just backend application.
Am trying to understand the program flow of this application through debugging by setting breakpoints at various points in the code. I want to trace where is the starting point of the application, where is its endpoint. And, how is the program control flowing from start to end. I want to know how many n-tiered application it is etc.
This particular application is NOT multithreaded one.
What best can be the approach in knowing these requirements?
How can I find out if this application is MVC compliant?
What are the specific points in the entirety of a typical C# Solution,where breakpoints are best placed to know the program flow?
thank you
|
|
|
|
|
All C# apps start in a method called Main, which must be declared as one of the following:
public static void Main()
public static void Main(string[] args)
public static int Main()
public static int Main(string[] args) There can only be one Main method in an application.
Execution starts at the beginning of the Main method, and ends when the method returns.
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
And in 7.x we now can have:
public static async Task Main(string[] args)
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Don't forget the other new options:
Task Main();
Task<int> Main();
Task<int> Main(string[] args);
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am trying to update locations of controls in a vertically scrollable panel. When the panel is not scrolled it works just fine, but when it is scrolled it doesn't work at all.
I have a procedure that returns a Y value for the item. I then modify that number like so:
y = y - (PanelList[panelNumber].VerticalScroll.Value);
But this does not seem to place it correctly. This is true if I add this value as well. It is also true if I use: y = y - (PanelList[panelNumber].AutoScroll.Y);
Any help appreciated.
|
|
|
|
|
1. WinForms ? WPF ? or ... ?
2. PanelList[panelNumber] : a list of Panels each of which is ?
3. the normal use of a scrolling Panel is so you avoid moving its contained Controls manually: what are you trying to achieve ?
«... thank the gods that they have made you superior to those events which they have not placed within your own control, rendered you accountable for that only which is within you own control For what, then, have they made you responsible? For that which is alone in your own power—a right use of things as they appear.» Discourses of Epictetus Book I:12
|
|
|
|
|
This is a list of panels each of which I add lines of controls to. I need to add new lines dynamically as each represents information that the user can add or delete.
Is there a way to determine where to place controls based on how the panel is scrolled?
FC
|
|
|
|
|
Until you answer the first question (WPF or Windows Forms or WHAT?), you are not going to get much help.
And you need to be more clear about you want to accomplish; from a user point of view.
There is more than one way to accomplish something; some better than others. If you are having a lot of issues, it's probably the "wrong" solution.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Sorry, I didn't see that question. It is Winforms. I must have read it when I was tired---I thought you were asking what I was trying to do.
Best,
FC
|
|
|
|
|
Member 12074849 wrote: a list of panels each of which I add lines of controls to. I need to add new lines dynamically I'm still not clear on what the problem is here: I assume you know at any time which panel in the list of panels you want to add controls to ... I assume you know how to add controls at run-time.
Where the controls you add at run-time show up in the panel you have added them to is up to you:
1. you can position them by setting the 'Location property
2. you can position them by setting the 'Dock property, ... after you add them ... using 'BringToFront or 'SendToBack to position them first or last in their host panel's z-order.
So, try to clarify what you are doing a bit more.
«... thank the gods that they have made you superior to those events which they have not placed within your own control, rendered you accountable for that only which is within you own control For what, then, have they made you responsible? For that which is alone in your own power—a right use of things as they appear.» Discourses of Epictetus Book I:12
|
|
|
|
|
Hi,
your description isn't really clear. If what you need is viewing a tall (possibly growing) panel through a limited and fixed "opening" in a WinForm, then my article WinForms AutoScroll Experiment[^] may well apply. If so, you don't need to worry about the scrolling while populating the tall panel at all, it is all automatic, just think about the tall Panel and put the Controls on it where you want them.
On the other hand I probably would not be using a tall and growing panel at all, I much prefer using a ListBox where each item could be a Panel holding some Controls. And then you add a Panel to the ListBox.Items whenever you need to. The big problem now is to get the ListBox paint its content...
You might be interested in FlowLayoutPanel class[^].
Hope this helps.
modified 24-Jul-18 14:14pm.
|
|
|
|
|
Hello Everybody,
I am writing a sender and receiver application, sender in C#,WPF and receiver in C# WinForms. In sender, will be having a list of task to do, which will be sent to multiple receivers running in multiple systems.
Here is the code in Sender
for (int j = 0; j < tmpfilled.Count; j++)
{
Thread thFromReceiver = new Thread(new ThreadStart(thFromReceiverFunction));
thFromReceiver.Start();
}
//Body of the thFromReceiverFunction()
public void thFromReceiverFunction()
{
try
{
TcpClient client = new TcpClient();
IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse(ip_address), portNo);
client.Connect(serverEndPoint);
Thread readThreadRec = new Thread(new ParameterizedThreadStart(readFromReceiver));
Thread writeThreadRec = new Thread(new ParameterizedThreadStart(writeToReceiver));
readThreadRec.Start(client);
writeThreadRec.Start(client);
}
catch(Exception ex)
{
}
In Receiver,
TcpListener tcpListener = new TcpListener(IPAddress.Any, portNo);
tcpListener.Start();
while (true)
{
TcpClient client = tcpListener.AcceptTcpClient();
Thread readThread = new Thread(new ParameterizedThreadStart(read_thread));
readThread.IsBackground = true;
Thread writeThread = new Thread(new ParameterizedThreadStart(write_thread));
writeThread.IsBackground = true;
readThread.Start(client);
writeThread.Start(client);
readThread.Join();
writeThread.Join();
client.Close();
}
My problem is, if I am sending to single receiver, everything is working fine. If multiple receivers are running in multiple systems, then, ipaddress which I am sending the request, shows right, but whichever the client receives the first request, all other requests are going to the same client, even though I am sending to different ipaddress (through thFromReceiverFunction() funtion).
I think I explained the issue properly, if not please let me know.
Thanks in advance.
Regards,
Gopinath.
|
|
|
|
|
You have shown all the code related to receivers, but it is the sender that is causing the problem. Please edit your question and show the problem code.
|
|
|
|
|
Hello Richard,
Thanks for your reply.
First two session in earlier post is the code from sender. Here are the code for the functions mentioned in the thread.
public void readFromReceiver(object clients)
{
ASCIIEncoding encoder = new ASCIIEncoding();
TcpClient client = (TcpClient)clients;
NetworkStream clientStream = (client).GetStream();
byte[] msg_type = new byte[1];
bool flag = false;
while(!flag)
{
try
{
int bytesRead = 0;
bytesRead = clientStream.Read(msg_type, 0, 1);
int msg = (int)(msg_type[0]);
string retVal = "";
if (msg == 3)
{
retVal = receiveString(clientStream);
}
}
catch(Exception ex)
{
}
}
}
public void writeToReceiver(object clients)
{
ASCIIEncoding encoder = new ASCIIEncoding();
TcpClient client = (TcpClient)clients;
NetworkStream clientStream = (client).GetStream();
bool flag = false;
while(!flag)
{
while (nQReceiveProjName.Count > 0)
{
try
{
string cmdToPass = fnGetXMLString(nQReceiveProjName[0]);
nQReceiveProjName.RemoveAt(0);
sendCommand(clientStream, 5);
sendString(clientStream, cmdToPass);
}
catch(Exception ex)
{
}
}
}
}
In both the cases, client remote end point is holding the ip address of the client in which the first request is received.
Regards,
Gopinath.
|
|
|
|
|
I don't see anything anywhere where you are storing or using an IP address. Once a socket connection is established between server and client, that socket remains open until closed by either end. Each message using the correct socket endpoint will be sent to the correct client. Google for "client server C#" to see other examples.
|
|
|
|
|
Here is where I am using the ip address to send the request.
IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse(ip_address), portNo);
client.Connect(serverEndPoint);
Let me check in google also as you mentioned.
Thanks again.
Regards,
Gopinath.
|
|
|
|
|
You only do that once, when the client first connects. From then on you must use just the socket that is returned on the connection.
|
|
|
|