list

Insert element into a tree from a list in Standard ML

I have just started to learn SML on my own and get stuck with a question from the tutorial. Let say I have: tree data type datatype node of (tree*int*tree) | null insert function fun insert (newItem, null) = node (null, newItem, null) | insert (newItem, node (left, oldItem, right)) = if (newItem ...

Sort list using stl sort function

I'm trying to sort a list (part of a class) in descending containg items of a struct but it doesn't compile(error: no match for 'operator-' in '__last - __first'): sort(Result.poly.begin(), Result.poly.end(), SortDescending()); And here's SortDescending: struct SortDescending { bool operator()(const term& t1, const term& t2) ...

Python to MATLAB: exporting list of strings using scipy.io

I am trying to export a list of text strings from Python to MATLAB using scipy.io. I would like to use scipy.io because my desired .mat file should include both numerical matrices (which I learned to do here) and text cell arrays. I tried: import scipy.io my_list = ['abc', 'def', 'ghi'] scipy.io.savemat('test.mat', mdict={'my_list': my...

List of resources to learn cassandra

Hi all, Lately I have been reading a lot of blog topics about big sites(facebook, twitter, digg, reddit to name a few) using cassandra as their datastore instead of MysqL. I would like to gather a list of resources to learn using cassandra. Hopefully some videos or podcasts explaining how to use cassandra. My list Twissandra - Twiss...

Accessing Class Variables from a List in a nice way in Python

Suppose I have a list X = [a, b, c] where a, b, c are instances of the same class C. Now, all these instances a,b,c, have a variable called v, a.v, b.v, c.v ... I simply want a list Y = [a.v, b.v, c.v] Is there a nice command to do this? The best way I can think of is: Y = [] for i in X Y.append(i.v) But it doesn't seem ...

unable to apply jquery filter

Hi I m un-animating a list using this code... function unanimate_li() { $li.filter(':last') .animate({ height: 'hide', opacity: 'hide' }, 1000, function() { unanimate_li(); }); $li = $li.not(':last'); } I have set up the li using this code $li = $("ol#update > li"); $li = $li.filter(':gt(4)').filter...

Python: Removing tuples from a list of lists

I have a list of lists containing tuples: [[(1L,)], [(2L,)], [(3L,)], [(4L,)], [(5L,)] how do i edit the list so the list looks like: l = [[1][2][3][4][5]] ...

Python - Check if numbers in list are factors of a number

Hey, I have a list of numbers (integers) (say, from 1 to 10). They're not necessarily consecutive, but they are in ascending order. I've prompted the user multiple times to enter a choice of the available numbers. When that number is entered, it is removed from the list along with any of its factors that may be there. I've prevent...

How to create and add elements in a list in Scheme?

I want to define a method that take an integer as input and creates dynamically a list of all descending integer numbers to zero. I find trouble into calling method for the n-1 element ...

Problems with Linked List in C

Hey everyone, I am new to C and I am working on an XOR linked list for a project. I have most of the code done, but I can't seem to get the delete function of the list to work properly. It seems able to delete some numbers, but not any number you pass into the function. Could anyone experienced with C take a look and possibly point out w...

How to get a list of users for all instance's databases

I guess the procedure should be something like this: declare @db varchar(100) declare @user varchar(100) declare c cursor for select name from sys.sysdatabases open c fetch next from c into @db while @@fetch_status = 0 begin print @db exec ('use ' + @db) declare u cursor for select name from sys.sysusers ...

Filtering directly and indirectly connected things from list

Hello, if you have a function "test a b" which returns true if a and b are connected directly and if you have a given unordered list of things, what would be an elegant and fast solution to filter all connected things from given list? Example: let test a b = let diff = a - b in diff == 0 ;; let lst = [4;1;7;3;8;9;2;0] ;; filter_conn...

Compass search not working on Lists

Hello, My Compass search does not seem to search inside Java Lists (It searches only the last node in the list) . It works correctly with Sets, but my application needs sorted data. Could some one please tell me what I am doing wrong and how to fix it? Thanks a lot! ...

Displaying list of objects as single column in a bound gridview (Winforms)?

I have a gridview that is bound to a datasource on a Windows Form (VB.NET). The grid displays a list of "certifications", and each "certification" can be associated with many languages. So in the grid, I'd like to display "languages" as a column, and display a comma delimited list of the language names for each "certification". In the ...

duplicate each member in a list - python

Hi I want to write a function that revives a list [1,5,3,6,...] and gives [1,1,5,5,3,3,6,6,...] any idea how to do it? thanks ...

Rails: Ruby debugger shows old code unless I stop the server and start it again.

Using ruby-debug, when I issue a list command, it shows old code. So if I update the code surrounding (especially before) the debugger command in the model it still shows the old code. The only way I have found to 'refresh' this code is by stopping the server and running it again. Is there a better way? Thanks, Josh ...

Trying to get these list items to display inline

I have several unordered lists that I want to display like this: <ul> <li><img></li> <li><p></li> //inline </ul> //linebreak <ul> <li><img></li> <li><p></li> //inline </ul> ...etc I'm not able to get the li items to be inline with eachother. They are stacking vertically. I have stripped away most styling but still can't figur...

how to get the index or the element itself of an element found with "if element in list"

Hey, Does a direct way to do this exists? if element in aList: #get the element from the list I'm thinking something like this: aList = [ ([1,2,3],4) , ([5,6,7],8) ] element = [5,6,7] if element in aList #print the 8 ...

Python: Create a duplicate of an array

I have an double array alist[1][1]=-1 alist2=[] for x in xrange(10): alist2.append(alist[x]) alist2[1][1]=15 print alist[1][1] and I get 15. Clearly I'm passing a pointer rather than an actual variable... Is there an easy way to make a seperate double array (no shared pointers) without having to do a double for loop? Thanks, Da...

How to drill down with jQuery?

I'm new to jQuery so sorry if this sounds stupid but I'm having truble drilling down to other elemnts. Paticularly I want to fade in the .menu li a:hover class with jquery. CSS .menu { padding:0; margin:0; list-style:none; } .menu li { float:left; margin-left:1px; } .menu li a { display:block; height:44px; ...