dictionary

C# Super fancy LINQiness

I'm trying to write a dynamic sort of command line processor where I have a dictionary with keys being possible parameters, and the member being an Action where the string is the text between the parameters passed on the command line. Want to be able to add parameters just by adding the params array, and writing the action in the diction...

Windsor Castle resolve Dictionary<> failed

I did the following: container.Register(Component.For<Dictionary<string, string>>() .Instance(ServiceDictionaryInstance) .Named("serviceDictionary")); The class consumes the component is: public class BusinessService : IDecisionFilter { private readonly Dictionary<str...

Safe to hold context within a Dictionary

OK so my question is self explanatory, here is some code so you can understand a little more. public Dictionary<string,VcardWindow> VcardWindowManager = new Dictionary<string,VcardWindow>();' And access like so: public void ShowVcardWindow(string VcardOwner) { VcardWindow Window; if(VcardWindowManager.ContainsKey(VcardOwne...

Dynamic Dictionary usage Problem in C#

I am using Dynamic dictionary in C#. The problem which I am facing , is the usage of TryGetMember behavior which i am overriding in dynamic ditionary class. here's the code of dynamic dictionary. class DynamicDictionary<TValue> : DynamicObject { private IDictionary<string, TValue> m_dictionary; public DynamicDictionary(IDicti...

Free/open Translation databases ?

Are there any open/free downloadable translation databases, besides wiktionary? (any language welcome) ...

convert list to dictionary using linq and not worrying about duplicates

i have a list of Person objects. i want to convert to a dictionary where the key is the first and last name (concatenated) and the value is the Person object. the issue is that i have some duplicates people so this blows up if i use this code: private Dictionary<string, Person> _people = new Dictionary<string, Person>(); _people ...

Python: Thread safe dictionary with short lived keys, is this correct?

import threading import weakref _mainlock = threading.RLock() _job_locks = weakref.WeakValueDictionary() def do_thing(job_id): _mainlock.acquire() #Dictionary modification lock acquire _job_locks.setdefault(job_id, threading.RLock()) #Possibly modifies the dictionary _mainlock.release() _job_locks[job_id].acquire() tr...

tries data structure implementation......... Application - Dictionary............

Hi, Wanted to write a program to implement a dictionary of words using Tries Data Structure. Please tell me the structure for the implementation so that I could start the program, as i haven't got any article on internet, for Tries Implementation.. The confusion is, that when we search through the word, and we get through the word at...

Dictionary<K,V> that implements IList<V>

I find myself often faced with this problem: I have a dictionary where the key is some simple numeric ID and the value is an object. The ID is also contained in a specific property of that value object. Then, I want to be able to deserialize some (format-inflexible) XML that looks like: <listitem> <id>20359</id> <someotherval>f...

Python: Accessing Values For Dict Key Made Using Variables

Hi I've been coding a console version of Minesweeper just to learn some of the basics of Python. It uses a coordinate system that is recorded in a dictionary. Now, I have been able to implement it successfully but accessing or assigning a value to a specific coordinate key using variables for the "x,y" of the coordinate seems... clunky. ...

Speeding up parsing of HUGE lists of dictionaries - Python

Hi folks, I'm using MongoDB an nosql database. Basically as a result of a query I have a list of dicts which themselves contains lists of dictionaries... which I need to work with. Unfortunately dealing with all this data within Python can be brought to a crawl when the data is too much. I have never had to deal with this problem, a...

Why is Dictionary crashing when I am sure I am accessing different value references synchronously?

During adding key to dictionary, it is crashing if I don't lock on it and giving NullReferenceException which is reasonable Rarely sometimes it is also crashing when I am adding element to the Dictionary Value (list reference), which is weird... I have another question as well. The files are in text format. Sometimes reading them takes...

How to split a string into an array

I have a string of attribute names and definitions. I am trying to split the string on the attribute name, into a Dictionary of string string. Where the key is the attribute name and the definition is the value. I won't know the attribute names ahead of time, so I have been trying to somehow split on the ":" character, but am having trou...

Is it possible to automate generation of wrong choices from a correct word?

The following list contains 1 correct word called "disastrous" and other incorrect words which sound like the correct word? A. disastrus B. disasstrous C. desastrous D. desastrus E. disastrous F. disasstrous Is it possible to automate generation of wrong choices given a correct word, through some kind of java dictionary API? ...

Binding a Dictionary's key and value in a listbox with wpf

Hi, I am trying to bind a dictionary's key to a row of the grid in a listbox, and bind the dictionary's value to another row of the grid. key's type is Book, a class thati wrote and the value's type is int. i want to write the elements of the class and the integer value in grid. Can you help me on this? I'm quite confused on determining...

setDefault for Nested dictionary in python.

How do I use setdefault in python for nested dictionary structures. eg.. self.table[field] = 0 self.table[date] = [] self.table[value] = {} I would like to setdefault for these. ...

Next key in C# Dictionary

How to get an Enumerator to an item in a -Sorted- dictionary using key? Note:GetEnumerator() gets an Enumerator to first element.. But I need to get an Enumerator to the element with a given key in order to gain access to next elements using MoveNext() for example... Edit: Or a way to access next elements... Edit: I prefer a const ti...

How to Get Rid if Intermediary Page in Searchable Dictionary-Like App

Hi to all! I am working on a search app and since I am a beginner, I decided to start from the searchable dictionary sample, which is quite similar to what I'm trying to achieve. Got it to work, but I have a problem: the sample loads a blank page initially, telling the user to press on the search button to start performing a search. Onc...

workaround: javascript dictionary which takes objects as keys

Hi, I read a few questions and answers about javascript dictionary implementations, but they don't meet my requirements: the dictionary must be able to take objects as keys the values must be accessible by the []-operator So i came up with the idea to overwrite the "valueOf"-method in Object.prototype, as follows: Object.__id__...

Iteration in python dictionary

I populate a python dictionary based on few conditions, My question is can we retrieve in the same order as it is populated. questions_dict={} data = str(header_arr[opt]) + str(row) questions_dict.update({data : xl_data}) valid_xl_format = 7 if (type.lower() == "ma" o...