.net

A Dictionary API for C#?

Does anyone know a good .NET dictionary API? I'm not interested in meanings, rather I need to be able query words in a number of different ways - return words of x length, return partial matches and so on... Thanks ...

Using .NET Framework 3.5 in a SQL Server 2005 Stored Procedure

I have an SQL Server 2005 server, and I'd like to run a .Net CLR stored procedure on it. However, I'd like to use .NET Framework 3.5. If I try this right now, I get this error: Error: Assembly 'system.core, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089.' was not found in the SQL catalog. I'm told this is possible ...

How to implement design time validations for XAML, that result in compile errors?

How to enforce that developers writing XAML in Visual Studio should follow certain standards and validations need to be run and if invalid compile time errors are thrown. For example, making sure that all the databinding expressions (some are real long) are written correctly as per 'a custom validation' I would like implement, during de...

SOAP Attachment from .NET 3.5 to PHP web service

We've got a PHP web service which we need to send a file from a .NET 3.5 web app. The PHP team has stated that we need to provide the file in the form of a SOAP attachment, but we can't find a way from which we can do that in .NET. All reference examples that we've been able to come across refer to using the DIME, but that's not suppor...

Writing code to fire the last method to throw an exception in a multi-threaded web app

I was writing some try-catch blocks for various methods today, and thought to myself it would be good to have utility method which would automatically call the method again for a number of times specified in a parameter, at a certain time. However, I thought to myself, the method/property etc which will cause an exception will be at th...

How can I pass cookies into an external web browser?

I'm writing an application that will need to open up browser windows (probably can stick to IE) to websites that use Forms Authentication. The trick is that they need to be authenticated already, in order to save time due to the sheer number of sites we need to get into. (Eventually I'll be screen scraping them and processing the data....

What is the limitation in the length of an SqlCommand query

Is there a limitation in the length of a query that SQL Server can handle? I have a normal SqlCommand object and pass a very long select statement as a string. The query seems to be fine when running against an SQL Server 2005/2008 engine but doesn't execute against an SQL Server 2000 engine. I don't have any error details as I only...

Regex expression to split string into items

Hi, I've got text in a form of [1/12/2008 2:32:11 p.m. - name] line 1 [1/12/2008 2:36:00 p.m. - name] - PRIVATE line 2 [some text] sd [1/12/2008 2:36:00 p.m. - name] line 3 which i want to split into items so i have access to time, name and text of each item, e.g.: (item 1) 1: 1/12/2008 2:32:11 p.m. 2: name 3: line 1 (item 2)...

Set value of bound field to NULL using DataGridViewComboBoxColumn in DataGridView

I have a DataGridViewComboBoxColumn in a DataGridView that's based on a lookup table. The ValueMember and DisplayMember fields are bound to string columns in the DataTable. All rows have a value for both fields - except for a special record where the value field is deliberately set to NULL. However, when I choose this record an empty s...

C# 4 and CLR Compatibility

Are all the additions to C# for version 4 (dynamic, code contracts etc) expected to run on the current .NET CLR, or is there a planned .NET upgrade as well? ...

How can I use Mock Objects in my unit tests and still use Code Coverage?

Presently I'm starting to introduce the concept of Mock objects into my Unit Tests. In particular I'm using the Moq framework. However, one of the things I've noticed is that suddenly the classes I'm testing using this framework are showing code coverage of 0%. Now I understand that since I'm just mocking the class, its not running the ...

Closing StreamReader after ReadToEnd

Is it possible somehow to close StreamReader after calling ReadToEnd method in construction like this: string s = new StreamReader("filename", Encoding.UTF8).ReadToEnd(); Any alternative elegant construction with the same semantics will be also accepted. Thanks! ...

.NET equivalent of modern Java web architecture

Almost every new Java-web-project is using a modern MVC-framework such as Struts or Spring MVC for the web tier, Spring for the "Service"/business-logic-layer and an ORM mapper such as Hibernate for persistence. What is the equivalent in .NET? I guess ASP.NET is used for the web tier and ADO.NET for persistence but what is the equivale...

Free tool or library to convert Tiff files to pdf in .Net

Does any one know of a free tool or library to convert multi page tiffs to pdf in Asp.Net 1.1? ...

Best method of tracking users for unique visitor reporting using .NET?

I would normally use Google analytics because it is free and simple to implement but on this occasion we need an internally built reporting system. This system needs to be in .NET only because JavaScript is not an option. My question is how do you track unique visitors when you can never be sure that they have cookies turned on? I was ...

Is there a library for notification/alert in .NET?

I need to design a notifications framework written solely in .Net. I was wondering is there were some libraries already available to ease in creating rules for the notifications. PS: Anything other than SQL Server Notifications please. Note: Notifications as in Emails and SMS notifications. ...

How to detect Windows 64 bit platform with .net?

In a .net 2.0 C# application I use the following code to detect the operating system platform: string os_platform = System.Environment.OSVersion.Platform.ToString(); This returns "Win32NT". The problem is that it returns "Win32NT" even when running on Windows Vista 64bit. Is there any other method to know the correct platform (32 or ...

How to detect CPU speed on Windows 64bit?

I've found the following code from here "http://www.boyet.com/Articles/CodeFromInternet.html". It returns the speed of the CPU in GHz but works only on 32bit Windows. using System; using System.Management; namespace CpuSpeed { class Program { static double? GetCpuSpeedInGHz() { double? GHz = null; ...

COM Control colour(color) bug/problem when embedded in PowerBuilder

We have built some .NET controls, and we are using them as COM controls in a PowerBuilder application. They (mostly) consist of controls with other controls on them, some other of our custom controls, some from DevExpress. All of ours inherit from a common base - and this has the DevExpress LookAndFeel control on to ensure that we can e...

When does script added with RegisterStartupScript() execute?

When does script added to the page with Page.ClientScript.RegisterStartupScript() actually run? MSDN states "when the page finishes loading but before the page's OnLoad event is raised" but this isn't much detail. For example, can a script added with RegisterStartupScript assume the DOM tree has been built? Does the behaviour differ bet...