.net

Service developed on 32bit windows xp pro, fails to run on windows server 2003 64-bit

A windows service was developed and runs on a 32 bit machine. It communicates to the Project Web Access web service. Now, the service was moved to the same computer as the Project Web Access web service. The code fails and I recieve this error: System.Net.WebException: The request failed with HTTP status 401: Unauthorized. at ...

How do I add a method to a property?

Let's say I create a class with a property: public class User { private string _userID; public string UserID { get { return _userID; } set { _userID = value; } } } What do I have to do with the class and property to be able to have a method attached to the UserID property, such as a method that generates Xml a...

What mode for .NET Application on Windows 2008 64 bits

How will my .NET application run under Windows 2008 x64? As a 32 bit application or as a 64 bit? Does that make any difference? ...

How can I find all the Guids in some text?

I've got a bunch of web page content in my database with links like this: <a href="/11ecfdc5-d28d-4121-b1c9-1f898ac0b72e">Link</a> That Guid unique identifier is the ID of another page in the same database. I'd like to crawl those pages and check for broken links. To do that I need a function that can return a list of all the Guids ...

Script / Utility to consolidate browser tabs?

I often find I have 10 browser windows (some firefox, some ie) running, each with multiple tabs. I'd like to be able to: 1) Consolidate all the URL's into a list, suitable for emailing 2) Merge all the tabs into one instance of either FF or IE Anyone ever come across a utility like this, and if not, have any idea how a person might do ...

Linq2SQl eager load with multiple DataLoadOptions

I like to fetch the data with eager-loading using Linq2SQL. The code is similar as : DataLoadOptions options = new DataLoadOptions(); options.LoadWith<Product>(c => c.ProductCompanies); options.LoadWith<Product>(c => c.OrderDetails); db.LoadOptions = options; IEnumerable<Product> products = db.Prod...

Detecting if a value contained in a Dictionary has changed.

If I derive a class from IDictionary, how can I be certain that any given V has not changed after it is added to the underlying collection? ...

How can I minimize a form by code on .NET Compact Framework

Under the .NET Compact Framework, there is no FormWindowState.Minimize value. How can I minimize my application, so that it remains active and available, but gives back the focus to the previous application? ...

Reliable CPU profiler for .NET 3.5 under Win64 with command line support?

I am looking for a CPU profiler for .NET supporting heavily threaded apps. (double) quad-core CPUs. sampling profiling. 64 bits OS. command-line API. Currently, I am getting trouble with most .NET profilers, in particular, YourKit does not seem to support command-line. dotTrace 3.1 is crashing with 64 bits OS. I haven't tried In...

Preventing the browser from showing the query re-submit dialog on refresh

When the user select an item from a dropdownlist and presses a button, my application shows a list of data manually binded and filtered according the selected value. If the user presses the Refresh button of the browser, it asks for confirmation whether the user is sure they want to submmit the query again. I don't want the browser asks...

Excel Interop: Range.FormatConditions.Add throws MissingMethodException

I am writing an application which uses the Microsoft.Office.Interop.Excel assembly to export/import data from Excel spreadsheets. Everything was going fine (except for 1 based indexing and all those optional parameters!), until I tried to use conditional formatting. When I call Range.FormatConditions.Add I get a MissingMethodException ...

how to correctly copy /clone a structure? and should I use a class instead?

let say i have that Structure myStruct Public myPoint As Point Public myBool As Boolean End Structure how to I make a copy / clone of that structure? I fixed that issue now, example of the code I was using: Dim myStruct(1) As myStruct myStruct(0).myPoint = New Point(10, 10) myStruct(0).myBool = True Dim myC...

Why does this javascript variable I'm creating via C# only get updated once?

In my C# code-behind for an ASP.Net app, I have a variable being set and then I want to set a Javascript variable equal to it so I can do some work with it client-side. This C# variable is set in an event handler and it changes fairly changing fairly often. So, my event handler is doing only this... int scale = (int)myObject.Scale; Pa...

Why do I need to convert console input to a specific data type?

Looking for more help on converting to doubles, integers, and decimal format when doing calculations. EX: ...Console.Write(" INPUT TOTAL SALES : "); ...userInput = Console.ReadLine(); ...totalSales = Convert.ToDouble(userInput); I'm not completely understanding why I needed to convert such to a double, why it couldn't just be C...

WCF and subclasses

I have this ServiceContract [OperationContract(IsOneWay=true)] void ProcessMessage(Message message); and these objects [DataContract] public class Message { [DataMember] public long Id { get; set; } [DataMember] public string Body { get; set; } } [DataContract] public class ExtendedMessage : Message { [Da...

Strange result return from sql server

Hello everybody, I am working on my project and having strange result with asp.net C# and stored procedure that returns scalar variable. In short, I am trying to return user name, however I get only the first letter from the name, which is strange. I went trough the code couple dozen of times; however i still cannot find the error. I w...

When implementing IXmlSerializable, how to only override either ReadXml or WriteXml and not both?

I would like to implement IXmlSerializable on a class and only override either ReadXml or WriteXml, but not both. If I didn't implement IXMLSerializable on this class, the XMLSerializer would automatically serialize all members. I'd like that default behavior to apply for the non-overridden case. However, since IXmlSerializable is an ...

Failed while publishing clickonce application.

I get the following error while trying to publish a wpf clickonce application. Error 1 Publish failed with the following error: Unable to cast COM object of type 'EnvDTE.DTEClass' to interface type 'Microsoft.VisualStudio.OLE.Interop.IServiceProvider'. This operation failed because the QueryInterface call on the COM component for the in...

What is faster: SqlCommand.Parameters[string] or .Parameters[int] ?

Which way is preferred? SqlCommand = new SqlCommand(query); command.Parameters.Add("@Foo"); command.Parameters[0].Value = Foo; command.Parameters.Add("@Bar"); command.Parameters[1].Value = Bar; // or command.Parameters.Add("@Foo"); command.Parameters.Add("@Bar"); command.Parameters["@Foo"].Value = Foo; command.Parameters["@Bar"].Valu...

Establishing communication between Java client and .NET server

Hi, I would like to create a server using .NET and Java client (Android application). The client will be connected to the server through mobile network so it's impossible to use tcp socket for two-way communication. I would like to develop a logic for client login: The client sends username and password to the server and server repli...