|
If you are receiving an XML serialization, then the only thing you can deserialize it with is an XmlSerializer - it is entirly possible that the error you are getting is a reflection of this. I.e. that the XmlNode entries are private, not available as public properties and thus the tree can be saved by a XmlSerializer, but not with a BinaryFormatter since this will try to save all private variables as well. Since XmlNore does not appear to have a [Serializable]attribute, I think you are stuck with XmlSerializer.
You could use multiple type of serializer, but since each would contain the same data this would just increase the effort, without producing a benefit.
|
|
|
|
|
So we all know that exceptions for anything other than exceptional circumstances are a bad thing. Using them to control execution flow is criminal.
For fun, in a quick console app I created a loop that just created and caught exceptions. Anyone care to guess how many exceptions you can throw a second? (Typical development PC)
Regards,
Rob Philpott.
|
|
|
|
|
I'm guessing >100, <1000
I are troll
|
|
|
|
|
That's a good guess! But as Luc points out below, I haven't really done this correctly. Within Visual Studio in debug, I can throw 370 a second before the process dries out so about 2-3ms per exception.
Outside the VS debugger, its much, much faster. 1000 exceptions take 17ms to run, so all in all, its nowhere near as bad as I thought.
Regards,
Rob Philpott.
|
|
|
|
|
Rob Philpott wrote: its much, much faster. 1000 exceptions take 17ms to run
I didn't imagine them being that fast! I thought that the average time would be near the 10 ms for a single exception.
with 1000's in <20 one can use them in a loop
--edit--
Shocked enough to be having trouble with typing
I are troll
|
|
|
|
|
Sorry to bother you again, but I am always suspicious when someone has measured a time span of 16 or 17 msec, since that is pretty much what a system tick takes on most popular hardware/software combinations. Have you been using StopWatch or PerformanceCounters, or did you just look at DateTime.Now?
I suggest you use StopWatch, or run a loop 100 times as long; and you may want and learn more about timing issues by reading my timers article...
|
|
|
|
|
Fair point - I've been using my new friend Stopwatch, which on this hardware at least is a great deal more accurate than DateTime.Now.
Just did 10,000 - took 178ms.
Regards,
Rob Philpott.
|
|
|
|
|
That's OK then.
Now to see how slow that really is, you should replace the exception by a somewhat equivalent return or goto statement and see the difference.
|
|
|
|
|
is that a debug build running inside Visual Studio? (which VS?)
is the first exception included in the measurement?
Visual used to be very slow at dealing with the first exception; and for throughput measurements one should not include the beginning (unless it gets averaged out by observing a large time, say > 1 minute).
could be less than 1.
|
|
|
|
|
Good points - I'll check the results outside VS.
Regards,
Rob Philpott.
|
|
|
|
|
Yes, my whole experiment was flawed by forgetting about running things outside Visual studio. Results are in the above post.
All-in-all, its nowhere near as bad as I thought. 17 microseconds per exception. 50,000 odd a second. Perhaps they're not as evil as all that.
Regards,
Rob Philpott.
|
|
|
|
|
They're just as evil as ever when no one comments that they're expecting an exception for some innocuous looking piece of code.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
Rob Philpott wrote: Using them to control execution flow is criminal.
So the chap that wrote the ASP.NET page redirection mechanism should be locked up for all those ThreadAbortExceptions
|
|
|
|
|
Not familiar with him, but it sounds like you should throw away the key....
Regards,
Rob Philpott.
|
|
|
|
|
Wait a minute, exceptions are supposed to alter execution flow,
how else would they be any better than on error resume next ?
|
|
|
|
|
Luc Pattyn wrote: Wait a minute, exceptions are supposed to alter execution flow
Agreed, but only in exceptional circumstances!
Regards,
Rob Philpott.
|
|
|
|
|
Hi Guys,
I am having problem when running the Following SQL script.It takes Pretty long time to return result.
I am having about 500,000 records in my database.
select count(distinct(CR_Cli)),SO_name from Callrecords inner join dbo.StudioOperators
On CR_StudioOperatorID=SO_ID
where datename(month,cr_callstart)='April'
and Cr_cli not in (select Cr_cli from Callrecords where cr_callstart<'2009-03-31')
group by SO_name desc
Is there any way i can write this script?
Thanks you very much.
|
|
|
|
|
You do realise that there are several Database related fora on CP?
This is a C# forum.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Sorry I couldnt get SQL forum From the Message Board List.
I will Try MYSQL.
Thank you
|
|
|
|
|
How about the "General Database" forum??
|
|
|
|
|
General Database might be better, if it is MS SQLServer.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
It´s very hard to rewrite a SQL query that I didn´t know the schema and relationships. Anyway, I made some changes.
kibromg wrote: select count(distinct(CR_Cli))
Verify if the column has an index.
kibromg wrote: datename(month,cr_callstart)='April'
Do not use much functions on where clause. Simplify... use "month(CR.callstart) = 4".
kibromg wrote: and Cr_cli not in (select Cr_cli from Callrecords where cr_callstart<'2009-03-31')
If Cr_Cli "not in" where cr_callstart < '2009-03-31 then Cr_Cli "is in" where cr_callstart > '2009-03-30'. More than that, you are already referencing Callrecords in inner join, so you don´t need to create a subselect. On where clause, use this condition: "CR.callstart > '2009-03-30'".
kibromg wrote: group by SO_name desc
On group by you have the column SO_name. Does this column have an index?! If not, you must consider creating one.
Try the code below, maybe it helps.
<br />
select count(distinct(CR.Cli))<br />
, SO.name<br />
from Callrecords CR<br />
inner<br />
join StudioOperators SO<br />
on CR.StudioOperatorID = SO.ID<br />
where month(CR.callstart) = 4<br />
and CR.callstart > '2009-03-30'<br />
group by SO.name desc<br />
|
|
|
|
|
I have a method in my Webservice:
[WebMethod]
public ReturnList GetList(string id, System.DateTime fromDate)
If I enter a invalid date when testing the service, I get a custom html-page with the errormessage and a stacktrace.
How can I get rid of this?
I want to handle the parsing of the incoming date myself, and send back a ReturnList object with a custom errormessage.. But I don't want to use string instead of dateTime, since I want it to be specified as dateTime in the wsdl..
|
|
|
|
|
What about using an overload that way if it is passed in as something other then a valid DateTime object it will get treated by the overlaoded method and there you can try parsing it manually:
<code>
[WebMethod]
public ReturnList GetList(string id, string fromDate)
{
}
[WebMethod]
public ReturnList GetList(string id, System.DateTime fromDate)
{
}
</code> Worth a try ... hth
|
|
|
|
|
Hi,
I would like to make a column of listview, invisible. by setting width property to zero, I can achieve this.
But, when I am trying to increase or decrease the width of previous or next column with mouse drag then the hiden column automatically get displayed.
Any solution for that ?
Like
making that column invisible. OR
making mannual resizing of any column as false
Please help me in this regard.
Thanks in advance
|
|
|
|