.net

Controlling the sort order of a list from an admin UI

Hi I have a list of data that users are able to control the sort order of. It looks something like this Apples /\ \/ Oranges /\ \/ pears /\ \/ banana /\ \/ Pineapples /\ \/ etc /\ \/ the /\ and \/ are meant to be up and down arrows When the user clicks up i want to retrieve the current sort order and ta...

J2EE integration with .NET for authentication

I have a Java Enterprise Edition web application, a standard WAR. I want to integrate this with an existing .NET infrastructure running IIS. To be specific, I need to be able to share user sessions between the two applications in some secure manner. Is there a "standard" way of doing this? Edit: I do not need full session sharing, sorr...

IIS7/2008 Sql/Service Connection Issues

While trying to get a 2008 server to connect to a sql server, I noticed a change in the 2008 IP stack that has me a bit flummoxed. I'm looking for either an OS way to override this, or a programmatic way in .NET to override this. For the sake of this argument, assume I have a web server with multiple IP addresses to server multiple site...

Does queuing threads impact non-thread safe objects in the same class?

If I spawn a thread with ThreadPool.QueueUserWorkItem and that thread does not reference the object that is not thread safe, would it compromise that non-thread safe object? [Edit] By not thread safe object, I mean a third party interface to a programmable logic controller that has no ability to open simultaneous connections or concurre...

Antialiased SmoothingMode distorts Dashed Pen

Why does switching on anti-aliasing interfere with my dashed pen? ...

ASP.Net MVC ModelState / Html.TextBox postback issue

I have an issue cropping up in a form I'm trying to post. In the scenario where the form doesn't validate, I'm taking the standard route of calling ModelState.AddModelError() then returning a View result. The thing is, the HTML.* helpers are supposed to pick up the posted value when rendering and I'm noticing that my text fields ONLY do...

linq query to join two tables and get the count from one table values from the other

I have two tables Customers, Orders Customers CustomerID FName LName Orders OrderId CustomerID OrderDate I want to make a linq statement that can join these two tables and get FName, LName, Count of orders for each customer ...

Array initialization in Managed C++

I wish to declare and initialize a 1D managed array of items. If it was C# code, I would write it like this: VdbMethodInfo[] methods = new VdbMethodInfo[] { new VdbMethodInfo("Method1"), new VdbMethodInfo("Method2") }; I am trying to write (well, actually, I'm writing a program generate) the same thing in managed C++... So f...

How much memory is allocated for each element when you dimension an array?

For instance, in VB.NET: Dim strArray(5) As String As I understand it, because this is an array, the computer will allocate contiguous memory locations for each of the 5 elements. But how much space is allocated for each of the five elements? What if I decide to put a 5MB block of text in position 2 of the array? Is it differen...

Using marker classes to control logic flow

I have been going through some code seen that a colleague of mine is using 'marker classes' to control program logic (see contrived example below). It seems to work well, and the code reads really nicely, but there is just something about it that smells... namespace ConsoleApplication4983 { public class MyClass { static ...

Embarrassingly parallelizable tasks in .NET

I am working on a problem where I need to perform a lot of embarrassingly parallelizable tasks. The task is created by reading data from the database but a collection of all tasks would exceed the amount of memory on the machine so tasks have to be created, processed and disposed. I am wondering what would be a good approach to solve thi...

Choosing between MEF and MAF (System.AddIn)

The Managed Extensibility Framework (MEF) and Managed AddIn Framework (MAF, aka System.AddIn) seem to accomplish very similar tasks. According to this Stack Overflow question, Is MEF a replacement for System.Addin?, you can even use both at the same time. When would you choose to use one vs. the other? Under what circumstances would yo...

Why does nullable KeyValuePair<,> have no key property?

I have the following: KeyValuePair<string, string>? myKVP; // code that may conditionally do something with it string keyString = myKVP.Key; // throws 'System.Nullable<System.Collections.Generic.KeyValuePair<string,string>>' // does not contain a definition for 'Key' I'm sure there is some reason for this as I can see that the type...

What should go into a top level namespace?

What should go into the top level namespace? For example, if I have MyAPI.WebLogic, MyAPI.Compression, etc. If I put classes into the top level namespace, am I violating the principle of encapsulation? ...

Bug in Array initialization in Managed C++ (followup)

Following up from my previous question. Can anyone explain why the following code compiles without any errors: typedef array<VdbMethodInfo^> MethodArray; typedef array<VdbParameterInfo^> ParameterArray; ParameterArray^ parameters = gcnew ParameterArray { gcnew VdbParameterInfo("name", "string", "Paul")}; MethodArray^ methods = gcne...

Why doesn't StreamWriter work in a Windows Service?

Hi community, I have this simple code that records appends a log to a text file: public static void RecordToFile(string filename, Log log) { TextWriter textWriter = new StreamWriter(Constants.APP_PATH + "\\" + filename, true); textWriter.WriteLine(log.ToString()); textWriter....

Can you Obfuscate LinqToSql Assemblies with .net reactor without breaking them?

I am using .net Reactor to obfuscate a data layer assembly containing LinqToSql classes. On invoking the assembly, i am getting the following error.. Bad Storage property: '_ApplicationId' on member 'RCSQLData.Application_DB.ApplicationId' I am using the 'Library' mode and have enabled 'Necrobit' and 'obfuscation'. Is it possible to ...

TranslateAttribute for my asp.net-mvc site

In my current project I have a custom ViewData that has (amongst others) the following properties: CustomViewData + IList <Language> siteLangauges + Language CurrentLanguage + T9nProvider All my URL's go like this: http://someUrl.com/{siteLanguage}/{restOfUrlIncludingcontrollersAndACtions} I want to create an ActionAttribute ...

Is this hWnd a child of mine?

How can I tell if an hWnd belongs to one of my child controls? I want to do something like: if(this.Controls.Find(hWnd) != null) return false; ...

How do I configure the name of a Windows service upon installation (or easily at compile time)?

I've created a Windows service in C#, installed it on a server and it is running fine. Now I want to install the same service again, but running from a different working directory, having a different config file etc. Thus, I would like to have two (or more) instances of the same service running simultaneously. Initially, this isn't pos...