.net

How do I compare two decimals to 10 decimal places?

I'm using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0.1123456789 0.11234567891 0.11234567899 The 10 decimal limit is coming from my database, so I have to assume that the first number was al...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn't work. What am i doing wrong? protected void bttnView_Click(object sender, EventArgs e) { ImageButton bttnView = (ImageButton)sender; String param1 = bttnView.CommandArgument.Split(',')[0]; String param2 = bttnVi...

How to convert string[] to ArrayList?

I have an array of strings. How can I convert it to System.Collections.ArrayList? ...

XML custom serialization in asmx web service

Hi, I try used custom XML serialization on my own class with IXmlSerializable, and also use xml scheme. public class Service : System.Web.Services.WebService { [XmlSchemaProvider("GetSchemaDocument")] public class EmployeeDetails3 : IXmlSerializable { public int employeeID; public string firstName; ...

Race condition / TextWriterTraceListener

Hi I have something wich looks to me like race condition while logging to file from multiple thread. 1) I've got a custom logger class (ConfigurableTraceLogger) that is shared by multiple threads in my application. It's has lots of wrapper functions which all call to main core function protected void TraceData(String category, TraceEv...

Issue with Zipped Streams from .Net and reading them from Java

I'm trying to zip a stream from .Net that can be read from Java code. So as input I have a byte array, which I want to compress and I'm expecting to have a binary array. I've tested with SharpZipLib and DotNetZip to the compressed byte array, but unfortunately I always get an error when trying to uncompress it using the java.util.zip.De...

Strange flickering using ImageAttributes ColorMatrix in .NET on Win7 x64

When alpha blending some greyscale images on Win7 x64 I'm getting strange tearing and flicker. It's fine on XP & Vista (both x64 and x86) and Win7 x86. I've tried it on several Win7 machines, and they all show the problem. The code that shows up the problem is: public partial class Form1 : Form { Image image; float alpha = 0; ...

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the DataGridView was closed. If the user repeatedly views this report they eventually get an out of memory exception. ANTS Memory Profiler c...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named 'Tags'. I want to know if value 'programming' exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new OleDbCommand("SELECT * FROM table1 WHERE Tags='programming'", conn); OleDbDataReader = cmd.ExecuteReader(); What should I do next? ...

C# View Complete SOAP Message Including Headers

Is there a way in C# .NET to view the complete SOAP message I am sending to a web service without digging through a bunch of properties in a Quick Watch window? I have added a web reference to a console app, generated the proxy classes, and I'm stepping through some code but how do I view what is actually being sent? ...

Converting ASP Web Form to User Control

I have a Web Form page that is called Search.aspx. I need to render the form in other places so I'd like to convert the Web Form to a User Control, but my Search.aspx.cs inherits a custom Page class which inherits System.Web.UI.Page. Since I C# doesn't support multiple inheritance, I'm unable to inherit both my custom Page class and Sy...

DataTable.GetChanges() keeps returning NULL!

I am trying to get all the rows that exist in allData but not in removeData public static DataTable RemoveDuplicateRows(DataTable allData, DataTable removeData) { removeData.Merge(allData); DataTable newData = removeData.GetChanges(); removeData.RejectChanges(); return newData; } removeData is empty prior to the...

Binding an SSL certificate to a port programmatically

I'm working on a self-hosted WCF service for which encrypted communications is an option. Everything works fine when a certificate is already bound to the port as described here. However, I want to avoid asking the user to run a command line tool. Is there a way the binding can be done programmatically? Perhaps using WMI? ...

ASP.NET datalist question

I have made some progress with the DataList and UserControl this morning but I still try to figure out how I could improve my code (everything work but the GUI is not yet what desired). In the ASPX file I have something like that : <asp:DataList ID="dlSpeechBubble" runat="server"> <ItemTemplate> <CSVSMS:Bubble I...

VS2005 Web Deployment Project to VS2008 - ASPNET compiler errors

I'm having problems with a wdproj I've upgraded to VS2008; This is the error I'm getting while trying to compile the project using msbuild: ASPNETCOMPILER : error ASPRUNTIME: The precompilation target directory (C:\code\CCI\CORUS\Website\Website_DeploymentProject\TempBuildDir\) cannot be in the same tree as the source application di...

Identifying idle state on a windows machine

I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn't mean the system has been idle for 10 minutes - scans, downloads, movies - lots of reasons. So how can we identify whether the system is truly idle or...

Is SHA512Managed considered the best one-way hash available in .NET 3.5 for security?

Three SHA512Managed related questions: Is SHA512Managed considered the best one-way hash available in .NET 3.5 for security? What Salt size should be used with SHA512Managed? The application is for strong passwords with at least 8 characters. Is 512 overkill compared to 256 for small strings? ...

Is there a library to get/set property from a string (xpath or Property Path)

I am looking for a way to use a string instance path or xpath expression to get/set property values very similar to what wpf does with it's data binding. Do you know of a library for this? I found ObjectXpathNavigator but I am not sure if there is something a little more active out there. Get("Person.FirstName"); Set( "Person/LastName...

Can I Nest OrderBy in .NET?

This doesn't seem to work as I intend. VB.NET: Dim x = Model.Discussions.OrderByDescending(Function(d) d.Messages.OrderByDescending(Function(m) m.Sent).First.Sent) For Each d As Discussion In x ... Next I get this runtime error: Sequence contains no elements There should be 20. Discussions are collections of messages. I w...

WCF binding error

So I got into work early today and got the latest from source control. When I try to launch our ASP.NET application, I get this exception: "The binding at system.serviceModel/bindings/wsHttpBinding does not have a configured binding named 'wsHttpBinding_Unsecured_Long'. This is an invalid value for bindingConfiguration. (C:\WINDOWS\Micr...