.net

Compilation error when using Generics C# 3.5

The following code fails to compile: class MyClass<T> : where T : MyClass <T>{} Is there any way to solve this? I have used the following workaround but I was wondering if there is a better way class MyClass <T> : IMyClass where T : IMyClass {} interface IMyClass {} ...

Communicating with all network computers regardless of IP address

I'm interested in finding a way to enumerate all accessible devices on the local network, regardless of their IP address. For example, in a 192.168.1.X network, if there is a computer with a 10.0.0.X IP address plugged into the network, I want to be able to detect that rogue computer and preferrably communicate with it as well. Both co...

Is there a way I can provide Lucene.NET with a list of predefined relevant terms?

I know I can, during search, specify a "boost factor" to a term as described in http://lucene.apache.org/java/2_4_0/queryparsersyntax.html. My question is: Can I provide Lucene with a predefined table of relevance? For instance, I could say that "chair" and "table" are relevant words with a boost factor of 4 and all subsequent searches...

DataGridView's SelectionChange event firing twice on DataBinding even after removing event binding

This Code triggers selection change event twice. how can I prevent it ? Currently i m using a flag or focused property to prevent this. But what is the actual way ? I am using it on winfoms EDIT My Mistake in writing Question, here is the correct code that i wanted to ask private void frmGuestInfo_Load(object sender, EventArgs e) { t...

DataType for storing a long serial number (10 bytes)

We have a device which has a 10 byte serial number which must be read into our application and stored into a .net datatype. In the device it is stored as an unsigned 10-byte (80-bit) number. I don't expect we will be performing any mathematical operations on this number, but only displaying it to the user. The .NET framework doesn't ha...

Regular Expression to capture the first <p> of HTML

I have the following regular expression: (?:<(?<tag>\w*)>(?<text>.*)</\k<tag>>) I want it t grab the text within the first HTML element. eg. <p>This should capture</p>This shouldn't Works, but ... <p>This should capture</p><p>This shouldn't</p> Doesn't work. As you'd expect, it returns: This should capture</p><p>This shouldn't...

autoscroll problem

I have a panel and in that a control should get added on the panel click of the button in that control.. I docked those controls to bottom since i have another control which has to be at top always... Now the problem is, I set a maxsize so that after the maxsize is reached the autoscroll of the panel should kick in, and the requirement i...

Is there a 128 or 256 bit double class in .net?

I have an application that I want to be able to use large numbers and very precise numbers. For this, I needed a precision interpretation and IntX only works for integers. Is there a class in .net framework or even third party(preferably free) that would do this? Is there another way to do this? ...

Is ThreadPool appropriate for this threading scenario?

I have a scenario that I'm trying to turn into a more responsive UI by pre-fetching some sub-elements of the results before they're actually required by the user if possible. I'm unclear on how best to approach the threading, so I'm hoping someone can provide some advice. Scenario There is search form (.NET rich client) that enable the...

Clarification required re: Use of .NET Assemblies in GAC - Set Up to use Globally?

Hi, I've done much reading and experimentation today regarding sigining of assemblies, and their installation into the GAC via various methods (mscorcfg.msc / drag and drop). What I thought, was that once a file was in the GAC, you did not need to make references from projects in Visual studio. I know that you CAN make references via t...

How to use Linq with Castle ActiveRecord

I am playing around with Castle ActiveRecord and noticed that the download included the file, Castle.ActiveRecord.Linq.dll. I haven't found any documentation for using Linq with ActiveRecord, only some old blog posts. What is the usage pattern? Is Castle.ActiveRecord.Linq ready for production use? ...

WinForms: How to find all BindingSources in an UserControl

In the program we are working on, the user data is collected in UserControls which is data bound to a business entity using BindingSources. I need to find all the BindingSources in a UserControl programatically. Since a BindingSource source is not added to the UserControl's Controls collection, I cannot search in there. Can this be do...

Visual Studio 2008 adding incorrect working folders to TFS Workspace

I am using Visual Studio 2008 with TFS. I have one workspace set up with one working folder. I map the root source control folder $/ to C:\TFS and get all code. When working on any project under the root, Visual Studio will randomly add incorrectly mapped working folders to my workspace. For example, it might map $/WebProject/ to C:\T...

Exception throws: encapsulate them or not?

Hi there. Once I read an MSDN article that encouraged the following programming paradigm (its not 100% true... see edit): public class MyClass { public void Method1() { NewCustomException(); } public void Method2() { NewCustomException(); } void NewCustomException() { throw ne...

.net 4.0 Task Parallel Library vs. MPI.NET

Does .net 4.0 Task Parallel Library replace MPI.NET for High-performace computings? MPI.NET found here http://www.osl.iu.edu/research/mpi.net/svn/ is a high-performance, easy-to-use implementation of the Message Passing Interface (MPI) for Microsoft's .NET environment. MPI is the de facto standard for writing parallel programs running o...

Is there a Tool for see files created with binary serialization?

I've working without problems serializating object graphs to and from files. Everything was fine until today: A dictionary, created in a constructor and NEVER deleted, was lost (null referece) just after deserialization from file, for the first time in more than a year doing the same without troubles. So, is there a Software Tool to loo...

It ok for AJAX to take place over non-SSL?

Say I have an https page can I make ajax calls to non SSL without getting warnings in browsers? I want to do it for non sensitive data so its faster ...

How to mask DLL in .NET ?

Let's say I have a DLL that provides math calculus functions. To use it, I include the using Colhq.Math.Basic; namespace. How could I use it by adding a statement like using Blala.Functions.Math; ? So how could I use everything (methods, enums, etc.) from a DLL by using a different namespace ? Is there a one-shot way to wrap or mask a...

f# pattern matching with DataGridColumn.Visibility

I'm encountering a situation where I'm using pattern matching for determining the visibility property of a column. System.Windows.Visibility has two fields, Visibility.Visible and Visibility.Collapsed. Can enyone tell me why the following code: let colItem = myDataGrid.Columns.Item 1 chkBox.IsChecked <- match colItem.V...

Using System.Reflection to Get a Method's Full Name

I have a class that look like the following: public class MyClass { ... protected void MyMethod() { ... string myName = System.Reflection.MethodBase.GetCurrentMethod.Name; ... } ... } The value of myName is "MyMethod". Is there a way that I can use Reflection to get a value of "MyClass.MyMethod" for myNam...