list

Jquery appending list content to div

I want to append the content within my 'li' to the 'trashbin' div when the link class 'ui-icon-trash' is clicked. I have a list and some li content like so: <li class="ui-widget-content ui-corner-tr"> <h5 class="ui-widget-header">item1</h5> <img src="tiem.png" alt="item1"/> ...

How can I list files for an init.d script without ruby

I need to convert a init.d script that uses ruby to not use ruby. I can use perl or python or something else, but I can't use ruby. My main problem is figuring out how to dynamically get the list of *.jar files in a directory and separate them with ':'. The rest I could easily do with a bash script. Here is the Ruby code I'm working wit...

How to sort a list of objects by a specific member?

Say I have a list of Person objects: class person { int id; string FirstName; string LastName; } How would I sort this list by the LastName member? List<Person> myPeople = GetMyPeople(); myPeople.Sort(/* what goes here? */); ...

Rails: Difference between List and Index

I appreciate this is an incredibly noob question, but having Googled multiple combinations of search terms I regretfully am still in the dark. These things can be difficult when one doesn't know and so obvious when one does. I have semi-home page where incoming customers can choose to see a queried list or do a handful of other things. ...

How can I check if there exist any reverse element in list of dict without looping on it

My list is like l1 = [ {k1:v1} , {k2:v2}, {v1:k1} ] Is there any better way to check if any dictionary in the list is having reverse pair? ...

Why does my WCF Service generate Array types when I explicitly set it to List????

I have been consuming a service for some time in development, and have been updating my service reference almost daily with no problems. Collection types have been set to generate as System.Collections.Generic.List in the Advanced options. However, for no apparent reason, now when I update the Service Reference, it's generating Array ty...

Python: deepcopy(list) vs new_list = old_list[:]

I'm doing exercise #9 from http://openbookproject.net/thinkcs/python/english2e/ch09.html and have ran into something that doesn't make sense. The exercise suggests using copy.deepcopy() to make my task easier but I don't see how it could. def add_row(matrix): """ >>> m = [[0, 0], [0, 0]] >>> add_row(m) [[0, ...

Persisting a heterogeneous array in C#

I have an List<Animal> but in that list I have subclasses of Animal such as Mammal. (Yes that is right; it is a school assignment, so don't be specific, just give me some pointers.) I should persist it with [Serializable] interface and that is no problem, except when I shall read it back again, I have no idea what subclass the data ca...

Math in python - converting data files to matrices

Hello! Today, as I tried to put together a script in Octave, I thought, this may be easier in python. Indeed the math operators of lists are a breeze, but loading in the file in the format is not as easy. Then I thought, it probably is, I am just not familiar with the module to do it! So, I have a typical data file with four columns ...

Python sort (list/tuple) in list

I have some data either in list contains lists, or list contains tuples. data = [[1,2,3], [4,5,6], [7,8,9]] data = [(1,2,3), (4,5,6), (7,8,9)] And I want to sort by the 2nd element in the subset. Meaning, sorting by 2,5,8 where 2 is from (1,2,3), 5 is from (4,5,6). What is the common way to do this? Should I store tuples or lists in m...

mysql list comparison problem with query logic

Hello, I am comparing two lists of email addresses in mysql - listA and listB (both of which are views). Originally, I wanted to find all of the email addresses in listA that are not in listB. I successfully accomplished that with: $comparison_query = mysql_query("SELECT DISTINCT email_addresses FROM listA WHERE email_addresses NOT IN ...

Generate a nested list from flatten data in Python

Hi, To generate a Table of Content, I have these data available in a Python list: data = [ {title: 'Section 1', level: 1, page_number: 1}, {title: 'Section 1.1', level: 2, page_number: 2}, {title: 'Section 1.2', level: 2, page_number: 3}, {title: 'Section 2', level: 1, page_number: 4}, {title: 'Section 2.1', level: ...

flex 4 list ItemRenderer: how can i have different itemrenderers for different rows ?

Hiya. I'm creating a list of scores for a game. now most of the list i need to have the same ItemRenderer. but in one specific row of the list where the user who's playing is listed, it should show different information and with different background color. how can i achieve this ? update I already tried to resolve the issue with state...

Traversing multiple lists in django template in same for loop

I want to travere multiple lists within a django template in the same for loop. How do i do it? some thinking link this - {% for item1, item2, item3 in list1, list2 list3 %} {{ item1 }}, {{ item2 }}, {{ item3 }} {% endfor %} Is something like this possible? ...

Problem with List<E> properties in exceptions thrown from JAX-WS/EJB3 web service

I have a (JAX-WS/EJB3) web service which has operations that can throw ValidationExceptions, which holds a list of standard POJOs that represent stuff that didn't pass validation. This list causes marshaling to break. Firstly, the exception class: public class ValidationException extends Exception { private final List<ValidationErr...

List of Lists Sort With String Dates?

I have a list of string lists that contains DateTime values converted to strings. There are other values in the list, so I can't make the list a full DateTime list. I have a line of code that sorts the list, but it sorts the dates by their string value, not DateTime value (which is what I want). How can I modify my code to correctly sor...

Find and replace string values in Python list

Hi! I got this list looking something like this words = ['how', 'much', 'is[br]', 'the', 'fish[br]', 'no', 'really'] What I would like is to replace the [br] with some fantastic value similar to <br /> and thus getting a new list looking like this words = ['how', 'much', 'is<br />', 'the', 'fish<br />', 'no', 'really'] I've labora...

Serialization issue with SortedSet, Arrays, an Serializable

I have this before the process: protected void onPostExecute(SortedSet<RatedMessage> result) { List<Object> list=Arrays.asList(result.toArray()); lancon.putExtra("results", list.toArray()); // as serializable } then in the other part I have Object o=this.getIntent().getSerializableExtra("results"); //at this point the o holds...

how to initialize List<string> with many string values

have your say your idea or correct the example below please. List<string> optionList = new List<string> { "AdditionalCardPersonAdressType","AdditionalCardPersonSex","AutomaticRaiseCreditLimit","CardDeliveryTimeWeekDay","CardDeliveryTimeWeekEnd","CCAdditionalCardAddress", "CCAdditionalCardPerson","CCAutoPaidType","CCSendAddressType","CCS...

associative list python

Dear all, i am parsing some html form with Beautiful soup. Basically i´ve around 60 input fields mostly radio buttons and checkboxes. So far this works with the following code: from BeautifulSoup import BeautifulSoup x = open('myfile.html','r').read() out = open('outfile.csv','w') soup = BeautifulSoup(x) values = soup.findAll('input',...