Search Results

Search found 4775 results on 191 pages for 'databound lists'.

Page 1/191 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Implementing Linked Lists in C#

    - by nijhawan.saurabh
    Why? The question is why you need Linked Lists and why it is the foundation of any Abstract Data Structure. Take any of the Data Structures - Stacks, Queues, Heaps, Trees; there are two ways to go about implementing them - Using Arrays Using Linked Lists Now you use Arrays when you know about the size of the Nodes in the list at Compile time and Linked Lists are helpful where you are free to add as many Nodes to the List as required at Runtime.   How? Now, let's see how we go about implementing a Simple Linked List in C#. Note: We'd be dealing with singly linked list for time being, there's also another version of linked lists - the Doubly Linked List which maintains two pointers (NEXT and BEFORE).   Class Diagram Let's see the Class Diagram first:     Code     1 // -----------------------------------------------------------------------     2 // <copyright file="Node.cs" company="">     3 // TODO: Update copyright text.     4 // </copyright>     5 // -----------------------------------------------------------------------     6      7 namespace CSharpAlgorithmsAndDS     8 {     9     using System;    10     using System.Collections.Generic;    11     using System.Linq;    12     using System.Text;    13     14     /// <summary>    15     /// TODO: Update summary.    16     /// </summary>    17     public class Node    18     {    19         public Object data { get; set; }    20     21         public Node Next { get; set; }    22     }    23 }    24         1 // -----------------------------------------------------------------------     2 // <copyright file="LinkedList.cs" company="">     3 // TODO: Update copyright text.     4 // </copyright>     5 // -----------------------------------------------------------------------     6      7 namespace CSharpAlgorithmsAndDS     8 {     9     using System;    10     using System.Collections.Generic;    11     using System.Linq;    12     using System.Text;    13     14     /// <summary>    15     /// TODO: Update summary.    16     /// </summary>    17     public class LinkedList    18     {    19         private Node Head;    20     21         public void AddNode(Node n)    22         {    23             n.Next = this.Head;    24             this.Head = n;    25     26         }    27     28         public void printNodes()    29         {    30     31             while (Head!=null)    32             {    33                 Console.WriteLine(Head.data);    34                 Head = Head.Next;    35     36             }    37     38         }    39     }    40 }    41          1 using System;     2 using System.Collections.Generic;     3 using System.Linq;     4 using System.Text;     5      6 namespace CSharpAlgorithmsAndDS     7 {     8     class Program     9     {    10         static void Main(string[] args)    11         {    12             LinkedList ll = new LinkedList();    13             Node A = new Node();    14             A.data = "A";    15     16             Node B = new Node();    17             B.data = "B";    18     19             Node C = new Node();    20             C.data = "C";    21             ll.AddNode(A);    22             ll.AddNode(B);    23             ll.AddNode(C);    24     25             ll.printNodes();    26         }    27     }    28 }    29        Final Words This is just a start, I will add more posts on Linked List covering more operations like Delete etc. and will also explore Doubly Linked List / Implementing Stacks/ Heaps/ Trees / Queues and what not using Linked Lists.   Normal 0 false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

    Read the article

  • Global Address List, Multiple All Address Lists in CN=Address Lists Container

    - by Jonathan
    When my colleges (that was way before my time here) updated Exchange 2000 to 2003 a English All Address Lists appeared in addition to the German variant. The English All Address Lists have German titled GAL below it. This has just been a cosmetic problem for the last few years. Now as we are in the process of rolling out Exchange 2010 this causes some issues. Exchange 2010 picked the wrong i.e. English Address Lists Container to use. In ADSI Editor we see CN=All Address Lists,CN=Address Lists Container,CN=exchange org,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=domain and CN=Alle Adresslisten,CN=Address Lists Container,CN=exchange org,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=domain. In the addressBookRoots attribute of CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=domain both address lists were stored as values. We removed the English variant from addressBookRoots and restarted all (old and new) Exchange servers. User with mailboxes on the Exchange 2003 now only sees the German variant. Exchange 2010 is still stuck with the English/Mixed variant as are Users on Exchange 2010. Our goal would be to have Outlook display the German title of All Address Lists and get rid of the wrong Address Lists Container.

    Read the article

  • not able to remove nested lists in a jQuery variable

    - by Pradyut Bhattacharya
    Hi I have a nested oredered list which i m animating using this code... var $li = $("ol#update li"); function animate_li(){ $li.filter(':first') .animate({ height: 'show', opacity: 'show' }, 500, function(){ animate_li(); }); $li = $li.not(':first'); } animate_li(); now i want not to show or animate the nested lists(ol s) or the li s in the ols take a look at the example here The structure of my ols are <ol> <li class="bar248"> <div class="nli"> <div class="pic"> <img src="dir/anonymous-thumb.png"alt="image" /> </div> <div align="left" class="text"> <span> <span class="delete_button"><a href="#" id="test" class="delete_update">R</a></span> test shouted <span class="timestamp"> 2010/02/24 18:34:26 </span> <br /> this </span> </div> <div class="clear"></div> </div> <div class="padd"> </div> <ol class="comment"> <li> <div>Testing </div> </li> <li> <div>Another Test </div> </li> </ol> </li> </ol> I m able to hide the nested ols using this code... $("ol#update li ol").hide(); But still time is being consumed in animating them although they are hidden I m not able to remove the nested li s using this code var $li = $("ol#update li").not("ol#update li ol"); $li = $li.not("ol#update li ol"); Take a look at this here Any help thanks < br Pradyut

    Read the article

  • Number nested ordered lists in HTML

    - by John
    Hi I have a nested ordered list. <ol> <li>first</li> <li>second <ol> <li>second nested first element</li> <li>second nested secondelement</li> <li>second nested thirdelement</li> </ol> </li> <li>third</li> <li>fourth</li> </ol> Currently the nested elements start back from 1 again, e.g. first second second nested first element second nested second element second nested third element third fourth What I want is for the second element to be numbered like this: first second 2.1. second nested first element 2.2. second nested second element 2.3. second nested third element third fourth Is there a way of doing this? Thanks

    Read the article

  • How can I use Databound variables in conditional statements within Custom Databound controls?

    - by William Calleja
    I'm developing my custom DataBound Controls that make use of an '<ItemTemplate>' tag and '<%# %>' server tags to generate some data however I need to make a conditional statement within one of my Databound controls as shown below. <custom:DataboundControl runat="server"> <ItemTemplate> <% if(((Dictionary<string, string>)Container.DataItem)["MyVariable"]=="" { %> <!-- Conditional Code Happens Here --> <% } %> </ItemTemplate> </custom:DataboundControl> Right now my code isn't working because the compiler cannot recognize my Container.DataItem variable within a <% %> tag and a <%# %> tag doesn't support conditional statements. What can I use?

    Read the article

  • Unselect Databound Combobox Winforms .NET

    - by joedotnot
    The problem: combobox is databound to a DataView, first item in the dataview is DataRowView whose fields are DBNull.Value; Combo DropdownStyle = ComboBoxStyle.DropDownList Loads fine, displays fine, selects fine, problem is to Unselect via code. Setting the SelectedIndex to 0 throws an exception. (Setting to -1 is a no-no as per msdn doco that says dont set SelectedIndex=-1 if databound) So how to unselect without throwing an exception ? For now i wrapped it into a try/catch to just ignore the error! EDIT: As asked by Hubeza, i worked on sample code to post. Did a stripped down version of the original code in C# (original is in VB.NET) and could NOT reproduce it either. Converted to VB.NET and could NOT reproduce it either ! In other words, SelectedIndex = 0 does work in the stripped down version! Currently further investigating what else could be wrong with the original code. EDIT2: Case Closed. Call me a stupid fool if you like, and apologies for wasting anyone's time - The error was originating from MyComboBox_SelectedIndexChanged event, which i neglected to check ! May as well post the sample in case anyone finds useful. private void LoadComboMethod() { DataTable dtFruit = new DataTable("FruitTable"); //define columns DataColumn colID = new DataColumn(); colID.DataType = typeof(Int32); //VB.NET GetType(Int32) colID.ColumnName = "ID"; DataColumn colDesc = new DataColumn(); colDesc.DataType = typeof(String); colDesc.ColumnName = "Description"; //add columns to table dtFruit.Columns.AddRange(new DataColumn[] { colID, colDesc }); //add rows DataRow row = dtFruit.NewRow(); row[colID] = 1; row[colDesc] = "Apples"; dtFruit.Rows.Add(row); row = dtFruit.NewRow(); row[colID] = 1; row[colDesc] = "Bananas"; dtFruit.Rows.Add(row); row = dtFruit.NewRow(); row[colID] = 1; row[colDesc] = "Oranges"; dtFruit.Rows.Add(row); //add extra blank row. DataRowView drv = dtFruit.DefaultView.AddNew(); drv.EndEdit(); //Bind combo box DataView dv = new DataView(dtFruit); dv.Sort = "ID ASC"; //ensure blank item on top cboFruit.DataSource = dv; cboFruit.DisplayMember = "Description"; cboFruit.ValueMember = "ID"; } private void UnselectComboMethod() { if (cboFruit.SelectedIndex > 0) { cboFruit.SelectedIndex = 0; } else { MessageBox.Show("no fruit selected"); } }

    Read the article

  • WPF Databound RadioButton ListBox

    - by Mark
    I am having problems getting a databound radiobutton listbox in WPF to respond to user input and reflect changes to the data it's bound to (i.e., to making changes in the code). The user input side works fine (i.e., I can select a radiobutton and the list behaves as expected). But every attempt to change the selection in code fails. Silently (i.e., no exception). Here's the relevant section of the XAML (I think): <Setter Property="ItemContainerStyle"> <Setter.Value> <Style TargetType="{x:Type ListBoxItem}" > <Setter Property="Margin" Value="2" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <Border Name="theBorder" Background="Transparent"> <RadioButton Focusable="False" IsHitTestVisible="False" IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" > <ContentPresenter /> </RadioButton> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </Setter.Value> I bind the listbox to a List of SchoolInfo objects. SchoolInfo contains a property called IsSelected: public bool IsSelected { get { return isSelected; } set { if( value != isSelected ) { isSelected = value; this.OnPropertyChanged("IsSelected"); } } } The OnPropertyChanged() stuff was something I put in during my experimentation. It doesn't solve the problem. Things like the following fail: ((SchoolInfo) lbxSchool.Items[1]).IsSelected = true; lbxSchool.SelectedIndex = 1; They fail silently -- no exception is thrown, but the UI doesn't show the item being selected. Mark

    Read the article

  • .net databound lists

    - by d daly
    Hi, Is there any way around this? I have a few dropdown lists bound to lookup tables in sql server. some old records imported from a previos version of the system wont open due to data in these fields not matching the current dropdown data. Other than adding the old data to the lookup table (which I dont want to do) is there a way around this? Thanks DD

    Read the article

  • Can't find controls in FormView.InsertItemTemplate even on DataBound event

    - by abatishchev
    I have FormView in my page markup: <asp:FormView ruanat="server" ID="FormView1" OnDataBound="FormView1_DataBound" DataSourceID="SqlDataSource1"> <InsertItemTemplate> <uc:UserControl1 runat="server" ID="ucUserControl1" /> </InsertItemTemplate> </asp:FormView> <asp:SqlDataSource runat="server" ID="SqlDataSource1" SelectCommand="EXEC someSP" /> It's code-behind: protected void FormView1_DataBound (object sender, EventArgs e) { var c1 = ((FormView)sender).FindControl("ucUserControl1"); // returns null var c2 = FormView1.FindControl("ucUserControl1"); // also returns null } In theory, I'm able to find control on FormView after it being data bound. But I'm not. Why?

    Read the article

  • WPF Databound Listbox

    - by Jeff
    I have a listbox bound to a list of objects for a data entry screen. The item template includes textblocks, a checkbox and comboboxes. When the listbox is populated I would like to change the foreground color of the textblocks to red if object.value1 = true and object.value2 = 0. Any ideas?

    Read the article

  • ASP.Net Form Databound problems

    - by Jason Bitman
    I know there is a similar problem on this forum, but the solutions did not really work for me. I am populating form controls with fields from a few different data sources, and the data shows up great. I have an ImageButton controlwhich has an OnClick Event set to grab all of the data from the form. Unfortunately, when I click the button, it seems as though the page is reloading first, and THEN is executes the OnClick call. The data that was hand-entered, or hard-coded seems to be pulled fine from the controls it was entered in, but anything that was pulled from a datasource is not able to be read. Any ideas. this is the last hurdle in a project that I have been working on for 6 months. I want to go home... Thank you so much in advance. Jason

    Read the article

  • Why are listener lists Lists?

    - by Joonas Pulakka
    Why are listener lists (e.g. in Java those that use addXxxListener() and removeXxxListener() to register and unregister listeners) called lists, and usually implemented as Lists? Wouldn't a Set be a better fit, since in the case of listeners there's No matter in which order they get called (although there may well be such needs, but they're special cases; ordinary listener mechanisms make no such guarantees), and No need to register the same listener more than once (whether doing that should result in calling the same listener 1 times or N times, or be an error, is another question) Is it just a matter of tradition? Sets are some kind of lists under the hood anyway. Are there performance differences? Is iterating through a List faster or slower than iterating through a Set? Does either take more or less memory? The differences are certainly almost negligible.

    Read the article

  • How to sort a list alphabetically and have additional lists sorted in the same order

    - by Carl
    I have 3 lists, each with equal elements: email addresses, salaries and IDs I'd like to sort the email addresses alphabetically and in some way sort the other 2 lists (salaries and IDs). E.g., Emails: [email protected] [email protected] Salaries: 50000 60000 IDs: 2 1 The puzzle: I'd like to sort Emails such that [email protected] is first and [email protected] is last and Salaries is 60000 then 50000 and IDs is 1 then 2. Additional detail: 1. Length of lists are the same and can be longer than two elements. 2. I will subsequently pass IDs to functions to retrieve further lists. Those lists won't need sorting as they will adopt the order of the IDs list.

    Read the article

  • HTML/CSS - How can I position these nested unordered lists correctly?

    - by Samuroid
    I am looking for some help resolving an issue im having with positioning the following unordered list elements that are contained in a div which has relative positioning: The html structure of the UL: <div id="accountBox" class="account_settings_box"> <ul> <ul> <li class="profileImage"><img src="images/profileimage.jpg" alt="Profile Image" /></li> <li class="profileName">Your name</li> <li class="profileEmail">Your email</li> </ul> <li><a href="">Messages</a></li> <li><a href="">Settings</a></li> <li><a href="">Password</a></li> <li><a href="">Sign out</a></li> </ul> </div> and the CSS for this list: .account_settings_box ul ul { display: inline-block; margin: 0; padding: 0; width: 100%; height: 150px; outline: 1px solid blue; } .account_settings_box ul ul li { display: inline-block; border: none; /* Reset the border */ } .profileImage { float: right; display: block; width: 150px; height: 150px; outline: 1px solid purple; } .profileName, .profileEmail { width: auto; height: auto; width: 150px; height: 150px; } .account_settings_box ul ul li:hover { outline: 1px solid red; } .profileImage img { width: 150px; height: 150px; } I am having difficultly with the embedded ul, i.e, .account_settings_box ul ul element. The image below shows what it currently looks like. I am trying to achieve the follow: Have the image floating to the right, and have the "your name" and "your email" positioned to the left of the image (basically where they are currently). Thanks for your help in advance. Sam :)

    Read the article

  • Combining lists but getting unique members

    - by MC
    I have a bit of a special requirement when combining lists. I will try to illustrate with an example. Lets say I'm working with 2 lists of GamePlayer objects. GamePlayer has a property called LastGamePlayed. A unique GamePlayer is identified through the GamePlayer.ID property. Now I'd like to combine listA and listB into one list, and if a given player is present in both lists I'd like to keep the value from listA. I can't just combine the lists and use a comparer because my uniqueness is based on ID, and if my comparer checks ID I will not have control over whether it picks the element of listA or listB. I need something like: for each player in listB { if not listA.Contains(player) { listFinal.Add(player) } } However, is there a more optimal way to do this instead of searching listA for each element in listB?

    Read the article

  • Merging k sorted linked lists - analysis

    - by Kotti
    Hi! I am thinking about different solutions for one problem. Assume we have K sorted linked lists and we are merging them into one. All these lists together have N elements. The well known solution is to use priority queue and pop / push first elements from every lists and I can understand why it takes O(N log K) time. But let's take a look at another approach. Suppose we have some MERGE_LISTS(LIST1, LIST2) procedure, that merges two sorted lists and it would take O(T1 + T2) time, where T1 and T2 stand for LIST1 and LIST2 sizes. What we do now generally means pairing these lists and merging them pair-by-pair (if the number is odd, last list, for example, could be ignored at first steps). This generally means we have to make the following "tree" of merge operations: N1, N2, N3... stand for LIST1, LIST2, LIST3 sizes O(N1 + N2) + O(N3 + N4) + O(N5 + N6) + ... O(N1 + N2 + N3 + N4) + O(N5 + N6 + N7 + N8) + ... O(N1 + N2 + N3 + N4 + .... + NK) It looks obvious that there will be log(K) of these rows, each of them implementing O(N) operations, so time for MERGE(LIST1, LIST2, ... , LISTK) operation would actually equal O(N log K). My friend told me (two days ago) it would take O(K N) time. So, the question is - did I f%ck up somewhere or is he actually wrong about this? And if I am right, why doesn't this 'divide&conquer' approach can't be used instead of priority queue approach?

    Read the article

  • Is the a pattern for iterating over lists held by a class (dynamicly typed OO languages)

    - by Roman A. Taycher
    If I have a class that holds one or several lists is it better to allow other classes to fetch those lists(with a getter) or to implement a doXList/eachXList type method for that list that take a function and call that function on each element of the list contained by that object. I wrote a program that did a ton of this and I hated passing around all these lists sometimes with method in class a calling method in class B to return lists contained in class C, B contains a C or multiple C's (note question is about dynamically typed OO languages languages like ruby or smalltalk) ex. (that came up in my program) on a Person class containing scheduling preferences and a scheduler class needing to access them.

    Read the article

  • Lists inside lists don't validate with w3c?

    - by cosmicbdog
    Hi everybody, I've got some lists inside lists to make some fancy drop-down menus. e.g <ul> <li>something <ul> <li>sub menu</li> </ul> </li> </ul> Problem is, w3c doesn't like it. Is there a way to make this validate or this just one of these hacks that browsers can render, but w3c dislikes?

    Read the article

  • Exchange mail users cannot send to certain lists

    - by blsub6
    First of all, everyone's on Exchange 2010 using OWA I have a dynamic distribution list that contains all users in my domain called 'staff'. I can send to this list, other people can send to this list, but I have one user that cannot send to this list. Sending to this list gives the user an email back with the error: Delivery has failed to these recipients or groups: Staff The e-mail address you entered couldn't be found. Please check the recipient's e-mail address and try to resend the message. If the problem continues, please contact your helpdesk. and then a bunch of diagnostic information that I don't want to paste here because I don't want to have to censor all of the sensitive information contained (lazy) Can you guys throw me some possible reasons why this would happen? If there are an innumerable number of reasons, where should I start to troubleshoot this? EDIT One Exchange server inside the network that acts as a transport server, client access server and mailbox server and one Edge Transport server in the DMZ.

    Read the article

  • Regex for recursive "wiki-style" lists

    - by Syd Miller
    I'm trying to create a Regular Expression to match "wiki style" lists as in (using preg_replace_callback() ): * List Item 1 * List Item 2 *# List Item 2.1 *# List Item 2.2 * List Item 3 Asterisks denote Unordered Lists while Number-Signs denote Ordered Lists. I'm trying to get this so it can match infinite depth and so that * and # can be mixed. I tried the following expression (and variations of it): /\s([*#]{1,}) ([\S ]+)\s/si But it doesn't seem to want to work. What am I doing wrong? Or is there a better way of accomplishing this?

    Read the article

  • taking intersection of N-many lists in python

    - by user248237
    what's the easiest way to take the intersection of N-many lists in python? if I have two lists a and b, I know I can do: a = set(a) b = set(b) intersect = a.intersection(b) but I want to do something like a & b & c & d & ... for an arbitrary set of lists (ideally without converting to a set first, but if that's the easiest / most efficient way, I can deal with that.) I.e. I want to write a function intersect(*args) that will do it for arbitrarily many sets efficiently. What's the easiest way to do that? EDIT: My own solution is reduce(set.intersection, [a,b,c]) -- is that good? thanks.

    Read the article

  • python union of 2 nested lists with index

    - by sbas
    I want to get the union of 2 nested lists plus an index to the common values. I have two lists like A = [[1,2,3],[4,5,6],[7,8,9]] and B = [[1,2,3,4],[3,3,5,7]] but the length of each list is about 100 000. To A belongs an index vector with len(A): I = [2,3,4] What I want is to find all sublists in B where the first 3 elements are equal to a sublist in A. In this example I want to get B[0] returned ([1,2,3,4]) because its first three elements are equal to A[0]. In addition, I also want the index to A[0] in this example, that is I[0]. I tried different things, but nothing worked so far :( First I tried this: Common = [] for i in range(len(B)): if B[i][:3] in A: id = [I[x] for x,y in enumerate(A) if y == B[i][:3]][0] ctdCommon.append([int(id)] + B[i]) But that takes ages, or never finishes Then I transformed A and B into sets and took the union from both, which was very quick, but then I don't know how to get the corresponding indices Does anyone have an idea?

    Read the article

  • How to hide Lists from specific group?

    - by DanSogaard
    How to hide Lists from specific group, but at the same time allow them to add items in it?. I edited permission levels for the site and created a permission that has these privileges: List Permissions: Add Items, View Items. Site Permissions: View Pages, Open. And then assign this permission to the group along with View Only. However this would still show Lists and the users are able to access them. How can I hide it from this specific group only?.

    Read the article

  • Feature activate via UI but does not show in the Libraries and Lists

    - by Justin Cullen
    I am really hating SharePoint as there are hardly any good/concrete documentation. I developed custom List "MainCatalog" with few columns (not site columns). Create features and elements with MOSS feature builder at Site collection level so scope="site" installed via stsadm activated via UI "went to site collection website", Site Setting Site collection Feature (and saw my custom list "MainCatalog") and was able to activate. then went to "mySiteCollection Site Settings Site Libraries and Lists " My list is showing But it shows in the "mySiteCollection Create Custom Lists "MainCatalog" I guess it's showing there as a template... But my intention is to deploy this list from development to test environment. EXTREMELY STRESSED. I AM ON THIS FOR LAST 8 DAYS.....

    Read the article

  • filtering elements from list of lists in Python?

    - by user248237
    I want to filter elements from a list of lists, and iterate over the elements of each element using a lambda. For example, given the list: a = [[1,2,3],[4,5,6]] suppose that I want to keep only elements where the sum of the list is greater than N. I tried writing: filter(lambda x, y, z: x + y + z >= N, a) but I get the error: <lambda>() takes exactly 3 arguments (1 given) How can I iterate while assigning values of each element to x, y, and z? Something like zip, but for arbitrarily long lists. thanks, p.s. I know I can write this using: filter(lambda x: sum(x)..., a) but that's not the point, imagine that these were not numbers but arbitrary elements and I wanted to assign their values to variable names.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >