.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Optimized way of comparing XML Nodes

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :ASP.Net
Hi Guys, I have an requirement which is already implemented in what seems to be an inefficient way. I have an XML Content and all the nodelist will always have the same set of attributes. <root> <data id ='1' name="ABC" groupId="45" referenceID="2345" status="old"> <data id ='2' name="XYZ" groupId="145" referenceID="5245" status="old"> <data id ='1' name="ABC" groupId="45" referenceID="2344" status="new"> <data id ='2' name="XYZ" groupId="45" referenceID="5245" status="new"> <root> Now I need to check the difference of attributes of "old" node with the "new" nodes. In the above case, the 1st node(status:old) and the 3rd node(status:new) the difference in attributes are ID - nodiff, name - nodiff, groupId - nodiff, referenceID - Different This is implemented in a nested loop and takes a long time to complete the comparison. Is there any other way in which I can achieve the requirement in an efficient way? Thanks Arun

View Complete Post

More Related Resource Links

Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Optimized Paging and Sorting in ASP.NET GridView

In this article I am going to demonstrate what are the performance drawbacks of using conventional way to page and sort your GridView and then I will demonstrate 'An Optimized way to implement Paging and Sorting'.

Site map with > 150 nodes


Based on the turotial, it mention that if my sitemap have more than 150 node it will have impact on the performance.

Is the any option if i do have more than 150 mode to include in the xml file (with security node trimming=true, where i inserted role=ABC in every node.)

Display homepage node along with child nodes


If the first Sitemap node is your homepage/default and all other nodes are supposed to be children / grandchildren of the first sitemap node in a web.sitemap, how do I set up my web.sitemap to enable me to display my cssFriendlyMenu with the homepage node along with the nodes that are 1 level down from it at the same time as in :

Home   Products   Services   About us


...or is it not possible to have the first sitemap node displayed along with the nodes that are 1 level down from it?  Do I need to have a different starting node rather than my homepage node?

Cutting Edge: Comparing Web Forms And ASP.NET MVC


In this month's column, we'll explore the pros and cons of both ASP.NET Web Forms and ASP.NET MVC.

Dino Esposito

MSDN Magazine July 2009

Timers: Comparing the Timer Classes in the .NET Framework Class Library


Timers often play an important role in both client applications and server-based components (including Windows services). Writing effective timer-driven managed code requires a clear understanding of program flow and the subtleties of the .NET threading model. The .NET Framework Class Library provides three different timer classes: System.Windows.Forms.Timer, System.Timers.Timer, and System.Threading.Timer. Each of these classes has been designed and optimized for use in different situations. This article examines the three timer classes and helps you gain an understanding of how and when each class should be used.

Alex Calvo

MSDN Magazine February 2004

Child nodes not allowed.


Hi everyone.

I'm positive that, by now, a lot of people have run into this problem but even with all the forum posts with great answers, I still can't seem to get to the bottom of it. Here are some specs:

  • Windows Server 2008
  • Visual Studio 2008 x86

So here's the issue:

I have VS2008 installed on the server listed above. This is our development server and everything is created and tested here. I have created an asp.net application, tested it on the dev. environment and everything works great. When I try to migrate this application up to our Quality Assurance environment (which is Windows Server 2003), I get the error in the subject title.

I've read many things that can be the cause of this and I'm positive that I know 2 ways of fixing it. One is from this post: Simple web site problem on Vista, related to <providerOption>, and the other is making sure 3.5 framework is at least installed on the server in question. There are 2 reasons why I'm unable to use these 2 methods:

  • The patches from DVD that I'm supposed to install won't let me install them. Upon double clicking I recieve a message saying the "Update is not applicable to your computer"
  • I don't have permission to install 3.5 frame

Comparing Enum values in a collection - BC42025: Access of shared member, constant member, enum mem


I am upgrading from asp1.1 to 2.0

I use collection classes to sort data (e.g in datagrids etc)


Enum newsFields
End Enum

Public Overloads Sub Sort(ByVal sortField As newsFields, ByVal isAscending As Boolean)
Select Case sortField
Case newsFields.title

WPF- Treeview--How to add child nodes-- a Bizzare problem-- plz help

