.net

Log WCF Data Services POST contents

What is the best way to log the contents of anything POSTed to a WCF Data Service? I have tried using the service trace viewer but only see WebHeaders? Thanks ...

C# parse regional date time strings

Hey everyone, I am trying to make a small application for a project in which clients from across the world can use. The problem I am having is that the back-end is setup using XML files that gets generated and uploaded to a shared network and in these XML files I store a date time variable that says when a particular task started and fi...

How do you differentiate between application and infrastructure endpoints?

I'm creating a custom behaviour for WCF which can (for interoperability reasons) only function correctly when a service exposes a single application endpoint. I would like to be able to use the IServiceBehavior.Validate method to check that only one application endpoint is exposed by the service. Currently I'm doing the following: publ...

Trouble with Datagridview.ClearSelection()

Hello stackoverflow. I want my (readonly,fullrowselect) datagridviews to have no selected rows when the form is loaded. I tried .ClearSelection in the forms constructor after setting their datasource but it doesn't work (i would really like to know why...). Then i tried in the Form_load event but it won't clear the selection on the dat...

Close foreground thread gracefully on windows service stop

In my windows service I create one "parent" foreground thread that in turn spawns "child" threads using ThreadPool (which means they are background) to execute tasks. What is the best way to close foreground thread gracefully on windows service stop? Here is my current implementation (stripped out of task-specific logic): public parti...

Retrieving Local Resource Values correctly: GetGlobalResourceObject or .NET Control?

Hey guys, While developing I've seen a couple different ways to get local resources values from the resx files. Which one is considered the best practice? Using the GetGlobalResourceObject method: <a id="myLink" href="#"><%= GetGlobalResourceObject("Filter","Diary")%></a> Or using a control and setting the value directly in the resx...

When do I initiate and dispose my UserControls?

In a winforms application I have an options form. The form has a treview control and a panel control. Depending on the users choice in the treeview I want to load/add a usercontrol to the panel control. When should I be creating/initiating the usercontrols? On the form load eventhandler or once a treeview node is selected? And should I b...

Handling exceptions from a json request with ELMAH

Hi I am using ELMAH to handle expception in my MVC project. All is working fine, except for when the request is an ajax request. The exception is captured and logged but when I do a response.redirect to the error page, the redirect doesn't happen and the error message is displayed on the same page, overlapping the existing content. He...

Concurrent Priority Queue in .NET 4.0

It seems there are lots of improvements in .NET 4.0 related to concurrency that might rely on concurrent priority queues. Is there decent priority queue implementation inside framework available for reuse? ...

Code First CTP4: How to map these two entities

Let's say that I have two entities, Team and Match. In every Match, there are two teams, the HomeTeam and the AwayTeam. A Team can have many matches, but HomeTeam and AwayTeam can only have one team each. Sometimes Team is a HomeTeam, and sometimes the same Team is an AwayTeam. I have provided just the basics for each of the classes: pu...

Design for remote debugging and status checking

I have an application that runs on a headless linux box (a SheevaPlug, to be precise). (It collects data from a weather station and sends it to a database, in case you're wondering.) I'm having a hard time debugging problems with the application because I can only SSH into the box or view it on the network (thanks to Samba). I could log...

Add Factory Support for a Windsor Registration Dynamically

I have an interface public interface IResolver<T> { T Resolve(); } I know this isn't the ideal (service locator is an anti-pattern and all), but in some cases it's still necessary (for example WCF service activation - I don't want to instantiate the channel until Resolve() is explicitly called...and in the case of BasicHTTP, the ...

cli C++ how can I see my user control in toolbox?

I created A project, and in the A project, i created a Form named bform and a user control named cComtermizedCtrl , and i compiled the project successfully ,but I coundn't find the cComtermizedCtrl control in toolbox. why? ...

Add accent marks with custom colors in .Net's RichTextBox

Using the Text property of a WinForms' RichTextBox, you can show a letter with an accent above it, in a way that the letter is one character, and the accent is another one. I.e., also visually it looks like one character, it actually consists of two. In Unicode terms, the letter is called a 'base character', while the accent is called 'c...

Castle Windsor Internal Constructor/Class

I looked at this and it answers half my questions: http://stackoverflow.com/questions/2370546/castle-windsor-register-class-with-internal-constructor But can you use Windsor to use internal constructors/class along with dependency injection? (so constructor parameters get injected too)? I'd like to keep the class/constructor internal t...

DLL - Using main project classes in library class

I've never tried separating down my projects into DLLs but something I'm working on at the moment calls for a more modular approach. What I want to be able to do is switch out versions of a number of my classes easily to push updates to users without them having to re install my entire application. These classes create instances of oth...

Windsor Registration Child Container Visibility

I have some (sort of) Singletons which exist in three context: Per AppDomain Per HttpApplication Per Web Request Right now, I'm creating a child container per HttpApplication and another child per Web Request. This is necessary because some components SHOULD actually share singleton instances across the three layers. For security and...

Sending a processed video from C# program to C++ program

Hi all, I am capturing video from my webcam and it is processed by a C# program then i want to stream it to a C++ program. this C++ program can be configured to get a video stream from a webcam so is it possible to send/stream my processed video to this program where the C++ program detect that stream as a video which is coming from the ...

ASP.NET - Dynamic controls created in Page_Pre_init() or Page_Init() or Page_Load()

Where is the best place to create dynamic controls in ASP.NET? MSDN says Pre_init , another MSDN article says Init, and some people say the Load event (which I read isn't good to do). I'm studying for a MS certification and I want to make sure I know which one is ideal and why. My initial thought would be to create the object in pre_i...

Automatic sorting

Is it possible to get nhibernate to sort lists on a specific property/column (if no sorting have been specified)? Maybe in the mapping files or in some other way? ...