.net

Visual Studio 2010 and .NET 4.0 Client Profile

We are a .NET component vendor, our product needs to connect to the internet to be activated. In Visual Studio 2010, as soon as you create a new WinForms project the .NET Framework 4.0 Client Profile is selected not providing the necessary support for internet connections. Despite this arguable Default chioce, is there something we can ...

ISAPI REWRITE ON IIS

I am workin on a aspx site hosted on shared hosting on appliedi.com with isapirewrite enabled. The site structure is WWWROOT->WEBSITE->FILES If i am right, all rewriterules go in to htaccess file. Now one such file is present in WWWROOT Folder, one in WEBSITE My questions, 1. which htaccess actually works 2. When i see both files there...

Long-term .NET plan (or roadmap)?

Does anyone know what is the Microsoft perception for the .NET future? Being mostly based on Delphi microISV shop I know that Delphi's future is uncertain but a few milestones are already announced in their roadmap: support x64 bit building native executables for Mac building Linux native executables QT bindings for VCL replacement Da...

List shared between different threads in .NET

I have a static List in a class that will be accessed by different threads, each one adding, reading and removing its own unique item from the list. I would like to know if I have to worry about making this variable thread safe, as even though the same List object is shared between threads, they only modify their own unique items ...

Creating Own Exceptions

I'd like some advice on building in known errors. Let's say I have a Windows form that needs to set the source path of an image in an object. It must be: A valid path An image A PNG 32 x 32 in size No transparency The thing about catching errors is that I'd like the class to handle the errors as much as possible, instead of the Windo...

Return MyNestedClass<K> when MyNestedClass is not MyNestedClass<K>?

Breaking down the MS RBTree (an internal .Net abstract class), I have discovered that one method returns TreePage<K>: private TreePage<K> AllocPage(int size) { ... } Within the method, variables are declared as TreePage...but the class is not defined that way: private sealed class TreePage { ... } Yet, when I mimic the code...

How to correctly use SerialPort.DiscardInBuffer ?

I've written an application which reads from a serial device at a very fast rate. The serial port object however, fails to fire the DataReceieved event after about 20 min of continuous operation. Disconnecting and reconnecting the serial programmatically allows the event to work again but for only another 20 min. I tried using DiscardIn...

Ajax.BeginForm Displays Partial as a New Page...

I have a partial view that I render on my Home/Index page. Its a short form with a viewmodel for and annotations for validation. It calls the controller and upon failure(since I don't type anything in and I have [Required] tags in my view model) it re-renders the partial view as a new page. My question is do I have to just return JSO...

How to "box" a value WITHOUT using programming language's boxing support?

I want to box a value without using whatever .NET language's built-in support for that. That is, given an enum value I want an reference type object that represents that value and its type. This is a subgoal of being able to pass enum values from late binding pure C++ code, a possible solution of that, so, I'm not looking for how to us...

Adding audit columns to a Fluent NHibernate many-to-many junction table

I'm using Fluent NHibernate to generate a database schema from .Net entity classes. I have two classes User and Permission with a many to many relationship, and Fluent NHibernate is correctly generating a junction table UsersToPermissions in the database. As expected the junction table is storing the primary keys UserId and PermissionId...

CPU usage goes to almost 100% with Async quere processing

I have an async queue processor that has a Run method whick keeps running with a pause of 100ms. This code results in CPU usage of almost 100%. following the thr code of 'Run' method of this async queue processor. private void Run() { while (true) { if (q.Count != 0) ...

How would a LISP developer solve the problem that AutoMapper solves in .NET?

I.e. transferring the state from one object to another object, which shares some (but not all) of the first object's members. I'm not applying this question to any real-life problem yet, but I guess I'm asking it to get a feel for the differences between the problem-solving approach in LISP as opposed to object-oriented languages like C...

What should I map a TimeZoneInfo property to a SQL Server 2008 DB Type?

Hi folks, I have a TimeZoneInfo property on some object which I need to save to a Microsoft SQL Server 2008 database. What type of database field type should I use, please? If it helps, I'm also using Entity Framework 4, which came with my Visual Studio 2010. ...

ASP.NET MVC 2 - Binding To Abstract Model

Hi Guys, If i have the following strongly-typed view: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<XXX.DomainModel.Core.Locations.Location>" %> Where Location is an abstract class. And i have the following Controller, which accepts a strongly-typed Model via a POST: [...

C# MVC2 - Generic Collection to IEnumerable<string>

I can't seem to figure this out...a little help please, thank you vm! I have a generic collection of Features. Each Feature has a FeatureId and FeatureName. I need to pass the featureids into an IEnumerable<string>. I thought I was close with this: Listing.Features.ToArray().Cast<string>().AsEnumerable(); and even tried to 'MacGy...

Resource ftp-server/client for .net

Hi all, Anyone know where could I find resource for ftp client and ftp server? I need sample source-code to create customize ftp client and ftp server. Thank. Regard, ...

Group by in Datagrid View

Hi, i have a scenario where i have to group the PinCode by city name like one city can have many pincode. I have to do this in winform in datagrid. How can i do this so in datagrid i can see the + and - on before city. I thing it can be done by nested grid. please, help. Column A | Column B | Column C Country Zip Co...

Decide when to use a particular .NET feature.

Is there any book that shows actually when to use a particular .NET feature? For example: (1) Remoting. In which scenario to use and what are the advantages and disadvantages. (2) When to use a List and when a Dictionary. Which one is fast. etc. Edited Above are just examples. While developing which thing to use when, any book that...

Can't change target platform to "any CPU"

Hey there. I work on a x86 pc and use .NET4.0 (same probelem witn 3.5) in VS2010. If i make a new Project (e.g. WinFormsApp), the first thing i want to do is to change the targetplatform of the project/solution to "Any CPU". I do the following: Project Properties -> build -> change TargetPlatform to "Any CPU" On top of the propertie...

How broadcast ping works?

Hi Can someone tell me why when I send broadcast ICMP Request, only router send me ICMP Reply? Even if I modify MAC destination of this ICMP Request (original is FF:FF:FF:FF:FF:FF) to MAC specific host (IP still broadcast that local network ...it still don't send me Reply. Why? ...