.net

Better way to bind generic List to DomainUpDown control (text spin control)

I have been trying to find out how to bind data to a System.Windows.Forms.DomainUpDown() control. Currently I have only come up with: private void Init() { List<string> list = new List<string>(); list = get4000Strings(); //4000 items foreach (string item in list) { ...

What is the preferred way to handle this TCP connection in C#?

I have a server application (singleton, simple .NET console application) that talks to a GlobalCache GC-100-12 for the purpose of routing IR commands. Various .NET WinForm clients on the local network connect to my server application and send ASCII commands to it. The server application queues these ASCII commands and then sends them to ...

Is it possible to track memory usage in a C# application without using a profiler?

I'd like to write a simple application which keeps track of its current memory usage, number of created objects etc. In C++ I'd normally override the new operator, but for obvious reasons I can't do this in C#. Is there any way to do this without using a profiler? ...

Executing a Cygwin process from .NET ?

I'm trying to launch Cygwin version of ruby.exe from a .NET application, but I'm stuck. c:\>"c:\cygwin\bin\ruby.exe" c:\test\ruby.rb /usr/bin/ruby: no such file to load -- ubygems (LoadError) As you see Ruby can't locate libraries because it's looking some Linux style paths. Obviously when I run ruby.exe from .NET since it can't fin...

Delphi's interoperability with .NET

I currently have a codebase of delphi (win32) code. I want to extend new functionality, however, my knowledge is in .NET (C#), and I'd like to keep the existing code base and add new functionality in .NET. What , if any, are my options (for delphi and .NET inter operating) ? Thanks! ...

How to find a comma that is not inside parenthesis in a .net regular expression?

Hi, Using some extensions provided by .net, one can find groups of parenthesis by using something like this: ^(\w+)\(((?>[^()]+|\((?<D>)|\)(?<-D>))*(?(D)(?!)))\)(.*)$ This will match the following: Func(innerfunction(arg)).DoSomething() With the following groups: Group 1: Func Group 2: innerfunction(arg) Group 3: .DoSomething() ...

VS2005: How to automatically generate a build number with date?

I have a .net 2.0 C# application in Visual Studio 2005 for which I'd like to automatically generate the correct version build number which should contain a number that allows me to guess the build date of the application. I tried to use the 'AssemblyInfo Task' tool from Microsoft but by default this tool doesn't work. For today it would ...

C# interface question

Is there a cost in passing an object to a function that implements a particular interface where the function only accepts that interface? Like: Change (IEnumerable<T> collection) and I pass: List<T> LinkedList<T> CustomCollection<T> which all of them implements IEnumerable. But when you pass any of those to the Change method, are t...

Get plain text from an RTF text

Hello I have on my database a column that holds text in RTF format. How can I get only the plain text of it, using C#? Thanks :D ...

Is ASP.NET taking over as dominant .NET UI platform?

Just a year or two ago I thought that learning WPF is the best use of my free time. Now though, I'm not so sure: seems like the number of ASP.NET jobs vs. WinForms/WPF is something like 10:1. Am I the only one noticing this, or is this really an overall trend? And should all thick-client developers drop everything and begin learning ASP....

How to Mono, PHP and .NET module run together on Ubunty Hardy at Slicehost?

I'm running a rails app and PHP at my SliceHost Ubuntu Hardy Heron vps server. I've a PdfProcess.exe module built upon ASP.NET (.NET 2). I've one PHP file which uses a passthru("PdfProcess.exe ......") function which loads a pdf template and outputs a new processed pdf file and sent to browser. The combination of PdfProcess.exe and PHP p...

TableAdapters SQL Injection

Hi I am using a dataset and in that dataset I have a table adapter. In my table adapters I have used stored procedures as queries. If I use the following lines to insert form data using my table adapter, is it safe against SQL injection? Thanks. UserDataSetTableAdapters.UserInformationTableAdapter myFactory = new TestProject.UserData...

.NET naming convention for "ID" (anything identification: Capitalization)

I am in the process of unifying these inconsistent naming conventions and this one problem has been a bit driving me crazy lately. In the code base I am working with has no convention regarding "ID"; "ID", "Id" and even "iD" are used inconsistently. **Question: In .NET, how do you guys capitalize "ID"? For an example, nodeID, nodeId? ...

Under C# is Int64 use on a 32 bit processor dangerous

I read in the MS documentation that assigning a 64-bit value on a 32-bit Intel computer is not an atomic operation; that is, the operation is not thread safe. This means that if two people simultaneously assign a value to a static Int64 field, the final value of the field cannot be predicted. Three part question: Is this really true? ...

Converting WCF Request from JSON to IPC/TCP/etc

I have an HttpHandler that acts as a proxy between website visitor and a windows hosted WCF service. Right now the WCF service is setup to handle a json request, but I would like to convert the json request to net.pipe or net.tcp or any of the protocols that WCF can handle. I am hoping to have a communication that goes: client <--j...

Why should we bypass DataSet when updating DB?

hi 1) a) Why is it preferable to bypass DataSet when updating, deleting or inserting records ( I realize using DataSet takes more CPU time and memory, but are there any other reasons besides that?! )? b) Are direct updates faster than batch updates? Why? c) Why do Web services represent only real web application scenario in which ...

Re-opening SqlConnection instance

hi 1) I noticed that after you close SqlConnection instance, you are still able to re-open the same connection: a) can you tell me what is going on behind the scenes? Meaning, after we close file stream object, we can’t re-open it, but instead must create a new object – so why isn’t the same with SqlConnection objects? b) If pooling ...

Static methods vs instance methods in C#

For an application I am writing, I want to have extreme extensibility and extension methods seem to give me what I want, plus the ability to call them without an instance, which I need too. I remember reading that static methods are faster than instance methods but don't get the advantages of GC. Is this correct? It's highly unlikely I...

Attempted to read or write protected memory

I've started seeing an AccessViolationException being thrown in my application a several different spots. It never occured on my development pc, our test server. It also only manifested itself on 1 of our 2 production servers. Because it only seemed to happen on one of our production servers, I started looking at the installed .net fra...

How to specify .NET Anonymous object return type in Linq using Func<T,Q>?

How do you specify the Func signature for anonymous objects? new Func<DataSet, **IEnumerable<int>>** I am having a trouble with return type where I have specified as IEnumerable<> in the Func declaration Error I am getting from the expression is Cannot convert expression type 'System.Collections.Generic.IEnumerable<{ParentNodeId...