dictionary

Declaring the datatype dynamically reading from an xml string

Hello I've this strange issue. I've an xml string which looks like below - <key><int>5</int></key><value><int>10</int> The above xml is obtained after serializing a Dictionary using Paul's Code. Now i want to convert the xml back to the dictionary. How can i get the type "int" from the xml and declare the dictionary as follows? Dic...

Why can't I define a case-insensitve Dictionary in C#?

This C#/WPF code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigatio...

Dictionaries with tuples that have lists as values.

How can i have a tuple that has a list as a value. F.x. if i want to have a structure like this. ( Somechar , Somelist[] ) And how would i iterate through a dictionary of these things? ...

Sending a JSON array to be received as a Dictionary<string,string>

I have a method with the following signature: public ActionResult RenderFamilyTree(string name, Dictionary<string, string> children) I'm trying to call it from javascript using jQuery like this: $('#div_render').load( "<%= Url.Action("RenderFamilyTree") %>", { 'name': 'Raul', [ {'key':'key1','...

Defining the context of a word - Python

Hi folks, I think this is an interesting question, at least for me. I have a list of words, let's say: photo, free, search, image, css3, css, tutorials, webdesign, tutorial, google, china, censorship, politics, internet and I have a list of contexts: Programming World news Technology Web Design I need to try and match wo...

Which NHibernate.Mapping.Attributes should I use in my class to map a dictionary?

Hi Folks, I'm using NHibernate and I map my objects directly with attributes. I've seen similar questions but most of the case people use mapping files... or they give answers with links that don't exist anymore :) For the following class, which attributes do I have to add for the property Table which is a IDictionary? I guess it's som...

List of dict in Python

Hi everybody, I've got a list of dict in Python: dico_cfg = {'name': entry_name, 'ip': entry_ip, 'vendor': combo_vendor, 'stream': combo_stream} self.list_cfg.append(dico_cfg) I append to my list a lot of dict in the same way. Now I would like to delete one dict and only one dict in this list? What is the best way to proceed? I've ...

catalogue a list of dictionaries

I have a list of dictionaries: people = [{"name": "Roger", "city": "NY", "age": 20, "sex": "M"}, {"name": "Dan", "city": "Boston", "age": 20, "sex": "M"}, {"name": "Roger", "city": "Boston", "age": 21, "sex": "M"}, {"name": "Dana", "city": "Dallas", "age": 30, "sex": "F"}] I want to catalogue them, for ex...

How to get values after dictionary sorting by values with linq

hey, I've a dictionary, which i sorted by value with linq, how can i get those sorted value from the sorted result i get that's what i did so far Dictionary<char, int> lettersAcurr = new Dictionary<char, int>();//sort by int value var sortedDict = (from entry in lettersAcurr orderby entry.Value descending select entry); during the ...

Suppose I have a python dictionary , many nests.

If a lot of nested dictionarys, I am trying to find a certain key. this key is called "fruit". But it's nested inside somewhere. How do I find the value of this key? ...

C# Custom Dictionary Take - Convert Back From IEnumerable

Scenario Having already read a post on this on the same site, which didn't work, I'm feeling a bit stumped but I'm sure I've done this before. I have a Dictionary. I want to take the first 200 values from the Dictionary. CODE Dictionary<int,SomeObject> oldDict = new Dictionary<int,SomeObject>(); //oldDict gets populated somewhere...

Best way to store 3 pieces of data as a single entry

For a game server, I want to record details when a player makes a kill, store this, and then at intervals update to a sql database. The part i'm interested in right now is the best method of storing the kill information. What i'd like to pass to the sql server on update would be {PlayerName, Kills, Deaths}, where the kills and deaths ar...

python: what are efficient techniques to deal with deeply nested data in a flexible manner?

My question is not about a specific code snippet but more general, so please bear with me: How should I organize the data I'm analyzing, and which tools should I use to manage it? I'm using python and numpy to analyse data. Because the python documentation indicates that dictionaries are very optimized in python, and also due to the f...

How to synchronize a python dict with multiprocessing

I am using Python 2.6 and the multiprocessing module for multi-threading. Now I would like to have a synchronized dict (where the only atomic operation I really need is the += operator on a value). Should I wrap the dict with a multiprocessing.sharedctypes.synchronized() call? Or is another way the way to go? ...

C# Dictionary as a ListBox.DataSource

I am trying to bind a dictionary as a DataSource to a ListBox. The solution in How to bind a dicationary to a ListBox in winforms will not work for me because my dictionary is a class-level variable and not a method-level variable, so I can not use var. When you put a class-level variable into new BindingSource(...) with null as the se...

C# linq in Dictionary<>

I have an object allStudents = Dictionary<ClassRoom, List<Student>>() In Linq how would I get a list of all the students who are male? (student.Gender=="m") from all the Classrooms? Ian ...

dictionary interface for large data sets

I have a set of key/values (all text) that is too large to load in memory at once. I would like to interact with this data via a Python dictionary-like interface. Does such a module already exist? Reading key values should be efficient and values compressed on disk to save space. Edit: Ideally cross platform, but only using Linux ...

How to query collections in NHibernate

Hi, I have a class: public class User { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual IDictionary<string, string> Attributes { get; set; } } and a mapping file: <class name="User" table="Users"> <id name="Id"> <generator class="hilo"/> </id> <property name=...

In .NET, will cleaning a nested dictionaries parent release all memory upon garbage collection?

I have the following nested dictionaries: Dictionary<int, Dictionary<string, object>> x; Dictionary<int, SortedDictionary<long, Dictionary<string, object>>> y; If I do x.Clear() and y.Clear() will all the nested objects clear and all the memory will be reused on the next garbage collection? Or do I need to iterate on all the items ...

Free String Dictionary (Nouns)

Hi All, I am looking for a free (downloadable) dictionary of nouns to use as an actual word generator - similar but not the same as captcha's. Does anyone know if anything like this is available? Thanks, Kyle ...