list

Prolog A predicate for alignment

By alignment I mean that the predicate takes in two lists, well three with the alignment list. And then check that every item in the alignment list is indeed an element in both the other lits. And there is a requirement about order, so that rules out just checking that every item in the alignment list is a member of both the other input ...

Display unordered list as a horizontal binary tree

Hi, I have a binary tree in unordered list that looks like this: <ul> <li>1 <ul> <li>2 <ul> <li>4 <ul> <li>8</li> <li>--</li> </ul> </li> <li>5</li> </ul> </li> <li>3 <ul> <li>6</li> <li>7</li> </ul> </li> </ul> </li> Where -- is a empty space (to differ ...

appending successfully to a python list

This may seem like the worlds simplest python question... But I'm going to give it a go of explaining it. Basically I have to loop through pages of json results from a query. the standard result is this {'result': [{result 1}, {result 2}], 'next_page': '2'} I need the loop to continue to loop, appending the list in the result key to...

Logic of iterating through a list. Element "flickering"

[SOLVED]: Applying proper list iteration procedure fixed problem. (Shown below) I currently have a program in which elements of a list are iterated through and erased if they meet certain conditions. Due to the nature of the program, this can be visually seen. Objects on screen that are being iterated through sometimes flicker on and o...

searching within nested list in python

I have a list: l = [['en', 60, 'command'],['sq', 34, 'komand']] I want to search for 'komand' or 'sq' and get l[1] returned. Can I somehow define my own matching function for list searches? ...

erlang list manipulation

I have a list of tuples: L = [{1, [a, b, c]}, {2, [d, e, f]}, {3, [[h, i, j], [k, l, m]]}] this is what I have lists:map(fun({_, B}-> B end, L). the output is [[a, b, c], [d, e, f], [[h, i, j], [k, l, m]]] what I want is: [[a, b, c], [d, e, f], [h, i, j], [k, l, m]] it seems a pretty easy problem, but I can't figure out how ...

Prolog Find the longest list in a list of lists

I have a list of lists, and I need to find the longest one of them. If there are more than one with the same length it's the same which it returns. Thanks. ...

Can't add value to List in C#

I'd like to add a value to a struct if (!existISDNteilnehmer(split)) { isdnObjs.Add(new ISDN() { name = split, number = "", channels = new List<string>()}); } ISDN? actualISDN = getISDN(split); if (index < ISDN_teilnehmer.Count()) { var numbers = from num in xISDN.XPathSelect...

List all devices, partitions and volumes in Powershell

Hi! I have multiple volumes (as nearly everybody nowadays): on Windows they end up specified as C:, D: and so on. How do I list these all like on a Unix machine with "ls /mnt/" with Powershell? ...

Can I zip more than two lists together in Scala?

Given the following Scala List: val l = List(List("a1", "b1", "c1"), List("a2", "b2", "c2"), List("a3", "b3", "c3")) How can I get: List(("a1", "a2", "a3"), ("b1", "b2", "b3"), ("c1", "c2", "c3")) Since zip can only be used to combine two Lists, I think you would need to iterate/reduce the main List somehow. Not surprisingly, the f...

File Attachments in Lists in SharePoint 2007 - how can I limit what kinds of files users can attach to list items?

Hello all, I am working with a custom anouncements list, and I am allowing users to upload documents as file attachments to list items (pretty standard SharePoint functionality, I know). What I would like to do is limit the kinds of files a user is able to attach to a list item. Specifically, when a user makes a new anouncement, I only ...

Is there a way to inspect the (differing) internal structures of Python objects that test as equal (==)?

Yesterday I asked ("A case of outwardly equal lists of sets behaving differently under Python 2.5 (I think …)") why list W constructed as follows: r_dim_1_based = range( 1, dim + 1) set_dim_1_based = set( r_dim_1_based) def listW_fill_func( val): if (val == 0): return set_dim_1_based else: return set( [val]) W...

Python list filtering and transformation

Hello, I have a list of library filenames that I need to filter against regular expression and then extract version number from those that match. This is the obvious way to do that: libs = ['libIce.so.33', 'libIce.so.3.3.1', 'libIce.so.32', 'libIce.so.3.2.0'] versions = [] regex = re.compile('libIce.so\.([0-9]+\.[0-9]+\.[0-9]+)') for l ...

Linq to generic list?

Hey, in my DAL I have 3-5 Lists of something: List<User>, List<Items>, List<bla> Now I want to modify these Lists generic in a method. How can I write a method with parameters allowed of all of this? (I tried var but don't allowed in the method head) P.s.: Don't care about type, I will cast it back easily: List<User> user; user = ...

List refresh, item renderer in Flex

I have a List and the item renderer displays an image and text from xml (news rss). Not all news have an image. Whenever you scroll the list, and the item renderer refreshes, it move images of news of a position, so the news "1" have the image of news "2", and the news "2" have the image of news "3" ecc., but the text (the title of news...

Advance grouping of List Items - Jquery

I have a list like <ul> <li> hgh55jjj </li> <li> abc99xyz </li> <li> hgf88hjk </li> <li> ........ </li> <li> ........ </li> <li> def99bnb </li> <li> gjj77hkj </li> <li> hgh55fhj </li> </ul> I want this to be formatted to a grouped list based on the two digits inside the text in such a way that all 99 items come together. And I also w...

C++ array list or vector?

Hello, I'm trying to rewrite code I've written in matlab in C++ instead. I have a long cell in matlab containing 256 terms where every term is a 2x2 matrix. In matlab i wrote it like this. xA = cell(1,256); xA{1}=[0 0;3 1]; xA{2}=[0 0;13 1]; xA{3}=[0 0;3 2]; and so on... What would be the easiest thing to use in c++? Can I give ...

Prolog Problem with combinding predicates that work on their own

Here we go, bear with me. The over-all goal is to return the max alignment between two lists. If there are more than one alignment with the same length it can just return the first. With alignment I mean the elements two lists share, in correct order but not necessarily in order. 1,2,3 and 1,2,9,3; here 1,2,3 would be the longest alignm...

how to handle large lists of data

We have a part of an application where, say, 20% of the time it needs to read in a huge amount of data that exceeds memory limits. While we can increase memory limits, we hesitate to do so to since it requires having a high allocation when most times it's not necessary. We are considering using a customized java.util.List implementatio...

Inserting items in a list that is frequently insertion sorted

I have a list that is frequently insertion sorted. Is there a good position (other than the end) for adding to this list to minimize the work that the insertion sort has to do? ...