Questions tagged [items]

581 questions
624
votes
3 answers

Add a new item to a dictionary in Python

I want to add an item to an existing dictionary in Python. For example, this is my dictionary: default_data = { 'item1': 1, 'item2': 2, } I want to add a new item such that: default_data = default_data + {'item3':3} How can…
brsbilgic
  • 10,643
  • 12
  • 55
  • 89
122
votes
3 answers

Add a new item to recyclerview programmatically?

I'm still trying to get my head around recyclerview. I have an arraylist, that I use to initialize a recycler view with. How can I add new items to the recycler view post setting an adapter and layoutmanager? private void initData() { …
Shubham Kanodia
  • 5,044
  • 3
  • 28
  • 45
31
votes
3 answers

Modification of the list items in the loop (python)

I'm trying to modify items in a list using a for loop, but I get an error (see below). Sample code: #!/usr/bin/env python # *-* coding: utf8 *-* data = [] data.append("some") data.append("example") data.append("data") data.append("here") for item…
Mateusz Jagiełło
  • 5,914
  • 10
  • 32
  • 43
23
votes
1 answer

AttributeError: 'set' object has no attribute 'items'

I am very new to python and have been trying to teach myself as I go (not the best method this deep into python but for time's sake I need too). The modules I've imported are Tkinter and csv. Let me know if you have any questions, For the sake of…
MTMA
  • 233
  • 1
  • 2
  • 5
22
votes
3 answers

Woocommerce - Getting the order item price and quantity.

Using Woocommerce 2.6.8 , I can't get the Order Item Data information as described in the docs and here on SO. All I want is to get the Line Item price and Quantity, which should be as simple as: $order = new WC_Order( $order_id ); $order_items =…
robobobobo
  • 629
  • 1
  • 7
  • 17
19
votes
4 answers

How do I find an item by value in an combobox in C#?

In C#, I have variable, a, of type string. How do I find item by value of a in combobox (I want find item with value no display text of combobox).
Duy Khanh
  • 314
  • 1
  • 4
  • 11
18
votes
5 answers

Programmatically Check an Item in Checkboxlist where text is equal to what I want

In C#, I am trying to Check an item in a CheckBoxList where the text equals what I require. I would modify the code to check items that exist in the database. If you would like an example, I need to select the checklistbox item that equals to abc.
Peter Roche
  • 315
  • 2
  • 6
  • 17
11
votes
1 answer

Items in listView have white text when using setAdapter in UI thread

For another listView in another activity the text color of the items is black, like it should be. However, in another activity when using setAdapter in a new thread when the new items created the text color is white when I want it black. Here is the…
user3864563
  • 325
  • 7
  • 21
9
votes
1 answer

Android - How to get all items in a Spinner?

How do I get all items in a Spinner? I was having trouble trying to search a way to get all items from a Spinnerbut I was not able to find an elegant solution. The only solution seems to be storing the items list before to add it to the Spinner Is…
Antonio
  • 10,457
  • 6
  • 30
  • 45
7
votes
3 answers

Why does python's dictionary iteration seemingly work with a copy?

I am confused how python is iterating through this dictionary. From python's documentation, the itervalues returns an iterator over the dictionary's values. dict = {"hello" : "wonderful", "today is" : "sunny", "more text" : "is always good"} for x…
Justin
  • 5,913
  • 9
  • 43
  • 69
7
votes
2 answers

HttpContext.Current.Items reused?

I'm using HttpContext.Current.Items to make a Per-Request Cache Store. I'm experiencing strange problems because I'm hitting to many Cache entries over different http requests. It seems that HttpContext.Current.Items is reused across multiple http…
Ricibald
  • 8,534
  • 7
  • 44
  • 62
7
votes
0 answers

Move items in half circle just like an endless listview

Hello guys I have tried to make a list like that. But nothing find. The items shown in list moves up and down. Main question is how to set items like a circle. This is possible in iphone, but in android how to achieve this.
Umesh Suryawanshi
  • 924
  • 1
  • 7
  • 21
6
votes
1 answer

Animating the Addition / Removal of items within a TreeView - WPF

I know similar questions have been asked in relation to animating items within an ItemsControl so if an acceptable answer has been posted then it would be great if I could be pointed in the right direction. I have a databound TreeView where the…
SilverX
  • 1,449
  • 15
  • 17
6
votes
3 answers

jQuery UI Sortable - how to include/exclude multiple "items"?

I have a working example of the jQuery UI Sortable function. I'm applying it to a HTML table to drag and drop and sort table rows. It works great except I want to exclude certain classes of row from being sortable. Using the items parameter, I can…
TrojanName
  • 4,189
  • 5
  • 24
  • 38
6
votes
4 answers

Android -- Problems with Checkable menu items

I have read the instructions at the android developers page's in order to get the Checkable menu items: http://developer.android.com/guide/topics/ui/menus.html this is my xmlmenu:
andrestoga
  • 599
  • 2
  • 8
  • 19
1
2 3
38 39