|
Math.Pow([value smaller than 0], [non integral value]) is always NaN, according to the specs[^]
What else do you suggest?
I may be reading it wrong (nearly 7 in the morning, so I make mistakes easily), but to me it looks like you're suggesting that he do what he did already - which already proved to go wrong..
|
|
|
|
|
But if it's to be a general-use routine, why not assume it will be used in the normal way and only try to add special handling as a backup?
|
|
|
|
|
to summarize what others have said:
1. read the doc, it lists special cases including yours:
x < 0 but not NegativeInfinity; y is not an integer, NegativeInfinity, or PositiveInfinity ==> NaN
2. realize Math.Pow is using exp(y*ln(x)) so x better be positive
(you don't have to know that, but it justifies some of the documented special cases)
3. realize (double)1/3 can't be stored exactly in binary (not really relevant here)
4. make your own cubicroot method, which performs sign(x)*Math.Pow(abs(x),y)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi All,
Here are the code...
//
List< String >category=new List < String >();
category.Add("House");
category.Add("Car");
category.Add("Dog");
category.Add("Car");
I want to show report like this...
Name Count
===== =====
Car 2
Dog 1
House 1
Please let me know how to do the above output.
Thanks & Regards
Rao
|
|
|
|
|
You deleted your earlier post[^] and reposted?
WE DON'T DO HOMEWORK HERE!
|
|
|
|
|
I refer the honerable gentleman to my earlier answer to his question. I'll do your homework only if you pay me lots.[^]
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Sure, however you forgot to mention your price.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I feel the word "lots" indicates he would be in the "I don't like the client and so he should be gouged" price band.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
I meant your earlier request for credit card details, that one was very unspecific.
"Lots" has become very precise around here, reminds me of "1, 2, many".
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Once I have his details, we can see how much he still owes me when I hit his credit limit...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hey all,
I want to intercept windows message that is sent to my program when form is deactivated (or activated, no matter). I can intercept mouse clicks etc. using regular message filter, but I can't intercept WM_NCACTIVATE or WM_ACTIVATE messages, why is that?
I'm trying something like that:
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public class MessageFilter : IMessageFilter
{
private const int WM_ACTIVATE = 0x006;
private const int WM_NCACTIVATE = 0x086;
public bool PreFilterMessage(ref Message m)
{
if(m.Msg == WM_NCACTIVATE)
return true;
return false;
}
}
and then in Main:
MessageFilter mf = new MessageFilter();
Application.AddMessageFilter(mf);
I can see using debugger that it doesn't react on activation and deactivation of my form. How to do it correclty?
|
|
|
|
|
Magnat75 wrote: but I can't intercept WM_NCACTIVATE or WM_ACTIVATE messages, why is that?
Because they are sent to the control directly rather than posting into message queue. I believe, PreFilterMessage will only be called for messages sent to message queue.
Here[^] is a similar discussion.
|
|
|
|
|
Hi ,
I'm very beginner in c#, i try to develope a application to retrieve data from html page , but
i have a confused idea on mode to retrive data from field on table on HTML page, anyone can help me?
Thanks
Massimo
modified on Sunday, July 19, 2009 6:58 PM
|
|
|
|
|
I assume you're teaching yourself for fun, because if you were in a class, you'd talk to your teacher, and if you were being paid for this, that would be immoral and borderline criminal.
This is a complex task for a 'very beginner'. Instead, buy a C# book and learn some basics first.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Guys, I need help. Sorry for my English now,my brain just refused to work. I have an Image in PictureBox and have some filters to its process: contrast and brightness. Two trackbars controls filters changing values. When trackBar1_ValueChanged or trackBar2_ValueChanged events raises, function ApplyFilter() starts to work in different thread. When I using the brightness trackbar it changes the brightness of basic image. When I using the contrast trackbar it changes the contrast of image, But I don't know how to change the brightness and contrast together and show it in pictureBox component. For example I want to increase a brightness of an image. After that I want to increase a contrast but not of basic image, and what has turned out at brightness increase. After that I want to decrease a brightness to its basic level or lower. I don't know How to explain it clearly... If anybody have Vista you can see the same example in Vista PhotoGallery fix component. There are a lot of filters which you can apply to your image and change it back as you need. Here is a logic of my code...
Bitmap previewimage = null;
int brightness_value = 0;
int contrast_value = 0;
public PicPreviewForm(string filename)
{
previewimage = new Bitmap(Image.FromFile(filename));
pictureBox1.Image = previewimage;
}
public void ApplyFilter()
{
Bitmap bit;
bit = new Bitmap(previewimage);
if(brightness had been changed)
{
BrightnessFilter(bit, brightness_value);
}
If(contrast had been changed)
{
ContrastFilter(bit, contrast_value);
}
PictureBox.Image = bit;
}
I could apply all filters every time when I changing some trackbar but it really decrease program performance..
|
|
|
|
|
All you need to do, is start with the image already in the picture box, then apply your filter to that. How are you doing the brightness and contrast ? If you're using a matrix, you can combine the two matrices and do the operations together in one pass. That would also make a lot of sense, speed wise
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I have just begun to program in C# and I created this program by 2 ways:
1. Used wmp.dll at C:\WINDOWS\system32 in Windows XP but my program run on Pocket PC only play audio file, not video file.
2. I tried use Microsoft.DirectX.AudioVideoPlayback but it only run in Window project, not run in Smart Device project.
Have any solution as there is a like library wmp.dll or Microsoft.DirectX.AudioVideoPlayback in Windows Mobile?
Everybody, help me?
Thanks.
|
|
|
|
|
Please send me your code on my email mishra.nishant4@gmail.com i must need to see it before commenting.
|
|
|
|
|
Why C#.net does not support multiple inheritance?why it can support by interface?why not by class?
|
|
|
|
|
Because the designers decided they'd cripple the language in the interests of making it "safer".
Implementing an interface is unrelated to inheritence.
|
|
|
|
|
C# and Java languages don't support multiple inheritance because of the diamond problem[^].
Here is the short summary:
The diamond problem is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If a method in D calls a method defined in A (and does not override the method), and B and C have overridden that method differently, then from which class does it inherit: B, or C?
Uri
|
|
|
|
|
This is a stupid example, given by people too stupid to understand the value of multiple inheritance. It seems the C# team is in general too stupid to understand complex solutions, I asked them for default parameter values years ago, and they got very confused trying to work out how that would work, or why you'd use it.
The example is valid, but it assumes the programmer is a moron. A good language assumes it will be used well, not protects itself from being used poorly
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hear hear! I think that's what I said.
Christian Graus wrote: default parameter values
Aren't those in C# 4.0 ?
|
|
|
|
|
Yes, you did.
PIEBALDconsult wrote: Aren't those in C# 4.0 ?
Yes, it's taken them three iterations to realise the people crying for it were right. And, they explicitly told me that if they have a choice between making the language powerful, or making it easy and safe, they choose the latter.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: It seems the C# team is in general too stupid to understand complex solutions
Wow, that's quite an accusation. How many programming languages have you written, Christian?
I'd think the main issue here is not language, but the CLR. If C# supports multiple inheritance, there must be some way to express it in metadata and IL, which means the CLR must support it. I'm guessing here that that would mean only a language which is aware of multiple inheritance would be able to deal with that type. Also, the way C++ implements MI might not be compatible with the CLR requirements (reflection etc..), so there are problems even for a language that already supports MI.
In general, I'd say language changes that only affect code generation (lambdas, automatic properties) are much more simpler than those that change the type system (generics etc..).
Christian Graus wrote: I asked them for default parameter values years ago, and they got very confused trying to work out
Unlike C++ which requires recompilation whenever a module changes, .NET supports binding against different versions of a module (assembly). Which means that embedding the default values at the caller will break versioning. I don't see how that assumes the programmer is a moron.
|
|
|
|