One error I stumble upon every few month is this one:
double x = 19.08;
double y = 2.01;
double result = 21.09;
if (x + y == result)
{
MessageBox.Show("x equals y");
}
else
{
MessageBox.Show("that shouldn't happen!"); // <-- this code fires
...
Hello everyone,
I am using C# + .Net 3.5 + VSTS 2008 + ADO.Net + SQL Server 2008. And I am sharing one single SQL Connection object (TestDBConnection variable in my below sample) within my application.
The exception I met with is, "There is already an open DataReader associated with this Command which must be closed first.." Any ideas ...
I have a view from which I am selecting three columns. Of these three columns, one of them contains the OS version.
I want to create an additional column in the result which checks the OS Version. If the OS Version is less than 5.1 it should return 'Bad', if it is greater than that it should return 'Good'.
Any ideas about how to add t...
I've found lots of examples of the repository pattern, all of which show the repository managing it's own connection lifecycle. I was wondering how people deal with a case where they want to share a single connection across multiple repositories?
The main reason I'm asking is because when I create a transaction, using TransactionScope,...
I have an application which is making use of the RSACryptoServiceProvider to decrypt some data using a known private key (stored in a variable).
When the IIS Application Pool is configured to use Network Service, everything runs fine.
However, when we configure the IIS Application Pool to run the code under a different Identity, we g...
I have a windows form project in Visual Studio that reads configuration files from an other project in the same solution. Once deployed this application will run from the root folder for the solution and the files will then be read from something like "/Project1/connection.config".
When I however debug the forms application and get the ...
Our .NET app copies large files, and needs to give the user feedback; so rather than use File.Copy we read a chunk of one file and write it to the other, and display the progress after each chunk. Nothing out of the ordinary. But what's the right size of chunk to use, to give the fastest file copy, assuming the time to display the prog...
I'm using Blackberry's ESS that includes support for sending an email to its own SMTP server which then pushes the email to the Blackberry device.
When using Thunderbird to send to this SMTP server, it works perfectly, I can send multiple emails without problems.
However, when using SmptClient, or a few third party componenets, and fin...
Does anyone know of a .NET array class/library which will page its contents out to disk?
The idea is to be able to use it as a normal array but the class uses less RAM (to avoid getting out-of-memory exceptions with more than 2GB of data). Ideally the class will implement one of:
System.Collections.Generic.IList
System.Collection.ILi...
Hi
Im workin for last few days on possibility to modify brightness or contrast in my video player (avi, mpeg, wmv), i was tryin with:
DirectX.AudioVideoPlayer.
Direct Show and Video Mixing Renderer
Windows Media Player Component
in every case im able to play, pouse, stop, mute video and so on. but i stuck with controlling of brightn...
We're looking at patterns such as MVP that can help make us seperate UI from logic from data. The initiative is late in the game, but is an effort to begin to set rules that we need to write more testable code (currently we write hairballs, spaghetti, duct-tape and wood screws, etc.)
As we look to the approaches to take with out 2.0 ...
Hi,
When I develop a C# console application (which will run on a server) and I run it using Visual Studio, I get a "Press any key to continue" message before the program terminates.
However, when I compile the very same C# code file manually using CSC, my program doesn't show that message and it terminates immediately after finishing i...
In .net, is there a standard library that should be used to read in csv files? All the samples on the web roll their own csv reader / parser, or use OleDb.
It's not a problem using any of these solutions, I was just wondering if there is a generally accepted library (not that I can find), or any other "proper" way to do it?
...
Hi
I've to parse over a piece of HTML.
It looks a bit like:
<table>
<tr>
<td class="blabla"> <table><tr><td><table><tr><td></td></tr></table></td></tr></table>
</td>
</tr>
<tr>
<td class="blabla"> <table><tr><td></td></tr></table>
</td>
</tr>
</table>
I need to extract each td with class blabla, but ea...
I'm doing some pre-processing of an XML document in a .NET Webservice (Standard .NET SOAP Service) for eventual use in a Silverlight front end.
I'm processing that XML document into a POCO object for ease of use. The object is defined as follows:
public class CACDocument : ITextDocument
{
#region Properties
public string Title...
What is the best way to loop through an assembly, and for each class in the assembly list out it's "SuperClass"?
...
Hi there I am writing a piece of code where I want to make sure that the code is onle executed on the machine in which OS is WindowsXPSP2 or greater. I have got OS version of the OS ex- 5.1,5.2 and so on.
I just want to know how can I make sure that the OS is either WindowsXPSP2 or greater?
Can I check it with version number > 5.1?
...
I have a WCF service, hosted in IIS returning the following error (when trying to call a method or even just browse to the service definition):
"Service not available"
The error log shows a bit more detail:
An unhandled exception occurred and
the process was terminated.
Application ID:
/LM/w3svc/1/ROOT/C_wcfService
...
Hi - I've got a PowerBuilder project that calls my .Net class library exposed to COM. I'm very new to PowerBuilder and just starting to pick it up. Id like to create some simple tests for my COM calls and I've looked for quite a while and can't find anything that is similar to the VS Diagnostics methods.
Does this functionality exist?
...
Hi,
Why there is InvalidCastException thrown? Can someone describe me this behavior?
object zero = 0;
decimal? dec = (decimal?)zero;
TIA
...