.net

Add or Sum of hours like 13:30+00:00:20=13:30:20 but how?

Hello coders!!! i want to add second(00:00:02) or minutes (00:00:20) on datetime value (may be stored string type) but how? Examples: 13:30+02:02:02= 15:32:02 , 13:30+00:00:01= 13:30:01 , 13:30+00:01:00=13:31:00 or 13:30(not important) how can you help me? I need your cool algoritm :) thanks again... ...

Polymorphic associations in LINQ to SQL

Does LINQ to SQL provide out-of-the-box polymorphic associations as ruby on rails active record does? If not, is there any workaround to manually map those associations? ...

Limiting number of test run results in Visual Studio 2005

Hi, I have a 'suite' of VS2005 unit tests that attach a db as part of the initialization. Tests modify the db fairly substantially so need to revert it to a known state before each test run. I deploy the test db to the 'out' folder of each TestResult and attach it in the MyClassInitialize method. DB is fairly large so this uses up lo...

Cross platform programming on Windows

Two Questions: Is there any way to write cross platform programs on Microsoft Visual Studio? If there isn't then could I write a C# application on VS2008 and recompile it with MonoDevelop and have it work? ...

.NET Dictionary: is only enumerating thread safe?

Is simply enumerating a .NET Dictionary from multiple threads safe? No modification of the Dictionary takes place at all. ...

Method return an interface

Hi All, I'm thinking in this line of code IDataReader myReader = questDatabase.ExecuteReader(getQuest); I'm using DAAB but I can't understand how and what's the meaning of the fact the method ExecuteReader(DbCommand) returns an IDataReader Interface. Anyone can Explain, Please ...

Should I set Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture by default in my app?

I have an app which is for a global market and needs to be localisable. During development I had some problems in that my satellite assemblies never seemed to be picked up even when I changed my locale. After some research I now understand why this is and was able to test by setting the CurrentUICulture in the code and verify that thin...

Dynamically creating a new instance of IList's type

Hi, My application is processing IList's. ILists of different user defined types. I'm thinking that i can use reflection to to see what type of object the IList contains and then create a new instance of that type and subsequently add that to the IList itself? So at any one time I might be processing IList<Customer> l; and I'd like ...

ASP.NET MVC - Image Upload Failing

Got a simple form, posting to an action... the action takes the data and creates a record in the DB, and copies the image to a directory. Works great on my local dev box. Upload the form to my host, and the image uploading doesn't work. The form acts as if it's failing the UpdateModel(), but doesn't show any validation messages. Anyone...

Request a user's roles in AD when caller is not in domain

I would like to get a user's group memberships in an ActiveDirectory, without being in the domain. When I run this inside the domain, all is well. var context = new PrincipalContext(ContextType.Domain); var principal = UserPrincipal.FindByIdentity(context, IdentityType.Name, "administrator"); foreach (var authorizationGroup in principa...

How should I handle socket disconnections in .NET?

I'm building a (LAN) network application, so there is always the possibility that a connection will be disconnected, for various possible reasons. I am trying to think of a good design for handling this issue, such that it doesn't affect the rest of the application. I wrote a quick thing to try to do it, but I think it can be enhanced a ...

DataRow Update .NET

Hi, I have a question about the datarow and how I can update it... I have a datatable with two columns, id and name. I do the following: // data table has data at this point.... myTable.Columns.Add("Fri"); foreach(DataRow r in myTable.Rows) { r["Fri"] = 4; } What I am trying to do here is add a new columnm...

Generic types not equal

The code segment below prints out "The types ARE NOT the same.". Why? I am aware of the fact that using interfaceOnMyType.GetGenericTypeDefinition() will solve the problem, but why should I have to do that? class Program { static void Main(string[] args) { var myType = typeof(Baz<>); var interfaceOnMyType = myType.Ge...

Fixing the position of a form

I am starting a winform application[.NET 3.5, C#], where in the the main form of the application starts at a particular specified location. Am calling the following code in the constructor for this private void SetFormPosition() { this.StartPosition = FormStartPosition.Manual; this.Left = Screen.PrimaryScreen.Wo...

Availability of ROR flash functionality in ASP.Net-mvc

Does Microsoft MVC make available a mechanism comparable to RubyOnRails internal storage container known as flash? The preference would be not using UpdatePanel tricks. ...

In WCF, can data contract classes inherit from one another?

In a WCF service, I have two classes with the [DataContract] attribute. One of these classes has an "is-a" relationship with the other - so class B can inherit from class A. However, when I configure inheritance between these two classes, both denoted with a [DataContract] attribute, the metadata fails to load when testing the services...

Ideal options for archiving flat files

We receive multiple thousands of flat files per week currently, and I have a system that runs reports on these and exports them to PDF for our people to process and reference. I currently bulk load these into a database, make sure all fields/formatting is valid, export them, and truncate the tables on the next run. What I'm wondering...

Problem publishing an MVC app on IIS6

I have a small MVC app that works locally, but when I publish it to the server (running IIS6), all the links get messed up. For example, a typical link when running locally would be: http://localhost:3467/Exceptions?exdate=20090108 However, when I publish it to our dev server at \\deverserver\apps\MyProject, note the duplication in t...

LINQ to Entities and creating a new instance of an entity

I am trying to create a new instance of a Customer entity in our application, and I am having a few problems. This entity has several navigational properties, each of which has their own nav. properties. For example, each Customer entity has an Address entity, and each Address entity has a Phone Number entity etc. I haven't figured ou...

How to count group records based on certain values?

Hi guys. I have a report, divided into set of groups, one of them is grouped by "Status". Status values are: S, R, V. I need to make two total fields to get 1- Count of S and V records. 2- Count of R records. Any suggestions? FYI: I use CrystalReport Designer embedded with VisualStudio.NET 2005. ...