I want to experiment with an idea I have of automatically localizing software, or at least suggesting a reasonable translation if a localized string is not available.
I'm not sure this will be working satisfactorily tomorrow morning but I just wanted to play with this idea.
Does anybody know of a dictionary that is free to use, and is ...
How can I make a fast dictonary ( String => Pointer and Int => Pointer ) in C without a linear search? I need a few ( or more ) lines of code, not a library, and it must be possible to use it in closed-source software (LGPL, ...).
...
I'm very new to multi-threading and for some reason this class is giving me more trouble than it should.
I am setting up a dictionary in the ASP.net cache - It will be frequently queried for individual objects, enumerated occasionally, and written extremely infrequently. I'll note that the dictionary data is almost never changed, I'm pl...
Hello all
I have a quick question: I do alot of iteration of Dictionary.Value collections and in annoys me that I have to call .ToList() to then be able to call .ForEach(), as it seems none of the enumerable collections in a Dictionary (The Dictionary itself, the Keys collection or the Values collection) have a ForEach extension method....
Suppose I'm given a large dictionary in flat file with 200 million words and my function needs to check the existence of any given word in the dictionary, what's the fastest way to do it? You can't store the dictionary in the memory because you only have 1GB of memory. You can store it in the database, however querying it would still b...
I've got a situation where I have a business object with about 15 properties of different types. The business object also has to implement an interface which has the following method:
object GetFieldValue(string FieldName);
I can see 2 ways of implementing this method:
Use a switch statement:
switch ( FieldName )
{
case "Field1"...
For example, suppose I do this:
>>> class foo(object):
... pass
...
>>> class bar(foo):
... pass
...
>>> some_dict = { foo : 'foo',
... bar : 'bar'}
>>>
>>> some_dict[bar]
'bar'
>>> some_dict[foo]
'foo'
>>> hash(bar)
165007700
>>> id(bar)
165007700
Based on that, it looks like the class is getting hashed as its id number. T...
What is more efficient in Python in terms of memory usage and CPU consumption - Dictionary or Object?
Background:
I have to load huge amount of data into Python. I created an object that is just a field container. Creating 4M instances and putting them into a dictionary took about 10 minutes and ~6GB of memory. After dictionary is ready...
Hi all,
now i am working with python. So one question about dict ....
suppose i have a dict that
config = {'account_receivable': '4', 'account_payable': '5', 'account_cogs': '8', 'accoun
t_retained_earning': '9', 'account_income': '6', 'account_expense': '31', 'durat
ion': 2, 'financial_year_month': 9, 'financial_year_day': 15, 'accou...
I wrote a small python program to iterate over data file (*input_file*) and perform calculations. If calculation result reaches certain states (stateA or stateB), information (hits) are extracted from the results. The hits to extract depend on parameters from three parameter sets.
I used a dictionary of dictionaries to store my parameter...
I'm writing a program that uses regular expressions to make comparisons against the entire dictionary on the UNIX shell.
Is there a way that I can echo some sort of predefined dictionary and then pipe it to grep? I was thinking I could use the backend of some programs spell-checker?
Or do I just need to echo a file of words? If so, whe...
I have a list of dicts, something like this:
test_data = [
{ 'offset':0, 'data':1500 },
{ 'offset':1270, 'data':120 },
{ 'offset':2117, 'data':30 },
{ 'offset':4055, 'data':30000 },
]
The dict items are sorted in the list according to the 'offset' data. The real data could be much longer.
What I want to do is lookup a...
Suppose I have the following object in javascript:
var object = {"key1":"value1","key2","value2","key3","value3"};
How do I find out how many tuples I have in the dictionary?
...
I've created a new class that inherits from SortedDictionary:
public partial class ListIncomeWeight : SortedDictionary<string, double> {
public Guid Identity { get; set; }
}
This list is combined with a few dozens of other lists, where the other lists will keep track if they already calculated with this list or not. For that purp...
I've created a Range type:
public class Range<T> where T : IComparable<T>
{
public Range(T min, T max) : this(min, max, false) { }
public Range(T min, T max, bool upperbound)
{
}
public bool Upperbound { get; private set; }
public T Min { get; private set; }
public T Max { get; private set; }
public bool ...
Hi folks,
I have a class derived from Dictionary. I need this class to simulate a HashSet, because Silverlight doesn't know HashSets and my classes make heavy use of HashSets. So I decided to exchange the HashSet with Dictionary. To further use my classes with all the HashSet-Objects, I try to make a custom HashSet class, that is derive...
Hello. I've found a strange issue with subclassing and dictionary updates in New-Style Classes:
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on
win32
>>> class a(object):
... def __init__(self, props={}):
... self.props = props
...
>>> class b(a):
... def __init__(self, val = None):
.....
I'd like my associative array indexed by Point (or, in general, an Object) that has a semantic equality. Unfortunately
var p:Point = new Point(1, 1);
var q:Point = new Point(1, 1);
var dict:Dictionary = new Dictionary();
dict[p] = 5;
trace(dict[p]); // => 5
trace(dict[q]); // => undefined
because
trace(p===q); // => false
Is there...
I want to write a simple application like the "stardict" (but not so huge), that searches for the phrase in the dictionary and provides the corresponding value.
I guess that it is kind of "bicycle" and that it was done many times by different people... But the thing is that all the suitable open software, that is available in the web ...
I'm implementing generic, persistent .NET collections based on top of the ESENT database engine (using the ManagedEsent interop layer). So far I have been focusing on classes that exactly mimic their System.Collections.Generic counterparts, except that they take a path in the constructor indicating where the database should go. Code like...