list

Java: List<E> decorator implementation with notification

Hi, I need to implement List decorator class, which notify registered listeners in case of any change in list. I have subclassed AbstractListDecorator from org.apache.commons.collections15 and override methods like add(), addAll(), remove(int), remove(E) and so on with my notifying. But there are some holes in -- for example when iter...

Sharepoint 2007 Userlist custom property

I have a custom event handler on a wiki page, which should add a Tag to a custom coloumn which I attached to the Users List. The problem is how can I obtain a reference to the List in a event. It doesn't seem to be in the Profile of the profile manager and accessing it with Spweb.Lists["Userinformationlist"] gives me an error for non Adm...

Why I get UnsupportedOperationException for this?

I am using a List to hold some data obtained by calling Array.asList() method. Then I am trying to remove an element using myList.Remove(int i) method. But while I try to do that I am getting an UnsupportedOperationException. What would be the reason for this? How should I resolve this problem? ...

MVC 1.0 DropDownList static data select not working

I'm new to MVC and C#. I'm trying to get a static list to work with a DropDownList control such that the selected value rendered is set by the current Model value from the DB. In the controller, I have: ViewData["GenderList"] = new SelectList(new[] { "Female", "Male", "Unknown" }, donor.Gender); In the view: Gender:<%=Html.DropDo...

How to find length of an element in a list?

I'm just starting with programming. I have a list of a few strings and now I need to print the biggest (in length) one. So I first want to just print the lengths of elements. I was trying things like this: l = ("xxxxxxxxx", "yyyy","zz") for i in range(len(l): So how do I do it? ...

Show duplicates in Mathematica

In Mathematica I have a list: x = {1,2,3,3,4,5,5,6} How will I make a list with the duplicates? Like: {3,5} I have been looking at Lists as Sets, if there is something like Except[] for lists, so I could do: unique = Union[x] duplicates = MyExcept[x,unique] (Of course, if the x would have more than two duplicates - say, {1,2,2,2...

MySQL - DB Design for "has many" issue across tables vs stored lists

Trying to figure out the best way to set up collection "lists" for users given the following data (pseudo code): user table = id, name, email cars table = id, make, model user_cars table = user_id, car_id, rating collections table = id, user_id, name Facts: Users can have many cars Users can have many collections Individual cars ...

Best way to construct a "complex" data structure in Python

Hello guys. I need to construct a tool that will be used to create field mappings (between tables) in the most automated manner possible. Here is the deal: imagine a table being appended to other. (lets ignore field type, just for a second...) CREATE OR REPLACE TABLE fooA( id, name, type, foo) CREATE OR REPLACE TABLE otherFooTable( i...

Reconciling a new BindingList into a master BindingList using LINQ

I have a seemingly simple problem whereby I wish to reconcile two lists so that an 'old' master list is updated by a 'new' list containing updated elements. Elements are denoted by a key property. These are my requirements: All elements in either list that have the same key results in an assignment of that element from the 'new' list...

Generic function on a list of derived class

Hi; I feel my question is pretty dumb, or another way to put it is : I'm too lost in my code to see a workaround for now. Stay too long on a problem, and your vision becomes narrower and narrower ><. Plus I'm not good enough with inheritance, polymorphism and so Here is the idea : I have multiple list of derived class, and I would like...

jquery adding stripes to ul

Hi I'm trying to make a function that will add a striped effect to an unordered list, I've got the following so far but cant work out how the selector should work. (function($) { $.fn.stripe = function(){ this.$("li:even").css("background-color","#f00"); }; })(jQuery); $("list_id").stripe(); thnks ...

Modifying list while iterating

l = range(100) for i in l: print i, print l.pop(0), print l.pop(0) The above python code gives the output quite different from expected. I want to loop over items so that I can skip an item while looping. Please explain. ...

SPDataSource for update and delete

Hi All, Has any now tried out working with Delete and update command of SPDataSource used in conjuction with SPGridView? If yes, can you share a working example? Thanks, Taha ...

Converting a single ordered list in python to a dictionary, pythonically

I can't seem to find an elegant way to start from t and result in s. >>>t = ['a',2,'b',3,'c',4] #magic >>>print s {'a': 2, 'c': 4, 'b': 3} Solutions I've come up with that seems less than elegant : s = dict() for i in xrange(0, len(t),2): s[t[i]]=t[i+1] # or something fancy with slices that I haven't figured out yet It's obviously ...

How can I display a total for a calculated column in a SharePoint list?

I have a column, B, that is calculated based on another column, A. At the top of the list, I'd like to display the sum of B. When I look in the Totals section in the Create/Modify a Column screen, I only see column A (actually, I only see all the non-calculated columns), so I can't choose to sum column B. Is there a way to display a tot...

jQuery split long ul list in smaller lists

I have a long UL list I need to break up in smaller lists containing about 20 items each. I was thinking I could use something like $(function() { $("ul li:nth-child(20n)").after("</ul><ul>"); }); but that's not the case. Any idea how to use jQuery in a way that uses minimal CPU? Thanks ...

Problem with ChoiceGroup, strings don't fit in screen

Hi guys! I'm developing a J2ME application, and I need to show a .png picture, then right beneath it, a list of strings from which the user can select one. Since you can't append an image to a List, I tried using a Form, appending an ImageItem to it, then appending an ChoiceGroup with the options. This works very well on the Sun WTK emu...

How to association workflow on creating of list definition

Hi, I have my custom content type, and list definition. Once we create a list from this template, by default I wish to enable "Require content approval for submitted items", "Create major and minor (draft) versions", "Enable scheduling of items in this list " and approval workflow association. My list look as :- Also i tried added a...

rbind dataframes in a list of lists

I have a list of lists that looks like this: x[[state]][[year]]. Each element of this is a data frame, and accessing them individually is not a problem. However, I'd like to rbind data frames across multiple lists. More specifically, I'd like to have as output as many dataframes as I have years, that is rbind all the state data frames ...

STL list exception

Hello, I was trying to use an STL list in C++ and I arrived into a strange exception that I'm not able to understand. The list is defined as list<ASTNode*> m_stats; and ASTNode* is a class. When I try to add elements by calling ASTNode *node = new ASTNode(); m_stats.push_back(node); it throws the following exception: Program receive...