.net

What are common Application Deployment and Configuration Best Practices with .NET?

Here's my current scenario which is specifically what i'd like to discuss as a case study, however I want this to be open enough to address other deployment practices for .NET projects. I have a .NET WPF Application written to perform manufacturing functional tests. Currently this software is deployed by copying the executable and it's...

Another DateTime.ParseExact question.

I have the following code. using System; using System.Globalization; class testCompile { static void Main(string[] args) { CultureInfo provider = CultureInfo.InvariantCulture; string format = "mm/d/yyyy"; string strInput = "11/5/2010"; string strOutput = DateTime.Pa...

How will an object with a value type and reference type be stored in .NET?

In .NET, integer data type is a value type(stack) and String is a reference type(heap). So If a class A has an integer, and a string type object in it, and a class B creates an object of class A, then how will this object of class A be stored in memory? In stack, or in a heap? This was asked in my Microsoft interview. Need to understan...

Memory leak. ManagementBaseObject stays as GC Root, but never cleaned up

I am using ANTS Memory Profiler to try and determine why my application's memory usage is continuing to grow. I run the application and take various snapshots over time. I can see that the live instances of IWbemClassObjectFreeThreaded and ManagementBaseObject keeps increasing over time. Looking at the class reference explorer I can s...

c#: DateTime.Parse problem when changing culture

Hello, I am parsing a string to convert it into a DateTime. I am geeting in some cases an error: "String was not recognized as a valid DateTime." I am getting this error only if I run the application from a computer located in a different country then US. What I see in the string is "09/20/2010 14:11" and in this case I get an excep...

How to convert Tinymce HTML code generated in the front end to a word file[.doc]???

Hi.. I'm working on doing a online word processor, such as Google Docs, Zoho etc.. I want to create its front end using Tinymce editor, i.e front end of the editor will be done using Tinymce. But i want to convert this front end generated by tinymce into a word file[.doc] at the server end.. so, tell me how to convert this HTML represent...

Catch all exception good or bad?

I've seen in multiple projects a kind of catch all exception to catch all unexpected exception so the app won't crash, i see this usually with : AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(myUnexpectedExhandler); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(threadE...

single-table-per-hierarchy mapping error

I got the following mappings <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="false"> <subclass name="Module.CRM.Models.CallRecord, Module.CRM" extends="Gate.Calls.CallRecord, Gate.SDK" discriminator-value="call_record_id"> <property name="ContactId" column="contact_id" /> ...

Response time Issue in WCF REST Service returning a large file

HI, I have created a WCF REST service with response format as JSON. The basic functionality of the service is that when it is called it will return a large file(mostly zip file) from the file system to the requester. The time taken for the file to completely downloaded by the user is taking more than 20 mins for 20MB file. How to find ...

What does Html.HiddenFor do?

Although I have read the documentation on Html.HiddenFor, I've not grasped what is it used for... Could somebody explain its uses and give a short example? Where should those helpers go in the code? ...

ASP.Net MVC 2 - Merge all outputs to a single assembly

I have a Web Deployment Project in my solution. The solution consists of the MVC2 App and another Class Library. In the Web Deployment Project properties I have the Merge all outputs to a single assembly option ticked and I have given it a name. When I look in the bin folder I have all my reference DLL's from my MVC app, a DLL with th...

C# creating a custom NumberFormatInfo to display "Free" when a currency value is $0.00

I need to display a currency in my ASP.NET MVC application but when the currency is 0 I would like it to display "Free" (localized of course!) instead of $0.00. So when I have something like this... Decimal priceFree = 0.00; Decimal priceNotFree = 100.00; priceFree.ToString("C"); priceNotFree.ToString("C"); The output is "$0.00" "$1...

Removing read only attribute on a directory using C#

I was successfully able to remove read only attribute on a file using the following code snippet: In main.cs FileSystemInfo[] sqlParentFileSystemInfo = dirInfo.GetFileSystemInfos(); foreach (var childFolderOrFile in sqlParentFileSystemInfo) { RemoveReadOnlyFlag(childFolderOrFile); } private static void RemoveReadOnlyFlag(File...

psake vs. rake for .NET builds

I'm investigating build tools for use with an ASP.NET MVC 2 application. I like the idea of using a scripting language rather than XML, and have narrowed my choices down to psake or rake. I don't have much experience with Ruby or PowerShell, but am willing to learn either. I don't mind installing Ruby on my build server if that's my best...

visual studio 2010 from 2005?

What happens if I compile and deploy solutions written in vs 2005 using 2010? Must the web server have 3.5 and 4.0 installed? Will my web.configs change? I'm talking mostly about standalone DLLs used in SharePoint and Web application solutions that use .net 2.0. Can I have vs2010 and vs2005 on the same development client? Is there...

How can I load an HTML string into Webkit.net so I can access its "DOM"

I'd like to use Webkit.net to load an (X)HTML string and then analyze the DOM in order to "compress" it (remove whitespace, newlines, convert <input></input> and <input /> to <input> (basically an XHTML to HTML conversion, doctype allowing). Is there anyway to do get the "DOM tree" in webkit.net? If not, are there any .net HTML parsers ...

Is wpf still relevant and can I use it in my C# windows application

I have a process which I break into multiple processes and even when using threading it takes a very long time to complete. I'd like to give the user an indication of the status of the execution in a cute way. (for each process % complete) Maybe betting the right horse will ease the pain :) I found this project long ago: http://www.co...

Setup project custom action reading checkboxes

I have checkboxes and a dialogue added. I need to be able to read the state of the boxes from a custom action. I also need the path which I have but I can't find how to read the state of the checkboxes. How can this be done? public override void Commit(IDictionary savedState) { base.Commit(savedState); String TargetDirectory =...

Help debug a stackoverflow - next steps with repeating stack?

Folks, I've got a stack overflow in my .net 4.0 app. using WinDbg I've found the following chunk of stack-info repeated 110 times (with different memory addresses of course), which leads me to believe that this is the case of the overflow. The issue is that none of this seems like my code! Any suggestions on how to proceed with debug...

AxImp Generated Reference

I've recently been working on a C#/VS2008 project which requires 3 ActiveX controls. I created a .NET wrapper using AxImp.exe for the controls, and added them as references to my project. The code had been working without any trouble for a few days. Yesterday, I pulled a clean version from our version control server (the wrapper DLLs w...