.net

Problem with .net app under linux, doesn't work from shell script

I'm working on a .net post-commit hook to feed data into OnTime via their Soap SDK. My hook works on Windows fine, but on our production RHEL4 subversion server, it won't work when called from a shell script. #!/bin/sh /usr/bin/mono $1/hooks/post-commit.exe "$@" When I execute it with parameters from the command line, it works proper...

Printing data into a preprinted form in C# .Net 3.5 SP1

Hi, I need to print out data into a pre-printed A6 form (1/4 the size of a landsacpe A4). I do not need to print paragraphs of text, just short lines scattered about on the page. All the stuff on MSDN is about priting paragraphs of text. Thanks for any help you can give, Roberto ...

How can I indicate that multiple versions of a dependent assembly are okay?

Assemblies A and B are privately deployed and strongly named. Assembly A contains references to Assembly B. There are two versions of Assembly B: B1 and B2. I want to be able to indicate for Assembly A that it may bind to either B1 or B2 -- ideally, by incorporating this information into the assembly itself. What are my options? I'm...

How can you do paging with NHibernate?

For example, I want to populate a gridview control in an ASP.NET web page with only the data necessary for the # of rows displayed. How can NHibernate support this? ...

How to best merge information, at a server, into a "form", a PDF being generated as the final output

Background: I have a VB6 application I've "inherited" that generates a PDF for the user to review using unsupported Acrobat Reader OCX integration. The program generates an FDF file with the data, then renders the merged result when the FDF is merged with a PDF. It only works correctly with Acrobat Reader 4 :-(. Installing a newer ver...

How can I monitor trace output of a .Net app?

I'm working on some code that uses the System.Diagnostics.Trace class and I'm wondering how to monitor what is written via calls to Trace.WriteLine() both when running in debug mode in Visual Studio and when running outside the debugger. ...

Is there a good library for dealing with the Modbus protocol in .NET?

Does anyone know of a good (preferably open source) library for dealing with the Modbus protocol? I have seen a few libraries, but I am looking for some people's personal experiences, not just the top ten Google hits. I figure there has to be at least one other person who deals with PLCs and automation hardware like I do out there. Open...

What are some best practices for creating my own custom exception?

In a follow-up to a previous question regarding exceptions, what are best practices for creating a custom exception in .NET? More specifically should you inherit from System.Exception, System.ApplicationException or some other base exception? ...

How well does .NET scale?

(I'll begin by making it clear, I am not a .NET developer and am not tied to any other environment.) Recently, I heard that the London Stock Exchange went down for an entire day. I've also heard that the software was written in .NET. Up to this point they would experience performance hits on busy days. People seem to be blaming .NET. ...

Hidden Features of ASP.NET

There are always features that would be useful in fringe scenarios, but for that very reason most people don't know them. I am asking for features that are not typically taught by the text books. What are the ones that you know? ...

How would you refactor this LINQ code?

I've got a lot of ugly code that looks like this: if (!string.IsNullOrEmpty(ddlFileName.SelectedItem.Text)) results = results.Where(x => x.FileName.Contains(ddlFileName.SelectedValue)); if (chkFileName.Checked) results = results.Where(x => x.FileName == null); if (!string.IsNullOrEmpty(ddlIPAddress.SelectedItem.Text)) resul...

Adopting standard libraries

My team has a command parsing library for console apps. Each team around us has their own as well. There isn't anything in the BCL so I suppose this is natural. I've looked at the the module in Mono, which seems solid, and the one on CodePlex looks fine as well. There are probably others out there that will work (and I would love to hea...

Should I always use the AndAlso and OrElse operators?

Is there ever a circumstance in which I would not want to use the AndAlso operator rather than the And operator? or in which I would not want to use the OrElse operator rather than the Or operator? ...

Application to Stress Test in a Windows .NET Application

I am developing a Windows .NET application (WinForms) and I need to simulate a stress test of the database and the application ( more than 100 conections). What tools do you recommend? ...

Embed a File Chooser in a UserControl / Form

I've inherited a desktop application which has a custom .NET file chooser that is embedded in a control, but it has some issues. I'd like to replace it with a non-custom File Chooser (like the OpenFileDialog). However, for a variety of reasons it needs to be embedded in the parent control not a popup dialog. Is there a control I'm miss...

add values to enum

I know this rather goes against the idea of enums, but is it possible to extend enums in C#/Java? I mean "extend" in both the sense of adding new values to an enum, but also in the OO sense of inheriting from an existing enum. I assume it's not possible in Java, as it only got them fairly recently (Java 5?). C# seems more forgiving ...

Using Microsoft's Application Blocks

I haven't done a lot of .NET programming, but I have examined a few of the application blocks published by Microsoft's Patterns and Practices group. I was wondering how these are typically used: Linked directly into applications Source added into applications and built with them, perhaps with some customizations Sample code used as re...

Return collection as read-only

I have an object in a multi-threaded environment that maintains a collection of information, e.g.: public IList<string> Data { get { return data; } } I currently have return data; wrapped by a ReaderWriterLockSlim to protect the collection from sharing violations. However, to be doubly sure, I'd like to return the col...

.NET namespaces

My background is primarily as a Java Developer, but lately I have been doing some work in .NET. So I have been trying to do some simple projects at home to get better at working with .NET. I have been able to transfer much of my Java experience into working with .NET (specifically C#), but the only thing that has really perplexed me is n...

What, if anything is typically done in a repository's structure to reflect deployed units?

This is a follow-up to the question Should the folders in a solution match the namespace? The consensus on that question was a qualified "yes": that is, folders == namespaces, generally, but not slavishly (the way java requires). Indeed, that's how I set up projects. But setting up source control has made me hesitate about my current...