list

R: preventing unlist to drop NULL values

I'm running into a strange problem. I have a vector of lists and I use unlist on them. Some of the elements in the vectors are NULL and unlist seems to be dropping them. How can I prevent this? Here's a simple (non) working example showing this unwanted feature of unlist a = c(list("p1"=2, "p2"=5), list("p1"=3, "p2"=4), l...

Java: change an element in a prepopulated List of string array.

I have a List of string array already populated in storeInv. How do i change a specific element in the string array? For example the code below... Thanks =] List <String[]> storeInv ; //assume already populated with elements String[] store = storeInv.get(5); store[1] = 123; store.set(5, store[1]); //this gives me an error. ...

Efficient and accurate way to compact and compare Python lists?

Hi folks, I'm trying to a somewhat sophisticated diff between individual rows in two CSV files. I need to ensure that a row from one file does not appear in the other file, but I am given no guarantee of the order of the rows in either file. As a starting point, I've been trying to compare the hashes of the string representations of the...

Efficient way to maintain a sorted list of access counts in Python

Let's say I have a list of objects. (All together now: "I have a list of objects.") In the web application I'm writing, each time a request comes in, I pick out up to one of these objects according to unspecified criteria and use it to handle the request. Basically like this: def handle_request(req): for h in handlers: if h....

How can I create a list with only certain items expandable?

I am trying to compose a list with some items expandable and some single items. I wish to have it so that when either a single item or expandable list child is clicked, I can call an intent based on the text of the item. I suppose expandable lists would work, but is there a way to set items in an expandable list so that they don't ha...

Is there something like List<String, Int32, Int32> (multidimensional generic list)

I need something similar to List<String, Int32, Int32>. List only supports one type at a time, and Dictionary only two at a time. Is there a clean way to do something like the above (a multidimensional generic list/collection)? ...

removing items from a generic List<t>

I have the following method, I wish to remove items from my collection that match the product Id. Seems fairly straight forward, but i get an exception. Basically my collection is getting out of sync. So what is the best way to remove an item from a collection. public void RemoveOrderItem(Model.Order currentOrder, int productId) { ...

Visual Studio C++ list iterator not decementable

I keep getting an error on visual studio that says list iterator not decrementable: line 256 My program works fine on Linux, but the Visual Studio compiler throws this error. Anyway, do you see what my problem is? #include <iostream> #include <fstream> #include <sstream> #include <list> using namespace std; int main(){ /** crea...

Queue In a C# Ilist

Hello, I have a list with 5 elements...What I want to move foward all elements, removing the last one and add a new value to the first one. Is there any pre-made list methods that do that or help me so? Like a Queue ...

Compare List/set elements

I'm looking to compare two sets and display the missing elements in second set by iterating over the first set. I've done using lists but it seems like an overhead iterating over the unordered list to find the elements. #include <iostream> #include <list> using std::list; bool isExist(list <int> &original, int i) { list <int>::iterat...

How to create custom rss feed generator (sharepoint 2010)?

I need to create RSS, that include all sharepoint lists and pages. Sharepoint gives "http://localhost/_layouts/listfeed.aspx?List={0251B48D-9D09-4C94-8D33-8A4589C57EC8}&amp;Source=http%3A%2F%2Flocalhost%2FPages%2FForms%2FAllItems.aspx" "http://localhost/_layouts/feed.aspx?xsl=1&amp;web=%2F&amp;page=122705e9-4542-4e65-b001-81ea8699c5bd...

Use of Distinct with list of Custom Object

How can I make the Distinct() method work with a list of custom object(Href in this case), here is what the current object looks like: public class Href : IComparable, IComparer<Href> { public Uri URL { get; set; } public UrlType URLType { get; set; } public Href(Uri url, UrlType urltype) ...

Multiple group expressions in list (ssrs 2005)

Hi, I have a problem with group expressions in a list. I want to use two expressions: '=Ceiling(RowNumber(Nothing)/3)' and '=Cint(Fields!kpilevel.Value)' They work both individually, but when I insert them together only 1 works. I inserted them like this: img718.imageshack.us/img718/736/problemxq.png Does anyone know how to solve this...

trying to make an accordion menu from a list - jquery indexhibit

Hello - Im teaching my self javascript & jquery so this might be a bit of a low brow question or entirely too much code for anyone to wade through, but Im hoping for some feedback. I have looked around and haven't found a thread that looks like it will deals neatly with my question. Im using the cms indexhibit (cant create a new tag!) ...

Downsampling the number of entries in a list (without interpolation)

I have a Python list with a number of entries, which I need to downsample using either: A maximum number of rows. For example, limiting a list of 1234 entries to 1000. A proportion of the original rows. For example, making the list 1/3 its original length. (I need to be able to do both ways, but only one is used at a time). I believ...

How do you change the Subject/Title of a Sharepoint list RSS feed?

The default RSS feed of my list is working but the problem is, it uses the name of the Page itself as the Subject of each item. How do I change this to show the actual Title of my article? e.g., instead of "AnArticleAboutMountains" (page name with the ".aspx") it should be "An Article About Mountains" (Article Title) Thanks! :) ...

C# remove redundant paths from a list

Say I have this list List<string> sampleList = new List<string> { "C:\\Folder1", "D:\\Folder2", "C:\\Folder1\\Folder3", "C:\\Folder111\\Folder4" }; I'd like to remove the paths that are contained in other folders, for example we have C:\Folder1 and C:\Folder1\Folder3 the list's third entry should go away because C:\Folder...

List filtering: list comprehension vs. lambda + filter

I happened to find myself having a basic filtering need: I have a list and I have to filter it by an attribute of the items. My code looked like this: my_list = [i for i in my_list if i.attribute == value] But then i thought, wouldn't it be better to write it like this? filter(lambda x: x.attribute == value, my_list) It's more rea...

jquery: if ul has li with certain classname?

hi guys, i wonder how i can query if a ul has a first-child li with a certain classname? like… <ul> <li>list element 1</li> <li>list element 2</li> </ul> <ul> <li class="whatever">list element 1</li> <li>list element 2</li> </ul> i want to query if ul has a child with classname whatever -> do something! is that even possible? than...

How to output an array's content in columns in BASH.

I wanted to display a long list of strings from an array. Right now, my script run through a for loop echoing each value to the standard output: for value in ${values[@]} do echo $value done Yeah, that's pretty ugly! And the one column listing is pretty long too... I was wondering if i can find a command or builtin helping me to d...