dictionary

Converting a dictionary key in double

Hi all I think it is not complicated but after doing some research I can't find an answer to a simple problem. I am iterating through keys in a dictionary and I would like to use the key which is a string as a double in some calculation. If I do this : foreach (KeyValuePair<string, List<string> price in dictionary) double ylevel = Co...

copying dictionary doesn't give me expected result

I have to copy one dictionary, work with that copy and return to the original one. What seems to happen is that the orignal dictionary is modified when I do some work on the copied one. Here is my code : dmodified_profile = new SortedDictionary<int,SortedDictionary<string,List<string>>>(d_profile); I don't know why d_profile which ...

NSMutableDictionary setobject giving "message sent to deallocated instance" error

This line of code: [mymutabledict setObject:myclassobj forKey:myclassobj.myidstring]; Is giving this error: *** -[NSCFString hash]: message sent to deallocated instance 0x3c14610 I put in a breakpoint on that line and I've checked and all 3 objects (mymutabledict, myclassobj, and myclassobj.myidstring) are correctly allocated and ...

what will happen if not lock the dictionary when i modify it? about asp.net cache

sorry i have many questions about the lock/cache.=_=.. ->1. about cache, i know that the cache in asp.net is threadsafe, the simple code i usually use is IList<User> user= HttpRuntime.Cache["myCacheItem"] as IList<User>; if (user == null) { //should i have a lock here? //lock(some_static_var){...} Htt...

How can i add key/value to object queryset

Hi I need to add key/value to queryset per each object based on stuff in request.session. How to do that? Alan ...

How to modify key in a dictionary in C#

How can I change the value of a number of keys in a dictionary. I have the following dictionary : SortedDictionary<int,SortedDictionary<string,List<string>>> I want to loop through this sorted dictionary and change the key to key+1 if the key value is greater than a certain amount... Thanks ...

Style Google dictionary API results

I have no idea what I am doing, but I keep trying. I have been trying to find a way to add a dictionary search box to my school website for my 3rd grade (7-8 year olds). Most of the dictionary sites are too complex and riddled with inappropriate advertisements. I found out about google/dictionary.com the other day and have been trying to...

How do I map a dictionary using Fluent NHibernate automapping?

I have an entity like so: public class Land { public virtual IDictionary<string, int> Damages { get; set; } // and other properties } Every time I try to use automapping with the following code: var sessionFactory = Fluently.Configure() .Database(SQLiteConfiguration.Standard.InMemory) .Mappings(m => m.AutoMappings.Add...

Dictionary merging

I have a Dictionary of dictionaries : SortedDictionary<int,SortedDictionary<string,List<string>>> I would like to merge two dictionaries for example key = 2 and key = 3. Very important I could have duplicate keys in the respective dictionaries. example key = 2 has a dictionary Key,Value "1000",{a,b,c} and key = 3 has a dictionary ke...

Style JSON results from a search

If I make the search: http://www.google.com/dictionary/json?callback=dict_api.callbacks.id100&amp;q=school&amp;sl=en&amp;tl=en&amp;restrict=pr%2Cde&amp;client=te I end up with a response in JSON. I am not a programmer and I have no idea where to begin to take the results and then style them and turn them into something my students can...

.NET - Dictionary locking vs. ConcurrentDictionary

Hello, I couldn't find enough information on ConcurrentDictionary types, so I thought I'd ask about it here. Currently, I use a Dictionary to hold all users that is accessed constantly by multiple threads (from a thread pool, so no exact amount of threads), and it has synchronized access. I recently found out that there was a set of t...

where to find dictionaries for other languages for intellij ?

Hi all, a quick googling didn't bring anything interesting, intellij spellchecker comes with only english and arabic bundled (strange, I think it made in east Europe, they didn't even bundle their language ?). My customer is german so all my code is mixed english (code)/german (interface) and I can't find a german dictionary for intel...

How to use a hash_map with case insensitive unicode string for key?

I'm very new to STL, and pretty new to C++ in general. I'm trying to get the equivalent of a .NET Dictionary<string, value>(StringComparer.OrdinalIgnoreCase) but in C++. This is roughly what I'm trying: stdext::hash_map<LPCWSTR, SomeStruct> someMap; someMap.insert(stdext::pair<LPCWSTR, SomeStruct>(L"a string", struct)); someMap.find(L...

Python: Split list into list of dicts?

Just beginning with python and know enough to know I know nothing. I would like to find alternative ways of splitting a list into a list of dicts. Example list: data = ['ID:0:0:0', 'Status:Ok', 'Name:PhysicalDisk0:0:0', 'State:Online', 'FailurePredicted:No', 'ID:0:0:1', 'Status:Ok', ...

Adding new terms in the Gosen Dictionary

Good day, How do you add new terms in the Gosen's Dictionary? Thanks, Franz ...

why dict objects are unhashable in python?

I mean why cant we put key of dict as dict? that means we can't have dictionary having key as another dictionary... ...

Time complexity of accessing a Python dict

Hello, I am writing a simple Python program. My program seems to suffer from linear access to dictionaries, its run-time grows exponentially even though the algorithm is quadratic. I use a dictionary to memoize values. That seems to be a bottleneck. The values I'm hashing are tuples of points. Each point is: (x,y), 0 <= x,y <= 50 ...

How to add value for Complex Dictionary?

Hi, As i know, the method to add values for dictionary as below. Dictionary<string, string> myDict = new Dictionary<string, string>(); myDict.Add("a", "1"); If I declared "myDictDict" as the style below. IDictionary<string, Dictionary<string, string>> myDictDict = new Dictionary<string, Dictionary<string, string>>(); myDic...

Anyone know if theres a library of english audio word pronunciations available for commercial use?

I know this is not exactly a programming oriented question but I'm looking for audio pronunciations for english words. I would like to be able to use this library for commercial purposes so I'm wondering if anyone knows of a good open source library or one with a license that allows one to use it commercially. The audio format doesn't re...

Actionscript 3 Dictionary returning undefined/null for key that has just been set in a different class

I'm rendering display objects to the stage depending on the given XML elements, as you can see here: PageRenderer.as private static var curElements:Dictionary = new Dictionary(); //renders the current page private static function renderCode(pageCode:XML):void { if (pageCode) { /...