Hi
I hope somebody can help. I am using Python and I would like to be able to do the following.
I have a set of objects (shapes for example) and a series of commands to act on these objects. The commands have the a format of a command string followed by a variable number of parameters which can be strings or integers
For example the s...
I need to determine if an unknown 5 or 6 letter string is a valid word, i.e. is in the dictionary. I could submit the string/word to an online dictionary, but I need to check this string/word, which will be different each time, for about 100 to 150 times. This seems to be a bit time consuming.
My next thought would be to try to get a di...
Here is a twofold question, with a theoretical part, and a practical one:
When subclassing dict:
class ImageDB(dict):
def __init__(self, directory):
dict.__init__(self) # Necessary??
...
should dict.__init__(self) be called, just as a "safety" measure (e.g., in case there are some non-trivial implementation deta...
I'm currently implementing a complex microbial food-web in Python using SciPy.integrate.ode. I need the ability to easily add species and reactions to the system, so I have to code up something quite general. My scheme looks something like this:
class Reaction(object):
def __init__(self):
#stuff common to all reactions
d...
What's the best way to transform an IEnumerable into a lookup- or dictionary-like structure, but with multiple keys per value?
What I'm looking for is something that does roughly the same thing as this, and in a generic way:
var wordsByLetter = new Dictionary<char, HashSet<string>>();
foreach (string word in words)
{
foreach (char l...
In the example code below, I get this error:
Element
TestSerializeDictionary123.Customer.CustomProperties
vom Typ
System.Collections.Generic.Dictionary`2[[System.String,
mscorlib, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089],[System.Object,
mscorlib, Version=2.0.0.0,
Culture=neutral,
PublicKeyT...
Hello all.
I have the following code that I think should work - however, what I think and what actually works is something completely different! This being demonstrated by the fact it doesn't work!
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
Dictionary<String, String> headerTooltips = new ...
I am building a class which subclasses dict, and overrides __setitem__. I would like to be certain that my method will be called in all instances where dictionary items could possibly be set.
I have discovered three situations where Python (in this case, 2.6.4) does not call my overridden __setitem__ method when setting values, and inst...
I've always used dictionaries. I write in Python.
...
What is the most efficient method to store a Python dictionary on the disk? The only methods I know of right now are plain-text and the pickle module.
Edit: Sorry for not being very clear. By efficient I meant fastest execution speed. The dictionary will contain mutable objects that will hold information to be parsed and modified.
...
Hi.
I am new to iphone development. I am "old School" - I was tought to use Procedures etc. when programming. Everything is object oriented these days but my style is still as its always been. Please bear that in mind. My project is tiny and really just a proof of concept.
The program below works on a timer - every 30 seconds it will r...
I have a classic ASP site where I create a dictionary when the user logs in and then stores that dictionary in a session variable like so...
dim objDict
set objDict = server.createobject("scripting.dictionary")
' processing here to fill dictionary
set session("user") = objDict
That all works fine and dandy but when I navigate to anoth...
I would like to add to my site a on-hover/on-select dictionary. What are they usually called, so I can search on the web?
I am thinking in a piece of javascript code that detects which word the mouse is currently hovering/selecting and after some time it shows a baloon with the hovered word definition.
...
How can i copy Dictionary object by value in c#
...
edit: Thanks Jason, the fact that it was a dictionary isn't that important. I just wanted the runtime to have a low runtime. Is that LINQ method fast? Also, I know this is off topic but what does the n => n mean?
I have a list of numbers and I want to make another list with the numbers that appear most at the beginning and the least...
Hello. I am working on an iPhone app that will construct, at run-time, an NSMutableDictionary for which the values (of the key-value pairs) will be NSMutableArrays. Being somewhat new to the Objective-C, I am concerned that the following will cause a memory leak:
- (void) addNewSupplierPhoto:(UIImage*)image toSupplierID:(NSInteger*) sup...
An example list of lists:
[
["url","name","date","category"]
["hello","world","2010","one category"]
["foo","bar","2010","another category"]
["asdfasdf","adfasdf","2010","one category"]
["qwer","req","2010","another category"]
]
What I wish do to is create a dictionary -> category : [ list of entries ].
The resultant dictionary would...
Here is the situation:
I have a webpage that I have scraped as a string.
I have several fields in a MSSQL database. For example, car model, it has an ID and a Name, such as Mustang or Civic. It is pre-filled with most models of car.
I want to find any match for any row in my models table. So if I have Civic, Mustang and E350 in my ...
If I have a deeply nested dict is there a built-in way to subtract/remove list of "paths" (eg: keyA.keyB.key1, keyA.keyC.key2, etc) or a the keys of a second dict from the original dict? Or maybe there is a common module which has functionality like this?
...
Hi,
I want to create a data store to allow me to store some data.
The first idea was to create a dictionary where you have 1 key with many values, so a bit like a one to many relationship
I think the dictionary only has 1 key value.
How else could I store this information??
Marc
...