.net

How do I convert byte values into decimals?

I'm trying to load some decimal values from a file but I can't work out the correct way to take the raw values and convert them into decimals. I've read the file out into a byte array, and each chunk of four bytes is supposed to represent one decimal value. To help figure it out, I've constructed a table of how the decimal values 1 thro...

Learning C# .net Framework.

Hi all, I want to learn “C#” and “.net frame work” properly. I read basic concept of C# language. Since I know C++ It did not took too much time to read C# simple tutorial. Now when I searched the .net tutorial, most of the sites give C# language feature and some of the .net controls API and class usage. But I don’t want that. I want...

Tooltip not showing for nested control

I have the following piece of code that works great in all but one instance. private void tbxLastName_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e) { GetRemainingChars(sender); } public void GetRemainingChars(object sender) { var control = sender as TextEdit; var maxChars = control.Pr...

WCF Streaming Service that returns Stream Length and includes Input Parameters

I am trying to create a WCF Streaming Service. I have two requirements that I seem to be stumbling over trying to get this to work: Length of stream size Input parameters My message contract looks like this: [MessageContract] public class MyStream { [MessageHeader] public long StreamSize; [MessageBodyMember] public Stream Stre...

.Net compact framework: inherit from DataGridTextBoxColumn, GetColumnValueAtRow is missing

The DataGrid in the .net compact framework (I'm using v3.5) is a bit limited. I try to display a bool-value with app-defined texts like "on/off" or translations of "true/false". I've created a class DataGridBoolColumn which inherits from DataGridTextBoxColumn and there I override the Paint-method. But I've problems with retrieving the cu...

What could be the extreme of building logic inside an application(software) i.e. GMail Attachment Validation

I have recently visted the GMail Blog, and found the extreme point of logic building inside software, i.e. Never forget an attachment again Gmail looks for phrases in your email that suggest you meant to attach a file (things like "I've attached" or "see attachment") and warns you if it looks like you forgot to do so....

Using HTTP as a transport layer between client/server applications

I would like to expose some data to client applications via HTTP. For example, the client would go to URL: http://mysite.com/books/12345 to obtain data about book 12345. The client could do an HTTP PUT or POST to http://mysite.com/books/54321 to upload data about book 54321. Is this known as a RESTful web service? I have no idea wher...

What are the hard bounds for drawing coordinates in GDI+?

I am rendering an interpolation curve thusly: e.Graphics.DrawLines(new Pen(Color.Red), _interpolationPoints.ToArray()); which sometimes throws an OverflowException. Examination of the _interpolationPoints array shows some very large values in scientific notation e.g. {X = 0.0 Y = -1.985174E+10} I suspect that Y = -1.985174E+10 is a...

Using certutil to check certificate responses

I am having a lot of trouble setting up an X509 certificate scheme in C#.NET. SSL is enabled on the server and the connection is being made over SSL. Certificates are being added to the request's store via request.ClientCertificates.Add(). However, no client certificate is being attached to the handshake request (which I am both confi...

Is using processor usage for the automated scheduling of processes a good practice?

I've been having a debate of sorts with a co-worker who suggested that we allow some cpu intensive processes in our enterprise to poll CPU usage and execute their tasks when the CPU usage is low. My counter-point was that while cpu usage in an ideal system would denote the level of system activity on a given server, in actuality it has ...

The quintessential email listener / mini server in Java or .NET

I'm embarrased of how I'm unaware of SMTP / POP3 / IMAP protocols, as much as I thought I know HTTP and TCP/IP it apears that I took email as granted, and never had to write any piece of code that will do other than sending an email via an existing SMTP server. My task is to write an incomming email channel and I would like to hear what...

Error rendering ReportViewer (10.0.0.0 in LocalMode) directly to PDF when passing in an empty recordset.

I have a utility method (below) that has always served me well. After databinding a report control, I pass the control to this and it renders the report as a PDF. I recently upgraded to .NET 4.0 and the new 2010 report viewer control (10.0.0.0). Now it throws the error (below) if the recordset (dataset) I pass to the reportviewer does...

Excel Recalculation

I am using the excel pia's to do some writing and reading to/from excel spreadsheets, i may just be being paranoid but i have the following questions: As far as i can tell Excel recalculates the formulas in the worksheet upon every write but... is this the case? - ie is it possible to do series of write read write read and not to read...

Writing a regex to capture text between outer parenthesis

So I'm trying to a parse a file that has text in this format: outerkey = (innerkey = innervalue) It gets more complex. This is also legal in the file: outerkey = (innerkey = (twodeepkey = twodeepvalue)(twodeepkey2 = twodeepvalue2)) So I want to basically capture only the outerkey's text. I cannot guarantee that all of the text wi...

In what scenarios must I deal with detached/disconnected DataContexts?

I've been reading lately about disconnected DataContexts but there's a few things I don't understand. There seems to be a scenario where you'd want to use a disconnected DataContext and then a scenario where you have to use one. Why might you want to use a disconnected DataContext? In a single machine scenario I don't think it violat...

C# GZipStream to String

Hi all, I am in need of a way to write a GZipStream to a string. I am using: GZipStream Decompress = new GZipStream(inFile, CompressionMode.Decompress) I have tried several methods, but can't figure it out. Does anyone have any ideas? Many thanks, Brett ...

What's the .NET equivalent of a COM LocalServer?

In VB6, it was a simple matter to write applications that served up COM classes, the application would run as a system-wide singleton and would be able to serve COM classes to multiple processes. I believe this is called a COM LocalServer. What's the equivalent in .NET? How can I make a single executable that handles requests from multi...

How do I find out the type specified by an Expression?

For example, let's say I have a method that takes the following as a parameter: Expression<Func<T, object>> path How do I determine the type of the 'object' specified in the expression? More specifically, I'd like to determine if it's a collection type (eg. IEnumerable) ...

How to handle AccessViolationException

I am using a COM object (MODI) from within my .net application. The method I am calling throws a System.AccessViolationException, which is intercepted by Visual Studio. The odd thing is that I have wrapped my call in a try catch, which has handlers for AccessViolationException, COMException and everything else, but when Visual Studio (...

What is BindingFlags.InvokeMethod meant for?

I have the following code used to avoid a switch statement to decide which method to invoke, and it works with just the BindingFlags flags I have set, without InvokeMethod. What is InvokeMethod actually meant for and why is it not needed in the following code: public enum PublishMethods { Method1, Method2, Method3 } private...