|
Good call: I use both and they work fine and are free.Tychotics
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
I recently started using Doxygen (http://www.stack.nl/~dimitri/doxygen/index.html[^]) and have been very impressed with its capabilities. Once you set up a configuration file, you can easily (and quickly) generate documentation with the click of a button. And you can't beat the price. -NP
Never underestimate the creativity of the end-user.
|
|
|
|
|
i am currently working with ptz cameras. i want to send the ptz commands thorugh http. can anybody help me?
or some good reference which could help me ?
|
|
|
|
|
I suppose you want to send http requests to those cams and receive whatever response the cams send back. In this case you might take a look at the System.Net.WebClient class in the MSDN. With this class you can send HttpRequests and receive the responses. Good Luck. A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
Hi everyone.
This is a trivial question, but I can't find the answer anywhere (even though it's been asked before in these forums, but it wasn't solved in a way that satisfies me): is it possible to catch several hierarchically unrelated exceptions in the same catch block? By hierarchically unrelated I mean one isn't a subclass of the other, etc.
Basically, I'd like to do this:
try {
} catch (ExceptionType1, ExceptionType2) {
}
Is it possible, or do I need to do it as follows?
try {
} catch (ExceptionType1) {
handleMyException();
} catch (ExceptionType2) {
handleMyException();
}
public void handleMyException() {
}
I know Java allows the first format (ExceptionType1, ExceptionType2 ), but C# doesn't seem to like it. However, having to create a method each time this happens doesn't seem to promote code-cleanliness.
So... is it possible to do it as in Java?
Thanks!modified on Wednesday, March 10, 2010 6:10 AM
|
|
|
|
|
You have to use the 2nd method you posted..45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
|
You need to do the second. I'm actually surprised Java has the first syntax, though it does make sense if you don't access the Exception object, so I suspect the Java syntax is really [good] syntactic sugar. If you do need to access the Exception object (as in my snippet) and the first syntax is used the compiler would have hellish time as it wouldn't be able to work out the Exception object type etc...
try
{
}
catch (NullReferenceException ex)
{
Console.WriteLine(ex.Source);
}
catch (ArgumentException ex)
{
Console.WriteLine(ex.ParamName);
}
is OK, but
try
{
}
catch (NullReferenceException ex, ArgumentException ex)
{
Console.WriteLine(ex.ParamName);
}
Hope this helps!Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
|
You could do this:
private static void Main(string[] args)
{
Exception ex = null;
try
{
throw new InvalidOperationException("oops");
}
catch (InvalidOperationException myEx)
{
ex = myEx;
goto Something;
}
catch (InvalidTimeZoneException myEx)
{
ex = myEx;
goto Something;
}
catch (Exception myEx)
{
Console.WriteLine("Exception: " + myEx.ToString());
}
return;
Something:
Console.WriteLine(ex.ToString());
return;
}
That would allow your catch-all code to have access to local variables and would give it the ability to return (perhaps conditionally), which a method you call cannot do. And, yes, you can have labels in C#. Or, you could do this:
private static void Main(string[] args)
{
try
{
throw new InvalidOperationException("oops");
}
catch (Exception ex)
{
switch (ex.GetType().ToString())
{
case "System.InvalidOperationException":
goto case "System.InvalidTimeZoneException";
case "System.InvalidTimeZoneException":
Console.WriteLine(ex.ToString());
return;
case "System.Exception":
Console.WriteLine("Exception: " + ex.ToString());
break;
default:
Console.WriteLine("Hmmm.");
break;
}
}
}
I don't think either are pretty and I don't recommend either. I'd say just call a common method.
|
|
|
|
|
Thanks for your answers.
As you say, they're not pretty (but I appreciate them! ), so I'll stick with the method.
In particular:
1) Like many other people, I don't really like using labels and gotos in a high-level language.
2) GetType() is computationally expensive (not extremely so, but you know, reflection). Plus, I don't think you need a goto in this case. Couldn't you just do this?
private static void Main(string[] args)
{
try
{
throw new InvalidOperationException("oops");
}
catch (Exception ex)
{
switch (ex.GetType().ToString())
{
case "System.InvalidOperationException":
case "System.InvalidTimeZoneException":
Console.WriteLine(ex.ToString());
return;
case "System.Exception":
Console.WriteLine("Exception: " + ex.ToString());
break;
default:
Console.WriteLine("Hmmm.");
break;
}
}
}
Anyway, as suggested, I'll just use a method.
Thanks!
|
|
|
|
|
blackblizzard wrote: Couldn't you just do this?
Hmm, I thought C# complained when you let it fall through like that, but it seems the compiler only complains when you have something under the first case above and no "break". That is, it expects that all the logic be placed on the bottom-most of the cases you fall through. Good to know... thanks!
blackblizzard wrote: GetType() is computationally expensive
Not sure if that's true. I know Reflection.Emit and dynamically building types and things of that sort are expensive, but I'm not sure GetType is all that expensive, as it is pretty much known at compile time. As far as derived classes, that shouldn't be any more expensive than other inherited method call. Depends on how .NET implements GetType under the hood, but I tend to think it would use the faster technique. The string comparison done during the switch statement could slow things down marginally, but when you are dealing with exception cases, you typically don't need to worry about speed (assuming you are not using exceptions to control the typical flow of your program).
blackblizzard wrote: I'll just use a method.
Good choice.
|
|
|
|
|
aspdotnetdev wrote: Hmm, I thought C# complained when you let it fall through like that, but it seems the compiler only complains when you have something under the first case above and no "break". That is, it expects that all the logic be placed on the bottom-most of the cases you fall through. Good to know... thanks!
Sure!
aspdotnetdev wrote: Not sure if that's true. I know Reflection.Emit and dynamically building types and things of that sort are expensive, but I'm not sure GetType is all that expensive, as it is pretty much known at compile time. As far as derived classes, that shouldn't be any more expensive than other inherited method call. Depends on how .NET implements GetType under the hood, but I tend to think it would use the faster technique. The string comparison done during the switch statement could slow things down marginally, but when you are dealing with exception cases, you typically don't need to worry about speed (assuming you are not using exceptions to control the typical flow of your program).
I read somewhere in the msdn site that although GetType and typeof are considerably less expensive than all other reflection methods they don't come particularly cheap (I'd post a link, but I haven't been able to find my reference). Although you're right that this is a case where an exception has been thrown, so we're not really concerned about performance.
|
|
|
|
|
Check out this page. It seems you can do on the order of 10 to 100 million GetType()'s a second. I suppose whether or not that is "cheap" is subjective.
|
|
|
|
|
Great to know, thanks
|
|
|
|
|
Hi,
My application automatically sends email messages using System.Net.Mail.MailMessage and System.Net.Mail.SmtpClient. However, the sent emails are not kept on the mail server.
Is there a way of doing so?
Thanks,
Eyal.
|
|
|
|
|
Hi !
This depends on your mail-server.
At our mail system I installed a seperate mail address and use
the BCC to send an extra copy to this address.
> System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage()
> string mail_bcc_address = "dummy@myfirm.de";
> mail.CC.Add(new MailAddress(mail_bcc_address));
Best regards,
Gerrit
|
|
|
|
|
first of all use POP control protocol for send mail because it provide facility to send mail as well as store mail..
and SMTP protocol only use for send mail...
after that for save mail use fileupload control for save mail at server side in folder
If You Get your answer then please Rating me...
Thanks..
"Are You Ready"
DX-ARMY
|
|
|
|
|
DX Roster wrote: first of all use POP control protocol for send mail because it provide facility to send mail as well as store mail..
Incorrect. Protocols POP (POP3) and IMAP are used for retrieve emails. Usably ISP doesn't support IMAP. IMAP doesn't erase emails automaticly unless it was specified. SMTP is used for only sending emails, While POP or IMAP are only for retrieving emails,
|
|
|
|
|
Thank you.
So how can I send message that will be saved in the "sent items" folder? In worst case I'll add myself as recipient (regular or CC or BCC), but it's a bit dirty...
Eyal.
|
|
|
|
|
This depends on your mail-server.
Have you tried using a client such as thunderbird or outlock to test if it is possible?
Some mail server support settings such as GMail.
eyalbi007 wrote: I'll add myself as recipient (regular or CC or BCC), but it's a bit dirty...
Yes, and also the one who recieves it, also will see it your CC and BCC
|
|
|
|
|
hi to all
i need "audio sound suite for .net crack" because
i live in iran, i like purchase this product but in iran
don't exist way for buy this product.
anyone can help me...
|
|
|
|
|
Does it even exist? Google thinks it doesn't
|
|
|
|
|
yes, doesn't exist !!!!!!!
iran don't accept copy right law
they want me credit card or ...
but i don't have...
can you guide me?
|
|
|
|
|
How am I supposed to guide you to something that doesn't appear to exist
Now I don't know what you're doing, but the pirate bay is usually not a bad place to start looking for something..
|
|
|
|