dictionary

wpf image resources and changing image in wpf control at runtime

I would like to know exactly how to dynamically use a Dictionary Resource in the C# code behind - ie.. I would like to load images at runtime from an image resource within a dictionary I have a program that has 3 images in a WPF Dictionary - these are images set as image resources. Then in the code behind of my WPF Window I want to loa...

Hashtables/Dictionaries that use floats/doubles

I read somewhere about other data structures similar to hashtables, dictionaries but instead of using ints, they were using floats/doubles, etc. Anyone knows what they are? ...

Accessing elements from a Dictionary plist

I'm trying to make use of a dictionary plist as shown below: I read it into a temp dictionary just fine. What I'd like to know is if there is an easy way to get at the string children (which are actually a single element in an array, as you can see). I initially tried objectAtIndex but that was, of course, returning an array, not the...

Tuples( or arrays ) as Dictionary keys in C#

I am trying to make a Dictionary lookup table in C#. I need to resolve a 3-tuple of values to one string. I tried using arrays as keys, but that did not work, and I don't know what else to do. At this point I am considering making a Dictionary of Dictionaries of Dictionaries, but that would probably not be very pretty to look at, thou...

Python creating a dictionary of lists

I want to create a dictionary whose values are lists. For example: {1: ['1'], 2: ['1', '2'], 3: ['1', '2']} If I do: d = dict() a = ['1', '2'] for i in a: for j in range(int(i), int(i) + 2): d[j].append(i) I get a KeyError, because d[...] isn't a list. In this case, I can add the following code after the assignment ...

How do I bind a dictionary to a set of checkboxes using ASP.NET MVC?

My need is to 'bind' Dictionary<MyType, bool> to list of checkboxes in asp.net mvc. I'm confused about how to accomplish that. Could anyone help me? ...

Want to create a custom class of type Dictionary<int, T>

Hi, I want to create a custom class that basically wraps a dictionary. I want to add a property to it called Name. I tried: public class MyDictionary<int, T> : Dictionary<int, T> { public string Name { get; set;} } Doesn't seem to be working, any ideas? Update THe error I'm getting is: Type parameter declaration must be...

A doubt about Dictionary<T,T>

I have a class which looks like this: public class NumericalRange:IEquatable<NumericalRange> { public double LowerLimit; public double UpperLimit; public NumericalRange(double lower, double upper) { LowerLimit = lower; UpperLimit = upper; } public bool DoesLie...

Is there a way to use a Dictionary-like collection as an Application Settings object?

I'd like to store a set of key/value pairs in the application settings of my ASP.NET web app, but I'm not finding a straightforward way to do that. For example, these two questions tell me that StringDictionary etc. won't serialize to XML and suggest that I'll have to roll my own implementation. But it seems like this should be easier ...

Python Advice for a beginner. Regex, Dictionaries etc ?

I'm writing my second python script to try and parse the contents of a config file and would like some noob advice. I'm not sure if its best to use regex to parse my script since its multiple lines? I've also been reading about dictionaries and wondered if this would be good practice. I'm not necessarily looking for the code just a push ...

Enum Overuse?

I'm not sure if I am abusing Enums here. Maybe this is not the best design approach. I have a enum which declares the possible parameters to method which executes batch files. public enum BatchFile { batch1, batch2 } I then have my method: public void ExecuteBatch(BatchFile batchFile) { string batchFileName; ... ...

.NET Dictionary as a Property

Can someone point me out to some C# code examples or provide some code, where a Dictionary has been used as a property for a Class. The examples I have seen so far don't cover all the aspects viz how to declare the dictionary as property, add, remove, and retrieve the elements from the dictionary. ...

Converting a String to Dictionary?

How can i convert the following: s = "{'muffin' : 'lolz', 'foo' : 'kitty'}" Into a dictionary object? I'd prefer not to use eval() what should i do? The main reason for this, is one of my coworkers classes he wrote, converts all input into strings. I'm not in the mood to go and modify his classes, to deal with this issue. ...

Dictionary Component or source code that can check in multiple languges

We are developing an application in which we need to implement spell checking for Indic languages that use ANSI fonts (not UNICODE) I am looking for a Dictionary Component or Source Code that will allow: To maintain separate dictionaries like for example Legal, commercial, etc. Support more than one language If possible to allow devel...

Checking passwords against word database on server or use a web service?

If I want to check passwords in my application for the inclusion of English words, should I store a database of English words locally (is there a free database?) or is there a (free) web service I can use to check them remotely? Ideally I would check the words using an Ajax call but I don't want to pass the entire English dictionary by...

Why are 008 and 009 invalid keys for Python dicts?

Why is it that I can't have 008 or 009 be keys for a Python dict, but 001-007 are fine? Example: some_dict = { 001: "spam", 002: "eggs", 003: "foo", 004: "bar", 008: "anything", # Throws a SyntaxError 009: "nothing" # Throws a SyntaxError } Update: Problem solved. I wasn't aware that starting a literal wi...

Is there a dictionary api or something similar where I can find the definition of words in PHP?

Does anybody know of any? (I'd be using a php page to call the terms) THANKS! ...

How can this be written on a single line?

I've seen some Python list comprehensions before, but can this be done in a single line of Python? errs = {} for f in form: if f.errors: errs[f.auto_id] = f.errors ...

dictionary in python??

in how many way i traverse dictionary in python??? ...

Traversing multi-dimensional dictionary in django

I'm a PHP guy on my first day in Python-land, trying to convert a php site to python (learning experience), and I'm hurting for advice. I never thought it would be so hard to use multi-dimensional arrays or dictionaries as you pythoners call them. So I can create multi-dimensional arrays using this, but i can't loop it in a django templ...