.net

Add custom param to odata url

I want to add some authentication to my odata service. The authorization token i want to include in the url as param so that the url can be used in excel How would one be able to receive and parse any addition param supplied in the url before the odata service does it's thing? (i'm using entitie framework and wcf dataservices) ...

Parsing every part of an HTTP header field-value

Hi all. I'm parsing HTTP data directly from packets (either TCP reconstructed or not, you can assume it is). I'm looking for the best way to parse HTTP as accurately as possible. The main issue here is the HTTP header. Looking at the basic RFC of HTTP/1.1, it seems that HTTP header parsing would be complex. The RFC describes very com...

ASP.NET MVC2 DateTime Control

Hello guys, i am looking for a date time control/template for mvc2 anybody of you know a good one? ...

How to unit test class that reads xml file ?

Hello all I need to write a unit tests for a class that reads a xml file and parses it's content. How can I Mock the file reading ? Because all the content of the tests should be against read file . I use nmock2 with nUnit. Thanks ...

Allow selection of readonly files from SaveFileDialog?

I'm using Microsoft.Win32.SaveFileDialog in an app where all files are saved as readonly but the user needs to be able to choose existing files. The existing files being replaced are renamed eg: blah.png becomes blah.png-0.bak, blah.png-1.bak and so on. Thus, the language for the OverwritePrompt is inappropriate - we are not allowing th...

DefaultIfEmpty doesn't work

Why is array still null after queried by DefaultIfEmpty ? class Program { static void Main(string[] args) { Program[] array = new Program[5]; Program[] query = array.DefaultIfEmpty(new Program()).ToArray(); foreach (var item in query) { Console.WriteLine(item.ToString()); } ...

Web service creates stack overflow

I have an application that when executed as a windows application works fine, but when converted to a web service, in some instances (which were tested successfully) by the windows app) creates a stack overflow. Do you have an idea of what can cause this? (Note that it works fine when the web service is placed on the localhost). Could ...

.NET Regex - Replace multiple characters at once without overwriting?

I'm implementing a c# program that should automatize a Mono-alphabetic substitution cipher. The functionality i'm working on at the moment is the simplest one: The user will provide a plain text and a cipher alphabet, for example: Plain text(input): THIS IS A TEST Cipher alphabet: A -> Y, H -> Z, I -> K, S -> L, E -> J, T -> Q Cipher ...

Could it be that the stack size of a Web Service is smaller than that of a Window Application?

Possible Duplicate: Webservice creates Stack Overflow Hi, I have a program that includes a recursive function. This function when executed in a Windows Application works just fine, and when used in a Webservice, it works fine when the webservice is initiated by the VS (it assigns a random port), but this function return a sta...

How to insert a float into a SQL table in the right locale

I have to insert float values into different SQL Servers. Each one can have different locales so in one it the representation could be "42,2" and at another one "42.2" or whatever. How should i construct the query so it works in any SQL Server? Do i need to detect the locale of the server before constructing the query or what? ...

Checked status not updated in CheckBox template

Hey there. I'm trying to create an hyperlink that changes its text depending on a boolean value. I thought I could leverage the IsChecked method of a CheckBox. So I wrote this ControlTemplate for a CheckBox: <CheckBox Checked="CheckBox_Checked" IsChecked="{Binding Path=SomeBool, Mode=TwoWay}"> <CheckBox.Template> <Contro...

Get current Cursor Position in Word (VSTO)

Is there a way for a Word Add-In to get the current cursor position within the document/on screen (e.g. to display my own control next to it)? ...

.NET Deployment of Interface/Classes for Command Pattern Question

In theory I would like to produce 2 projects: 1) Asp.net (Sever A) 2) DAL running (Server B) I would like to utilise command objects to comunicate with the DAL. ASP.net instantiates a command class e.g. CmdGetAllUsers which impliments IMyCommand interface and sends it to the DAL (using ASMX or WCF). My question is: Would the class ...

Generalised XML Serialization

I apologise for asking a question that's probably been asked hundreds of times before, but I don't seem to be able to find an answer in the archives; probably because my question is too basic. I know that XML Serialization by default only touches public members and properties. Properties very often mask a private variable; particularly ...

How to get or make a WPF WebBrowser with a visual.

Having problems related to WPF WebBrowser not having a visual. Reason being, that it actually a wrapper around the winforms browser. Anyways, I searched the web for any solution to this problem, and got hold of the following suggestions: http://chriscavanagh.wordpress.com/2009/08/25/a-real-wpf-webbrowser/ http://rob.runtothehills.org/...

Attribute to mark code

In c# there are attributes such as [obsolete] that create compiler warnings that will be shown in visual studio. Is there an attribute that I can use to mark a method or a class with a comment that should be shown as a warning in visual studio when I compile? Something like: [TBD(Msg="Please change me after 2010 07 20")] public void ...

resources at class library project

Hello I want to add some xml file as resource to my class library project . Any idea how to do so , and call it later? In windows application i would do it like ClassLibrary1.Properties.Resources.file.xml But here it didn't worked any idea how i do it here ? ...

How can be possible to use anonymous type fields without know them ?

Hello everybody It is really looks so cool to me how GridView's DataSource property gets anonymous type and shows results in Grid . Simply Grid.DataSource = from order in db.OrdersSet select new { order.PersonSet.Name,order.PersonSet.SurName}; For example how can i write a propery or method which takes anonymous type and wr...

Multi-Touch Frameworks vs. Windows 7 Native support for Multi-touch ?

Is it still feasible to use the Current Multi-Touch frameworks .. Breeze, Multi-Touch Vista .. etc. While Native support for multi-touch in Windows 7 + .NET 4.0 and WPF ? What are the advantages of using the mentioned frameworks over Windows 7 .Net 4.0 Transformation, Scale, Rotate Mechanisms ? ...

How to "reduce" a hash?

Suppose I have any "long" hash, like a 16 bytes MD5 or a 20 bytes SHA1. I want to reduce this hash to fit on 4 bytes, for GetHashCode() purposes. First, I'm perfectly aware that I'll get more collisions. That's totally fine in my case, but I'd still prefer to get the less possible collisions. There are several solutions to my problem: ...