.net

What is the appropriate initial value for a ElapsedTime Performance Counter?

What is the proper initial value for an ElapsedTime performance counter? When my app starts up I am setting the .RawValue of the performance counter instance to 0 but that is not correct. It looks like it needs to be based on the current time but I'm not sure what is the actual value I should be using. ...

Finding controls in javascript

I'm having an issue finding an UpdatePanel inside of a Gridview inside of a Formview in Javascript. The Below Doesn't work. var UpdatePanel3 = $get('<%=FormView1.FindControl("Gridview1").FindControl("UpdatePanel3").ClientID %>'); How can I find that control?? ...

Does the whole .NET assembly get loaded in memory or just the parts used?

If I have a 15M .NET assembly and a program calls a method in it, does the whole assembly get loaded into memory and use 15M or a lot less? (assuming the assembly is not allocating any memory during runtime) ...

Cannot connect to DB after I uploaded website to a host

I have upload my website to a shared hosting, set-up everything and my asp.net 3.5 app won't connect to SQL Server database on the shared hosting provider. This is the error I get: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify...

How can I make the cursor turn to the wait cursor?

I have a C# application that has users login to it, and because the hashing algorithm is expensive, it takes a little while to do. How can I display the Wait/Busy Cursor (usually the hourglass) to the user to let them know the program is doing something? The project is in C#. ...

How do I obtain a handle on an object from another .NET process?

In C#, I know how to run a .NET executable from code and also find out if an instance of the executable is already running. What I would like to do is if an instance is already running, obtain an instance of the Foo object within the C# code of a different executable. I have a windows application, (e.g..NET version of Outlook). A user ...

Best way to call a single operation at some time in the future?

I want to fire off a timer to execute once at some point in the future. I want to use a lambda expression for code brevity. So I want to do something like... (new System.Threading.Timer(() => { DoSomething(); }, null, // no state required TimeSpan.FromSeconds(x), // Do it in x seconds ...

SqlDataSource Timeout. OK in Management Studio

In code that I inherited, I have a SqlDataSource that has a fairly complex select statement that for certain SelectParameters, always times out ("Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."). When I run the exact same query with the same parameters in management stu...

URL Rewriter.NET and multiple querystrings

I'm stressing out trying to create a url rewriter.net rule for my web site. I have a link http://localhost/Pages/CategoryList.aspx?ID=2&amp;Page=1 And I want replace it by this http://localhost/Category/2.aspx?Page=1 I tried the following: <rewrite url="~/Category/(.+).aspx?Page=(.+)" to="~/Pages/CategoryList.aspx?ID=$1&amp;Pa...

How to detemine (by code) the assembly corflags?

I need to write a CorFlags-like application. If I have a path to assembly file, how to I read its CorFlags? I specifically need to know if the assembly is Any-CPU or x86 only I want to avoid loading the assembly using reflection because I need to scan many files. ThanksSaa ...

WebBrowser - Find height of rendered text

I've got a web browser control that needs to have a specific height set. If the user has a small amount of text, I want the web browser to be short. If the user types alot of text, then I need the web browser to be alot taller. How can I find the height of the rendered text from the WebBrowser? I saw this Getting the page height from a...

How does Rowlex relate to Protege and are there other .NET offerings for OWL?

I work with RDF and OWL but until I came to SO I'd never heard of Rowlex and OwlGrinder. It's got a much larger presence on SO than Protege or Pellet (although from a smallish number of active people). Is it primarily the .NET equivalent of Protege or does it take a different approach (It stresses the Open-world assumption). There's very...

Custom Component property won't serialize after intial change

Can/Should a derived Component class have a property of type another derived Component type? I have a RecordComponent that derives from System.ComponentModel.Component. It has three properties DeleteCmd, SaveCmd, and BoundCmd. Those properties are of type DeleteCommand, SaveCommand, and BoundCommand respectively. DeleteCommand and Sa...

Regex to remove javascript double slash (//) style comments

I'm trying to do remove javascript comments via regex in C# and have become stuck. I want to remove any occurrences of double slash // style comments. My current regex is (?<!:)//[^\r\n]* which will catch all comments and prevent matching of http://. However, the negative lookbehind was lazy and of course bit me back in the following ...

How to avoid "The element 'x' in namespace 'x.xsd' has invalid child element 'Items' in namespace 'x.xsd'" ?

I have xml file whose structure is defined with following xsd: <?xml version="1.0" encoding="utf-8"?> <xs:schema targetNamespace="http://schemas.TEST.com/TEST/TEST.xsd" elementFormDefault="qualified" xmlns="http://schemas.TEST.com/TEST/TEST.xsd" xmlns:mstns="http://schemas.TEST.com/TEST/TEST.xsd" xmlns:xs="http://www.w3.org/2001/XMLSche...

Page.Request.QueryString has a value although none was passed to the page

We have the following code that is returning a value of "3" although no value is passed as a query string. Is there some way that the "id" is getting stuck in the server memory (since it is not user specific) or is "id" a special value. Any ideas? if (Page.Request.QueryString["id"] != null) { Page.Trace.Write("Query String Key Found")...

Assembly Manifest loading error (.NET and C++ dlls)

My application (pure DotNET 2.0) is referencing another pure DotNET 2.0 dll which is PInvoking into an unmanaged (C++ 2005) dll. On some computers this works fine, on others there is a consistent error message: Could not load file or assembly 'C:\Program Files\Rhinoceros 4.0\Plug-ins\Grasshopper\rhcommon_c.dll' or one of its dependenci...

MVVM, WPF, and Validation

Well, I think i have a fairly good understanding of MVVM. But I need some clarifications. Is the ViewModel responsible for calling the appropriate service to persist model information? If so, then the ViewModel must have a clean way of determining if the data it holds is valid. If the data is valid, it will update the model accordingl...

How to share resource files between .NET CF 1.0 and 2.0/3.5?

Hi, I've created NAnt scripts to compile our codebase for .NET CF 1.0, 2.0 and 3.5. This worked pretty well in the past. Now we started localizing our UI. So our scripts need to compile the resource files (resx) too. And that's where the trouble starts. The resx format changed from VS .NET 2003 to VS 2008. My idea is to continue mainta...

Response.GetResponseStream() escapes double quotes

Response.GetResponseStream() is returning xml with escape characters <?xml version=\"1.0\" encoding=\"utf-8\"?> Because of this XmlReader return {None}. Help please? HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url); req.Accept = "*/*"; req.Headers.Add("UA-CPU", "x86"); req.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0;...