list

List<T>().Add problem C#

Hi, I made a List to hold object in it, and then i'll read it. But even if i give an index to List, i always get the same object results. Here is the code: List<TempIds> treeDIds = new List<TempIds>(); TempIds tempIds = new TempIds(); foreach (ItemGroupTreeD treeD in itemTreeDColl) { ...

C#: Get Single Item from a List<Custom_Class> If an item exist with one Property value="somevalue" in the list

I have a list of my custom class(which has properties like Name,Age,Address).How can i check whether i have an item with the "Name" value as "shyju" exist in the list and return it if it exist.Name will be unique.No two items have the same name. the solution now i am thinking of is to go for a for each loop and loop thru each item and ...

Define <OL> start value

Building on the post I found at http://stackoverflow.com/questions/487528/ordered-lists-ol-starting-index-with-xhtml-strict, I was wondering if there is a way to define the start value of a list without using CSS and still be compliant conforming to the strict DTD specification? I am also looking for a solution of the "value" attribute a...

selected list item in MVC 2.0

Hello, i inherited a menu based on lists that was used before i started and that needs going into MVC. The list needs to show a white box for the selected item and a standard grey box for the rest. up to now, all that gets shown is a grey box for all. We have been looking around for a solution for this but we fail to get to the bottom ...

Check if a List is of that type that it can ADD/Delete items ?

Hello, I am having a UserControl with an ItemsSource that allows only objects, that can be enumerated (implement IEnumerable) and where I can add/delete items. How can I test the latter? ...

Facebook php sdk Retrive friendlist problem

Title should say my words.Here is my basic code... <?php require_once 'fb-sdk/src/facebook.php'; // Create our Application instance. $facebook = new Facebook(array( 'appId' => 'xxxxxxx', 'secret' => 'xxxxxxxxxxxxxxxx', 'cookie' => true, )); $accessToken = $facebook->getAccessToken(); $session = $facebook->getSession(); $...

deallocating memory for objects I haven't set to null

EDIT: Problem wasn't related to the question. It was indeed something wrong with my code, and actually, it was so simple that I don't want to put it on the internet. Thanks anyway. I read in roughly 550k Active directory records and store them in a List, the class being a simple wrapper for an AD user. I then split the list of ADRecords...

Check if the typeof(object) in a List is a reference type

Hello, this seems odd to me: if(customerList.Count > 0) { if(typeof(customerList[0]).IsReferenceType) { // do what I want } } How would you do it? ...

How to create a Class with List<> properties

The problem: - I want to read filename into a List<> inside a class. How to I read the filename into List<> in foreach Statement? How to set up the get and set statement in List<> properties in the class. For this operation, which type to use: static class or normal class? ------revise------------- This is the problem : sorry for th...

Python nested loop with condition

reworked to hopefully make it clearer. my_list = [[1,2],[1,3],[1,3],[1,3]] my_var = 7 My goal is to be able to see if my_var is larger than all of the positions at my_list[0][1] and my_list[1][1] and my_list[2][1] and so on. my_list can vary in length and my_var can also vary so I am thinking a loop is the best bet? *very new to pyt...

In Lisp (Clojure, Emacs Lisp), what is the difference between list and quote?

From reading introductory material on Lisp, I now consider the following to be identical: (list 1 2 3) '(1 2 3) However, judging from problems I face when using the quoted form in both Clojure and Emacs Lisp, they are not the same. Can you tell me what the difference is? ...

Check if value already exists within list of dictionaries?

I don't think this question has been asked in this form on SO before. I've got a Python list of dictionaries, as follows: a = [{ 'main_color': 'red', 'second_color':'blue'}, { 'main_color': 'yellow', 'second_color':'green'}, { 'main_color': 'yellow', 'second_color':'blue'}] I'd like to check whether a dictionary with a particular ke...

Flex 4 Enable Drag and Drop in List

Hello! I have a Spark List with a TileLayout. I want to enable moving itemRenderers around to be able to order items. How can I do that please? Thank you. ...

Finding length of items from a list

Hi everyone, I have two list in a python list1=['12aa','2a','c2'] list2=['2ac','c2a','1ac'] First- Finding combinations of each two item from list1. Second- Finding combinations of each two item from list2. Third- Finding combinations of each two items from list1 and list2 Fourth- Calculating each combinations total length Advic...

list.extend and list comprehension

When I need to add several identical items to the list I use list.extend: a = ['a', 'b', 'c'] a.extend(['d']*3) Result ['a', 'b', 'c', 'd', 'd', 'd'] But, how to do the similar with list comprehension? a = [['a',2], ['b',2], ['c',1]] [[x[0]]*x[1] for x in a] Result [['a', 'a'], ['b', 'b'], ['c']] But I need this one ['a', 'a...

How to check whether elements appears in the list only once in python?

I have a list: a = [1, 2, 6, 4, 3, 5, 7] Please, explain mne how to check whether element appears only once in in the list? Please, also explain if all elements from 1 to len(a) are in the list. For inctance, in list 'a' element from 1 to 7 are in the list, but if the list is b = [1, 4, 3, 5], then not all elements from 1 to 4 are not...

Ignore an element while building list in python

Hello, I need to build a list from a string in python using the [f(char) for char in string] syntax and I would like to be able to ignore (not insert in the list) the values of f(x) which are equal no None. How can I do that ? ...

Updating List <HashMap>

I just want to know how to, if a Hashmap is already on the list add 1 to quantity, if it is not then add it to list. This is what I've done that just add eventhough the item is already on list. list = new ArrayList<HashMap<String, String>>(); Cursor c = db.rawQuery("SELECT code,desc,price FROM TbLPrice WHERE code =" + txtCode.getText()....

Lists in Python

Possible Duplicate: What is the easiest way to convert list with str into list with int? =) Is it possible to transform: a = ['1', '2', '3', '4'] to a = [1, 2, 3, 4] Thank You! ...

Can't *copy* an index from list to another with a twist in Python

I'm pretty new to python and am trying to grab the ropes and decided a fun way to learn would be to make a cheesy MUD type game. My goal for the piece of code I'm going to show is to have three randomly selected enemies(from a list) be presented for the "hero" to fight. The issue I am running into is that python is copying from list to l...