As a webmaster, I do a lot of research on the web. This requires many different tools to manage links, content, and domains (of course, my favorite is Pioneer Report ;)). One important task is search engine research. It involves comparing one list of links with another, different list.
It is easy to find software which makes a list or takes a list. But, what if you want to compare two lists? What if you want to know what are the common elements to each list? How about knowing what is in one list but not in another, and eliminating all the duplicates?
This code solves this problem.
There are a lot of tools on the web which use lists of data. This includes stock market research, webmaster tools, government data, product info, etc. As a webmaster, I use many tools which produce or use lists. However, none of these tools let you compare the different lists they produce, or use.
To get around the problem of comparing lists, I decided to write the following code.
Using the Code
Besides a lot of user interface commands, there are three basic routines for comparing lists. They are:
In the process of comparing, the routines alphabetize all results. So, once the result is written in the Results window, it is in alphabetical order.
This is what the
AnotB routine code looks like:
int CBigFinderDlg::AnotB(CString& sBody)
std::map<CSTRING, int>::iterator <CODE>it;
int nResultsCount = 0;
for (it = m_aMap.begin(); it != m_aMap.end(); it++)
std::map<cstring, />::iterator itb;
BOOL bSkip = false;
for (itb = m_bMap.begin(); itb != m_bMap.end(); itb++)
if (it->first == itb->first)
bSkip = true;
if (nResultsCount > 0)
sBody += "\r\n";
sBody += it->first;
Points of Interest
Outside of the comparison routines, most of the code is just UI stuff. However, it does make it easier to use the software to do comparisons.
There are many ways to improve this tool and I will add a lot more features. A few new features to add would be loading lists from a file. Also, for large lists, the app locks until it finishes. By adding threads, it lets you stop the app if it is taking too long.
However, all in all, it appears to be a very useful little tool. I look forward to using this all over the place.
These are my crappy websites: Tiny links | tiny MySpace layouts | MySpace backgrounds.
- 10/09/06: Version 1.0. Current name is BigFinder.