I retrieve some data from a database which returns it in a list of tuple values such as this: [(1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,)]
Is there a function that can sum up the values in the list of tuples? For example, the above sample should return 18.
...
I am trying to do print all the possible outcomes of a given list and I was wondering how to put a value into various locations in the list. For example, if my list was [A,B], I want to insert X into all possible index of the list such that it would return this [X,A,B], [A,X,B], [A,B,X]. I was thinking about using range(len()) and a for ...
I have a standard sharepoint list with a workflow (the sort you create through the standard sharepoint interface). When the approver of the workflow approves an item, any previous comments other staff members have made immediately get reattributed to him. I've looked through the workflow settings but can't see anything obvious, and docum...
Is this possible?
private void Test(out List<ExampleClass>? ExClass)
{
}
A nullable List<> that is also an out parameter?
...
How do you add an element to a List in Scala 2.7.5, without creating a new List and without using a deprecated solution.
...
I am trying to print to a file that will look like:
'A'
'1'
'B'
'2'
'C'
'3'
Given the code below, however, the result is :
['A']
['B']
['C']
This is probably a 'softball' question, but what am I doing wrong here?
l1 = ['1']
l2 = ['A']
l3 = ['2']
l4 = ['B']
l5 = ['3']
l6 = ['C']
listoflists = [l1,l2,l3,l4,l5,l6]
itr = iter(listof...
So I wanted to know if there was a way to grab a specific HTML tag's information using PHP.
Let's say we had this code:
<ul>
<li>First List</li>
<li>Second List</li>
<li>Third List</li>
</ul>
How could I search the HTML and pull the third list item's value into a variable? Or is there a way you could pull the entire unordered list in...
The number of values in a list can only be determined by iterating over its values, or converting it to an array. Assigning it to a scalar won't return the items count:
my $n = ('a', 'b', 'c'); # $n = 'c'
There's an "empty parentheses" idiom, that can be used to get the number of elements:
my $n = () = ('a', 'b', 'c'); # $n = 3
I...
Hi All
Just finished small linked list in C, and realized that I got a problem :)
There is no template arguments for C, so at the start of the file I declaring my data type for list, something like:
typedef int LData;
So far so good, but I cant use this Linked list for 2(or more) different data types in one program.
I can define LDa...
So, I'm having a problem building a feed-style list of posts efficiently using PHP and Mysql.
I want to output the posts organized and grouped by the day they were posted, showing the date as a header. For example:
February 9th -----------
Posts that were posted on Feb 9th
Feb 8th -----------------
Posts that were posted on the 8th
...
I'm just starting with Python, and I can't figure out how to group tuples.
For instance, I have tuple1=("A", "B", "C") and tuple2=("1","2","3"). I want to combine these into a list, grouped by the first tuple. I want it to appear stacked, as in A1 A2 A3 on one line, and B1 B2 B3 on the next line.
I can make them print concatenated, but...
Hi, I'm creating a site where I've encountered a huge IE lag when hovering over the menus.
I'm using Cufon in combination and it seems like it's causing a huge lag when I apply height, width, margins or paddings to the li:hover element.
So, I need to figure out a smart way of doing this otherwise.
The site is here, http://w3box.com/m...
What is the simplest and reasonably efficient way to slice a list into a list of the sliced sub-list sections for arbitrary length sub lists.
For example, if our source list is:
input = [1, 2, 3, 4, 5, 6, 7, 8, 9, ... ]
And our sub list length is 3 then we seek:
output = [ [1, 2, 3], [4, 5, 6], [7, 8, 9], ... ]
Likewise if our sub...
I am new to Sharepoint and I want to make sure I am on the right path.
I am in a highly restricted environment and would rather do this in Visual Studio but am currently in the position where I have to try to get this to work using just the web interface and Sharepoint Designer.
I have created multiple lists that I plan on using in a r...
I lost a little bit of time in this Python for statement:
class MyListContainer:
def __init__(self):
self.list = []
def purge(self):
for object in self.list:
if (object.my_cond()):
self.list.remove(object)
return self.list
container = MyListContainer()
# now suppose both obj...
I've got a list comprehensions which filter a list:
l = [obj for obj in objlist if not obj.mycond()]
but the object method mycond() can raise an Exception I must intercept. I need to collect all the errors at the end of the loop to show which object has created any problems and at the same time I want to be sure to loop all the list e...
How to restrict user to attach particular type of files to items in a list ? Now i can attach any type of file to an item . But i want to restrict the user to upload only images. If user will upload any other then i want to display an error
message . Also how can i restrict the user to upload maximum one file only to a particular item?
...
hey
I am trying to learn lisp, using emacs dialect and I have a question.
let us say list has some members, for which predicate evaluates to false. how do I create a new list without those members? something like { A in L: p(A) is true }. in python there is filter function, is there something equivalent in lisp? if not, how do I do i...
Hello again,
I'm making a LIST container with my own item renderer to display xml file.
Now, I'm overriding the public override function set data(value:Object):void method in my item renderer, the problem is that this function been called many times(!!) (more then the data provider length).
Maybe I'm not setting the data provider righ...
Possible Duplicates:
splitting a list of arbitrary size into only roughly N-equal parts
How do you split a list into evenly sized chunks in Python?
I need to create a function that will split a list into a list of list, each containing an equal number of items (or as equal as possible).
e.g.
def split_lists(mainlist, split...