.net

Regex.Replace why does \b prevent this?

Why does the second statement fail? works Regex.Replace("zz WHERE zz", "where", "yy", RegexOptions.IgnoreCase | RegexOptions.Singleline); does not Regex.Replace("zz WHERE zz", "\bwhere\b", "yy", RegexOptions.IgnoreCase | RegexOptions.Singleline); This works to but replaces the space which i do not want to do Regex.Replace("zz WHE...

Best way: to implement an interrupt/cancel feature for all your threaded workers.

Hello there, So my question is how to implement cancel/interrupt feature into all (I mean ALL) thread workers in your application in best and most elegant way? It's not important if it's an HttpWebRequest, IO operation or calculation. User should have an possibility to cancel every action/thread at any moment. ...

WebServices does not interact with App

Problem: (Solution at the end) I got a Silverlight App with-in a Web Project Web Silverlight The web contains a service: [WebService(Namespace = "svChat")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. //[S...

How can I adjust the CommandTImeout in DbFit for long running queries?

Is there any way to increase the CommandTimeout for DbFit queries? I have a long running stored procedure that times out when running it in a DbFit Test. It's possible for the procedure to run for a really long time (processing millions of records) and would like to have DbFit wait until it's completed, even if it takes several minutes...

Makefile for ASP.NET Website project?

Correct me if I'm wrong - I understand a C#/.NET application's .csproj project file is effectively its makefile or build file. A Website project does not have a .csproj file (not to be mixed up with Web Application which does). In the case of a Website project, can I create a makefile equivalent, or does it use a build process/instruct...

What are good introductory resources for expert developers new to the .NET framework?

I have a client who wants to transition off their old environment into .NET. The client has a good grounding in basic OO concepts (their existing development environment supports this) and are expert developers, but need a quick "up to speed" introduction to the .NET framework (C# as the chosen language) for building Line of Business a...

Continuous Deployment with an ASP.NET website?

I have a website in C#/ASP.NET that is currently in development. When we are in production, I would like to do releases frequently over the course of the day, as we fix bugs and add features (like this: http://toni.org/2010/05/19/in-praise-of-continuous-deployment-the-wordpress-com-story/). If you upload a new version of the site or e...

WCF REST Starter Kit not filling base class members on POST

I have a WCF REST Starter Kit service. The type handled by the service is a subclass of a base class. For POST requests, the base class members are not correctly populated. The class hierarchy looks like this: [DataContract] public class BaseTreeItem { [DataMember] public String Id { get; set; } [DataMember] public St...

MVC: What would be the best way to keep a reference to the current user in your controllers?

I'm an app where everything is tied to the currently connected user. So far almost all my actions have a call to my UsersService.GetUser(guid) method which brings the user and all its associated data. It does work ok but having said call in every action is really bothering me. After giving it some thought I decided to go with a base con...

XNA vs SlimDX for offscreen renderer

Hello, I realise there are numerous questions on here asking about choosing between XNA and SlimDX, but these all relate to game programming. A little background: I have an application that renders scenes from XML descriptions. Currently I am using WPF 3D and this mostly works, except that WPF has no way to render scenes offscreen (i.e....

Deciphering which control fired an event

I have an application with many images that all look the same and perform similar tasks: <Image Grid.Column="1" Grid.Row="0" Name="image_prog1_slot0" Stretch="Uniform" Source="bullet-icon.png" StretchDirection="Both" MouseDown="image_prog1_slot0_MouseDown"/> <Image Grid.Column="1" Grid.Row="1" Name="image_prog1_slot1" Stretc...

Question about migrating from ASP .NET User Controls to .NET 3.5 Master Page technology

When migrating from an ASP .NET user control -based page with a header, footer, and menu to a Master Page using the same HTML mark-up, is it normal for CSS or javascript behaviors to change slightly? In particular, the submenu bar text now appears run together (which looks like a CSS symptom) and the graphics on the line above it appe...

Unboxing to unknown type

I'm trying to figure out syntax that supports unboxing an integral type (short/int/long) to its intrinsic type, when the type itself is unknown. Here is a completely contrived example that demonstrates the concept: // Just a simple container that returns values as objects struct DataStruct { public short ShortVale; public int In...

Error exposing event through interface

I have this interface Interface IProDataSource Delegate Sub DstartingHandler(ByVal sender As Object, ByVal e As EventArgs) Event starting_Sinc As DstartingHandler End Interface Trying to use the interface like this Public Class DataSource : Implements IProDataSource Public Event starting_Sinc As DstartingHandler Impl...

A 110 kb .NET 4.0 app needs 10 seconds for a cold start, thats not acceptable !

Hello, I am using the .NET 4.0 client profile for my app and I run a dual core with 4 GB Ram and a fast hard disk. nothing big is done at the start just showing a generic List in a wpf listview. How can I make the cold start faster of my assembly ? I have done now again a cold start and run the windowsapplication.exe in my \obj\x86\D...

Active Directory LDAP - Lock User Account

What is the best way to use System.DirectoryServices.AccountManagement to lock an Active Directory user object? I'm able to determine if an account is locked using.. UserPrincipal principal = new UserPrincipal(context); bool locked = principal.IsAccountLockedOut(); How do I lock the account? Is there an alternative to doing something ...

What is the fastest way to calculate a Windows folders size?

I need to calculate the size of hundreds of folders, some will be 10MB some maybe 10GB, I need a super fast way of getting the size of each folder using C#. My end result will hopefully be: Folder1 10.5GB Folder2 230MB Folder3 1.2GB ... ...

How do I get the XML data that went down the wire from a WCF Service generated from `Add Service Reference`

Assume I have code like this: var svc = new Namespace.SvcClient(); var request = new Namespace.SvcRequest(); request.SomeProperty = "Value1"; request.SomeProperty = 4.0d; var response = svc.Request(request); SetText(response.Result.ToString()); svc.Close(); What I want to have is the actual XML that got sent out as the result of svc.R...

How best to organize projects folders for unit tests in .NET?

So I'm trying to introduce unit testing to my group. I've successfully upgraded a VS'05 web site project to a VS'08 web application, and now have a solution with the web app project and a unit test project. The issue now is how to fit this back into the source repository such that we don't break the build system and the unit test proje...

How to assign class instances in exception handler during constructor execution

public Alphabet(params char[] list) { this.ExceptionInitializer(); try { if (list != null) _alphabet = list; else throw this.NullableAssignment; //add exception handler; this._charCounter = list.Length; } catch (this.NullableAssignment) { ...