F # comparing unions discriminated by case identifier

Is there a way to compare discriminated unions by their case-identifiers in F#? type MyUnion = | MyString of string | MyInt of int let x = MyString("hello") let y = MyString("bye") let z = MyInt(25) let compareCases a b = // compareCas

LINQ Query Throwing a Cast Exception

I am attempting a LINQ query in a VB.NET WPF solution that bridges two datatables and groups by a Zone. I am receiving an "Invalid Cast Exception" on these rows: .MfstCt = ZoneGroup.Count(Function(c) c.Field(Of String)("ConsignmentNumber&qu

Best way to load an XML

I am reading a XMl and using it for some processing in my application. var config = XElement.Load("c:/sample.xml"); Is there anyway to do load it in a better way? it takes a while while trying to process this line of code.Look at XmlReader class

What are the responsibilities of the data layer?

I'm working on a project where I had to add a data layer to my application. I've always thought that the data layer is purely responsible for CRUD functions ie. shouldn't really contain any logic but should simply retrieve data for the business layer

Fingerprint reader on node.js via .NET SDK

I'm trying to get a node.js app to interact with a .NET SDK fingerprint reader called U.are.U. The SDK provides .dll (win32 and x64), Java and .NET libraries. I decided to use .NET for the simple of use, having all the interfaces ready to use and all

How to organize MVP with an IoC container?

I'm trying to get the IoC concept down with a winforms app. Say I have a presenter whose constructor takes its view and a service as constructor arguments. So in the form code I have something that amounts to this: mnPresenter = new Presenter(this, n

Using ref with 2 shapes ..?

I have 2 forms.. from first form i call 2nd form... in second form i do some calculations and i want to get the result in first form after closing second form. First Form Code public partial class XtraForm1 : DevExpress.XtraEditors.XtraForm { String

More DispatcherTimers in an application

I have an application behaving like autorefresh. It checks emails, new videos, jokes, etc. My client wants these single elements check in different intervals. For example emails every minute, videos every hour, etc. So there should be option for him

C # Covariance on the types of subclass return

Does anyone know why covariant return types are not supported in C#? Even when attempting to use an interface, the compiler complains that it is not allowed. See the following example. class Order { private Guid? _id; private String _productName; pri

Jquery ajax call to an aspx page method

I have two aspx page on my application. From the first one, lets say default.aspx, I have one button and one textbox. When I click the button I do an ajax call to the checkname.aspx as below function docheck() { var un = $('#username').val(); $.ajax(

Return the number in text format

Possible Duplicate: How can I convert an integer into its verbal representation? I am looking for some solution to return a number as text. By that I mean that 100 should be returned as 'one hundred' It is more or less just a tidious task to make suc

Publishing to a REST Web Service from .NET?

I was trying to hit a web service using the instructions here: http://help.seeclickfix.com/kb/api/creating-an-issue I came up with the code below: string paramContent = "api_key=afs684eas3ef86saef78s68aef68sae&issue[summary]=abeTest&issue[lat

How to call the function?

I need to get the position of the mouse on click in a form, and save the x and y coordinates. I made this simple function: public void kokot (MouseEventArgs e) { x = e.X; y = e.Y; this.Invalidate(); } How can I call it? When I try kokot() it doesn't

.NET client that supports multiple versions of an unmanaged DLL

I am developing a .NET 4.0 client that will utilize a C Library for data processing. The user will be able to specify the DLL file they wish to load for processing. I am doing late binding / assembly loading as described here. http://blogs.msdn.com/b

How can I reference array values ​​in string.Format?

I am using XPath to exclude certain nodes within a menu. I want to expand on this to exclude nodes identified within an array. This works to exclude all the nodes in the menu with id 2905 whose type is not content: XmlNodeList nextLevelNodeList = cur

How to use a Command Command .NET object as a non-string object

Ok so it appears in the .NET framework API docs that the CommandArgument property of the CommandEventArg class is of type 'object' suggesting that I might assign to it something other than a string object yet I get an InvalidCastException using the c

Unit test with an external host process dependency

I'd like to run some NUnit unit tests against a class in a .Net class library assembly which is designed to be hosted by an external process (outside of my control) and loaded at runtime. The class I want to test derives from a class defined within t

Create a video stream (AVI) from a series of images

There is an IP web camera that I wrote a .NET class for sometime ago. It's basically a Timer implementation that pings a snapshot CGI script from the camera every five seconds. The camera itself is very rudamentary; it does not have any sort of API f

XNA unit tests: should I mock my GraphicsDevice

I'm fooling around with the XNA framework. To help me around I made a helper class that looks like this: ActorHolder + SpriteBatch (SpriteBatch) + ContentManager (ContentManager) - drawables (IList<IDrawable>) - updatables (IList<IUpdatable>)

ReadOnly vs. Property in the Question / Conundrum assembly

How can I make a Property "ReadOnly" outside the Assembly (DLL) for people using the DLL but still be able to populate that property from within the assembly for them to read? For example, if I have a Transaction object that needs to populate a