.net

Rich Text Box character set

When I copy, for example, the word "Çamlık" from a web page into a rich text box (forms application) at runtime, it is displayed as "?aml?k". Is there a setting in the richtextbox control or form or application to fix this? If not, what is the "socially acceptable" method? (.Net 2008) ...

How to allow DTD in XML Documents loaded via XSLT's document(uri) function with XslCompiledTransform (.NET)

When the document(uri) function is used to load another document within the XSLT, where the target document contains a DTD I get an XslTransformException, containing an inner XmlException: For security reasons DTD is prohibited in this XML document. To enable DTD processing set the ProhibitDtd property on XmlReaderSettings to false a...

How to preserve Linq2SQL OR between conditions?

Lets say we need to select two sets from a table: "Things" var GradeA = db.Things.Where(t=> condition1); var GradeB = db.Things.Where(t=> !condition1 && condition2); var DesiredList = GradeA.union(GradeB); alternatively, we need to write a single statement to avoid union cost: var DesiredList = db.Things.Where(t=> condtion1 || (!con...

Overriding a private method with Reflection

Is it possible to override a private method by using Reflection in .NET 3.5? ...

Algorithm for reading the actual content of news articles and ignoring "noise" on the page?

I'm looking for an algorithm (or some other technique) to read the actual content of news articles on websites and ignore anything else on the page. In a nutshell, I'm reading an RSS feed programatically from Google News. I'm interested in scraping the actual content of the underlying articles. On my first attempt I have the URLs from th...

What OS software is missing in the .NET world?

I'm a .NET developer working alongside Java and Eclipse developers. They seem to work with a lot more Open Source than I ever have. Some/Most seem to have made it across to .NET (Hibernate to NHibernate is a great example of this.) But I am curious as to what OS software out there hasn't made it to the .NET world? What do people feel is...

Automatically logging unhandled exceptions without using try/catch

So I want to be able to just log all unhandled exceptions to the event log without having to catch all the exceptions manually and write them out. I wanted to use the health monitoring functionality within a WCF service, the problem is that this only catches errors generated by asp.net and I specifically want to also catch SPException e...

NHibernate version confusion

OK, hit me over the head if this is a blatantly duplicate question.... I recently purchased NHibernatie in Action from Manning. This book outlines version 1.21 It mentions a version 2.0 of NHibernate that is coming/is in beta. If I download NHibernate from nhforge I get version 2.1 Is the book hopelessly outdated?? ...

Helping to ease COBOL programmers to .Net. What are your suggestions?

I have a number of COBOL programmers who are moving to .NET. I've found many struggle to adopt/understand OO programming principles. I don't have any COBOL experience, so my ability to find what few similarities there are is very limited. There's no way I want to say "forget your twenty years of experience. This is all new," but I don...

Solution for Linq2SQL expressions that has no translation

Is there a way to provide translation for expressions that have no translation ? like double.parse() ...

Solving partial differential equations using C#

I am working on a project (C# and .NET Framework) which requires me to solve some partial differential equations. Are there any specific libraries based on .NET Framework that I could see and make my work simpler? I have worked with MATLAb and solving partial differential equations is very straightforward there. How can I solve this pro...

Remoting or WCF for new development (between two .NET apps on the same machine) using interfaces?

We want to have two .NET apps running on the same machine communicate with each other. We want three projects. A library containing interfaces. A "server" app that implements the interfaces and "client" app that communicates with the server using the interfaces. We do not want the client to reference the server. We have a test app th...

Why null == myVar instead of myVar == null?

What the title says! I see it from times to times and I'd like to know why. Is there any difference at all? ...

[Conditional("Debug")] + #if DEBUG

I have seen in Debugging .net 2.0 Applications the following code [Condictional("DEBUG")] void AssertTableExists() { #if DEBUG ... #end-if } Is there any reason to use the #if directive? I mean, from what I understand the method will only be called if the DEBUG is defined, so I don't see a point in having the #if in th...

using case in linq

How can this be written in linq select * from transactions T JOIN TransactionSample ts ON ts.TransactionID = CASE WHEN T.ParentTransactionID is null THEN T.TransactionID ELSE T.ParentTransactionID END where T.TransactionID = 227511 ...

NHibernate not picking up changes

I am wondering under what circumstances the following NHibernate code could fail: var session = NHibernateSessionManager.CurrentSession; var foo = session.Linq<Foo>.ToList()[0]; foo.SomeProperty = "test"; session.SaveOrUpdate(foo); var reloadedFoos = session.Linq<Foo> .Where(x => x.SomeProperty == "test"); ...

Linq to Objects: does GroupBy preserve order of elements?

Does Enumerable.GroupBy from LINQ to Objects preserve order of elements in the groups? ...

Is it secure to use a DLL for the main logic of your .NET application?

If a user knows almost anything about coding in .net, and they see a .dll, they have the unfortunate ability to call your public functions and subroutines. I know you could try a "key" system, where it will check for a certain "key" as an argument, and only run the code if the "key" is valid, but I just ran some code and a .dll that I ma...

Conditional Joins in LINQ

I have a parent child table relationship. In the example below Foo has a FooID and a nullable ParentFooID that points to a parent record. The Bar table is always linked to the parent record. This is the SQL I use to get the result. Select * from Foo f JOIN Bar b ON b.FooID = CASE WHEN f.ParentFooID is null TH...

LINQ table join with entity Framework

Hi there, In my datbase I have TableA, TableB and TableC TableB has just 2 columns, the primary key of TableA and TableC, so it really defines a one to many relationship between the two tables What i want to do using SQL is: SELECT * FROM TablesA a JOIN TablesB b ON a.AID = b.AID WHERE b.BID = 1 In the Entity Framwork is doesn't c...