5,666,547 members and growing! (16,188 online)
Email Password   helpLost your password?
Web Development » Applications & Tools » General     Intermediate

Compare lists - Power tool designed for webmasters

By Toby Jacob Rhodes

This lets you take two lists and do all kinds of comparisons.
C++, Windows, Visual Studio, Dev

Posted: 9 Oct 2006
Updated: 9 Oct 2006
Views: 7,242
Bookmarked: 7 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
5 votes for this Article.
Popularity: 1.16 Rating: 1.67 out of 5
2 votes, 40.0%
1
3 votes, 60.0%
2
0 votes, 0.0%
3
0 votes, 0.0%
4
0 votes, 0.0%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article

BigFinder Screenshot

Introduction

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.

Background

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:
  • CString AnotB(CString&)
  • CString BnotA(CString&)
  • void OnResultsAandB()
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::iterator itb;

        BOOL bSkip = false;

        for (itb = m_bMap.begin(); itb != m_bMap.end(); itb++)
        {
            if (it->first == itb->first)
            {
                bSkip = true;
                break;
            }
        }

        if (!bSkip)
        {
            if (nResultsCount > 0)
                sBody += "\r\n";

            sBody += it->first;

            nResultsCount++;
        }
    }

    return nResultsCount;
}

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.

History

10/09/06. Version 1.0. Current name is BigFinder.

Links.

These are my crappy websites. One day... Tiny links | tiny myspace layouts | myspace backgrounds

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Toby Jacob Rhodes


Developing with MFC for a couple of years now. Working at getting my new web browsers just right.

My website is at GRML web browsers.

Downloads:
Pioneer Report MDI (GRML/CSV/delimited web browsers)

Other stuff:
free myspace backgrounds | Free Images Graphics | Myspace profile editor

I enjoy Memphis, TN and it is great coz there are absolutely no major sports teams (well, except for the Grizzlies).

Occupation: Web Developer
Location: United States United States

Other popular Applications & Tools articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
  (Refresh) 
-- There are no messages in this forum --

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 9 Oct 2006
Editor:
Copyright 2006 by Toby Jacob Rhodes
Everything else Copyright © CodeProject, 1999-2008
Web20 | Advertise on the Code Project