.net

Extracting information from a SPARQL query using regular expressions

I am having a hard time creating a regular expression that extracts the namespaces from this SPARQL query: SELECT * WHERE { ?Vehicle rdf:type umbel-sc:CompactCar ; skos:subject <http://dbpedia.org/resource/Category:Vehicles_with_CVT_transmission&gt;; dbp-prop:assembly ?Place. ?Place geo-ont:parentFeatu...

What is the difference between SqlException and SqlExecutionException?

What is the difference between SqlException and SqlExecutionException? I understand that SqlException is an exception (or warning) thrown by SqlServer itself. But in what cases the SqlExecutionException is thrown? Why it is defined under System.Web.Management namespace? ...

Given a GUID representing a user in Active Directory, how would I use this to determine the distinguished name?

Given a GUID representing a user in Active Directory, how would I use this to determine the user's "distinguished name" using C#? The GUID is retrieved earlier in our application using directoryEntry.Guid; MSDN Link ...

Controlling a USB device from a web application

I would like to be able to control a USB device from a web application. I was hoping to use Adobe Flex but I don't think that Flex can support access to USB devices. Is this possible using Java applets, or a similar approach using .NET? Thanks. ...

Cross-process read-write synchronization primative in .NET?

Is there a read/write locking mechanism that works across processes (similar to Mutex, but read/write instead exclusive locking)? I would like to allow concurrent read access, but exclusive write access. ...

SyncLock on two objects

Suppose I have two objects a and b. I want to SyncLock on both objects. Is this feasible? Can it be done by nested SyncLock statements? What are the dangers of such an operation? Edit Perhaps I should ask, how can one refactor to avoid deadlocks? ...

.NET: drawing text hangs - FormattedText bug?

A customer has reported that our software hangs when he runs it on one of his computers. We narrowed down the problem to rendering text with FormattedText and put together a simple application for him to try, which just renders some text with different font parameters - this would hang too. Here's the bit of code which does the actual t...

Need something like locals in python

It works like that: >>> def foo(arg): ... x = 1 ... print locals() ... >>> foo(7) {'arg': 7, 'x': 1} >>> foo('bar') {'arg': 'bar', 'x': 1} And i need something like this in c# .net, or how is it possible to implement it myself? ...

Rebinding DGV Combobox Column. C#.Net 2008, Framework 3.5.

I have a dgv that's bound to a table tblQuoteItems. One of the columns of the dgv is ItemID which is a combobox column. Its value is obtained from ItemID field of tblQuoteItems. Before binding the dgv, the ItemID column is populated from tblItems table containing fields ItemID and Item. The ItemID column of the dgv has ItemID as val...

Prevent XmlTextReader from expanding entities

I am trying to read a XML document without expanding the entities, do some manipulations to it, and re-save it with the unexpanded entities as they were initially. When using the XDocument directly, it fails to load, throwing an exception tell me it has unexpanded entities: XDocument doc = XDocument.Load(file); // <--- Exception // .....

LdapConnection cannot re-bind other than with Basic authentication

I'm a little lost with this one. I'm calling in the .NET LdapConnection object in the following code. The first query works just fine (the SearchRequest), and uses the default Authentication Type, Negotiate. In the foreach loop of this sample code I'm then trying to do a bind to check the password of the user I hard coded in the search...

How are .NET assembly references "translated" to file paths?

I'm trying to troubleshoot a .NET 2.0 error with Outlook Web Access on a SBS 2008 Server. The error I'm getting is: Exception information: Exception type: HttpException Exception message: Could not load file or assembly 'Microsoft.Exchange.Data, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its de...

Need to know if my threading lock does what it is supposed to in .Net?

I have an application that, before is creates a thread it calls the database to pull X amount of records. When the records are retrieved from the database a locked flag is set so those records are not pulled again. Once a thread has completed it will pull some more records form that database. When I call the database from a thread shou...

wcf 3.5 REST service works with XML but not JSON response format

I have a service contract with several operation contracts defined. I have added a new endpoint to expose my operations as a restful webservice. Moreover I've updated operation definitions so that they can be called in a RESTful way [OperationContract] [WebInvoke( Method = "GET", ResponseFormat = WebMessageFormat.Xml, ...

Typed Dataset ConstraintException on insert

Basically I have a table that contains hierarchical data. So I have an id column, and a rollup column which points to the id column for each child's parent. This table is loaded from the database using GetData() on the TableAdapter then the table's primary key autoincrementseed is set using: SELECT IDENT_CURRENT('TableName') + 1 ...

Conflict between Global.asx and CSS

Hi, I need to restrict multiple users from logging into my system. I am using Application_OnPostAuthenticateRequest event in global.asax to see if anybody is logged in. It works really well. But CSS is not loading and the screen looks horrible. If I comment out the code in that event, the page renders perfectly... What am I missing? W...

Need help with .Net SOLID design

I'm trying to stick fast to Robert Martin's SOLID design principles for the first time, and I am not good at it. In essence, I need a hierarchy of "Node" objects. Some nodes are NodeHosts, some are NodeChildren and some are Both. Everybody's done this one before, but I can't figure out how to do it SOLID without over-complicating the ...

F# - The type int is not compatible with type unit

Quite new to functional languages, but I'm maintaining someone else's code with a lot of F#. Can anyone offer some insight into this? let mtvCap = Rendering.MTViewerCapture(mtViewer) mtvCap.GetCapture() mtvCap.ToWpfImage() grid.Children.Add(mtvCap.ImageElement) MTViewer.ImageViewer is of type System.Win...

Porting VC 6.0 Application to VS 2003 VC++ application

I have an application which is written in VC++ using VC 6.0 version. Now i open the project in VS2003. Does my project now have any link or relation with .Net framework as i am not using the .Net framework. Will the VC 7 compiler bring about a relationship with . Net. ...

why does my silverlight reference to my wcf service blow up when I add a method to the wcf service that returns a generic list

I have built a WCF Service that is being consumed by a Silverlight app. At first I created one method that was very simple: public String SfTest() { return "SF Test"; } No poblem. My silverlight app references my service and displays "SF Test" in a textbox. Now I add a method to my wcf service like this: ...