list

Select element within a list/tuple

Hey bit of a beginners question here, I have connected to an imap server using the imaplib and fetched a email, it returns the following: [('1 (BODY[HEADER.FIELDS (SUBJECT)] {62}', "Subject: Gmail is different. Here's what you need to know.\r\n\r\n"), ')'] My question is how do I select just the subject element ("Subject: Gmail is..."...

make a change to an element within a list within a list

i am reading a csv file into a data: def get_file(start_file): #opens original file, reads it to array with open(start_file,'rb') as f: data=list(csv.reader(f)) i need to go through every row and add a value to row[1] like this. initially row[1] = 'Peanut', i need to add 'Butter' so the result would be row[1]='PeanutButter' ...

link Redirect from php

Dear all I have database of website link, it list out in main file ,when i try to click that link it get to redirect on that database link. my code is test.php <?php // getting from database echo '<li onclick=\"window.location='.$result->website.'\"> <a href="#">'.$result->option.'</a></li>'; ?> The Main.h...

Sending objects of information between classes to add to List<T>. Please help!

Hello! I am working with two classes. MainForm and EmployeeRegistry. In EmployeeRegistry I got a method that adds to a List (addToList). public void AddToList(...) { employeeList.Add(...); } In MainForm I created an object of EmployeeRegistry and I want to send another object (with information) into the EmployeeRegistry.AddToList ...

Duplicates in Listbox when displaying items from a List<T>. Please help!

Hello! I got a List that I add to every time I create a new Employee. The content of this list is then displayed in a Listbox. The problem is that each time I add a new Employee and then call the below method the items in the listbox gets duplicated over and over again. So if I got 3 items in the list the Listbox displays 6. I have chec...

Read and modify objects in a generic List<T>. Please help!

Hello! I am working with a generic List which I add Employee objects to. I know how to add and remove from it, but how do I "read" object data from it and how do I access methods and properties for a specific object in the list. Let´s say the Employee class contains the property below, how do I access it to modify the objects data? pu...

clickable list of individual items populated by single internet file (android)

alright first off i will say that im definitely newer to android programming than most.. i think that i am picking up quite quickly however i think that the program that im looking to eventually create is a bit out of my league right now considering my level of knowledge.. im hoping someone here can either tell me what i need to do so i ...

rich:dataList pagination?

I know you can use a <rich:datascroller> when you want pagination on a <rich:dataTable>. But, what about a <rich:dataList> or <rich:dataOrderedList>? Is there any mechanism for pagination on these components? Or will I have to code in the logic by hand? ...

Problem with Lists

I have a List of integers List<int> LI = new List<int>(); i wants check whether a particular number exists in the list.if exists do a database updation else do a database insert foreach (int IT in LI) { } can i do this inside the foreach loop or if not possible how to achieve this????? ...

how to access the list in different function

I have made a class in which there are 3 functions. def maxvalue def min value def getAction In the def maxvalue function, I have made a list of actions. I want that list to be accessed in def getaction function so that I can reverse the list and then take out the first entry from it. How can do i that?? def getAction(self,gamesta...

list query, functions in function

i have a function: I need to first reverse the list and then take an entry from it. Earlier, I was making the 3 functions but now I am defining the main function and the other 2 functions in it. ...

Groovy Properties list from HashTable

I am setting an external file to hold some persistent variables as Properties() Is there an easy way to list these in the same way that System.Properties() does?? to produce a list of Properties I have set. ...

Can't change a value inside a php list

Hi everybody, I have the following php loop that takes an array that contains a set of arrays, then I convert each array to a list to manipulate more accurately the elements. while ($i<sizeof($my_array)){ while(list($key,$val) = each($my_array[$i])){ $j = $i+1; if ($key == "fruit"){ $val = "ananas".$j; ...

Is there a way to specify an anonymous empty enumerable type?

I'm returning a Json'ed annonymous type: IList<MyClass> listOfStuff = GetListOfStuff(); return Json( new { stuff = listOfStuff } ); In certain cases, I know that listOfStuff will be empty. So I don't want the overhead of calling GetListOfStuff() (which makes a database call). So in this case I'm writing: return Json( ...

Python : define a list of a specific type of object

I would like to inherit from list to produce the myList class, that ony accepts one specific type of object (say ints). I am sure decorators can do that elegantly. Thanks ...

python: append a list of values into a list

c1=[] for row in c: c1.append(row[0:13]) c is a variable containing a csv file i am going through every row in it and i want only the first 14 elements to be in the c1 what am i doing wrong? ...

Python check first and last index of a list

Assuming I have object_list list which contains objects. I want to check if my current iteration is is at the first or the last. for object in object_list: do_something if first_indexed_element: do_something_else if last_indexed_element: do_another_thing How can this be achieved? I know that I can use rang...

Usage of Procedure and Map in Scheme

I am very new to Scheme and I am slowly finding my way around it. I have some doubts on Procedures and Map which I hope could be answered. (map plus1 (list 1 2 3 4)) will basically return me the result: (2 3 4 5) It is fine if the procedure takes in the list as its only parameter. My question is how am I able to use a procedure li...

Find out deselected item in spark list with multiple selection

In a spark list I could use the change event to find out which item has been selected or deselected. The dispatched IndexChangeEvent object has the properties newIndex and oldIndex holding this information. But with multiple selection allowed this doesn't work anymore because newIndex and oldIndex could refer to indices of still selecte...

Internet Explorer 8: list problem

There is an unordered list, and one of the list items contains two links. For some reason, Internet Explorer 8 is showing the part of the list item beginning with the first link as outside the list and apparently outside the containing div also. Here is what it looks like (those two lines should be on one line!): The html: <!-- These...