.net

Replace Bad words using Regex

I am trying to create a bad word filter method that I can call before every insert and update to check the string for any bad words and replace with "[Censored]". I have an SQL table with has a list of bad words, I want to bring them back and add them to a List or string array and check through the string of text that has been passed i...

A check for update feature

I am creating a small .NET 4 application that will require small but frequent updates. Are there free/cheap services out there that will provide an update feature? Or, is this something that has to be developed into the application? ...

How Iterate from list of Anonymous Types?

Hi, i have this linq to entities query: c.CreateQuery<T_Hotels>("T_Hotels").Where(item => item.Id > 0).GroupBy(item => new { item.Location, item.Name }).Select(group => new { group.Key, Total = group.Sum(item => item.Id) }) I want to implement everything in a method of a class Helper, how declare the expressions of GroupBy and Select...

Is there a way to implement rolling log out put using standard .NET trace listener config (as opposed to one massive file)

Hi, I'm using .net web config to create trace listener for debug and trace output in a .NET web app. The problem is that if left, the log file, which always uses the same name can get massive and has actually caused me some application issues today. I can't find a method on the net of setting a log file size limit, or a method of usin...

Is it still benefitial to think about NHibernate for .Net while there is LINQ to SQL possibility?

Hi, I am not very familiar with both LINQ to SQL and NHibernate. As far as I understand LINQ to SQL is a kind of replacement of NHIbernate for .Net in many ways. So does this mean that LINQ to SQL is a built-in replacament of NHibernate which let's a .Net developer to skip NHibernate and start to work with LINQ to SQL? Thanks ...

How to have reflector load a different framework on load

When you first start .NET Reflector, it'll ask you what framework's base assemblies it should load. I often switch from framework to framework and wondered how I could have it popup that question each time (other than reinstalling). Or do I have to manually create lists for each I can't seem to find it anywhere in the menu or under opti...

How to use: PartCover .NET 4 with NUnit 2.5.6

Say I have Test assembly (NUnit compliant) App.Test.dll and a library to be tested App.dll. How do I get the code coverage analysis using PartCover and NUint? ...

transform UT8 to UCS-2

Hi, I have recently learned that sql server 2005 does not support UTF8: http://stackoverflow.com/questions/3336992/utf8-problem-sql-server I believe it supports UCS-2 though and look for a way to transform UTF8 to UCS-2 without loss of information if possible. Is it? Any feedback would be very much welcome. Thanks! Christian PS: C#...

Next key in C# Dictionary

How to get an Enumerator to an item in a -Sorted- dictionary using key? Note:GetEnumerator() gets an Enumerator to first element.. But I need to get an Enumerator to the element with a given key in order to gain access to next elements using MoveNext() for example... Edit: Or a way to access next elements... Edit: I prefer a const ti...

XmlSerializer throws InvalidOperationException when having a namespace prefix in the attribute

I try to read an XML file that contains the following element: <ho:CODED-TYPE ho:BASE-DATA-TYPE="A_UINT16" CATEGORY="STANDARD-LENGTH-TYPE" ENCODING="UNSIGNED"> My class to describe this node looks like that: public ref class FIBEXCodedType { public: [XmlAttribute("ho:BASE-DATA-TYPE")] property String^ BaseDataType; [XmlAttr...

DAL: repository boundaries question

There is DAL library that exposes dozen of repositories. One repository per entity. There is PersonRepository & PhotoRepository. When I add a new method to repository and method deals with entity it's obvious where I have to put it. If I want CreatePerson I'll create PersonRepository::Create(...) or when I need to update photo I'll cre...

How can I assign an integer to 3Bytes of field?

Hi, I have retrieved the Size of my Struct by using size of like below: int len = Marshal.SizeOf(packet); Now the len has a Value of 40. I have to assign this 40 to a 3-byte Field of my Structure.My Strucure looks like below: public struct TCP_CIFS_Packet { public byte zerobyte; public byte[] lengthCIFSP...

Loading many videos in WPF (.NET 4)

I am developing a WPF application (in .NET 4) which contains a lot of videos (40 videos, each video > 1 G) using the WPF media element. Unfortunately, I cannot load more than 10 videos at a time. When I try to display more videos, a black screen appears where normally the video should be played. Has anyone ever experienced such a pr...

Store IP Address in Data Base best way

Hi, I need create a table to store Black listed IP address in case of spammers in my blog. I would like to know: What is the best datatype to store IP addresses. What others field I can list in this table that you think could be useful against spammer. I use MS SQL 2008 DB Thanks for your time ...

Strange case with crystal report.

I am using crystal reports CR XI R1 and CR XI R2 in the application. When I run the application in Windows 7 64-bit OS as 32-bit application, crystal reports works perfectly. However, if the same application is installed in Windows 7 32-bit OS, crystal report doesn't work. Shouldn't it be opposite of the above case? I thought it should ...

.NET Assembly Version

Hi, The scenario is as follows. Developers compile the projects and deploy assemblies to production. eg, deployment contains 10 assemblies. Out of 10, they actually change the source code only in 5 assemblies and they recompile other 5 assemblies without changing the source code. Before deployment, I want to trace which assemblies are ac...

Powershell webbrowser refresh makes my content disappear

I am writing a small powershell script using windows forms which generates an HTML signature. The user can edit size, color etc and the script generates the html as a from their choices, and updates (theoretically) my WebBrowser preview when they press a preview button. My WebBrowser Control: $Preview = new-object System.Windows.Forms...

Why do .NET web request classes re-run requests without authentication headers?

I'm writing a WPF test application against a WCF REST service running on Azure local development fabric with a custom Basic Authentication provider. When the test client makes a call, using either WebClient or HttpWebRequest, it passes the authorization header and the custom provider authenticates it. The service then receives the same ...

How to gracefully shutdown socket in C#

I have a TCP client/server application. 1) server is listening on a port 2) client send request and server accept the connection 3) send receive operation performed 4) server tries to disconnect the connection (first Shutdown then Close) 5) connection state changed to TIME_WAIT 6) the next time client open another socket but sending do...

Kill child process when parent process is killed

I'm creating new processes using System.Diagnostics.Process class from my application. I want this processes to be killed when/if my application is crashed. But if I kill my application from Task Manager, child processes are not killed. Is there any way to make child processes dependent on parent process? ...