csharp

There are 4 entries for the tag csharp

Replacing passwords on application logs

Many applications write various information into log files and sometimes this information is sensitive, e.g. contains user passwords. In my case, I knew that we are logging SQL statements with stored procedures calls and one of the parameters may contain user’s password. So I have been asked to replace such passwords with something neutral. I’ve ended with following regular expression string (works only for stored procedures and alike call logs!): (?<Pre>(pass(word)?|pwd)[^=']*=[^']*'?)(?<Target>[^']+)(?<Post>'?) Technorati Tags: Regular Expressions, CSHarp, C#

Progress bar in Janus Grid

Janus's Grid doesn't allow custom controls inside its cells, but for my task, I had to show a progress bar on each row and was looking on how to do that. Well, I couldn't find any info apart from drawing the progress myself. Fortunately, progress bar is a simple rectangle and drawing rectangle is quite simple task. Below I'll explain how I did it. You can also download a zip file, containing sample project (you will have to have Janus GridEx installed on your system in order to be able to compile it though) - see the...

ADO.NET Entity Framework, SQLCE and identity columns

Recently I've doing some works using MS SQL Compact Edition and for data layer ADO.NET Entity Framework was chosen. Now MS only recently added support for SQLCE in the framework, so its kind of beta inside beta. Some features are not working properly or missing, as for example, support for identity columns. While SQLCE provides support for auto-generated columns, the framework doesn't yet have it. And of course all my IDs in tables are auto-generated integer values, e.g. identity. Of course the only option was to generate ID at client. But I didn't want to change everything to be GUID,...

Running .NET Windows service project from debugger

It sounds like an easy task, but I have seen many times that people actually do some strange stuff, trying to run a .NET project containing Windows service from debugger. So decided I'll write a small note on how do I do that. If you create a project for Windows service, using wizard in Visual Studio, try to execute it straight from debugger. You'll get that service cannot start or something similar. I do a small trick by checking if debugger is attached and calling some sort of Start method in such case, or executing code created by wizard otherwise....