.net

System.Xml.XmlDocument, what's the best way to cache an external dependency DTD?

I'm loading valid XHTML into an XmlDocument, but it takes 2 seconds to load. I've found that if I drop the DTD, it's instant, but then I have to replace   to  , etc. The number of declared HTML entities is large, so I feel the DTD should be loaded. So what is the easiest way to pre-load the DTD with minimal manual labor? Perhap...

Usage of log4net in .net petshop 4

I have a question regarding log4net usage for logging information in .net petshop 4 application.How do I use it to log informaton related to size of the message and time at which logging occurs.Please help !I have tried opening .net petshop using visual c# express edition 2008 and visual web developer 2008 but the solution items are unav...

Using System.Net.Socket, how can we know when the remote socket is closed?

Ok so here is how things are going: [Server] Start [Server] Socket.AcceptConnection [Client] Start [Client] Socket.Connect [Server] Receive //blocking [Client] Send [Server] Print [Server] Receive [Client] Close socket Is there any way to know when the client as closed the connection? I am currently using the fake packet trick as des...

What's a quick way to familiarize myself with C#, .NET framework, etc?

Hi all, I just graduated college and will be starting working in about a month and I was asked to familiarize myself with C++, C#, .NET framework for NT Services and web services. I'd appreciate recommendations on how to familiarize myself with these topics (books? internet links?) in a short time span. I don't expect to be an expert ...

Why is UnhandledExceptionEventArgs.ExceptionObject an object and not an Exception?

Why is UnhandledExceptionEventArgs.ExceptionObject an object and not an Exception? I am attaching to AppDomain.UnhandledException. I would like to cast UnhandledExceptionEventArgs.ExceptionObject to an Exeption and interogate it. And with this in mind will it ever be null? The MSDN documentation is not exatly useful http://msdn.mic...

Using ObjectDataSource and DataObjectTypeName, How Do You Handle Delete Methods With Just An Id Parameter?

If I have an ObjectDataSource setup like: <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Employee" InsertMethod="Insert" UpdateMethod="Update" DeleteMethod="Select" TypeName="EmployeeDB"> </asp:ObjectDataSource> and a data/business object with methods like: public clas...

c# truthy and falsy values

In javascript there is the idea of truthy and falsy values. e.g. 0 : Always false 1 : Always true '0' : Always true '1' : Always true Is there an equivalent list of truthy and falsey values in the C# language on the .NET framework? The reason I would like to know this is that I find myself doing the following if(obj != null)...

Reading a file bug in vb2005?

The way this file works is there is a null buffer, then a user check sum then a byte that gives you the user name letter count, then a byte for how many bytes to skip to the next user and a byte for which user file the user keeps their settings in. the loop with the usersm variable in the IF statement sets up the whole file stream for ...

How to move insert caret on textbox when accepting a Drop

I have a TreeView and a Multiline Textbox together on the same form in a Windows form. I have drag and drop setup so that I can drag a node from the TreeView over to the textbox and insert text into the textbox (this is working). I would like to enhance this so that as the mouse is dragged over the textbox some sort of indicator moves ...

can we access the managed code with out pointer object??

Hi i have created some application in managed c++.when i try to instantiates it shows error as cannot convert from obj to *obj. when i instantiates as pointer obj it shows no error. so. is there any way to access such class without creating pointer object ...

How to use LINQ to select object with minimum or maximum property value

I have a Person object with a Nullable DateOfBirth property. Is there a way to use LINQ to query a list of Person objects for the one with the earliest/smallest DateOfBirth value. Here's what I started with: var firstBornDate = People.Min(p => p.DateOfBirth.GetValueOrDefault(DateTime.MaxValue)); Null DateOfBirth values are set to Da...

Problem only in Vista (.net): call unmanaged dll(Shell32.dll, function: SHEmptyRecycleBin) from thread

***Platform: in Vista(ultimate or home/premium) it does not work, other OS(xp, windows7) it works****** I'm emptying recycle bin using c++.net(or c#.net) inside a thread. When i do this straight (without thread) it works. But if thread used it doesn't. Please watch the code snippet below: namespace EmptyRecycleBin_C{ enum RecycleFlags ...

Application-wide Restriction of objects, methods etc.

Hello SO-followers, I have a very theoretical question: Is there a way to ban the use of some methods, objects etc. inside of my application/project map in C#, .Net and/or Visual Studio? To be more specific: I'm developing a DMS System where it should never be possible to delete files from an archive. The archived files are just files ...

XSLT html output problem with

Hi, The problem is, that my XSLT-Transformation process ( called by .NET ), doesn't leave the HTML content in the XSLT file alone ( which isn't xml-compliant like an <img> tag without an closing slash-sign ), so i'll get errors like: <pre>System.Xml.Xsl.XslLoadException: XSLT-Compilererror. ---> System.Xml.XmlException: The 'img'-Start...

Using C# assembly in SQL Server

I've got a c# class library that I call from an asp.net application. The assembly calculates grades for students and performs calculations using datatables and such. How can I use this assembly in SQL Server 2005 and call it once for each record in a database table? I want to re-use functionality and avoid writing the thing in T-SQL. ...

Examples of Asynchronous Interaction in C#.Net?!

I know that it's possible to implicitly provide asynchronous interaction using: Asynchronous Delegates Asynchronous Callbacks I was just wondering what other methods .Net supports for asynchronous interaction? Help greatly appreciated. Regards EDIT: Maybe I didn't explain myself correctly.... I UNDERSTAND THREADING AND CONCURRENC...

Getting values from an enum

I have some code that sets up a dictionary with some defualt values for an enum: foreach (string status in Enum.GetNames(typeof(TargetStatusType))) { dict.Add((TargetStatusType)Enum.Parse(typeof(TargetStatusType), status), 0); } Is there an easier way to do this, as it seems a bit messy. I was hoping I could just do foreach(Targ...

Create .NET Custom Control Button for CRUD

Hello there, I am thinking to create a Custom Control button that would do a CRUD tasks for me. Let me elaborate: I wanted something that save time to writeup code on every UI for CRUD tasks. I am here becuause I want to make sure the approach I am taking should be verified before I am putting hours and taking strain. A Custom (could ...

Simulate keypress in a non-visible webbrowser object C#

I'm currently working in an application that has to navigate a webpage and recollect data about products, prices, ... with webbrowser object in .net 3.5. The problem is that the page has some fields with a suggest script in ajax, and I can't simply modify the innerText property because the script also saves codes in a hidden input field...

What is the REGEX to match this pattern in a html document in C#?

I really can't work out how to best do this, I can do fairly simple regex expressions, but the more complex ones really stump me. The following appears in specific HTML documents: <span id="label"> <span> <a href="http://variableLink"&gt;Joe Bloggs</a> now using </span> <span> ' <a href="/variableLink/">Important Data</a> ' </span> <sp...