.net

How to merge two arrays of undefined type in C# using .NET 1.1

I'm trying to create a utility method that will accept two arrays as parameters, merge them together, and return the resulting array. Discarding duplicates. Ideally, the parameters would accept any array type, such as int[] or string[]. I'm using C# .NET 1.1, and therefore do not have access to Generics or Array.Resize(). Is there a b...

NDepend Code Quality Metrics - Custom CQL - Brownfield development

I'm working on a brown-field project that was initially developed for .NET 1.1, and subsequently was retro-fitted to .NET 2.0, with a smattering of .NET 3.5 I'm curious what kind of metrics to use to begin finding optimization and modernization inflection points. Are there any good CQL queries that anyone has found useful in cleaning u...

Using Android app to interact with a Windows application

I'll come up with any excuse to get a chance to write my first Android application. I've never done much with it except for a couple of tutorials. I've got a Windows application that controls a device, and the computer isn't necessarily right next to it. I think it would be great to be able to use my Droid to issue the device commands...

Explain sorting in ASP.NET Dynamic Data

Can anyone explain what the Dynamic Data team was thinking when they designed grid sorting in Dynamic Data scaffolded tables? Sorting defaults to using all columns, in the order the appear in the model, often arbitrary very counter-productive. We've just had a run in with the 'out-of-the-box' sorting, and solved it with a simple SortEx...

Update WPF controls at run time

I'm trying to write a WPF application that will update a set of text boxes and labels at run time using threads but the problem is that when ever a thread tries to update the text boxes and labels I get the following error: "The calling thread cannot access this object because a different thread owns it." Is it possible to update the co...

The file is busy. I can't delete it.

I set copyright on the image. After that i need to delete the old file. But i can't because it's busy. I need rename the copyrighted file from "copyrighted_"+imageFile to imageFile. public static void SetImageCopyright(string imageFile) { #region //create a image object containing the photograph ...

Defining DataTrigger for StackPanel

How do I define a DataTrigger for a StackPanel? It does have a Trigger property, but defining a trigger here gives the following error on Initialize when starting the application: Failed object initialization (ISupportInitialize.EndInit). Triggers collection members must be of type EventTrigger. .... This is given from the follo...

RX IObservable as a Pipeline

Currently, I'm using the RX Framework to implement a workflow-like message handling pipeline. Essentially I have a message producer (deserializes network messages and calls OnNext() on a Subject) and I have several consumers. NOTE: If and transform are extension methods I have coded that simply return an IObservable. A consumer does so...

Changing background color of the form with hexadecimal code.

I have one method named ChangeFormBackground(Color colorName) which changes the form background with the colorname which is the parameter of the method.Now when I call this method I have not color name but the hexadecimal code of the color and I want to change the background color of the form with that hexadecimal code using that method ...

IronRuby System.DateTime NilClass

Why comparing to null is so unstable? Just code. IronRuby 0.9.4.0 on .NET 2.0.50727.4927 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'System' => true >>> i = System::Int32.MinValue => -2147483648 >>> i==nil => false >>> d = System::DateTime.Now => 11.02.2010 14:15:02 >>> d==nil (ir):1: can't convert NilClass ...

.net message loop

Hi everyone. Could anyone help to explain how can I interact with message loop in WPF? I know how to start it using System.Windows.Threading.Dispatcher.Run() Now, I just need a way to call it. I have a while-loop and I whant to process messages in a message loop from it. while (state == DebuggerStaus.Waiting) { ...

Check if path is on network

Hi, In my app I have a dialog in which the user can select a database backup location. If want to warn the user if the location he/she selected is "probably not secure". I want to consider the following locations secure: When selected folder is on a network (either by a mapped drive (e.g. "I:\Backup") or UNC notation (\server2\backup...

Determine Assembly Version during a Post Build Event?

Let's say I wanted to create a static text file which ships with each release. I want the file to be updated with the version number of the release (as specified in AssemblyInfo.cs), but I don't want to have to do this manually. I was hoping I could use a post-build event and feed the version number to a batch file like this: call foo....

Is it possible to run devenv.exe in foreground?

I need to build a solution with CAB Project. As far as I understand I should use devenv.exe in order to build CAB. Following command line starts devenv.exe in background: devenv.exe MyActiveX.sln /Rebuild "Release" Is it possible to run devenv.exe in foreground? I would like to get build traces not in file but to stdout. ...

How do I perform several string replacements in one go?

I'm writing an app in C# which allows the user to perform database queries based on file names. I'm using the Regex.Replace(string, MatchEvaluator) overload to perform replacements, because I want the user to be able to have replacement strings like SELECT * FROM table WHERE record_id = trim($1) even though the DB we're using doesn't su...

Using Ruby or PHP with .NET

Hi, Currently we have a web application written in the providers own proprietary language / framework. Unfortunately, with it's limited syntax and "wonky" architecture its not great to work with. With some really great development platforms out there (.NET, PHP, Ruby - note that I know nothing of PHP or Ruby but i've heard they are gre...

Asp.net hashing (using codesmith) when upgrading from .net 2.0 to 3.5

Hi, I'm administrating servers running IIS 6, hosting a website on ASP.NET 2.0. Yesterday I installed .Net framework 3.5, and all my user authentication system was lost. Users can't log in, because their password arn't getting authenticated, maybe because the hash function has changed in 3.5??? I can't really get to the code, but I know...

VS2005 rebuilds .NET/CLI projects on implementation detail changes in .cpp files

My solution consists of several native, C++/CLI wrapper and managed libraries/assemblies. The wrapper projects are referencing different native DLL-projects. Every time i change an implementation detail in a .cpp file of a native dependency, all CLI/.NET projects are rebuilt (not just linked, but recompiled). This also happens in the Deb...

List<T> vs BindingList<T> Advantages/DisAdvantages

Can someone describe what the difference between the two are for my project. Currently I have a List<MyClass> and set the BindingSource to that and a DataGridView to the BindingSource. I have implemented IEditableObject so when CancelEdit is called I revert my object back to what it was with a Memberwise.Clone() Will changing my List ...

Does any .NET ORM support localized entities out-of-the-box ?

I need to store localized entities in a database (for instance a Product, which has a Name, which is different in English and Danish). There are several well-known ways to do this, for instance having some sort of a resource table containing the values of the localized columns. However, this does not seem to be very easy to fit into an ...