I have got a hashtable that holds an analysis of individual photo characteristics. There are duplicate values in the hash table. Can someone explain how I can get values that are not unique,ie there is more than one entry the same.

My hashtable is in the form of a text file.

Recommended Answers

All 5 Replies

I'm not sure what you want. Do you want to read the hashtable into memory and then retrieve values, or do you just want to search through the file to find values?

I'm ok with reading things into memory a list or an array.
What I would like to do would be to group like items, I can't sort the table as it is currently in the order needed.

I don't understand hash tables, so my values don't have a key in them.
I thought what I could do is to group the items that are the same, and retrieve the photo according to the index ( the order of the hashtable).

Another thought I had was to add a key(not sure how) with the index, then the table could be sorted to allow easy grouping of the items, and the get the index, and thereby the photo.

I hope this makes sense.

I realize I made a mistake with the second approach I referred to of course adding the index into the hashtable would mean that the entries would never match.

Please disregard the second part of my query.

First you need to define 'like items'. What makes them alike? Also if you group items it will change the order of the table.

I can see that you don't understand hashtables. Hashtables have to have a key, otherwise they aren't hashtables :)

You need to think more about what it is that you are trying to do. Do you want to be able to search for specific conditions? If so, how many? What are they? What defines 'like'? What is the goal of this software?

Fair enough. I am writing a program that scans all photos, and finds and displays similar looking ones.

I have an algorithm that analyses each pixel and stores the results in a hash table, I could have used just the stats, but the hashcode appealed because it is reliable, has the same number of characters each time, and apparently can be searched efficiently.

I am happy that the routine works and produces the results, ie the hashtable codes identify similar photos. When I use the term, like items I mean similar looking photos, some that are exactly the same, and some that are nearly the same. I anticipate that out of 2000 odd codes about 20 will not be unique, these are the ones I want to capture, and show in a Listview image control.

Reading I can see the List.FindAll method might work, but I can't understand predicates and the syntax. Hence I am looking for ideas on how to accomplish the task.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.