.net

Regex failing on right parens

I have this .NET regex: ^(?<prefix>("[^"]*"))\s(?<attrgroup>(\([^\)]*\)))\s(?<suffix>("[^"]*"))$ It properly matches the following strings: "some prefix" ("attribute 1" "value 1") "some suffix" "some prefix" ("attribute 1" "value 1" "attribute 2" "value 2") "some suffix" It fails on... "some prefix" ("attribute 1" "value (fail) 1"...

Multiple DB Updates:

Replaces Question: http://stackoverflow.com/questions/184096/update-multiple-rows-into-sql-table Here's a Code Snippet to update an exam results set. DB structure is as given, but I can submit Stored Procedures for inclusion (Which are a pain to modify, so I save that until the end.) The question: Is there a better way using SQL server...

Powershell Generic Collections

I have been pushing into the .Net framework in powershell and I have hit something that I don't understand. This works fine: 13# $foo = New-Object "System.Collections.Generic.Dictionary``2[System.String,System.String]" 14# $foo.Add("FOO", "BAR") 15# $foo Key Value --- ...

What is an intuitive way to move an XmlNode from one XmlDocument to another?

I have two XmlDocuments and I would like to move an XmlNode selected from one of the documents and append it at a particular location in the other document. The naively intuitive approach of simply calling AppendNode(xmlNodeFromDocument1) at the appropriate place of document 2, of course doesn't work because the method does not take car...

How to get an image stored as an oracle blob into an Image object

I am trying to retrieve an image stored in an oracle blob and place it in a new System.Drawing.Image instance. I know I can write the stream to a temp.bmp file on the disk and read it from there but thats just not l33t enough for me. How do I convert the blob object directly to an image? ...

Create GUI similar to Windows Explorer using WPF

How would you implement a GUI similar to the "My Computer" view in Windows Explorer? In particular the "Icons" view mode. Including the grouping of different item types (as Files Stored on This Computer/Hard Disk Drives/Devices with Removable Storage groups in Windows Explorer) In WinForms I would use a ListView for this thing but in W...

ListBox keep selection after losing focus

I have a ListBox that when in focus, and when I have an item selected returns a valid SelectedIndex. If I have a valid SelectedIndex and I click on a TextBox on the same Forum, the SelectedIndex now becomes -1. However I want it to keep its SelectedIndex from changing. How would I go about doing this? ...

Play Audio from a Stream using C#

Is there a way in C# to play audio (e.g. MP3) direcly from a Stream (I mean the real .NET class) that for instance was returend from a WebRequest without saving the data temporarily to the disk? Solution with NAudio With the help of NAudio 1.3 it is possible to: load a mp3 file from a url into a MemoryStream convert mp3 data into w...

Which Facebook .NET Library is the best to use?

There is a list of projects here, mainly the Facebook Developer Toolkit and Facebook.NET. However, I've seen a lot of negative feedback about the toolkit and it seems like Facebook.NET hasn't been upgraded to the latest facebook API. Are either of these worth using? Any other good libraries out there? Specifically I'm looking to use t...

Windsor Container and internal properties

Is there any solution how to initialize properties of component marked as 'internal'? What assembly name should I use for InternalsVisibleTo attrribute or it won't help? ...

Draw shapes or images on a curved path

I am looking for a drawing library or code examples to draw images or vector shapes repeated along a path which could be curved. I found a cocoa library which is what I am looking for http://apptree.net/drawkitmain.htm but for .NET. ...

How do I resolve "%1 is not a valid Win32 application"?

Environment: Windows Server 2003 R2 Enterprise 64bit, SP2 .NET framework is supposedly installed (2.0 SP2, 3.0 SP2, 3.5 SP1) I say "supposedly" because they are listed as installed under Add/Remove programs. I'm not sure it's properly installed, because the "ASP.NET" tab isn't added to any of the sites in IIS. In the IIS Web Service Ex...

Learning LINQ: QuickSort

I took the plunge this afternoon and began studying LINQ, so far just mucking around with LINQ on collections. One of the first things I tried was to implement QSort. Now -- ignoring the fact that I could just use an ORDERBY and that this is a very silly qsort implementation -- what I came up with was this: public class lqsort { p...

Can I inject a thread in a remote app domain from C#

I was wondering if its possible to inject a thread into a remote app domain running in a separate process. My guess is that I could do this using the debugging interfaces (ICorDebug) but I was wondering if there is any other way? ...

How to avoid screen flickering when a control must be constantly repainted in C#?

I have a simple panel that is used as a drawing surface. The goal here is to draw a 4 pixel wide outline around a child ListView under certain circumstances. I would like to make the outline pulsate when something can be dragged into it. I am just drawing a simple rectangle around the ListView and updating the opacity of the rectang...

How to make Publisher Policy file redirect assembly request

I have created a common library at work, and it is installed in the GAC on our test server. I've recently updated it and I want all of our applications to be using the update. I created a publisher policy assembly and installed it in the GAC along with the update, but when a web app loads Leggett.Common, 1.0.0.0, it isn't redirected to L...

How do I get and set Environment variables in C#?

How can I get Environnment variables and if something is missing, set the value? ...

How can I make a class global to the entire application?

I would like to access a class everywhere in my application, how can I do this? To make it more clear, I have a class somewhere that use some code. I have an other class that use the same code. I do not want to duplicate so I would like to call the same code in both place by using something. In php I would just include("abc.php") in bot...

Issues with client consuming a .net web service upgraded from .NET 1.1 to 3.5

I am working on a web application that was recently converted from Visual Studio 2003 to Visual Studio 2008. The application contained some web services that were written using the .NET 1.1 Framework and Web Service Enhancements 2.0. They were converted to the .NET 3.5 framework using the VS 2008 Conversion Wizard Tool. A client appli...

FileLoadException on windows 2003 for managed c++ dll

My company has login integration with GroupWise, and Exchange 5.5/2000+. The Exchange 5.5/GroupWise logic is done using wldap32.dll (win32), and so the login code is in a managed c++ class. When the configuration tool (or the backend service) tries to load the dll built off this managed c++ project on my XP development box, it works fi...