.net

Format a numeric string using a numeric composite format.

I've just encountered an interesting problem in a standard BoundField in a GridView. The field is for EmployeeCode, which is purely numeric, but stored in a character column in the database. The DataFormatString="{0:00000}" attribute on the BoundField doesn't work, as I assume that format is only for numeric values. To work around t...

Problem running web server through perl script

I am starting a web server(Cassini) on a remote machine through a perl script from my local machine. I am also specifying the virtual path, root directory settings, etc. However, I am not able to request files from the server as its giving me System.Net.WebException : The remote server returned an error: (500) Internal Server Error. ...

.net generic constraints and object inheritance compiling issue

I have the following situation below. This code will throw a compiler error for Test2 The type 'InheritedChild' cannot be used as type parameter 'T' in the generic type or method 'panelGenericIOGrid'. There is no implicit reference conversion from 'InheritedChild' to 'SerializerBase'. public class SerializerBase<T> { } public class...

Traversing arbitrarily large binary tree inorder

I'm stuck at finding a solution. C#, .NET 4.0, VS2010 I can easily write a recursive one, but can't for the life of me figure out something that won't overflow the stack if the tree is arbitrarily large. This is a binary tree question, and i am trying to write a public IEnumerable<T> Values() method. Here is the full code in case ...

Formatting logging for SystemDiagnosticsTraceListenerData listener of Logging Application Block

I need to perform logging to console (or debug/trace). Currently I'm using Ent Lib 4.1 Logging Application Block. To log to console I use SystemDiagnosticsTraceListenerData and System.Diagnostics.ConsoleTraceListener. It performs logging to console fine, but I'm not able to use formatter for this lister type and thus can't format log e...

Principal Permission

I worte a method with PrincipalPermissionAttrubute then i run this method but i get an exception - security exception. It happen cause i dont know who is the principal that running. I try to get the current principal by Thread.GetCurrntPrincipal() but i have a casting problem. My question is how i know the principal who running and...

Is it possible to create an instance of an abstract class in C#?

Can I create instance of abstract class in C#/.net like in Java ? Additional Info I think a lot of us does not understand what do I mean? So, In java I can create abstract class like this : Simple abstract class : /** * @author jitm * @version 0.1 */ public abstract class TestAbstract { public abstract void toDoSmth(); } Cod...

What is a good unique PC identifier?

I've been looking at the code in this tutorial, and I found that it uses My.Computer.Name to save settings that shouldn't roam between computers. It's entirely possible, however, for a user to have two identically named PCs. If they wanted to have the same username on each PC, for example, they may very well end up with two PCs named Use...

Is it possible to pass in a property name as a string and assign a value to it?

I'm setting up a simple helper class to hold some data from a file I'm parsing. The names of the properties match the names of values that I expect to find in the file. I'd like to add a method called AddPropertyValue to my class so that I can assign a value to a property without explicitly calling it by name. The method would look li...

Is it possible to download only one part of a file (e.g, the first 100KB) in C#?

I'm just curious about whether this is possible - I know how to download a file, but how can I download only the first 100KB of a file? ...

Is WWF project more useful than the typical project in .net ?

Is WWF project more useful than the typical project in .net ? Is WWF used or it's just another experimental feature from microsoft. Kindly elaborate more. Thanks in advance. I read about WWF here. ...

iPhone 3Des Encrypting matching Java and .NET key issue, SecretKeySpec?

I'm trying do some encrypt something using 3des on the iphone that must match the results from java and .NET. the code i have is: + (NSString*) doCipher:(NSString*)plainText:(CCOperation)encryptOrDecrypt { const void *vplainText; size_t plainTextBufferSize; if (encryptOrDecrypt == kCCDecrypt) { NSData *EncryptData = [NSData dataW...

Is there any limit on number of classes that a namespace can have in .net ?

Is there any limit on number of classes that a namespace can have in .net ? Further what is the recommended number of classes that there should be in a namespace? ...

Create custom exception or use built-in exceptions?

Currently I'm in the process of writing a client class that utilizes DNS, Sockets, and SSL among other classes that love to throw exceptions. Other people will be implementing this class, so I was wondering what the best practice is for throwing exceptions. Should I create my own custom exception so they know that it is my class throwi...

Can TFS Projects Reference Each Other?

I've recently begun working in an enterprise software environment with hundreds of different applications all confined to their own "silos." One of my tasks is to try to standardize things a bit, and the first attempt will be a standard event logging. Currently, the company's "standard" is "everyone should use Enterprise Library for lo...

assembly reference problem--'assembly not referenced' versus type in two assemblies

I'm having a problem with assembly references. I have four assemblies: A class library called EncryptionUtils Another class library called PasswordUtils that uses EncryptionUtils Another class library called Toolkit that is an ILMerge of many libraries, including EncryptionUtils A WPF application that uses Toolkit and PasswordUtils ...

Sync Framework with SQL DB's: Getting Started

I have an app that uses SQL Enterprise to store all data in 4 different DB's. I needed to build in the ability to work "offline" for my users. I accomplished this through Merge Replication to local SQL Express installs for everyone. This "Works" but feels like the sledge hammer approach. For instance, I am replicating all 14000 peo...

CachingCallHandler no way to invalidate cache object?

CachingCallHandler of the enterprise library caches items using NoAbsoluteExpiration. But, I don't see a way to invalidate the cache. That one would want an item cached forever with no way to invalidate it, doesn't make any sense. Before I implement my own invalidation method, I wanted to validate that there doesn't exist a trivial inva...

XmlSerializer: How can I allow a property to deserialize, but then stop it from serializing?

That is, I'd like my data to go one way - feed into a class, but then prevent it from saving out during a serialize operation. What's the best way to go about that? ...

How to prevent my C# application from opening the same file twice

Possible Duplicate: How to check For File Lock in C# ? I need to know when a text file that's opened by C# is not in use anymore - My app writes text to a txt file and sometimes it will still have a lock on it when trying to write to it again. There is no concern that another process or word may grab the lock back after it is...