list

Sort a list with element still in first position

I have a String list: List<String> listString = new ArrayList<String>(); listString.add("faq"); listString.add("general"); listString.add("contact"); I do some processing on the list and I want to sort this list but I want "general" to always end up in first position. Thx ;) ...

for (Object object : list) [java] construction

My question, is, whether the sequence of elements picked from a list will always be the same, is this construction behaviour is deterministic for java "List"s - descendants of java.util.List 2) question, if I use for(Object o: list) construction and inside the loop's body increment a variable, will it be the index of li...

for (Object object : list) [java] and index element

Is there a way to get an element id of a list to get it later through list.get(index) when using for(Object obj: o) construction Only define a local var and manually incrementing it? Anything simpler? ...

C#: IEnumerable, GetEnumerator, a simple, simple example please!

Hi there, Trying to create an uebersimple class that implements get enumerator, but failing madly due to lack of simple / non-functioning examples out there. All I want to do is create a wrapper around a data structure (in this case a list, but I might need a dictionary later) and add some functions. public class Album { public rea...

Json to treeview (<ul>)

Hi I get the following data back from my WCF Data Service (I cut out the metadata) { "d" : [ {"CodeId": 6, "Title": "A Child Sub Item", "Parent":}, {"CodeId": 5, "Title": "Another Root Item", "Parent": -1}, {"CodeId": 4, "Title": "Child Item", "Parent": 2}, {"CodeId": 2, "Title": "Root Item", "Parent": -1} ] } I am trying to ...

Replacing emty csv column values with a zero

Hey, So I'm dealing with a csv file that has missing values. What I want my script to is: #!/usr/bin/python import csv import sys #1. Place each record of a file in a list. #2. Iterate thru each element of the list and get its length. #3. If the length is less than one replace with value x. reader = csv.reader(open(sys.argv[1], "rb...

How to access gallery -> Camera Media videos and display it in List on button Click?

i am beginner in Android app development i am working on a app which lists the videos and images and uploads them from android phone to the windows server, Button Listvideo = (Button) findViewById(R.id.Listvideo); Listvideo.setOnClickListener(this); help me out with the listing images and videos........................ ...

Common elements comparison between 2 lists.

def common_elements(list1, list2): """ Return a list containing the elements which are in both list1 and list2 >>> common_elements([1,2,3,4,5,6], [3,5,7,9]) [3, 5] >>> common_elements(['this','this','n','that'],['this','not','that','that']) ['this', 'that'] """ for element in list1: if element in ...

removing elements incrementally from a list

Dear all, I've a list of float numbers and I would like to delete incrementally a set of elements in a given range of indexes, sth. like: for j in range(beginIndex, endIndex+1): print ("remove [%d] => val: %g" % (j, myList[j])) del myList[j] However, since I'm iterating over the same list, the indexes (range) are not valid any ...

In Python, how to find all the files under a directory, including the files in subdirectories ?

Is there any built in functions to find all the files under a particular directory including files under subdirectories ? I have tried this code, but not working...may be the logic itself is wrong... def fun(mydir): lis=glob.glob(mydir) length=len(lis) l,i=0,0 if len(lis): while(l+i<length): if os.pat...

c++ : list(vector) definition with array

I have Class Email, there is parameter "bcc" in her constructor. Its actually list of emails for copies. There is no fixed number of these emails and later i have to have possibility to extend this list. //constructor prototype Email::Email(vector<string> bcc) So i want to use type vector or list for that and function push_back(). H...

What's happening to my lists?

Hello, why does List<Object> objectList; = some objects List<Object> getList() { return objectList; //or return new List<Object>(objectList); } return a list with all items referenced to the original list's items? Thanks. ...

Silverlight databinding datagrid to List<List<X>>

I got a List<List<X>> object and I want to bind it to a datagrid in the following way: Each entry in the outer list represents a single column Each list inner list represents the rows for each column I need to do it in code because the size of each of the list depends on user input at runtime. Is this somehow possible? Changeing/wrap...

MOSS query the SiteUserInfoList list

Hi, I want to know how I can connect to the SiteUserInfoList using U2U CAML Builder tool, I know I can do it in code. But want to be able to quickly query it through the tool so I can bring back the values it holds. Or a better question... where is the SiteUserInfoList information held in the content database (mysites or site content d...

How can I acquire an aggregated list of known proxy IP addresses?

I'd like to use this to help maintain a good defence against people trying to skirt the rules of my system. I've found TOR endpoints, nothing that's readily available to be shot into a script (needs to be parsed) but they work. However I need a list which goes beyond TOR yet I cannot find anything conclusive just yet. Any suggestions wo...

Getting values from datagrid view column to list<>

My main form in my application has a datagrid view that can have 1 to many user selected inputs. Column 8 of this grid is for the user to input "time in minutes." I have a separate class where I have built a timer that counts down from whatever time the user specifies down to 0. What I need is to create a series of alarms that go off ...

ListView With checkbox and images in android

hi.. please someone help me about this. i need to implement a list view with checkbox and each item should be assosiated with images. ex: [image1] list_item_1 [checkbox] [image2] list_item_2 [checkbox] ' . . please help me ...

Combining entries, filtering of Python dictionaries

I have two large lists that are filled with dictionaries. I need to combine the entries if a value from dict2==dict1 and place the newly combined matches somewhere else. I'm having trouble explaining it. List one contains: {'keyword':value, 'keyword2':value2} List two: {'keyword2':value2, 'keyword3':value3} I want a new list with ...

How can I css for List/grid in div with border?

I want to create a list table in DIV with border. When more content of width of a column then line break and border increase but other column border not increase. see the example: Div based CSS Table .list_container{ float:left; width: 550px; margin-bottom:10...

Empty UL inside LI element

Can anyone explain me why <ul> elementa cannot be empty? And why this HTML: <ul> <li class="header"> <a href="#">Work</a> <ul/> </li> <li class="header"> <a href="#">New</a> <ul/> </li> <li class="header"> <a href="#">Ungrouped</a> <ul/> </li> <li class="header...