Search Results

Search found 31721 results on 1269 pages for 'adjacency list'.

Page 70/1269 | < Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >

  • python processs complete list files matched

    - by thomytheyon
    Hi All, I'm trying to get a simple code working, unfortunatly im a python beginner. My script should return a list of files that doesn't match a pattern, more information here : http://stackoverflow.com/questions/2910106/python-grep-reverse-matching/2910288#2910288 My code is running but doesn't process the complete list of files found as it should : import sys,os filefilter = ['.xml','java','.jsp','lass'] path= "/home/patate/code/project" s = "helloworld" for path, subdirs, files in os.walk(path): for name in files: if name[-4:] in filefilter : f = str(os.path.join(path, name)) with open(f) as fp: if s in fp.read(): print "%s has the string" % f else: print "%s doesn't have the string" % f This code return : /home/patate/code/project/blabla/blabla/build.xml doesn't have the string None If i change f = str(os.path.join(path, name)) for print str(os.path.join(path, name)) I can see the whole list being printed. How can i process the whole list as i which to ? :( Thanks again.

    Read the article

  • populate a list dynamically in ant build script

    - by user1164061
    I have the following directory structure: vardir1 vardir2 vardir3 vardir4 constantdir1 Inside constantdir1, i have an ant build script which takes the list of vardir1 to vardir4 and compiles them sequentially. The situation is, vardir1 to vardir4 may or may not exist all the time. Right now I have hard coded the values in the list and checking to see if the vardir is available before I kick off its compilation. Is there any way I can dynamically populate this list in my ant build script?

    Read the article

  • Sorting a List based on an ArrayList within a custom Object

    - by Matt Weldon
    I am using a list to keep track of a number of custom Row objects as follows: Public Rows As List(Of Row)() Row has 2 properties, Key (a String) and Cells (an ArrayList). I need to be able to sort each Row within Rows based on a developer defined index of the Cells ArrayList. So for example based on the following Rows Row1.Cells = ("b", "12") Row2.Cells = ("a", "23") Rows.Sort(0) would result in Row2 being first in the Rows list. What would be the best way of going about implementing this? Thanks

    Read the article

  • List<string> doesn't update the UI when change occurs [WPF]

    - by Hard Turner
    <ListBox x:Name="MainList" HorizontalAlignment="Left" Height="468" Margin="10,10,0,0" VerticalAlignment="Top" Width="100" ItemsSource="{Binding Items,Mode=TwoWay}" DisplayMemberPath="Name"/> [Serializable()] public class MYcontainer : INotifyPropertyChanged,ISerializable { private List<MYClass> _items = new List<MYClass>(); public List<MYClass> Items { get{ return _items;} set { this._items =value; OnPropertyChanged("Items"); } public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(string propertyName = null) { var eventHandler = this.PropertyChanged; if (eventHandler != null) eventHandler(this, new PropertyChangedEventArgs(propertyName)); } } when i add an item to "Items" the UI doesnt update, the binding is working fine, since if i closed the window and opened it again, the new items appear correctly what am i doing wrong? i know if i used observablecollection it will work fine, but shouldn't it work with List<? , i already have in another window a string[] property and it update fine

    Read the article

  • Remove items from one list in another

    - by coffeeaddict
    I'm trying to figure out how to traverse a generic list of items that I want to remove from another list of items. So lest say I have this as a hypothetical example List<car> list1 = GetTheList(); List<car> list2 = GetSomeOtherList(); I want to traverse list1 with a foreach and remove each item in List1 in List2. I'm not quite sure how to go about that as foreach is not index based.

    Read the article

  • C# type safe and developer friendly list/collection technique

    - by Agile Noob
    I am populating a "Dictionary" with the results of an sp call. The key is the field name and the value is whatever value the sp returns for the field. This is all well and good but I'd like developers to have a predefined list of keys to access this list, for safety and documentation reasons. What I'd like to do is have something like an enum as a key for the dictionary so developers can safely access the list, but still have the ability to access the dictionary with a string key value. I am hoping to have a list of string values that I can access with an enum key AND a string key. Please make sure any suggestions are simple to implement, this is not the kind of thing I'm willing to build a lot of overhead to implement.

    Read the article

  • Convert Text with newlines to a List<String>

    - by Vaccano
    I need a way to take a list of numbers in string form to a List object. Here is an example: string ids = "10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19"; List<String> idList = new List<String>(); idList.SomeCoolMethodToParseTheText(ids); <------+ | foreach (string id in idList) | { | // Do stuff with each id. | } | | // This is the Method that I need ----------------+ Is there something in the .net library so that I don't have to write the SomeCoolMethodToParseTheText myself?

    Read the article

  • Getting a list of all phone contacts?

    - by pcm2a
    Simple enough question. I need to know the best way to get the same list of contacts that show up when a user presses the Contacts button. You would think something like this would work: //For Contacts Intent pickIntent = new Intent(Intent.ACTION_PICK, People.CONTENT_URI); this.startActivityForResult(pickIntent, RESULT); //For Phones Intent pickIntent = new Intent(Intent.ACTION_PICK, Phones.CONTENT_URI); this.startActivityForResult(pickIntent, RESULT); The problem is that does not include secondary google accounts or Exchange contacts. By secondary accounts, in Android you can add additional gmail accounts to have the mail/contacts synced. The above intent will not list those additional contacts. I am also told that on the HTC Desire you can add contacts to the phone that do not get synced up to Google. These contacts also do not show up. So how do I get a real list of contacts so I can create my own list activity that works properly where the Google intent does not.

    Read the article

  • C# Generic List constructor gives me a MethodAccessException

    - by evilfred
    Hi, I make a list in my code like so: List<IConnection> connections = new List<IConnection>(); where IConnection is my own interface. This is in a .NET 2.0 executable. If I run the code on my machine (with lots of .Net versions installed) it works fine. If I run it on my test machine (which only has .NET 3.5 SP1 installed) then I get a MethodAccessException in the System.Collections.Generic.List constructor. Any ideas what could be going wrong?

    Read the article

  • Python check if object is in list of objects

    - by John
    Hi, I have a list of objects in Python. I then have another list of objects. I want to go through the first list and see if any items appear in the second list. I thought I could simply do for item1 in list1: for item2 in list2: if item1 == item2: print "item %s in both lists" However this does not seem to work. Although if I do: if item1.title == item2.title: it works okay. I have more attributes than this though so don't really want to do 1 big if statement comparing all the attributes if I don't have to. Can anyone give me help or advise on what I can do to find the objects which appear in both lists. Thanks

    Read the article

  • c# 3.5 class List<int> class initialisation

    - by josephj1989
    I can initialize a List like new List{1,2,3,4,5}; However List does not have a constructor which accepts a single parameter. So I tried to run this through the debugger and it seems to be calling the Add method. So how does the compiler know which method to invoke to add each individual element. This may be a silly question but I am a bit confused. Thanks

    Read the article

  • Understanding linear linked list

    - by ArtWorkAD
    Hi, I have some problems understanding the linear linked list data structure. This is how I define a list element: class Node{ Object data; Node link; public Node(Object pData, Node pLink){ this.data = pData; this.link = pLink; } } To keep it simple we say that a list are linked nodes so we do not need to define a class list (recursion principle). My problem is that I am really confused in understanding how nodes are connected, more precisely the sequence of the nodes when we connect them. Node n1 = new Node(new Integer(2), null); Node n2 = new Node(new Integer(1), n1); What is link? Is it the previous or the next element? Any other suggestions to help me understanding this data structure?

    Read the article

  • PHP Check if <ul> has ended IF it exists

    - by Krewe
    I have my blog generate a preview by taking the first 300 characters and cut off the last whole word. My problem is, when I have a list near the top of the blog it is sometimes included in the preview, however the end list tag usually never is. So how can I check the $preview variable for a starting list tag, and if it is found, check for an ending tag and if it's not there add one. All the code for my preview. $preview = wordwrap($content, 300); $preview = explode("\n", $preview); $preview = $preview[0] . "...";

    Read the article

  • design function: underlying structure to store list of results for print to file

    - by forest.peterson
    is this a good approach to print a list of items to csv file with a sublist attached to each item. The gist of the function is when an item is found that does not exactly macth then a list of close matches is generated - this works now writing out one list at a time to a command window. For export to a csv file I think all the lists must be generated, stored and then written at once. Right now I use a struct to store the attributes printed, each struct is an item on the list - these structs are then added to a sorted stack and when printed they pop off into write out. Is a stack of stacks of structs a good design?

    Read the article

  • dependent drop down list

    - by sushant
    i want to make a two drop down lists. the first list has static data( folder structure), so i can use an array for it,and depending on the folder or option selected in the first list, the second list shows the sub-folders in it. but the sub-folders keeps on changing, so i have to use asp fso for it. i am using the following fso code: <%@ Language=VBScript ENABLESESSIONSTATE = False% <% Dim fso, folder, files Set fso=Server.CreateObject("Scripting.FileSystemObject") Set folder=fso.GetFolder("D:\") Set files=folder.SubFolders For each folderIdx In files Response.Write("<option>" + folderIdx.Name + "</option>") Next % i dont know how to make such a dependent list. any help is really appreciated. and i am sorry for the formatting issue

    Read the article

  • ListSelector applies to the entire list

    - by jax
    I have a simple list with a listselector like so. <ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/round" android:listSelector="#99000000" android:clickable="true" android:cacheColorHint="#00000000" android:background="#00000000"> </ListView> As you can see android:listSelector="#99000000" but the "black alpha" color is applied to the entire list, not the selected item. So this is what I have now but the entire list still turns black ::listview_background.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:state_focused="true" android:drawable="@drawable/list_normal" /> <item android:state_pressed="true" android:drawable="@drawable/list_pressed" /> <item android:state_focused="true" android:drawable="@drawable/list_active" /> </selector> ::colors.xml <resources> <drawable name="list_normal">#96FFFFFF</drawable> <drawable name="list_active">#66000000</drawable> <drawable name="list_pressed">#CA000000</drawable> </resources> ::the xml tag in my list android:listSelector="@drawable/listview_background"

    Read the article

  • reorder list elements - jQuery?

    - by Alex
    Hello, I am experimenting with jQuery lately, and I was wondering if it's possible with js or pure jquery to reorder <li> elements. So if I have a silly list like the following: <ul> <li>Foo</li> <li>Bar</li> <li>Cheese</li> </ul> How would I move the list elements around? Like put the list element with Cheese before the list element with Foo or move Foo to after Bar. So is it possible? If so, how? Thanks!!

    Read the article

  • how properly remove item from list

    - by dygi
    // tmpClientList is List<Client> type if (txtboxClientName.Text != "") foreach (Client cli in tmpClientList) if (cli.Name != txtboxClientName.Text) tmpClientList.Remove(cli); Error: "Collection was modified; enumeration operation may not execute." How can i remove items from the list, in some simple way, without saving indexes of these items in another list or array, and removing them in another place in the code. Tried also RemoveAt(index) but it's exactly the same situation, modifying when loop runs.

    Read the article

  • Update one list from another

    - by lacqui
    I have two multi-select lists in HTML - one of categories, and another of items. What I want is that, when an item selected in the "category" list, everything in the "items" list from that category is also selected. For example, if "Categories" contains "Animal", "Mineral", and "Vegetable", and "Items" contains "Dog", "Cat", "Monkey", "Diamond", "Granite", "Carrot", "Tomato": If "Animal" is selected in one list, "Dog", "Cat", and "Monkey" should be selected; any other selections should remain as they are. I'm using a Symfony PHP backend on the server, if that makes any difference

    Read the article

  • More elegant way to initialize list of duplicated items in Python

    - by Claudiu
    If I want a list initialized to 5 zeroes, that's very nice and easy: [0] * 5 However if I change my code to put a more complicated data structure, like a list of zeroes: [[0]] * 5 will not work as intended, since it'll be 10 copies of the same list. I have to do: [[0] for i in xrange(5)] that feels bulky and uses a variable so sometimes I even do: [[0] for _ in " "] But then if i want a list of lists of zeros it gets uglier: [[[0] for _ in " "] for _ in " "] all this instead of what I want to do: [[[0]]*5]*5 Has anyone found an elegant way to deal with this "problem"?

    Read the article

< Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >