.net

Fastest Hash Algorithm for Text Data

I'm trying to choose a hash algorithm for comparing about max 20 different text data. Which hash is better for these requirements? Less CPU Consumption Small footprint (<=32 bytes) Collision is not a big deal Can be generated from .NET Framework 2 (shouldn't be a 3rd party library) I'm using hash for less memory footprint and compa...

Update Silverlight Datagrid After Response from Server

Hi, I got a datagrid in Silverlight. I would like the datagrid (or usercontrol that contains the datagrid) to post to the server when the user edit a cell in the gird. to signal to the datagrid using some symbol in the cell edited (like a loading-symbol) that a post is sent to the server and the control is waiting on a response. to si...

What is the best/easiest way to create ZIP archive in .NET?

Which method do you think is the "best". Use the System.IO.Packaging namespace? Use interop with the Shell? Third party library for .NET? Interop with open source unmanaged DLL? [I can target Framework 3.5; best = easiest to design, implement, and maintain.] I am mostly interested in why you think the chosen approach is best. ...

VS.NET 2003 and VS.NET 2008 co-existence

I was in the process of converting a VS2003 project (.NET 1.1) to VS2008 (.NET 2.0) and had converted all the C# (easy enough). I got a new machine and did the C# conversion on VS2008. We had a C++ layer that wasn't working under .NET 2.0 because of some memory protection issues. The C++ layer was pretty old and was written by some sub-...

MSDataSetGenerator xml documentation warnings

I code with treat warnings as errors turned on and XML Documentation turned on. I have a Typed Dataset which generates 500+ warnings which are treated as errors. I can not control this code as it is auto generated by MSDataSetGenerator. Is their a way to turn off warnings just for the dataset files? Turning XML Documentation off is not...

Referencing private .net assemblies in a subfolder

In Visual Studio 2008 I can add a project reference and set Copy Local property to true. As result the referenced assembly will be copied to the same folder the main assembly is build to. But what if I want to have all referenced assemblies in a subfolder near the main assembly? Something like this: .. myApp.exe Libs myLib1.dll my...

Best practice to fill an object hierarchy from a flat database resultset?

This is a frequently recurring problem of generating a tree from a flat list. I have caught myself relying on the two-level method described below. I would appreciate anyone suggesting a better approach that could be easily extended to multiple levels. Description: Resultset is flat and contains a reference to a parentId Root items w...

Slow SelectSingleNode

I have a simple structured XML file like this: <ttest ID="ttest00001", NickName="map00001"/> <ttest ID="ttest00002", NickName="map00002"/> <ttest ID="ttest00003", NickName="map00003"/> <ttest ID="ttest00004", NickName="map00004"/> ..... This xml file can be around 2.5MB. In my source code I will have a loop to get nicknames In each ...

System.Runtime.InteropServices.ComTypes.IStream to System.IO.Stream

In a .NET 3.0 project, I need to make some calls via P/Invoke (specifically to the PrintTicket Provider functions like PTConvertPrintTicketToDevMode() ). The framework has a managed definition of the COM IStream interface: System.Runtime.InteropServices.ComTypes.IStream I need this as System.IO.Stream so that I can easily use .NET clas...

Capturing Events For Logging Purpose

When an application is launched, I need to know for certain methods when they are fired. How to do this using attributes and AOP techniques? The simplest way is to record the time in the event method such as this: private void Page_load() { DateTime dt = DateTime.Now; } And save the Datetime into a database. But this is definitely ...

Safe to uninstall .NET Framework 2.0 and 1.0 after installing 3.5?

I'm new to Windows development and I have a question. I'm using a Mac with Boot Camp to run Windows in dual boot, but I have an extremely small Windows partition (10 GB, because Boot Camp failed with bigger partition, due to the disk usage). After installing Visual Studio 2008 I continuously get low-disk-space warnings so I want to free ...

How to map to get value from primary table in Nhibernate?

I face a problem when I try to get value from primary table in my mapping file. My tables: CREATE TABLE Customer ( [CustomerId] INT PRIMARY KEY, [FullName] NVARCHAR(50) NOT NULL ) CREATE TABLE CustomerOrder ( [CustomerOrderId] INT PRIMARY KEY, [CustomerId] INT, [TransactionDate] DATETIME ) My classes: public cla...

Application Crashes as limited user

I have a WPF application that runs fine under XP as an administrator. When I run as a limited user the application does not run at all, I get the hour glass for a half second and then nothing. Where do I start in working out what part of my application is causing it to crash when running under a limited user account? ...

Should I learn F# or functional programming languages in general?

Should I invest time learning Microsoft's new F# language? I am mainly a C# .NET developer and I wonder if learning F# will be of any help in developing today's typical applications. ...

Manager Classes?

Im writing a .net webforms app. It has a number of classes, for example users, bookings etc. At the moment I have a number of manager classes, say bookingManager, that manage these classes. For example when creating a new booking, you call the add method in the bookingManager, and pass a booking. It then checks the booking is valid, chec...

IOException reading a large file from a UNC path into a byte array using .NET

I am using the following code to attempt to read a large file (280Mb) into a byte array from a UNC path public void ReadWholeArray(string fileName, byte[] data) { int offset = 0; int remaining = data.Length; log.Debug("ReadWholeArray"); FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read); ...

Correct way to escape characters in a DataTable Filter Expression

Hi I would like to know if there is a function to correctly escape string literals for filter expressions. e.g. DataTable.Select(String.Format("[name] = '{0}'", MyName)) If MyName contains ' or a number of other key characters an exception is generated. The Microsoft documentation indicates that these charaters should be correctly e...

What does "active directory integration" mean in your .NET app?

Our marketing department comes back with "active directory integration" being a key customer request, but our company does not seem to have the attention span to (1) decide on what functional changes we want to make toward this end, (2) interview a broad range of customer to identify the most requested functional changes, and (3) still h...

How to dynamically create a object of a generic class?

i have a sub with this signature Public Sub Save(ByVal obj As IPta) now i want the create a instance of Generic.PtaDao(of T) with the type of obj, which could be anything that inherits from my base class Pta how can i do that? i already found a c# example http://stackoverflow.com/questions/307984/declare-a-generic-type-instance-dynam...

Linq-to-Sql SubmitChanges not updating fields ... why?

I posted this question yesterday evening, which has led me to discover a huge problem! I have a decimal column in my database called Units, anytime I set the value of the column to a NON ZERO, and SubmitChanges the column updates with the new value. If I try to set the value of the column to ZERO, the SubmitChanges does not update the ...