.net

Programmaticaly provide SqlNet authentication service name to Oracle client.

Hello, I am using a standalone Oracle.DataAccess manual installation for my project to avoid a full Oracle client installation on customers machines (no oracle home). For this I followed this guide and it works pretty well. Actually the user/password is stored in a configuration file but I want to use the current AD user so I need to p...

Url rewriting asp.net 3.5

Hi I have implemented URL rewriting using Intelligencia, everything works perfectly. now if i have an anchor i could do somenthig like <a href="../TestPage">Test</a> with the seo friendly url olready in place or do i have to do somenthing like <a href="<% GetSeoUrl("../TestPage.aspx")%>">Test</a> public string GetSeoUrl(string ur...

MDIWindowListITem Not Working

Hi, This one has really got me stumped. I have certain forms that are being instantiated. When I instantiate a form i make it a child of the mdi form by form1.MdiParent = this; I have set the MDIWindowListITem property of my menustrip to a toolstripmenuitem However this toolstripmenuitem does not show the mdi child form when it is in...

Deserialize JSON with embedded Dictionary<string, string>

I need to determine if the DataContractJsonSerializer can deserialize JSON to a Dictionary if the Dictionary is not the wrapping object being deserialized. I know there are other open source codes projects that may be able to do this (json.net, json-framework) but I'd like to know definitively if .NET can natively handle this before taki...

VB.net Memory efficient function needed

Hi All, I'm getting out of memory exceptions from the following function when RowCollection is 50000+ and thus i need to make it more memory efficient. The function is simply needs to construct a comma separated string of the row indexes stored in RowCollection. Can anyone spot any obvious memory hungry operations in the following? N....

adding selfmade button to c# vs2008

hi,how can i add my selfmade button into toolbox in vs2008?thanks ...

What patterns exist for translating data from one type to another?

I'm working on a project where I have to take data from one source and translate/tweak it so that it can be properly consumed by a different source, in this case, the database. I imagine this is a fairly common problem, and while I believe I'm off to a good start, I'm stuck as to how best to implement the middle part of the solution tha...

TargetInvocationException when handling a COM Event

I am developing a COM dll library, and I have a little vb.net (vs 2005) application just to test it. I had my object declared in the application as Private m_VarName As MyLib.CMyComClass So far, so good. But now, I need an event to inform the application of some things, so I implemented such event in the COM dll, and changed the...

Data Context's SubmitChanges method causing a entity reference to be set to null

I know this looks a bit long but i tried to explain the problem as throughly as i could. We are having a very 'exotic' problem with the linq to sql data context class. We have a n-tiered architectured structured like this: We have 3 classes MotherClass, ChildClass, ChildChildrenClass MotherClass looks something like this: public class...

ASP.NET MVC 2 Problem with custom ModelValidator

I am trying to validate that either of 2 textbox fields in my view have a value supplied. I made this Model Validator: public class RequireEitherValidator : ModelValidator { private readonly string compareProperty; private readonly string errorMessage; public RequireEitherValidator(ModelMetadata metadata, ControllerCont...

Is it possible to mock Activator.GetObject()?

Hi, I am trying to write a unit test for a method that uses a .net remoting object. The remoting object is created by using Activator.GetObject(typeof(myRemotingObjectType), uri); During runtime, the uri is server ip address of the remoting object. Since I want to write a unit test, I don't want to initialize any .Net remoting to slo...

If I create a new List<T> from an existing list, are the members equal?

Assuming I have a List<Stuff> listA that has some items in it. I create a second list as follows: List<Stuff> listB = new List<Stuff>(listA); Let's say I have an item from listA, and I try to remove it from listB: Stuff itemFromA = listA[0]; listB.Remove(itemFromA); Assuming Stuff is a Class, should the item be successfully removed...

find ALL methods of getting current date/time in VB.net

I have a 500K+ lines vb.net app, written by 10+ different devs over the past 5 years. Many times it gets the system time and/or date and relies on it. Now I have to re-run real cases thru the program for regression testing purposes, and it screws up cases where the date/time matter. My fix is easy, just replace all the areas in the pro...

.NET 4.0 framework on same server as .NET 1.1

Can these framework versions work and play well on the same server? Meaning that can IIS support two application pools where one pool is configured with .NET 4.0 and the other with .NET 1.1. EDIT: This question is concerned with IIS 7. ...

How is it that U[] is castable to T[]?

It is clear that the T[] array type is not covariant as the elements of a T[] can be set by index. And yet, a U[] can be cast to a T[] without any complaints from the compiler as long as U derives from T. Man[] men = new[] { new Man("Aaron"), new Man("Billy"), new Man("Charlie") }; Person[] people = (Person[])men; In the above code i...

How would you centralize configuration across multiple projects?

I have a solution with about 10 projects with read-only config. They are web applications, windows services, console apps, etc. All projects except for one are on the same server. Each project has 3 environments - dev, test, and production. So there are 30 different sets of configuration, each one with a decent number of settings. I...

Thread.Join vs Thread.State

Hi, Thread.Join returns us if the thread has completed. The same we can determine using ThreadState. Then what is the difference between Thread.Join() and Thread.ThreadState? Can we use them interchangeably? ...

Error message: 'OfType' is not a member of 'System.Text.....

Well the full error is Error 3 'OfType' is not a member of 'System.Text.RegularExpressions.MatchCollection' in the following lines of code, (curly braces in regex.Matches(input).OfType) For Each group As Object In regex.Matches(input).OfType(Of Match)().Select(Function(c) c.Value.ToLowerInvariant()).Where(Function(c) Not keywords.Con...

Foursquare - OAuth Authentication - .Net Sample

Is there any sample on how to authenticate to Foursquare using Oauth ? ...

Why do nullable types behave this way

I was having trouble with a nullable type so I wrote the following program to demonstrate the issue I was having and am confused by the results. Here is the program: Module Module1 Public Sub Main() Dim i As Integer? = Nothing Dim j As Integer? = GetNothing() Dim k As Integer? = GetNothingString() If i.HasValue Then ...