so here it is.... in WPF ... Treeview control -- i can add nodes under root node, using XAML code  which is static i hav to add the nodes, using C# code which is dynamic. For Example: Menu Table MenuId       Name       ParentId     1           Country         0     2           India             1     3           USA              1     4           AP                2     5           UP                2     6           California      3     7           Newyork       3 In my C# Code i took a class file in that, i declared the menu() method of type DataTable. Method menu() :- I created a temptable (using DATATABLE CLASS) with same fields(using CLONE()) and filled it with MENU table data and returned that temptable. So now i have data with me. Based on ParentID i can retrieve the child values. but how to add those values to TREEVIEW as its ITEMS There is no---> " treeview1.Items[0].Items.Add() " thing in WPF--- n its creating problem to me. Hw can i do dat...? i dnt knw which Methods , Properties , Classes  to Use. Ex:       + COUNTRY             + INDIA                    AP                    UP              +USA                    Lusiana                    Nwyrk Please help. Thank you. Beginner in WPF..... VENU.Beginner in WPF.......VENU

AppDomain.Unload effects Unable to evaluate expression because the code is optimized or a native fra

Hello, I create a custom AppDomain.Create().  I registered the Unhandled Exception Event from my custom AppDomain. In the Unhandled Exception Event i try to Unload my AppDomain with AppDomain.Unload. But this effects a "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack." Have anyone a idea what i can do against this behaviour. greetints

Multiple Child Nodes with For XML Path

I am trying to generate this format of xml and having difficulties because of the properties section. I can have unlimited number of properties and "For XML" tells me it can't generate the same node "Properties/@Name". I have tried several methods online, but can't seem to get it to work. OptionLists> <OptionList Name="Functions"> <Option Value="L9496"> <Properties Name="Description" Value="L9496 - Privacy Lock With Indicator" /> <Properties Name="Locked" Value="False" /> </Option> <Option Value="LV9040" /> <Option Value="L9485" /> </OptionList> </OptionLists>   My SQL currently looks like this: SELECT 'Functions' as '@Name', ( Select coalesce(nullif(No_,''),'NONE') "Option/@Value", Case NO_ when isNull(nullif(NO_,''),null) Then 1 Else 99 END "Option/@Order", 'TRUE' "Option/@Visible", 'FALSE' "Option/@Locked", '' "Option/@ToolTip", '' "Option/@ImageLink", '' "Option/@InfoMessage", 'QtySensitive' "Option/Properties/@Name", Case [Quantity Sensitive] When 0 Then 'False' When 1 Then 'True' End "Option/Propert

How to add custom nodes for a treeview

Hi the actual procees of my work is initially i will have a root node for a treeview. If i right click on that i will have a context menu with some options. If i select add new from that i will add a text file as child node to the root node. This works fine . After adding that text file i would like to add a child node under that text file..   The over all flow will be Initially when page loads my treeview will be with a single rootnode   ACH If i add a text file i would like to show my treeview as follows   ACH |-> some.txt    |->A( Child for some.txt)        |->B(child for  A)             |->C(Child for B)   Up to A i was succeded but i do not know how to add the remaining also i would like to set image index for the custom child nodes added  

Unable to evaluate expression because the code is optimized or a native frame is on top of the call

I have some code that gets the exception Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack. I have pasted some code below. I have confirmed that I am in mixed mode debugging, (native and managed). I have also confirmed that I am not 'pre-compiline' b4 debugging. the code is for a 'csv' download. Can someone help? Response.Clear(); Response.ClearHeaders(); //set the conttent type of the file to be downloaded (IF NEEDED) Response.ContentType = "application/vnd.ms-excel"; // initialize the http content-disposition header to indicate a file attachment with the filename Response.AppendHeader("Content-Disposition", "Attachment; Filename=\"" + strFileNameCSV + "\""); //// transfer the file byte-by-byte to the response object FileInfo fileToDownload = new FileInfo(strFileNameCSV); Response.Flush(); Response.WriteFile(fileToDownload.FullName); Response.End();

Comparing Null Values(from variable) in SSIS

Hi All I need to create a script that checks to see if a variable value is NULL, if it is then it executes the next SQL Task and if not then the package has finished. I have this in a SQL 2000 DTS package script: Function Main() If isnull(DTSGlobalVariables("NextLoadDate")) Then Main = DTSStepScriptResult_DontExecuteTask Else Main = DTSStepScriptResult_ExecuteTask End if End Function As you can see, all I want to do is check to see if a variable is null then don't execute the next task. But i cannot get it to work in a SQL 2005 SSIS package, so far I have created a script and come up with the following: Public Sub Main() If Dts.Variables("NextLoadDate").Value.ToString <> "" Then Dts.TaskResult = Dts.Results.Success Else Dts.TaskResult = Dts.Results.Failure End If End Sub Any Ideas? Thanks BigGopher

Comparing Datetime field in DB?

I need to check the datetime field in my DB to see if the time that's current set is 12hr's past? What's the command to use?  Can I just DATEDIFF? 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend