.net

Deleting double-entries from ListBox

Hello, how is it possible to delete double-entries from a ListBox? Let's say I've got the following Listbox: 5 4 6 4 7 5 As a result I want to have this one: 5 4 6 7 Thank you for your help. ...

Entity Framework change tracking

Is there any way of tracking EF entities changes between contexts for ASP.NET applications? Self-Tracking entities doesn't work well for me as it is primarily designed for WCF. And all approaches for tracking changes for POCO I have found are oriented on shared context. ...

Custom exception propagation in .NET Remoting fails with a TargetInvocationException saying "could not load the file or assembly"

Hi, I have a client server app which uses .NET Remoting to communicate. This is separated by an interface and the client doesn't reference the server's implementation. Now, a custom exception in a shared dll, when thrown from the server isn't caught by the client and throws a TargetInvocationException saying "Could not load the file or ...

DbType VarNumeric mapping error

I'm working on a project in .NET 4.0 against an SQL Server 2008 Database. The system uses some legacy code, originally written in .NET 2.0 (converted to 4.0). Running locally everything works fine, but when I moved the code to the test environment I get the following confusing error from the legacy code: Exception class: System.Argume...

Castle Windsor IOC: Passing constructor parameters to child components

Hello, The following code is for demo purposes only. Lets say i have 2 components (businessService, and dataService), and a UI class. UI class needs a business service, businessService needs a dataService, and dataService relies on a connectionString. Form the UI class i need to resolve the business service, so i am writing the belo...

Which blocking threading operations in .NET will handle COM messages when blocked?

When creating a new STA thread to host an STA COM component, it is the responsibility of that thread to pump Windows messages related to COM. From what I've been able to gather, certain built in .NET threading primitives such as lock (Monitor.Enter) will do this for you while waiting for the object to be released by another thread. Anoth...

Can I write an Extension for External Harddisk

I want to secure my external hard disk by writing sort of ShellExtension. But Shell extension is Workstation Specific. Is there a way I can write an application that will show a authentication or an extension encrypt my drive data so user will get a failure message when double click on my drive. ...

What DON'T you look for in a Junior developer?

Why is this closed? It fits within the 6 guidelines for subjective questions! More specifically what are the skills that you would not expect or require from a Junior Developer before hiring them? TDD? Agile? Multithreading? Inheritance? Polymorphism?......... For the purposes of this questions lets define a Junior Developer as being ...

Coerce a WPF TextBox not working anymore in .NET 4.0

In my WPF application I have a TextBox where the user can enter a percentage (as int, between 1 and 100). The Text property is databound to a property in a ViewModel, where I coerce the value to be in the given range in the setter. However, in .NET 3.5, the data is not shown properly in the UI after being coerced. In this post on MSDN, ...

Set a requesting port for HTTP WebRequest

I need to set the port of a HttpRequest. This is the port the Request is coming FROM. Normal HTTP scenario: Request: 127.0.0.1:6745 --> www.stackoverflow.com Response: 1227.0.0.1:6745 <-- www.stackoverflow.com Request: 127.0.0.1:8096 --> www.stackoverflow.com Response: 1227.0.0.1:8096 <-- www.stackoverflow.com My scenario: Request: ...

Get component type of custom .NET class from window handle

I need to see the component type, meaning the name of the class that was programmed, of a clicked control in another process. I need the type so I can react to the clicked control and then do some Automation tasks. Right now I am doing the following: 1. I FindWindow() from Win32 to find the main window handle of the process. 2. Then, I...

How do I secure my "hibernate.cfg.xml" file? (Nhibernate)

How do I secure my "hibernate.cfg.xml" file? (Nhibernate). It currently sits in the route of the web app and can be viewed via the browser. ...

c# linq conditional union

hi I have the following code and would like to only make each union if a condition is true. I Know I could write a select of if else but wanted to know if there is a slicker Linq way!? //join the list into one and sort by seqnumber SegmentList = Alist.Cast<BaseSegment>() .Union(BList.Cast<BaseSegment>()).Union(CList.C...

Fighting with certificates: Access was not successfully obtained for the private key

I work in company with many servers and Pcs for developers. Servers are win2003, PC developers Windows XP. In a server Win2003 named preiis01, in preproduction environment, other people in company install a client certificate using any other user (unknown user for me) for logging in server preiis01. I use my user "domainCompany\myuser"...

Sybase: create a database from a backup file

Hi there, Using SQL statements (sybase) how can I create or restore a full database given the conpressed backup file (myDatabase.cmp.bak). The reason i'm saying create or restore is that the DB already exists but I can drop it before creating it if that's easier. Do I need to worry about Device files? For example if the backup file us...

set position of grid view at runtime in asp.net

i want to show a grid in center on pageload and when i click on select button on grid it should shift to right of page.... now m using 2 grid to show it on center and on right... ...

Free Code Metrics Tool for .NET (should be callable directly from NAnt via Console)

Hi Everybody, I am looking for a free code metrics tool for .NET (mainly C# language). I have searched the web, but haven't found anything that matches my requirements. Requirements 1. LOC and CC metrics (mainly) 2. NAnt intregration is possible 3. No configuration file needed (provide the source files and config parameter via console ...

Setting Timer Interval to Infinite

I have a method that links a BO Connection.AliveInterval to a System.Timers.Timer (.NET 2). Some connections are managed to be always connected. Is it OK to set in such a case if (myConnection.AliveInterval == Connection.TimeInfinite) { myTimer.Interval = double.PositiveInfinity; } ? Should I expect that the Timer will throw ...

how to merge two changesets only (TFS)

You see 162489 and 162990, How can I merge them ? ...

Does Windows/.net put DLLs in the GAC automatically under any circumstances

I have a program which references a DLL. Code in this DLL gets the directory of the executing DLL and uses that to look for an XSD file to load (i.e. I expect the code to be executing from c:\foo\my.dll so it looks for c:\foo\validation.xsd). On of the thousands of customer installations I have this works fine. However in one case the D...