.net

How scalable is System.Threading.Timer?

I'm writing an app that will need to make use of Timers, but potentially very many of them. How scalable is the System.Threading.Timer class? The documentation merely say it's "lightweight", but doesn't explain further. Do these timers get sucked into a single thread (or very small threadpool) that processes all the callbacks on behal...

Remove Meta Data from .NET applications?

Is this possible? Does the .NET framework depend on the meta data in the bytecode? I'd like to have an application i write not work in reflector or a similar .NET decompiler. Any help would be super :D ...

Help accessing application settings using ConfigurationManager

In .net frameworks 1.1, I use System.Configuration.ConfigurationSettings.AppSettings["name"]; for application settings. But in .Net 2.0, it says ConfigurationSettings is obsolete and to use ConfigurationManager instead. So I swapped it out with this: System.Configuration.ConfigurationManager.AppSettings["name"]; The problem is, C...

How to marshal an array of structs - (.Net/C# => C++)

Disclaimer: Near zero with marshalling concepts.. I have a struct B that contains a string + an array of structs C. I need to send this across the giant interop chasm to a COM - C++ consumer. What are the right set of attributes I need to decorate my struct definition ? [ComVisible (true)] [StructLayout(LayoutKind.Sequential)] public...

(Why) should I use obfuscation?

It seems to me obfuscation is an idea that falls somewhere in the "security by obscurity" or "false sense of protection" camp. To protect intellectual property, there's copyright; to prevent security issues from being found, there's fixing those issues. In short, I regard it as a technical solution to a social problem. Those almost never...

NAnt and dual platform build - best way to build on Windows AND Mono/Linux

I'm new to NAnt but have some experience with Ant and CruiseControl. What I want to do is have my SVN project include all tools needed (like NUnit and Mocks etc) so I can check out onto a fresh machine and build. This strategy is outlined by J.P Boodhoo here. So far so good if I only want to run on Windows, but I want to be able to che...

How do I extract the inner exception from a soap exception in ASP.NET?

I have a simple web service operation like this one: [WebMethod] public string HelloWorld() { throw new Exception("HelloWorldException"); return "Hello World"; } And then I have a client application that consumes the web service and then calls the operation. Obviously it will throw an exception :-) ...

how do you programatically invoke a listview label edit

in C# I'd like to invoke the label edit of a newly added item to a ListView. basically, if I have a click here to add scenario, as soon as the new item is added, I want the text label to be in a user editable state. Thanks! ...

Installing a .NET service using InstallUtil

I'm trying to install a .NET service I wrote. As recommended by MSDN, I'm using InstallUtil. But I have missed how I can set the default service user on the command-line or even in the service itself. Now, when InstallUtil is run, it will display a dialog asking the user for the credentials for a user. I'm trying to integrate the ser...

Sending Email in .NET Through Gmail

Instead of relying on my host to send email, I was thinking of sending the messages though my gmail account. The emails are personalized emails to the bands I play on my show. Has anyone had success doing this? ...

How do I spawn threads on different CPU cores?

Let's say I had a program in C# that did something computationally expensive, like encoding a list of WAV files into MP3's. Ordinarily I would encode the files one at a time, but let's say I wanted the program to figure out how many CPU cores I had and spin up an encoding thread on each core. So, when I run the program on a quad core CPU...

XAML - Accessing static fields

How does one go about referencing a class's static properties in xaml? In other words, I want to do something like this: C# Class BaseThingy { public static readonly Style BaseStyle; ... } XAML <ResoureDictionary ...> <Style BasedOn="BaseThingy.Style" TargetType="BaseThingy" /> </ResourceDictionary> What is the syntax to do...

Best way to manage session in NHibernate?

I'm new to NHibernate (my 1st big project with it). I had been using a simple method of data access by creating the ISession object within a using block to do my grab my Object or list of Objects, and in that way the session was destroyed after exiting the code block. This doesn't work in a situation where lazy-loading is required, howev...

Looking for News and Podcast CMS

I feel I have outgrown Wordpress for where I want to take my website. I would prefer to start with a CMS core so I don't have to program that all from scratch, but am not having any luck. PHP or .NET are both options for me. Other languages are a possibility, but really depend on how much programing I would have to do. The front-end log...

Setting time zone remotely in C#

How do you set the Windows time zone on the local machine programmatically in C#? Using an interactive tool is not an option because the remote units have no user interface or users. The remote machine is running .NET 2.0 and Windows XP Embedded and a local app that communicates with a central server (via web service) for automated dir...

.NET : Double-click event in TabControl

I would like to intercept the event in a .NET Windows Forms TabControl when the user has changed tab by double-clicking the tab (instead of just single-clicking it). Do you have any idea of how I can do that? ...

How can I take a byte array of a TIFF image and turn it into a System.Drawing.Image object?

I have a byte[] array, the contents of which represent a TIFF file (as in, if I write out these bytes directly to a file using the BinaryWriter object, it forms a perfectly valid TIFF file) and I'm trying to turn it into a System.Drawing.Image object so that I can use it for later manipulation (feeding into a multipage TIFF object) The ...

What is a good dvd burning component for Windows or .Net?

I'd like to add dvd burning functionality to my .Net app (running on Windows Server 2003), are there any good components available? I've used the NeroCOM sdk that used to come with Nero but they no longer support the sdk in the latest versions of Nero. I learned that Microsoft has created an IMAPI2 upgrade for Windows XP/2003 and there...

What's the false operator in C# good for?

There are two weird operators in C#: the true operator the false operator If I understand this right these operators can be used in types which I want to use instead of a boolean expression and where I don't want to provide an implicit conversion to bool. Let's say I have a following class: public class MyType { pub...

How do you find what debug switches are available? Or given a switch find out what is being disabled?

In this question the answer was to flip on a switch that is picked up by the debugger disabling the extraneous header that was causing the problem. The Microsoft help implies these switched are user generated and does not list any switches. <configuration> <system.diagnostics> <switches> <add name="Remote.Disable" value="1"...