.net

How to expose classes that implement interfaces and use unmanaged resources?

Hi. I have a question regarding use of interfaces when unmanaged resources come to play. Suppose I have a web service and generated WCF client. Service contract looks like this: [ServiceContract] public interface ITestService { [OperationContract] string GetData(int value); } On client side I use dependency injection and bind...

How to stores and Pictures in Db40?

I want to stores fotos use DB4o and a tried de following code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using Db4objects.Db4o; using Db4objects.Db4o.Linq; namespace imagemsDb4o ...

.NET: Show the storage location or address of an object?

Is there a way to get the "address" of an object? This is for demonstration purposes, I know this is a bad idea in general and if it works at all then as unsafe code. The project is tuned to allow unsafe code. However my tries were unsuccessful. The code I have so far is not compiling: unsafe static String AddressOf(Object o) { ...

Why not to use Classes that generated by EF in large Projects ?

Hi everyone. I'm going to use Entity Framework 4 in sort of big project. And i know that many professional programmers advice to depend on my business classes instead of EF Model classes. Actually there is sound inside my brain tell me "Don't depend on that generated classes !. Just make your hand dirty with your stuff don't let some...

Add-in for windows live messenger

Hello Everyone, i have a language processing application that converts roman Urdu (Urdu written using english alphabets) to Proper Urdu script. i want to plug my code that does the conversion with windows live messenger. i have coded this app in c# 3.5 and it is a windows forms application. is there a way i can use library to make add-i...

What is the best approach to thread-safe multiple parallel readers threads and occasional writer thread on an ArrayList object to a C# application?

Consider the scenario below: The application is multi-threaded and it has one static ArrayList used globally. The application has one thread that reconstruct the ArrayList entirely from data read from database from time to time. The application has N threads reading from this global ArrayList in parallel. What is the best approach to...

VS2010 profiler seems to not resolve symbols from ngen'd images

I'm profiling a Windows service by attaching to it in the 'sampling' mode. I open the results file, the "functions" view and I see the "hottest" function being displayed as [System.Runtime.Serialization.ni.dll] without indication of the concrete .net function inside this assembly. It looks like all other symbols from ngen'd assemblies...

Run time exception handling (like Divide by zero) in JVM (Java)or CLR (C#)

Hello, How does JVM or for that matter CLR (Common language runtime) handles divided by zero? Does it check denominator every time, before executing divide instruction? Or is it handled using call back function which get invoked when "divide by zero" trap raised by processor? Any input will be appreciated. Thank you, Alan ...

.NET framework (Uninstallable kind of Application?)

So the windows have different versions of .net framework, 1.0, 1.1, 2.0, 3.0, 3.5 along with Service packs for particular frameworks. Now my windows have several versions of the said frameworks and what confuses me is that are these uninstallable or installable? Can I remove older versions If I am just using let's say 3.5 or 4.0 with AS...

reportviewer control issue

Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 + ASP.Net + SQL Server 2008 Enterprise to learn how to use reportviewer. Under the toolbox and under Data Tab, I learned there should be reportviewer control which I can drag into aspx page designer. But I can not find reportviewer control. Any ideas what is wrong? thanks in advance...

Add dataset issue in ASP.Net application

Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 + ASP.Net + SQL Server 2008 Enterprise to develop a simple web application. In MSDN library topic "Walkthrough: Using a Database Data Source with the ReportViewer Web Server Control in Local Processing Mode", which is located in the following Url, http://msdn.microsoft.com/en-us/libr...

Reading and writing with the same Access '97 table: Thread safety problems?

I am maintaining a program that reads records from a Access '97 table using a Timer. A different program outside my control writes records to this table. So the reading and writing is not synchronized. I am wondering if this could occasionally lead to data corruption. Writing a testing environment is difficult for several reasons. Does s...

Custom Filter not working in ASP.NET Dynamic Data

I have the following metadata property on a Region: [FilterUIHint("ActivationCampaignFilter")] [DisplayName("C")] public object Campaigns { get; set; } The DisplayName attribute is effective at changing the visible name of Campaigns to just "C", but the FilterUIHint attribute is simple ignored and a standard FK...

PrivateFontCollection takes apppool down

I'm using below simple code to write on an image with certain font. PrivateFontCollection FontCollection = new PrivateFontCollection(); FontCollection.AddFontFile(ToplistConfig.PrivateFontsPath + "/font.ttf"); FontFamily FontCollectionFamily = new FontFamily(FontCollection.Families[0].Name, FontCollection); Font myFont = new Font(FontCo...

Simple client / server concept for .NET

Hey everyone I want to implement a simple cardgame in silverlight that can be played together via a server. My question is, what concept for communication between client and server I should use. Is it possible to use WCF to implement the server ? I guess no because its more like a dataprovider right ? or do I need to use .NET Remoti...

MaxLength for AutoCompleteBox in Silverlight

I use an AutoCompleteBox control in my project. Now I need to restrict the length of text a user can enter, e.g. by the maximum length 50 characters. For this case, TextBox has the MaxLength property, but AutoCompleteBox hasn't. Also, AutoCompleteBox doesn't expose TextBox's properties. I tried to resolve the issue in this way: private...

Where should I save an image in my project?

I'm creating a website using MVC2. Where do I save the image? ...

Generating a good hash code (GetHashCode) for a BitArray

I need to generate a fast hash code in GetHashCode for a BitArray. I have a Dictionary where the keys are BitArrays, and all the BitArrays are of the same length. Does anyone know of a fast way to generate a good hash from a variable number of bits, as in this scenario? UPDATE: The approach I originally took was to access the internal...

help with second level cache using NHibernate and memcached

How can i read/write to the cache for a periode of time i.e 10 seconds and then commit the changes to the database? ...

Automated Deployment Options

We have a web application primarily developed in .NET and are entering into an era where we will be deploying the application at client owned windows infrastructure. Our goal is to complete deployment of the application in less than 15 minutes including * Deployment across at least 8 or more web server instances * Creating a backup of t...