.net

Working with relative file paths in .Net

I have a C# project where I include some resources which I need to refer using the Uri-class. For this specific problem I have some shaders placed in a "Shaders" folder in the root of the project, but I've had this problem before with other files like images, etc. This far I've used the simple solution giving a fixed absolute path, and m...

Common Gotchas when using TransactionScope and MS DTC

I am just starting to work with using TransactionScope, I find that there are always unexpected things I run into that take forever to debug. I figure that having a consolidated list of these would be great for those "weird error" circumstances, plus to expand our knowledge of oddness in the platform. Some context on how I am going to...

User controls called from child pages do not appear on master page.

Hey, I have a custom user control in ASP.net: MenuButton.ascx: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="~/MenuButton.ascx.cs" Inherits="MenuButton" ClassName="MenuButton" %> <li><a href="<%= Link %>"><span><%= Text %></span></a></li> MenuButton.ascx.cs: using System; public partial class MenuButton : System.Web....

Unable to open serial port in .NET

I am trying to open COM1, but get a strange error every time I call SerialPort.Open(). The error is: The given port name does not start with COM/com or does not resolve to a valid serial port. Parameter name: portName The code is very simple: SerialPort port = new SerialPort("COM1", 19200, Parity.None, 8, StopBits.One); port.Ha...

WPF control in windows forms?

I would like to create some custom UI controls that work with both WPF and Windows Forms. Is this possible? If so, can I create these controls in WPF or do I need ot use a Windows Forms control? Are there any other considerations? ...

How do I mark a method as Obsolete/Deprecated? - C#

How do I mark a method as Obsolete/Deprecated using C# ? ...

Viability of Ruby for Cross-Platform Development With Native Toolkits?

Let's say that I was writing a closed sourced commercial piece of software which was to be deployed in the following situations: Windows Desktop App built on .Net, ActiveX control, Windows Netscape plugin, Mac Desktop App built on Cocoa, Mac Netscape plugin, Java applet hosted in browser. Would it be viable in terms of code sharing to wr...

What is so great about extension methods?

Possible Duplicate: What Advantages of Extension Methods have you found? All right, first of all, I realize this sounds controversial, but I don't mean to be confrontational. I am asking a serious question out of genuine curiosity (or maybe puzzlement is a better word). Why were extension methods ever introduced to .NET? What b...

.Net AES Encryption - Universally Accepted Pad Setting

I have a .Net web service that processes AES encrypted data. The consumers of my service agree on a key/IV pair with me and that way we can pass data securely. I have a consumer using PHP that is using mcrypt to encrypt. mcrypt is padding with NULLs. I was not setting a pad (NONE) and therefore not able to decrypt the strings. I cha...

Ask jboss if it has a web method?

We have our web services written in Java running on JBoss. Our website is written in .Net 3.5. We've run into an issue where if a web service has a change, sometimes it breaks the website, and they end up having to be deployed at the same time. Right now I changed a web service, and the website code has been changed to match. The o...

Are custom Winforms control auto generated designer files needed?

Visual Studio creates code similar to this: namespace MyCustomControls { partial class MyCustomControl { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary>...

Update Google Doc from local file using google API possible ? (.NET / C# / WPF)

Hi, I am currently testing the google API. It seems promising, but I am stuck at a "simple" problem. I want to update an existing document with a local copy. My idea was, download all google documents to a folder, using the doc-download. That works. At the next run, I check the dates, if a remote document is newer, grab it again. If th...

validation application block object validator not working with rulesets

Howdy, Ive been battling with this issue which I originally thought may have been to do with polymorphism/inheritance affecting my validation but ive narrowed it to this... Here is the class structure.. public class Employee { [ObjectValidator(Ruleset = "A")] public EmployeeName Name { get; set; } public Employee() {...

Get IUnkown using window handle.

I know this may be a long shot so forgive me as I don't really know that much about COM. Basically what I am trying to do is get the pointer to the IUnknown interface for a running application, the problem is the only thing I know about the app is its main window handle. Would this be possible? ...

C# Sort list while also returning the original index positions?

Hi, I'm interested in sorting a collection, but also returning an index which can be used to map to the original position in the collection (before the sort). Let me give an example to be more clear: List<int> A = new List<int>(){3,2,1}; List<int> B; List<int> idx; Sort(A,out B,out idx); After which: A = [3,2,1] B = [1,2,3] idx ...

Where should you unit test your validation?

Hi This is bothering me for some time now. I put all my validation in a service layer. However when I unit test I usually pass everything through action method. Then that goes into my service layer what contains the validation. So I am not sure now if that is the best way to do it. Since usually they say you should just test that metho...

How does .NET locate the dll of the namespace I'm `using`?

How does .NET locate the dll of the namespace I'm using? yeah, we do mention the path in /referene:c:\program files** but after building & deploying and when the software is installed on some user's machine. It may not be at the same path as I (developer) mentioned it would be. I mean it could be some where else right? So, how does .N...

how do I tell .NET to how much memory it should use? & how much memory it should allocate for a process?

Hello, I'm aware that .NET doesn't use complete physical memory availabe. I've encountered a System.OutOfMemoryException while the physical memory usage as only 79%. I've run my system until 92% of physical memory usage. You can see screenshot here: http://a.imagehost.org/0655/CaptureOOM.gif How do I tell .NET to use more memory? I...

Email control in .NET environment

I am using .NET and I wonder if there is some free program (or .NET open source) that can help to queue and control email outflow: Every time an email supposed to be sent, put it in the queue (database) Queue database will have these information: Timestamp, Email Address, Time in Queue, Time Sent, Success, Number of Retry Email must be...

C# Stream Design Question

I have an appliction right now that is a pipeline design. In one the first stage it reads some data and files into a Stream. There are some intermediate stages that do stuff to the stream of data. And then there is a final stage that writes the stream out to somewhere. This all happens serially, one stage completes and then hands off to ...