.net

Getting size of an audio file in ASP.NET

Given an audio file (mp3 or wav), is here a way to get the duration, size (in bytes) and other other attributes of the file? Thanks ...

Where's the memory leak in this function?

Edit2: I just want to make sure my question is clear: Why, on each iteration of AppendToLog(), the application uses 15mb more? (the size of the original log file) I've got a function called AppendToLog() which receives the file path of an HTML document, does some parsing and appends it to a file. It gets called this way: this.user_ema...

Is there any way I can speed up the opening and hashing of 15,000 small files in C#?

I'm working on SHA1 checksum hashing 15,000 images (40KB - 1.0MB each, approximately 1.8GB total). I'd like to speed this up as it is going to be a key operation in my program and right now it is taking between 500-600 seconds. I've tried the following which took 500 seconds: public string GetChecksum(string filePath) { ...

Including config file from class library

Hi, I have a config file in my C# class library called MyLibrary.config, in vs 2008. I created another project, say a simple console app, add reference by "Browsing" the MyLibrary.dll in the bin directory of the class library project, and when I compile, the MyLibrary.config is not including in the bin directory of the output in the c...

system.convert to custom object

we have a custom datatype object "Money" which is used to represent money values in our application. at the moment we are trying to implement some custom formatting within a grid component however the exception "InvalidCastException" is raised from System.Convert. the text from the exception is; System.InvalidCastException occurred M...

.NET hashtable: How to simulate "Load factor too high" exception

Hi folks: Our production repeatedly met "Hashtable insert failed. Load factor too high". 1. How could I simulate this kind of exception? 2. If this sort of exception is thrown, would the existing key/value will disappear? Thanks for any help. ...

How do I get a long running method in one class to report back its progress to the calling class in C#?

I have a method that processes thousands of items and it takes a long time. What is the "right" way to have the method that is doing the long operation report back its progress as it does this? For example, if I wanted to have a progress bar in my UI show the progress of some long running method in another thread. ...

CIL,CLS,CTS IN .NET

what is the CIL,CTS,CLS in .net and what is the difference among them? ...

How to load balance with WCF

I am setting up a desktop WPF application with my BLL running as a WCF service on a separate application server. I'd like to set up a server farm and load balance the BLL. What is the recommended method to accomplish this? Does WCF include any features that help with load balancing? ...

Convert List of objects to List of interfaces

if i have objectA that implements ISomeInterface why can't i do this: List<objectA> list = (some list of objectAs . . .) List<ISomeInterface> interfaceList = new List<ISomeInterface>(list); why can't i stick in list into the interfaceList constructor ? Is there any workaround? ...

Resources for learning ASP.NET MVC 2.0

What are some good resources for learning ASP.NET MVC 2.0 (if I don't already know ASP.NET MVC 1.0)? ...

How to create an instance of value types using reflection

I want to create an instance of value types like System.String, System.Boolean, System.Int32, etc. I get qualified names of types like System.String or MyNamespace.Employee and I have to create an instance and return back. I use Activator.CreateInstance and FormatterServices.GetUninitializedObject to create instances. But it fails in cas...

Using an absolute value in a .net installer

I'm using WIX files to build an MSI to deploy an application. It work using an environment value, <Property Id="ProgramFilesDir" Value="$(env.ProgramFiles)" /> but doesn't seem to understand abolsute values, e.g <Property Id="ProgramFilesDir" Value="X:\MyFolder\" /> Is there anywhere else I need to declare absolute values? ...

LINQ query finds subclass in an ObservableCollection of base class

I'm still getting my head around LINQ queries and the LINQ extension methods. Say I have a base class BaseA and subclass SubB with a property IsAwesome. I have an ObservableCollection<BaseA>. Is there some neat way I can grab a collection of only SubB classes where IsAwesome is true? ...

Problem accessing SQL Server from network share after reinstalling SQL Server

Hello everyone, I have a problem, that is really driving me crazy. First of all I must admit, that most of the work was done by a coworker, who isn't available anymore. Before reinstalling the MSSQL Server rig, the whole thing looked like that: Someone has developed a little .Net c# program which connects to the SQL Server, that is ...

How to read certificates from my certificate store?

I want to install a certificate on a machine if it doesn't have it installed already. I tried checking if the store contains the certificate but somehow my store is always empty. I checked "Intermediate Certification Authorities" folder and found 18 certificates there. So why does this code write 0? X509Store store = new X509Store(Store...

NHibernate one to many problem

Hi I'm trying to map some tables using Nhibernate and it generally works apart from when it comes to one-to-many classes. I have a Visits table where each visit has many Inspection records. The mapping file for Visits contains the following: <bag name="Inspections" lazy="false" fetch="select" cascade="none" inverse="true"> ...

Why doesn't Moq run the overridden ToString method?

In the following code why does mockTest.ToString() return Null? EDIT: Added comment into example code to show how to fix the problem. Public Sub Main() Try Dim test = New TestClass If test.ToString <> "stackoverflow rules" Then Throw New Exception("Real Failed: Actual value: <" + test.ToString + ">") ...

WCF IConnectionRegister Duplicate Log Entries

I have some WCF log entries that have an action of http://tempuri.org/IConnectionRegister/Duplicate with a corresponding http://tempuri.org/IConnectionRegister/DuplicateResponse. Could someone shed any light as to what these are please? They seem to contain socket information, but I am curious as to the name "duplicate". Thanks ...

c# - Closing browse dialog causes form to close

I have a form which is displayed through: ShowDialog(). The form doesn't have CancelButton specified. When I open a BrowseDialog from the form and then close the BrowseDialog, the form is also closed. How can I prevent this from happening? When the "browse"-button is clicked: browseDialog.SelectedPath = projectLocation.Text; browseDi...