.net

String representation of small amounts of money

Formatting large amounts of money is not an issue (e.g. converting a decimal to dollars): myDecimal.ToString("C", {some culture info}); However, my current problem is dealing with very small amounts of money (e.g. cents/pence, etc.) and rather than formatting 5 cents as $0.05 (or 5 pence as £0.05), I need to format as 5¢ or 5p. Is th...

How to not pass around the container when using IoC in Winforms

I'm new to the world of IoC and having a problem with implementing it in a Winforms application. I have an extremely basic application Winform application that uses MVC, it is one controller that does all the work and a working dialog (obviously with a controller). So I load all my classes in to my IoC container in program.cs and crea...

Unable to write a file to the server

I have a web service that creates files on the server. It works great locally. As soon as I deploy the service to the shared host, it hangs. No exception is caught in the front end web site. When I inspect the folder where it should have written a file, I see the file written with 0 bytes. Is this a permissions issue? Any help is appr...

How can I programmatically retrieve the alter view script for a view in SQL Server 2005.

We allow our uses to alter certain views for reports and what not based on some application field meta data that we keep track of in our application. These fields can be created at run time. I have a standard process in place to alter the views when a field is added or removed. I now need to do this programmatically however, which mea...

Are double* and double** blittable types? C#

Hello, I have a question regarding marshalling of C++ arrays to C#. Does the double* automatically convert to double[]? I know double is a blittable type, so double from C++ is the same as double from C#. And what about double**, does it convert to double[,] ? I have the following unmanaged function: int get_values(double** param,in...

LinqToSql + calling .Count fails in production only

Hello, This should be very simple, but its very frustrating. I have a LinqToSql as below, it works fine in development but when i move the code to production it blows up on .Count update, resolved the issue, but dont understand why i had to... Please explain if you can, im confused. The code below works fine in development, in orde...

Unix timestamp to .net DateTime

I must be doing an obvious mistake but I can't figure it out. I am importing a date stored in a mysql database (it is stored by the ExpressionEngine CMS). It is a unix timestamp, i.e. seconds since 1/1/1970 00:00. So I'm doing something like this: DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); dateTime = dateTime.Add...

loading assemblies at runtime - plugin vs appDomain vs StructureMap vs MEF

I'm working on an application where users can create classes programatically at runtime. They have a UI screen where they fill out meta data which gets turned into classes. Basically, the data the user enters is used to generate properties in the .cs file. So, I need to be able to instantiate an object from the generated class file af...

What Are Your Thoughts On Entity Framework 4.0?

The initial release of the Entity Framework wasn't regarded well in the development community. Developers felt a number of things were left out, and many continued to use other ORM's, such as LINQ To SQL and NHibernate. The good news, however, is that Microsoft has been hard at work on the 4.0 release of Entity Framework, which will brin...

Is it right to use IoC for the extensibility of my entities or domain model?

Hi Everyone, I've came across a dilemma which I think is worth discussing here. I have a set of domain objects (you can also call them entities, if you like), which get some data from a separate DAL which is resolved with an IoC. I was thinking about making my system very extensible, and I'm wandering if it is right to also resolve th...

Interface 'System.Web.Mvc.IValueProvider' cannot be indexed because it has no default property

This used to work. <AcceptVerbs(HttpVerbs.Post)> _ Function Widget(ByVal collection As FormCollection) As ActionResult ... If ... Then ModelState.AddModelError(...) ModelState.SetModelValue("Gadget", collection.ToValueProvider("Gizmo")) Return View() End If ... End Function I upgraded to ASP.NET...

MS Stack web host with HIPAA expertice?

I'm a consultant, helping a provider of small medical practice management software move to the web. We're looking for a host that has experience with HIPAA-compliance, and supports the MS Web stack (IIS / .net / SQL Server) Can anyone here provide a recommendation of such a hosting company? Thanks, Andrew ...

Unhandled Exception in List Sort

So, I have a list containing a custom class, MyClass MyClass has properties, which can be null (but aren't meant to be). When this class is sorted, using a custom sorter, where the sorter accesses this null property and throws an exception, the exception is considered unhandled, even though there is a try-catch block around the sort me...

How do I get a relative path from one path to another in C#

I'm hoping there is a built in .NET method to do this, but I'm not finding it. I have two paths that I know to be on the same root drive, I want to be able to get a relative path from one to the other. string path1 = @"c:\dir1\dir2\"; string path2 = @"c:\dir1\dir3\file1.txt"; string relPath = MysteryFunctionThatShouldExist(path1, path2...

Resharper Suggestion Color Issue

I have a strange bug in resharper 4.5 in VS 2005. Instead of doing the usual underline for a suggestion -- IE: telling me that a using statement is unnecessary, it is setting the background to red in the same manner as a breakpoint. Here is a screenshot. I have uninstalled and reinstalled several times, including an install of resharp...

Visual Studio 2008 Editor Configuration - Caret & Current Line

I am trying to do a couple of things to customize the Visual Studio 2008 Editor Configuration. I want to do this via some setting or macro that I can write myself. I can't install third-party add-ins such as resharper to achieve these goals in the environment where I work. Here is what I need to do: I want to change the color of the ca...

Getting the contents of web page and processing it (Print or save to file)

I am a Real Estate appraiser and have some limited experience with vb and .net. I have a task which I perform which requires me to go to the conuty appraisers web site and print a copy (to image bmp or jpg or directly to the default printer) of the current public record info for anywhere from a few pages to 1,000 plus records at a time. ...

Problems connecting to WCF with in-code client

I'm trying to connect to a WCF service with an in-code configured client. The host is configured through web.config file. I get exception "The remote server returned an error: (405) Method Not Allowed." I've test it with self-hosting and it worked but I can't get it too work when it's running on it's own. I'm trying to get it too work wi...

Can I translate .net assembly versions to dates?

All of my .NET assemblies uses the 1.0.* format for their version numbers. Supposedly the * gets replaced with the current date and time, translated into a number. What is the formula to translate it back into a date and time? ...

ConfigurationSection - Custom Section is undefined - Why?

Hi, I'm trying to build a custom configuration and with some reason, I can't get it work. I'll appreciate if anyone can see where my problem is. Here is the code: public class PointServices : ConfigurationSection { public static PointServices Get() { var t = ConfigurationManager.GetSection("point.Se...