.net

Where can I find MS ActiveX Data Object (ADOR) Primary Interop Assembly (PIA)?

I'm trying to generate a Primary Interop Assembly for one of my projects that references Microsoft ActiveX Data Objects (MDAC 2.8). Adding this library through the References dialog box in Visual Studio adds the Interop.ADOR.dll file to the bin directory of the solution. However, when I run tlbimp.exe I get the error: C:\Solution> tlbi...

Entity Framework 4 Code Only Error "Multiple objects sets per type are not supported"

I have two "Code Only" POCO's using EF4 and the latest CTP, running against an existing, legacy database. Running a LINQ query against PocoA worked until I added a public virtual PocoB pocoB { get; set; } to PocoA. I was trying to add a relationship. Once I did that, I started getting the following error: Multiple object sets per typ...

What the .NET standard for remote method invocation?

Scenario: A common assembly defines domain object types (an assembly that is referenced by both client and server assemblies) A server assembly defines classes and methods that returns either primitive types or the types defined in the common assembly An client assembly needs to call the server defined methods and, of course, get their...

Detecting if Snipping Tool is open within a web application

Hi, I was just wondering - is it possible to detect, with either .net, SilverLight, Flash or some other plugin, whether or not Snipping Tool is open, or detect when the user opens it (after the page has loaded)? Also is it possible to detect when print screen is pressed even if another window is active? Thanks in advance. Regards, Ri...

How to send a multicast ping using .NET?

How can I send a multicast ping in .NET ? So that all computers on the network respond ? ...

Removing diacritics in Polish

Hi. I'm trying to remove diacritic characters from a pangram in Polish. I'm using code from Michael Kaplan's blog http://blogs.msdn.com/b/michkap/archive/2007/05/14/2629747.aspx, however, with no success. Consider following pangram: "Pchnąć w tę łódź jeża lub ośm skrzyń fig.". Everything works fine but for letter "ł", I still get "ł". ...

Is it better to use the [using] statement in C# or the [dispose] method? Does this apply to external (COM) objects?

What is better, the using directive, or the dispose directive when finished with an object? using(FileStream fileStream = new FileStream( "logs/myapp.log", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { using(StreamReader streamReader = new StreamReader(fileSt...

PropertyGrid alternatives

I love PropertyGrid, well, at least the concept behind it - use reflection and attributes to edit your objects without writing much UI code. My excitement died out pretty quickly though, the default PropertyGrid shipping with WinForms flat-out sucks. Well, it's fine for editing simple objects and such, but that's as far as it goes. It...

ASP.NET MVC helper for accessing Gravatar images

Whilst the Gravatar service's API (well, it's really just a URL) is pretty straightforward, is there a simple helper method out there that does a good job of reflecting all the options available for Gravatar? Image size Default image (when user hasn't specified one) Rating (G/PG/R/X) Ideally this would be an HtmlHelper extension meth...

What are the predominant .NET 3.0 mocking frameworks?

To preface this, I love Moq. I wish I could use it in .NET 3.0. Sadly, however, I cannot, but I would still like to use mocks for unit testing purposes. Also, I've used Rhino before, but I absolutely hate it. To be a little more descriptive, though, it's because the interface feels clunky and unintuitive--which can be dealt with--and the...

Google checkout integration with .NET

Hi all, I'm trying to use server to server XML API for google checkout with c#.net 3.5. I'm getting the following error when I try and post my URL "The remote server returned an error: (400) Bad Request." even though I'm sure I've followed their instructions to the letter. My code is below... help anyone? public void DoWebRequest...

Best way to compare complex strings in SQL or .NET

I feel like a bit of a newbie posting this, but anyway: I have a large number of stock items, 3000-5000 which have complex names, based on whoever has entered the items over a period of 16 years, and example of a name is: "Food, Dog, Pal Meaty Bites chunks 8kg bag" Another, related item is named: "DOG FOOD: Meaty Bites (Pal) 22kg ba...

Equivalent implicit operators: why are they legal?

Update! See my dissection of a portion of the C# spec below; I think I must be missing something, because to me it looks like the behavior I'm describing in this question actually violates the spec. Update 2! OK, upon further reflection, and based on some comments, I think I now understand what's going on. The words "source type" in t...

Regular Expression Help

Hi All I need help in regular expressions, match and replace pattens. I am working on rates. my rates can be like 345.00 456 2345.90 341.34 I have to check if the rate ends in 9, if not i have to end the rate with 9 and a $ symbol. The rates after running the rule should become $349.00 $459.00 $2349.00 $339.00 I am storing the r...

How to make Towers of Hanoi in C#

I have been trying to code Towers of Hanoi Game in Visual C# using the windows forms and 5 classes, The classes are called DiskMove.cs, Disk.cs, Board.cs, MainForm.cs (the form), and Program.cs(default class). I have got the Disk class working i think but I can't figure out how to do the other classes. The game must have have 4 Disks wit...

ShowDialog() doesn't bring form to top when owner is minimized

ShowDialog() doesn't bring form to top when the owner is minimized. It is shown and visible, but it is not focused and behind the current window. Even using the commented lines, I see the issue. public void Form1_Click(object sender, EventArgs e) { this.WindowState = FormWindowState.Minimized; // this.Hide(); ...

Find sequence in IEnumerable<T> using Linq

What is the most efficient way to find a sequence within a IEnumerable using Linq I want to be able to create an extension method which allows the following call: int startIndex = largeSequence.FindSequence(subSequence) The match must be adjacent and in order. ...

Windows Service: Where to write log messages (EventLog, File or DB Table) / Access from Web

We have a windows service (in .NET) that will write a fair amount of messages to a log. This log is of interest not only to server administrators but also to normal clients who use a web page to access the system. Or to us trying to remote debug the system! We are considering using the normal windows server event log, or writing to a ...

.Net Regex that Matches Strings With Any non-ASCII char in it

Looking for some black magic that will match any string with "weird" characters in it. Standard ASCII characters are fine. Everything else isn't. This is for sanitizing various web forms. ...

StackOverflowException in .NET 4

The following code works fine until I upgrade to .NET 4 (x64) namespace CrashME { class Program { private static volatile bool testCrash = false; private static void Crash() { try { } finally { HttpRuntime.Cache.Insert("xxx", tes...