|
What is it that you need help with?
If you ask the question in the forum, expect the answers in the forum, not in your email.
---
b { font-weight: normal; }
|
|
|
|
|
i am so soory , i didnot mean that but i need your help with my problem i want to ask you if you hear about cellular automata CA and program it with GA programing ????
if you have any idea please help me :::::::
iwill expect the answers in the fourm >>
|
|
|
|
|
Hi
I have a database containing several Tables. In a winfoarm, when I want to fill the dataset using data adapter, one of them generates this error (on the Fill statement)...
The strange part is taht when I delete the oleDataAdapter control from the form and create a new one, and then generate dataset from that, this error won't raise...
But the next time I open the solution, again the error continues to raise, unless I recreate the adapter!!!
Could any one tell me what is wrong (while I have recreated the data Table in the database and that didn't help...)
My data Table has two unicode right-to-left Text filds and two Memo fields...
Thanks
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
hello all and thank you for your help so far
i would like to start a new project as apractice. it will be a messenger
all what i need to know is how to get started and what are the tools that i have to use
thank you for your concern
abdelhameed81
|
|
|
|
|
Open Visual Studio and click on the New proejct button.
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hi,
i'm writing here because i'm an strange problem.
Taken two points, i' ve to find the step of x of line that goes on two points; to do that i had wrote this function:
// P1(x1,y1) e P2(x2,y2)
double m, dy, dx, ypp, xpp, q;
/*********** F(x) *************/
dy = (double)y2 - (double)y1;
dx = (double)x2 - (double)x1;
m = dy / dx;
q = (double)(x2 * y1 - x1 * y2) / (double)(x2 - x1);
/*********************************************************/
// Point next P1
ypp = (double)(y1 + 1);
xpp = (ypp - q) / m;
return xpp - x1;
Now i have step of x and to go to P2 i do that:
Xstart = x1; Ystart = y1;
for (; Xstart < x2;)
{
Xstart += Passox; Ystart += 1;
---
Xstart is double but i need its integer value, so i use a cast in a temporary var.:
Xtmp = (int)Xstart;
but any Xtmp are incorrect.
Now i know that m-value is incorrect, because when i find m by scientific-calculator i had another value: by this value my function work correctly!
Can an scientific calculator do division better tahn C# on Burton processor??
Sorry for my english and thanx for your time,
Luca
|
|
|
|
|
From where do you get the Passox value?
Double calculations are usually correct to 14 decimals. How much incorrect is it?
When you return the value (xpp - x1), is it supposed to be an integer? (Cause it is.)
---
b { font-weight: normal; }
|
|
|
|
|
Passox is the value returned: xpp - x1 (Passox translated from italian is step of x).
The function, i use Passox in, receives Passox as double; in this fuction i cast Passox from double to int, but in a temp variable: so i don't change the double var Passox (i do:
Xtmp = (int)Passox ) and so it's no problem of course!
The error for example is this:
start to P1(262, 2), end to P2(772, 309);
my final value is Pend(772, 308.99999999999886) -> after int-cast become Pend(772, 308) but it must be Pend(772, 309)!
I calculated step of y (i had to work with it too) by my scientific calculator (step of x and step of y have the same equation but for step of y i have that example so i report it!); the value is:
m = 1.661237785<-- it's work ok! Pend(772, 309.00000001300782)-> after int-cast become
Pend(772, 309)
value by C# is:
m = 1.6612377850162867<-- more precision but don't work as you can see up! This m by C# > m by
scientific calculator but the y of Pend by C# is less...
I write about only last point of my line but i need precision in all points of line... it's possible? I thinked to do:
PrecisionLost = 309 (y i want) - 308.99999999999886 (y i have);
Passoy = Passoy + PrecisionLost; (or, as the same, Passox = Passox + PrecisionLost)
but if someone knows another solution, i prefer very much! i'm sorry for me but i need maximum precision..
Thanks a lot,
luca
|
|
|
|
|
Your problem is not the precision of the calculations, but the casting of the values.
As you see, the error of the final result is 0.00000001300782 when using the hand calculated value, but only 0.00000000000114 with the value calculated with C#, so the result is at least 10000 times better with the later one.
When you just cast the value to int, you will be rounding it down instead of rounding to the nearest value. Use Math.Round() before casting the value to an int, and you will get the correct value.
---
b { font-weight: normal; }
|
|
|
|
|
It's true, it's not precision error thank you! Mathematics doesn't like me!
I tryed to use Math.Round but C# get me this error:
Error 2 Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are
you missing a cast?).
If i have to do a cast before using Round(), it's not a solution!
And if i'll can use it, i need to know how much the cost of code increase. Where i can read about?
thanks again,
Luca
|
|
|
|
|
luca_la wrote: If i have to do a cast before using Round(), it's not a solution!
No, you don't have to do that. The Round method takes a double value. It's after you have done the rounding that you have to do the casting. The method returns a double value, you have to cast that into an integer to store it into an integer variable.
luca_la wrote: And if i'll can use it, i need to know how much the cost of code increase.
The rounding is done using a single FPU instrution, so it's not expensive at all. It's comparable to casting a double to an integer, which also uses a single FPU instruction.
Consider this line of code:
y = Math.Round(x);
And look the disassembly of the generated code (with my comments):
00000051 fld qword ptr [ebp-44h] ; load from x<br />
00000054 frndint ; round<br />
00000056 fstp qword ptr [ebp-58h] ; store in temp<br />
00000059 fld qword ptr [ebp-58h] ; load from temp<br />
0000005c fstp qword ptr [ebp-4Ch] ; store in y
As you see, the rounding itself is just one instruction, and the rest is just getting the data in and out of the FPU stack and storing the result. If you use the method in an expression, the value doesn't even have to leave the FPU stack between operations.
---
b { font-weight: normal; }
|
|
|
|
|
Yeah round() works very well!! Now i'm happy!
Thank you very much for your time and you knowledge!
Luca
|
|
|
|
|
Hey all,
I'm pretty new to this .Net business, and I have a question about getting hold of an object's data. Given an object (of any type) is it possible to return a byte array that represents that object? I've had a look in the Framework, but can't seem to find any generic tool to do the job...
Cheers,
Martin.
|
|
|
|
|
For the standard .NET types you can use BitConverter.GetBytes(var) , but I don't know if this works with custom types
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The process is called serialization. When you want to send that object through the network or save to a file, you use a process called serialization.
It's not as straightforward, but at the same time it is very powerful and customizable.
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
Hi there.
I am wondering how one goes about doing what is done in email, clicking a button and then you can browse to a file that you want to attach. I want to be able to do this in a windows form app. I dont´know what it is called but when the user presses button he/she can go to a location on the computer and get the path of a file and then something can be done with the file.
I wish I could explain better what I mean but I am sure most will know what I am referring to.
Thanks
F
|
|
|
|
|
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Text files (*.txt)|*.txt|Bitmaps|*.bmp|All Files|*.*";
DialogResult res = dlg.ShowDialog();
if(res == DialogResult.OK)
{
Console.WriteLine(dlg.FileName);
}
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi, thanks a bunch. It´s so obvious once it has been pointed out;)
Thanks again!
F
|
|
|
|
|
When I try to open a window of my program in design mode, the following error occurs:
--------------------------------------------
The designer cannot process the code at line 1343, please see the Task List for details. The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again.
Hide Edit
at Microsoft.VisualStudio.Design.Serialization.CodeDom.XML.CodeDomXmlProcessor.ParseXml(String xmlStream, CodeStatementCollection statementCollection, String fileName, String methodName)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnMethodPopulateStatements(Object sender, EventArgs e)
at System.CodeDom.CodeMemberMethod.get_Statements()
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
-------------------------------------------------
The strangest thing is that I didn't mess with the designer code, it is 100% self-generated. When I comment the pointed line, the error occurs anyway, simply at previous lines... And when I run the application, everything seems OK.
Does anybody have any idea what I should do? Seems like it was a bug in VS itself?
-----Kordzik--------
|
|
|
|
|
Let me know advantages of ObjectSpaces over DAAB (Data Application Access Block).
Varun Jain
|
|
|
|
|
I'm working on a game that has to send 20kb data about every 30sec but when i try to send my data i only get the first 1024bytes.
I've tried changing the SendBufferSize and ReadBufferSize in the TCPClient but it still stops at 1kb.
I've also tried to split the data into 20 small pieces but that doesn't work good at all, the messages often merge into each other and if i make the server confirm that the message has been received for every part, it takes 10times longer time than it would if i only sent it in one piece.
|
|
|
|
|
IIRC you should not send more bytes than the buffer size at a time.
|
|
|
|
|
I've tried changing the buffersize to a bigger number (on both the client and the server of course) but anything over 1024bytes doesn't have any affect.
If the buffersize is SendBufferSize and ReceiveBufferSize on the TCPClient.
|
|
|
|
|
Does anybody know how to parse something like "Fri, 31 Mar 2006 09:24:25 PST" into a DateTime ?
/\ |_ E X E GG
|
|
|
|