.net

Monitor running .net apps

I have some .net apps running that I need to monitor for example, then MethodA is called in App1, my monitor app should detect this. I have a lot of running apps and the solution proposed here is to recompile all those apps and include a new line in the desired methods that we want to monitor. I want to do this only if there is absolutel...

Abusing XmlReader ReadSubtree()

Hello. I need to parse a xml file which is practically an image of a really big tree structure, so I'm using the XmlReader class to populate the tree 'on the fly'. Each node is passed just the xml chunk it expects from its parent via the ReadSubtree() function. This has the advantage of not having to worry about when a node has consumed...

HTML Tag ClientID in a .NET Project

If I want to manipulate an HTML tag's properties on the server within an aspx page based on a master page i.e. <a href="#" runat="server" ID="myLink">My Link</a> For example to give the link a different class depending on the current page i.e. if (Path.GetFileName(Request.PhysicalPath) == "MyPage") { myLink.Attributes.Add("class","a...

Is it possible to send a collection of ID's as a ADO.NET SQL parameter?

Eg. can I write something like this code: public void InactiveCustomers(IEnumerable<Guid> customerIDs) { //... myAdoCommand.CommandText = "UPDATE Customer SET Active = 0 WHERE CustomerID in (@CustomerIDs)"; myAdoCommand.Parameters["@CustomerIDs"].Value = customerIDs; //... } The only way I know is to Join my IE...

Simplest way to have a configuration file in a Windows Forms C# Application

I'm really new to .NET and I still didn't get the hang about how config files work. Every time I search on google about it I get results about web.config, but I'm writing a windows forms application. I figured out that I need to use the System.Configuration namespace but I'm kinda dumb and the documentation isn't helping. How do I def...

What are the best resources to get MS developer Certification?

I've just started working on my 2nd job out of university and my new employer has offered to pay for the resources and the tests to get me some certifications. Although most of the companies software is written in Java I'm pretty much the only .Net developer and they mean to keep me as a .Net devloper. I've looked into getting .Net 3.5...

Scatter/gather async socket I/O in .NET

I'm trying to use the Stream.BeginWrite Async I/O API in .NET for a high-throughput situation with many short messages. As such, a scatter/gather API will reduce the number of context switches (and CPU usage) tremendously. Does this API use the LPBUFFERS Win32 API at all? Is there an alternative API for Scatter/Gather I/O? ...

How do I bind the result of DataTable.Select() to a ListBox control?

I have the following code: ListBox.DataSource = DataSet.Tables("table_name").Select("some_criteria = match") ListBox.DisplayMember = "name" The DataTable.Select() method returns an array of System.Data.DataRow objects. No matter what I specify in the ListBox.DisplayMember property, all I see is the ListBox with the correct number of ...

How to prevent creating intermediate objects in cascading operators?

I use a custom Matrix class in my application, and I frequently add multiple matrices: Matrix result = a + b + c + d; // a, b, c and d are also Matrices However, this creates an intermediate matrix for each addition operation. Since this is simple addition, it is possible to avoid the intermediate objects and create the result by addi...

Custom role based Web Service access

Our CMS implements its own role based access control for content management and what not, much like all the other CMSs out there ;) I've recently been playing around with the idea of trying to implement an extension of this access control into our web service api, with the eventual idea of choosing which users have access to what method...

What are your experiences with Windows Workflow Foundation?

I am evaluating WF for use in line of business applications on the web, and I would love to hear some recent first-hand accounts of this technology. My main interest here is in improving the maintainability of projects and maybe in increasing developer productivity when working on complex processes that change frequently. I really like...

Update SQL Sever Database Schema with software update

How do you update your SQL sever database when installing your product's update? Are there any tools that will integrate with windows installer? My typical schema changes are: Adding/removing columns Adding/removing tables. Adding views. Adding/alter indexs. ...

"No symbols loaded for the current document" Visual Studio 2008 Javascript Debugging

I'm working on a .net 3.5 website, with 3 projects under one solution. I'm using jquery in this project. I'd like to use the visual studio javascript debugger to step through my Javascript. If I set a breakpoint in any of the .js files I get a warning that says "The breakpoint will not currently be hit. No symbols have been loaded for th...

Detecting what the target object is when NullReferenceException is thrown.

I'm sure we all have received the wonderfully vague "Object reference not set to instance of an Object" exception at some time or another. Identifying the object that is the problem is often a tedious task of setting breakpoints and inspecting all members in each statement. Does anyone have any tricks to easily and efficiently identif...

ASP.NET Framework effects of moving from 2.0 to 3.5?

I've started using Visual Studio 2008 and it keeps asking me to upgrade my 2.0 website project to 3.5 every time it opens. What effectively happens when I "upgrade" a website project from 2.0 to 3.5 in Visual Studio? Does it update my web.config? How exactly does it change my project/website/code? Is there a potential for any 2.0 met...

When reading a CSV file using a DataReader and the OLEDB Jet data provider, how can I control column data types?

In my C# application I am using the Microsoft Jet OLEDB data provider to read a CSV file. The connection string looks like this: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Data;Extended Properties="text;HDR=Yes;FMT=Delimited I open an ADO.NET OleDbConnection using that connection string and select all the rows from the CSV file w...

How fast is LINQ?

I need to manipulate 100,000 - 200,000 records. I am thinking of using LINQ (to SQL) to do this. I know from experience that filtering dataviews is very slow. So how quick is LINQ? Can you please tell me your experiences and if it is worth using, or would I be better off using SQL stored procedures (heavy going and less flexible)? Wit...

How do I get the title of the current active window using c#?

I'd like to know how to grab the Window title of the current active window (i.e. the one that has focus) using C#. ...

What is the best way to make a thread signal another thread in .NET?

I need to have a thread signal another if the user wishes to interrupt execution, however I'm unsure about how to implement the signaling/signal-checking mechanism. I wouldn't like to have a singleton in my project (like a global bool), but is there an alternative? In this thread people suggest proper structures for that in C++, but I d...

Linq to SQL Grouping Child Relationships

I'm trying to run a LINQ to SQL query that returns a result in a grid view in a search engine style listing. In the simplified example below, is it possible to populate the collection with a comma-separated list of any children that the parent has (NAMESOFCHILDREN) in a single query? var family = from p in db.Parents whe...