.net-3.5

Convert WMI Win32_OperatingSystem InstallDate to mm/dd/yyyy format (C# - WPF)

Hi, I am wondering how you would convert the date and time from 20100131022308.000000-360. I've been trying to figure it out for a while now and I can't seem to get anywhere. I am using C# in a WPF Application. ...

Can someone tell me where i can get the source code to create a simple Q&A forum using ASP.Net (Visual Studio 2005) ?

Can someone tell me where I can get source code to create a simple question answer forum by using ASP.Net (Visual Studio 2005) ? As per the requirement I need to get a prototype for this type of question answer forum which can be used along with a Reporting application. I can use Visual studio 2005/2008. Infact, I may be given the libe...

I'm a beginner of ASP.Net(c#). I want to build a simple threaded forum where clients can raise their questions and the answer would be given online.

I'm a beginner of ASP.Net(c#). I want to build a simple threaded forum where clients can raise their questions and the answer would be given online. Could you please show me some sample source code? The simpler, the better. ...

WPF FontSize style hangs / freezes / stops responding

Right, so on my desktop the following very very simple code hangs / freezes when compiled and run on the framework 3.5 <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Window.Resour...

Eficient way to remove all entries in a dictionary lower than a specified value

Hi everyone, so i need to remove all entries in a dictionary accordingly to a specified lower bound. My current solution is this: List<string> keys = new List<string>(); foreach (KeyValuePair<string, int> kvp in dic) { if (kvp.Value < lowerBound) keys.Add(kvp.Key); } foreach (string key in key...

Adding new line to label

I get the data from the database and display that data on the label. I have to apply new line on the text of the label for every 35 charecters. Because after 35 charecters the text overflows. Can you please let me know how to do this. ...

Validating disconnected POCOs

In my ASP.NET application I have separate projects for the Data, Business and UI layers. My business layer is composed of plain objects with declarative validation, using DataAnnotations. Problem is, when it comes to save them, I'm not sure how to process the validation, since they're not bound directly to any data context, but rather,...

Matching paragraphs with regex

Can somebody explain me why the following text: <p>some text some text...</p> <p>another text another <b>text</b>again</p> can't be parsed with the following regular expression: <p>.*?</p> (to retrieve every paragraph). The regular expression that should match the text between the first opening <p> tag and the last closing </p> tag...

Asp.Net Mvc 2 - RenderAction List with a create

First, I use Asp.Net MVC 2 RC 2. What I want to do is to list a comment view and below this view being able to add comment (with validations). For example, something like when you add comment in stackoverflow. Except that my page should work with or without javascript enabled. So to solve that problem I use the new RenderAction and it ...

Unexpected issue Copying Dictionaries

My idea was to copy a dictionary while resetting all the values of the previous one, so i have this instruction: var dic2 = new Dictionary<string, int>(dic.ToDictionary(kvp => kvp.Key, kvp => 0)); However i had an unexpected problem doing this, since the new copied dictionary doesnt have the same order of keys of the previous one....

Simple user registration without captcha or e-mail verifiaction with Asp.net

I want to create a simple user registration form with First / Last name, email, and password. We have used captcha and email verification in the past to ward off bots, but is there another way without using those techniques? I thought about encrypting the field ID names so that they aren’t names username, password, etc. we tried openID,...

SqlDependency query with WHERE clause not allowed. How can I modify it to be valid?

I have a SqlDependency set up using the following query: string sql = "SELECT dbo.Case.CMRID, dbo.Case.SolutionID, dbo.Case.CreateDT, dbo.Case.ModifyDT " + "FROM dbo.Case " + "WHERE dbo.Case.ModifyDT > '" + LastExecutionDateTime + "'"; Executing this query causes the OnChanged event to fire continuously with a type of Invalid and Sour...

WCF hosted in a Web application and compatibility mode

I have a WCF service hosted in a web application (IIS). I need to expose 1 end point over wsHttp and the other over netTcp. I am on a IIS7 environment that makes it possible for me to host non HTTP based services. Anyways, when I browse the .svc file using a browser, I get the error: The service cannot be activated because it does not s...

Creating a custom GridView control that supports DynamicData

I'm very disappointed in the built-in GridView control. I wanted to make a simple data-entry web application, thinking Dynamic Data would save me time. But it turns out that the GridView doesn't even support basic user interface scenarios such as inserting a new row. Since the project I'm building will incorporate this scenario a lot,...

running VisualStudio CF3.5 apps on WINCE

Hi, I am trying to write a program for a chinese PNA device with wince 5.0. But everytime I write a simple program in VS8 with C# and 'deploy' it to my device it just doesn't run. First it complains about disposing an object call menu, although I don't want an menu but VS8 just creates one for me. If I delete the menu from the form the ...

Bag of Words representation problem

Basically i have a dictionary containing all the words of my vocabulary as keys, and all with 0 as value. To process a document into a bag of words representation i used to copy that dictionary with the appropriate IEqualityComparer and simply checked if the dictionary contained every word in the document and incremented it's key. To g...

case insensitive string search csharp

Hi There, What is the quickest most efficient way to search text for words using non-casesensitive search. E.g here is my text to be searched : string textTosearch = "Here is a paragraph or Some text. Here is some more text". If i wanted to find the indexes of "Some" and "some", is there a .Net class string that does this or would i nee...

How do I generate a custom SID?

I need to generate custom SIDs for users in my web application for use with Microsoft AzMan. What is the best way to do this? What do I need to know before doing this? This is what I'm thinking, but I'm not sure if I'm missing something: S-1-9-1234-{user_id + 1000} S-{first revision}-{resource manager authority}-{domain (unique number...

Dash (-) in anonymous class member

Hi, is it possible to use dash (-) in a member name of an anonymous class? I'm mainly interested in this to use with asp.net mvc to pass custom attributes to html-helpers, since I want my html to pass html5-validation, this starting with data-. Exemple that doesn't work: <%=Html.TextBoxFor(x => x.Something, new {data-animal = "pony"})%...

Passing Forms Auth User credentials to SQL Server database connection

My web app is using .NET 3.5 framework, VS 2008 with a SQL Server database. I am using Forms authentication and the generic login to validate user access to the aspx pages. Is there a way I can pass the user's form auth credentials (different from their Windows login) to the sql server connectionstring so that their database permission...