.net

Detecting Ethernet Port insertion/removal in my winforms application?

Hi, I would like to detect when a device is connected to an ethernet port of the machine that my application is running on. I know how to do this with a USB port but the problem is, the Port isn't USB! If it was a USB device I would simply override WndProc and catch the message, if it is WM_DEVICECHANGE, then i'm on to a winner, I was ...

Oracle Advanced Queueing with .Net

Somebody knows how to implement Oracle Advance Queue from C# using PL/SSQL and ODP.NET? I can't find a single example or resource with concrete examples in C# or VB.NET. Ideally I would like some examples on how the enqueue and dequeue messages with simple types (XMl/string). ...

How can i globally set the Culture in a WPF Application?

I would like to set the Culture of a WPF application to a specific one based on user preferences. I can do this for the current thread via Thread.CurrentThread.Current(UI)Culture, but is there any way to do this globally for the application (so it affects all threads by default)? ...

What is a real-world application for HORN?

I've been hearing a bit about HORN lately, and wonder what problems it can solve or how a real life situation of using it is beneficial. http://code.google.com/p/hornget/ ...

How do I extend Html.ValidationMessage so that I can include an image as the error?

I would like to reduce the following code. The below code works, however it is not very tidy etc. <label for="Name">Name:</label><%= Html.TextBox("Name")%><% if (!string.IsNullOrEmpty(Html.ValidationMessage("Name"))) { string Error = HtmlRemoval.StripTags(Html.ValidationMessage("Name")); %> <img src="Error.gif" alt...

What kind of Queues are lists and dictionaries?

I'm just wondering what kind of queues are lists and dictionaries in C#. Whether they're FIFOs or LIFOs. ...

Dynamically Added Client Script/HTML Calling Server-Side Event

My problem is in regards to calling a server-side event (e.g. DeleteClicked) from dynamically generated html/javascript on the client. I have an existing page on my website that is deeply rooted in .net. The page lifecycle is pretty complex and there are dozens of events that can be fired from the page. We want to start taking advantage...

Pass network credentials by .net remoting.

How I can pass my NetworkCredendials by .Net Remoting? Is it possible? I've a service (TeamFoundationServer) where need a authorize using user's NetworkCredentials. In past, I had used open User/Password pair, but for security reason at now it is not good. Problem is that NetworkCredentials is not serializable, and I can't pass it as p...

List of .NET blogs worth following

Possible Duplicate: Which C#/.Net blogs do you read? As a .NET developer I follow these blogs so far: ASP.NET Weblogs DotNetKicks CodeBetter Visual Studio Magazine Blogs Scott Gu Phil Haack Brad Wilson Which ones would you reccomend on top of these? ...

Are there any .NET web automation frameworks that support headless test execution?

Similar to htmlunit, but for use with C#. I've seen that you can use htmlunit with .NET via IKVM, but I'd like a native solution if at all possible. The aim is to add UI tests to our existing (xUnit.net) tests being run on the CI server. I'd like to be able to run UI tests in memory (since I don't want to be opening browser instances on...

Retrieving an image from database with Linq to SQL

In my database I have stored images in the "image" data type, showing up as a binary code. I now want to retrieve all images from one column and diplay them on a asp.net page with C#. databaseDataContext db = new databaseDataContext(); var images = from Picture p in db.Pictures select p.pictureThumb; then I use t...

WPF Binding when a button is pressed (Explicit binding) has always BindingExpression at null?

I have a textbox that contain a string that must be binded only when the user press the button. In XAML: <Button Command="{Binding Path=PingCommand}" Click="Button_Click">Go</Button> <TextBox x:Name="txtUrl" Text="{Binding Path=Url,UpdateSourceTrigger=Explicit, Mode=OneWay}"></TextBox> In the code-behind: private ...

copy whole shared directory from network

Hi I am trying to copy whole directory tree from server's shared folder to my local machine, I found Best way to copy the entire contents of a directory in C# post and decide to use that but as I guess DirectoryInfo doesn't support network shares, how can I change this code to work with network shares as a source? public static void Co...

Why can static classes not implement interfaces?

Possible Duplicate: Why Doesnt C# Allow Static Methods to Implement an Interface? In my application I want to use a Repository that will do the raw data access (TestRepository, SqlRepository, FlatFileRepository etc). Because such a repository would be used throughout the runtime of my application it seemed like a sensible thing ...

What does .NET Dictionary<T,T> use to hash a reference?

So I'm thinking of using a reference type as a key to a .NET Dictionary... Example: class MyObj { private int mID; public MyObj(int id) { this.mID = id; } } // whatever code here static void Main(string[] args) { Dictionary<MyObj, string> dictionary = new Dictionary<MyObj, string>(); } My question is, how...

.Net Web Service call from php

How can I call a .Net Web Service from within php. Are there any useful libraries for php 4/5 ? ...

What kind of memory semantics govern array assignment in c#?

Given the following: byte[] sData; and a function declared as private byte[] construct_command() if I were to then assign the result of construct_command() to sData would sData just point to the contents of what's returned from the function or would some space be alloctaed for sData in memory and the contents of the result of the functi...

Can I add a linq compiler to my project?

I'd like to allow some of our business analysts to write in linq instead of SQL where applicable. Corporate would never go for allowing linqpad to be installed, so where would I start on learning how to allow say simple linq queries or expressions in vs2008 project? Is there sometype of eval() function for .net that would compile and ru...

Membership.GetUser() fails when called from an HttpModule

I'm calling Membership.GetUser() from inside Application_Error() method in Global.asax file in an ASP.NET application in order to write down some log information. However, it seems to fail if an error happens inside an HttpModule. Is it normal? Isn't Membership ready while executing HttpModules in ASP.NET? Am I doing something wrong?...

Removing black border around an image

I have a few JPG Images. Some of them may have a black border on one or more sides, and I'd like to remove them. The black border may not go around the actual image - some may only have the border at the bottom (with the actual image at the top), while some could be centered (which means black borders on two sides, but not connected). Wo...