hashtable

Associative Array/Hash/Hashtable using Connector/NET

Hey Guys, working with asp.NET and c#, I'm using MySQL's connector/NET plug-in thingy to connect to a MySQL db (no surprises there!). And that works fine, can connect, run queries etc etc all fine and dandy, but is it possible to return a Hashtable or similar of the results? Save running a describe on the same table to get the column na...

Update cached data in a hashtable

In order to minimize the number of database queries I need some sort of cache to store pairs of data. My approach now is a hashtable (with Strings as keys, Integers as value). But I want to be able to detect updates in the database and replace the values in my "cache". What I'm looking for is something that makes my stored pairs invalid ...

Add readable field descriptions to ActiveRecord models

I'd like to add descriptions to ActiveRecord model fields to serve as basic instructions / examples for each of the fields. Basically model metadata. I can then display these in the UI (next to the fields on a form etc.) The way I'm planning to do it is simply create a static hashtable inside the model with the field name as the key and...

How to define hash tables in bash?

Just what title says. I am surprised by insufficiency of results in Google search for this question! What I want to is the equivalent of Python dictionaries but in bash (and hence, should work across OSX, Ubuntu and other major Linux distributions). ...

Does powershell have associative arrays?

I am writing a function that returns an id, name pair. I would like to do something like $a = get-name-id-pair() $a.Id $a.Name like is possible in javascript. Or at least $a = get-name-id-pair() $a["id"] $a["name"] like is possible in php. Can I do that with powershell? ...

Creating generic hashtables - C++

.NET framework has got a Dictionary<TKey,TValue> class which is implemented as hash tables and provides data retrieval in constant time (O(1)). I am looking for a similar implementation in C++. I know about std::map but in this data retrieval takes logarithmic time. Is there any good hash table implementation in C++ which will retrieve d...

Which data structure to add/look up/keep count of strings?

I'm trying to figure out what data structure to quickly support the following operations: Add a string (if it's not there, add it, if it is there, increment a counter for the word) Count a given string (look up by string and then read the counter) I'm debating between a hash table or a trie. From my understanding a hash table is fast...

Make Hashtable immutable

How do I make a derived class from Hashtable, objects of which can be added, but cannot be removed or replaced? What do I have to override and particularly how do I override the [] operator? ...

Searching Keywords into a Text with a hashtable

I would like to search for keywords in a text, I have around 6000 keywords and I need to know what's the best way to do it in PHP. What's the best way to implement a hashtable in php? ...

C#: Binding hashtable to combo box question

public class FontType { ... public String Name { get { return _name; } } public String DisplayName { get { return _displayName; } } public Font UseFont { get { return _font; } } } bindFontTypes.DataSource = availableFonts; comboFontType.DataSource = bindFontTypes; comboFontType.ValueMember = ...

Best Java data structure to store a 3 column oracle table? 3 column array? or double map?

Hello :) What is the best data structure to store an oracle table that's about 140 rows by 3 columns. I was thinking about a multi dimensional array. By best I do not necessarily mean most efficient (but i'd be curious to know your opinions) since the program will run as a job with plenty of time to run but I do have some restrictions...

Best practice for loading and using dictionary items?

Say I have some 10 "categories" that I need to reference in a web app. Currently I'm storing these categories in the DB and am retrieving them (category name and id) during pageload in my basepage, storing them in a hashtable and then using the hashtable to reference the categories. I realized that the DB call is being made during eac...

Acceptable types to use as keys in a HashTable

I must admit to having only a rudimentary understanding of how HashTables work, although from what little I do know it seems fairly straightforward. My question is just this: it seems that the conventional wisdom is to use simple, basic value types such as integers for the keys in a HashTable. However, strings are also often used, even t...

C# Insert Button Into Hashtable.

I have a Winform in c# and I'm trying to build a hashtable with a list of buttons that I have. IE: Monday0700Button, Monday0730Button, Monday0800Button, and so on. In the hashtable I am trying to order these, so that if I need to use a button, and the button that follows it, I can use the hashtable key. IE: if I need to color the backgr...

Frequently Used metadata Hashmap

Are there any implementations of a static size hashtable that limits the entries to either the most recently or most frequently used metadata? I would prefer not to keep track of this information myself. I know most caching components keep track of this, but I would rather not introduce quite a lot of new dependencies. ...

Why does Dictionary[index] throws a KeyNotFoundException but Hashtable[index] doesn't?

Any idea why this behaviour is different? ...

Why isn't randomized probing more popular in hash table implementations?

According to various sources, such as Wikipedia and various .edu websites found by Google, the most common ways for a hash table to resolve collisions are linear or quadratic probing and chaining. Randomized probing is briefly mentioned but not given much attention. I've implemented a hash table that uses randomized probing to resolve ...

Hashtable how to get string value without toString().

How could I get the string value from a hashtable without calling toString() methode? example: my class: public class myHashT : Hashtable { public myHashT () { } ... public override object this[object key] { get { return base[key].ToString(); <--this doesn't work! } set ...

how to filter out DateTime type of values from all hashtable value?

I need to convert all DateTime values to String, though out my project, all of my code at the end follows 1 function, where I have 4 different Hashtables (actually XmlRpcStruct Object of CookComputing xmlrpc library). is there any way that without iterating on each hash table - I can convert the values of hashtable having datetime -> st...

Add to a hashtable

I am trying to implement a hash table ...