.net

How can I tell if a byte array has already been compressed?

Hi, Can I rely on the first few bytes of data compressed using the System.IO.Compression.DeflateStream in .NET always being the same? These bytes seem to always be the 1st bytes: 237, 189, 7, 96, 28, 73, 150, 37, 38, 47 , ... I'm assuming this is some kind of header, I'd like to assume that this header is fixed and isn't going to ch...

Resolving Circular References for Objects Implementing ISerializable

I'm writing my own IFormatter implementation and I cannot think of a way to resolve circular references between two types that both implement ISerializable. Here's the usual pattern: [Serializable] class Foo : ISerializable { private Bar m_bar; public Foo(Bar bar) { m_bar = bar; m_bar.Foo = this; } ...

Which framework exceptions should every programmer know about?

I've recently started a new project in C#, and, as I was coding some exception throw in a function, I figured out I didn't really know which exception I should use. Here are common exceptions that are often thrown in many programs : ArgumentException ArgumentNullException InvalidOperationException DivideByZeroException FileNotFoundEx...

SQL Express as a main DB

Hi everyone, Does anyone out there use SQL Express 2008 R2 in a production environment? I am looking at hosting a Windows VPS as a server for a client software product I have developed. Clients connect to the server, send their data to a service running on the server, and the service updates the database. I'm trying to keep running c...

JavaScript code that can enable the text on the webbrowser to blink once.

I have window application and on that there is one webbrowser control and I want to display the text on the webbrowser blinking one time and then it should not blinked more, is it possible ? I have done with one javascript but it blinks the text frequently but I want text blinking only single time or maximum two time.The java script is...

Virtual Cam - Cam Split .NET

I'm looking for a virtual webcam driver to use in a .NET project, this project will be GPL, and have no idea how many installations there will be The idea is that the application is using the webcam without locking the device. Found a couple of programs that do the job, but either in application and/or too expensive: * http://www.softs...

&& Operation in .NET

Which one out of the following two should be preferred while doing && operation on two values. if (!StartTime.Equals(DateTime.MinValue) && !CreationTime.Equals(DateTime.MinValue)) Or if (!(StartTime.Equals(DateTime.MinValue) && CreationTime.Equals(DateTime.MinValue)) What is the difference between the two? ...

How to fine tune FluentNHibernate's auto mapper?

Okay, so yesterday I managed to get the latest trunk builds of NHibernate and FluentNHibernate to work with my latest little project. (I'm working on a bug tracking application.) I created a nice data access layer using the Repository pattern. I decided that my entities are nothing special, and also that with the current maturity of ORM...

Saving unserializable class

I write the programm which work with Windows Registry i want to save some Microsoft::Win32::RegistryKey in binary mode. I want to use Serialization but that class not serialazale. do i need to create my own serialazable class or there is some more easy way to save this class in binary mode in .net? ...

How to remove focus style on a listbox in C#.Net

Hi, how to remove a focus (gray color)style on a listbox in C#.net Can anyone help me? ...

Suggestion for a small OSS .NET project for study

If one wants to learn better programming practices by studying a small .NET OSS project, what would that project be? ...

Silverlight file download for COM Interop

Is the following possible in Silverlight when a button is clicked? An Excel template is downloaded from a remote server and saved to the local machine An instance of the template is then opened on the client A macro is then executed within the new Excel document I can do everything apart from saving the template to the local machine...

Generic Abstract Singleton with Custom Constructor in C#

I want to write a generic singleton with an external constructor. In other words the constructor can be modified. I have 2 designs in my mind but I don't know whether they are practical or not. First one is to enforce derived class' constructor to be non-public but I do not know if there is a way of it? Second one is to use a delegate ...

versioning in Fluent NHibernate

In my NHibernate mapping files I used: <version name="Version" column="Version" /> to implement versioning. How do I achieve this using fnhibernate? What should go in here? public class blaMap : IAutoMappingOverride<bla> { public void Override(AutoMapping<bla> mapping) { ???? } } thanks....

How to select listbox item with incremental value - using selenium RC in C#

I Need to select a category from a list box with no of items on it. eg. Videos(29). I need to select this and in the next loop it will be "Videos(30)","Videos(31)" etc.. Tried the followings Addselection with "//option[@value='4641']", Storeselectedoption, selenium.click, selenium.doubleclick etc.. ...

Implementing Dispose on a class derived from Stream

I'm building a class that derives from Stream to wrap a COM IStream. However I've come across an issue where I need to release the COM IStream deteministically. Ok so that's easy just use Marshal.ReleaseComObject in the Dispose method. However I'm not sure its that simple. The Stream base class already has an protected virtual metho...

C# Unit Testing - Generating Mock DataContexts / LINQ -> SQL classes

Hi All, I am loving the new world that is C#, I've come to a point with my toy programs where I want to start writing some unit tests. My code currently uses a database via a DatabaseDataContext object (*.dbml file), what's the best way to create a mock for this object? Given how easy it is to generate the database LINQ -> SQL code and...

When the Microsoft's main support phase for .NET 2.0, .NET 3.0 and .NET 3.5 ends?

Hello, I'm wondering until when the .NET Framework 2.0, 3.0, 3.5 will be supported by Microsoft. According to Microsoft Support Lifetime page for developers products the mainstream support phase should last for 5 years and extended support phase for another 5 years. I've found a .NET Framework 2.0 entry in the Support Lifetime Index , h...

Microsoft Dynamics AX - Resources for new developers

I am trying to find some good resources that will help me understand how to use the .NET Business Connector and without digging too deep into X++ and those other AX-specific things. First of all I want a bit more knowledge regarding the very AX usage basics and after that I want to head on to the AX for .NET developers. So, suggestions...

Retrieving Windows Mobile browser history

How can I retrieve a list of urls a user has visited on a Windows Mobile phone? I've written a program that successfully retrieves the visited urls in a user's cache, using FindFirstUrlCacheEntry and FindNextUrlCacheEntry - but as I understand it this is not the same as the user's actual web history. In any case it does not seem to give...