.net

ZedGraph: just the dots

Hi! I am new to ZedGraph, so far I could draw curves and bars but couldn't figure out how can I display just the dots without connecting them. Can you help me? (Context: C#, WinForms) ...

Question about Encodings: How can I output from HtmlAgilityPack to a StringWriter and keep the encoding?

I am reading html in with HtmlAgilityPack, editing it, then outputting it to a StreamWriter. The HtmlAgilityPack Encoding is Latin1, and the StreamWriter is UnicdeEncoding. I am losing some characters in the conversion, and I do not want to be. I don't seem to be able to change the Encoding of a StreamWriter. What is the best around ...

Windows Media Encoder based application deployment issue

Hello everyone, If I develop my application based on Windows Media Encoder 9 Series SDK, and I am using C# + .Net 2.0 + VSTS 2008, how to deploy all necessary dependent files (the ones from Windows Media Encoder 9 and Windows Media Encoder 9 SDK) to another computer without installaing Windows Media Encoder 9 on the target computer? th...

Can Delegate.DynamicInvoke be avoided in this generic code?

This question is partly about delegates, and partly about generics. Given the simplified code: internal sealed class TypeDispatchProcessor { private readonly Dictionary<Type, Delegate> _actionByType = new Dictionary<Type, Delegate>(); public void RegisterProcedure<T>(Action<T> action) { _actionByType[typeo...

Calling Marshal.GetHRForException in a partial trust environment (SecurityPermission)

I have some IO code that reads a stream within a try..catch. It catches IOException and calls System.Runtime.InteropServices.Marshal.GetHRForException() within the catch, in an attempt to take different actions based on the HResult. Something like this: try { stream.Read(...); } catch (IOException ioexc1) { uint hr = (uint) Mar...

Regex blows up in an editor extension

I am building a Visual Studio editor extension for my Django rendering engine. I just started it so so far it is really simple and so far it does what I expect it to do - highlighting and the such. Or it did until I started to add parsing logic. Part of the parsing relies on regular expressions. And here is my problem: No matter how I t...

HTML and Compilers

This question is a more discussion oriented one that a simple problem specific question. Writing basic HTML is simple but writing fast light standards based, SEO best practices complaint, all browsers compatible HTML pages is hard and very time consuming. But why it hard ? In my opinion it hard because of the hundreds of different r...

How do you share code between projects/solutions in Visual Studio?

I have two solutions which have some common code, so I'd like to extract it out and share it between them. Furthermore, I'd like to be able to release that library independently because it might be useful to others. What's the best way to do it with Visual Studio 2008? Is a project present in more than one solution? Do I have a separate ...

How do you Setup your Unit Test Project(s) in .Net?

Can you share the way you setup your unit test projects within your .net solutions? I can imagine several possible methodologies. For example: Having a separate solution for unit tests, perfectly mirroring the structure of the original code solution being tested. Inside the original code solution, have a solution folder in which you'r...

Define default constructor with StructureMap without providing arguements or using DefaultConstructor attribute

I've been using StructureMap for sometime now but I'm far from an expert. My problem is simple, I'm trying to configure SM via code (Registry) to use a particular constructor when creating an instance of a repository object. Here are my 2 constructors (note neither is the greediest). public BusinessUnitRepository( IDatabase database )...

When to use "LINQ to SQL",entity framework, or NHibernate?

With .NET, which data access method is better to use "LINQ to SQL",entity framework, or NHibernate? Should a different method be used depending on the situation or is it more of a personal preference? If so which method and when? ...

How will Windows 7 be programmed? Will .NET still be king?

With Windows 7 due to be released at the end of 2009, what changes should we expect? What impact will Windows 7 have on the industry? Are we still going to be using .NET (3.5?) to program Windows? Where does 64-bit figure in all this? We'll definitely be able to use Java for 64-bit stuff, but how is Microsoft going to have us making nat...

Disposing SqlConnection from a base DAL class when calling ExecuteReader

I've been assigned on a project where the DAL consists of a base class with functions to return IDataReader, an Object (int, string and the like), or a DataSet. An ExecuteNonQuery function also exists. This DAL only accesses USPs (SQL Server), and is using MS's SqlHelper to execute the queries. Here's two sample functions from the base: ...

What's the best way to create a short hash, similiar to what tiny Url does?

I'm currently using MD5 hashes but I would like to find something that will create a shorter hash that uses just [a-z][A-Z][0-9]. It only needs to be around 5-10 characters long. Is there something out there that already does this? Update: I like the CRC32 hash. Is there a clean way of calculating it in .NET? Update2: I'm u...

Pros and cons of different MVC frameworks for .NET

With all the hype around MVC (and rightly so) I've decided to give it a go myself and write my first .NET MVC web application. With a few options to choose from I was wondering which framework MVC do people recommend. Microsoft ASP.NET MVC The above with alternative view engine Castle Project - MonoRail MVC# Maverick.NET It seems ...

stylecop exclude event handlers from casing

I have just discovered sylecop and am running it through my projects, I have disabled certain rules such as usings must be within the namespace. However visual studio auto generated event handlers for say a button click are in the form btnOk_Click(.... This as I understand it doesn't conform to stylecop default settings as they should ...

Coding a server that is *not* 'thread per client'

Using .NET what is the basic algorithm of a server that is not 'thread per client' based? Edit I'm looking for a basic 3, 4 maybe 5 line algorithm/psuedocode/pattern that describes the general process the server is using. Something opposite to this: open a server socket // this uses the port the clients know about while(running) ...

C# equivalent of Java PushbackReader's unread()

I'm looking for a C# equivalent to the Java's unread() method. The C# equivalent to PushbackReader is supposedly System.IO.StreamReader, but StreamReader doesnt have an "unread()" equivalent. It has Peek(), but no way to put a character back onto the stream. Java Code: // putBackChar puts the character back onto the stream // adjusts ...

How to start a BAT file through C# code.

I want to execute a BAT file through the use of C# code. I attempted to use the following code, Process aProcess = new Process(); aProcess = Process.Start(@"E:\IMP_DATA\PRC_Helper_uTest.bat"); aProcess.WaitForExit(24000); aProcess.Close(); It starts the batch file but very next second stops. I am not able to see any thing. Can...

how to invoke IE to open a local html file?

Hello everyone, I am using VSTS 2008 + C# + .Net 2.0. And I want to invoke IE to open an html file located under pages sub-folder of my current executable. Since my program may run under Windows Vista, I want to invoke IE under administrative permissions (Run As Administrator). Any code to make reference? I am especially interested in...