My question as title above. For example,
IEnumerable<T> items = new T[]{new T("msg")};
items.ToList().Add(new T("msg2"));
but after all it only has 1 item inside.
Can we have a method like items.Add(item)?
like the List<T>
...
Hi suppose these 2 methods:
private List<IObjectProvider> GetProviderForType(Type type)
{
List<IObjectProvider> returnValue = new List<IObjectProvider>();
foreach (KeyValuePair<Type, IObjectProvider> provider in _objectProviders)
{
if ((provider.Key.IsAssignableFrom(type) ||
...
Hi Everyone,
I'm fairly new to using JSON (as opposed to XML) and am currently working purely with Javascript to digest, parse and display my returned JSON data.
I'm using the JSON2.js library and am getting back some valid JSON data representing a fairly simple nested list:
{
"node":{
"class":"folder",
"title":"Test Framewo...
I have a list
a=[1,2,3,4,5]
and want to 'move' its values so it changes into
a=[2,3,4,5,1]
and the next step
a=[3,4,5,1,2]
Is there an build-in function in python to do that?
Or is there a shorter or nicer way than
b=[a[-1]]; b.extend(a[:-1]); a=b
...
Is this a list of lists or just a bunch of trees(forest)?
...
I was wandering if there is a class out there that implements both Map and List interfaces in Java.
I have a data structure that is primarily a Map. I map strings (IDs) to Images. But in a specific part of my code i need to present the user with all the available IDed Images. The only way to do that so far is to write this :
for (Stri...
Can I serialize a generic list of serializable objects without having to specify their type.
Something like the intention behind the broken code below:
List<ISerializable> serializableList = new List<ISerializable>();
XmlSerializer xmlSerializer = new XmlSerializer(serializableList.GetType());
serializableList.Add((ISerializable)Pers...
I have the following HTML :
<li>
<a class="meuble-tab" href="#">Meuble</a>
</li>
i need to achieve the following:
<li class="active">
<a class="meuble-tab" href="#">Meuble</a>
</li>
Using Jquery I am at the point where i can get to the
$(".meuble-tab")
How do I get to its parent "li" to do the addClass("active")?
...
Ok, I'm stuck, need some help from here on...
If I've got a main dictionary like this:
data = [ {"key1": "value1", "key2": "value2", "key1": "value3"},
{"key1": "value4", "key2": "value5", "key1": "value6"},
{"key1": "value1", "key2": "value8", "key1": "value9"} ]
Now, I need to go through that dictionary already to format some o...
I wonder if there is a way to hide some document library lists that are shown when the user navigates to the "All Site Content" page in SharePoint, and I wonder if there is a programmatic way to achieve this. (If possible using WSS).
I need to hide many lists from this view, these lists will be accessed from the links inside a link lis...
I have the following list item
public List<Configuration> Configurations
{
get;
set;
}
public class Configuration
{
public string Name
{
get;
set;
}
public string Value
{
get;
set;
}
}
How can I pull an item in configuration where name = value?
For example: lets sa...
Still learning python (finally!) and can't quite wrap my head around this one yet. What I want to do is sort a dictionary of lists by value using the third item in the list. It's easy enough sorting a dictionary by value when the value is just a single number or string, but this list thing has me baffled.
Example:
myDict = { 'item1' ...
Is there a simple and quick way to use sum() with non-integer values?
So I can use it like this:
class Foo(object):
def __init__(self,bar)
self.bar=bar
mylist=[Foo(3),Foo(34),Foo(63),200]
result=sum(mylist) # result should be 300
I tried overriding __add__ and __int__ etc, but I don't have found a solution yet
EDIT:
Th...
I am looking for an python inbuilt function (or mechanism) to segment a list into required segment lengths (without mutating the input list). Here is the code I already have:
>>> def split_list(list, seg_length):
... inlist = list[:]
... outlist = []
...
... while inlist:
... outlist.append(inlist[0:seg_length])...
Is there a better way to do this in python, or rather: Is this a good way to do it?
x = ('a', 'b', 'c')
y = ('d', 'e', 'f')
z = ('g', 'e', 'i')
l = [x, y, z]
s = set([e for (_, e, _) in l])
I looks somewhat ugly but does what i need without writing a complex "get_unique_elements_from_tuple_list" function... ;)
edit: expected value ...
Hi
I have a method named "GetOrders". This method reads an XML file and gathers OrderNumber of all orders related to a specific user. The method returns a list.
Now I wanna to know, having my list, How can I get other fields of these OrderNumbers from DB?
...
At the moment I am using one list to store one part of my data, and it's working perfectly in this format:
Item
----------------
Joe Bloggs
George Forman
Peter Pan
Now, I would like to add another line to this list, for it to work like so:
NAME EMAIL
------------------------------------------------------
Joe Bl...
One more question about most elegant and simple implementation of element combinations in F#.
It should return all combinations of input elements (either List or Sequence).
First argument is number of elements in a combination.
For example:
comb 2 [1;2;2;3];;
[[1;2]; [1;2]; [1;3]; [2;2]; [2;3]; [2;3]]
...
I have a python list which holds a few email ids accepted as unicode strings:
[u'[email protected]',u'[email protected]',u'[email protected]']
This is assigned to values['Emails'] and values is passed to render as html.
The Html renders as this:
Emails: [u'[email protected]',u'[email protected]',u'[email protected]']
I would like it to ...
Hey all,
I'm having a hard time figuring out how to refer to a specific Item List within a list in SharePoint. I looked up the page in SharePoint Designer and found that the listitem is inside a custom made webpart inside a custom made webpage. I'm coding an event receiver and need to read the information that the user types into that l...