Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

A Very High-Level Outline for a Way Cool Utility

0.00/5 (No votes)
24 Nov 2014 1  
In which the author takes the That is an Exercise Left to the Reader cop-out to Extremes

What Nerve That Guy Has!

This may be the strangest article you'll ever read on CodeProject - instead of showing you how to accomplish something in code, it instead outlines the steps necessary to create what I think would be a hip/fab/groovy/cool utility, leaving the actual writing of the code to whoever wants to tackle it - I'm taking "armchair coding" to a "whole 'nother level" with this.

Here's the idea: From a list of names (they have to be people who are famous enough to have a Wikipedia page), extract the person's birthplace and, if they are an athlete, the position they play. If they are a musician, the instrument they play. Assemble this information into the necessary code to generate a map displaying a marker on each person's birthtown, along with information that will display when the marker is selected (clicked or touched). The information would be their name, the name of their birthtown, and the position/instrument they play).

Simple, right? Here it is in a skeletal outline:

  • Assemble the names
  • "Wikipidify" the names
  • Extract the birthplace and position or instrument of each subject from their wikipedia article
  • Generate a map with markers for each birthplace

And now with a little more detail/implementation suggestions/clues

Assemble the names (for example, from a site like this one use HTML Agility Pack to parse the contents

Wikipedify the names (see my tip here for a method to do that

Extract the birthplace and position or instrument from their wikipedia article (use HTML Agility Pack for this, too)

Generate a map with markers for each birthplace using a combination of HTML, CSS, and jQuery and the gomap jQuery plugin (see my tip here or the one it references here)

As an idea of what the utility could generate, here's a scream shot of a map of the USA showing markers for the birthplaces of the various members of the Eagles, with one marker selected:

You can czech out a web site with various collections of markers here

Okay, I'll at Least Give You a Little Pseudocode

Some very rudimentary pseudocode might be:

public Class athleteInfo { String name, String birthplace, string position }
public Class musicianInfo { String name, String birthplace, string instrument }

List<string> names = GetNamesFromSite("http://...");
List<string>wikipediaURLs = GenerateWikiURLSFromNames(names);
Collection<playerinfo> playerData = GetPlayerData(wikipediaURLs);
</playerinfo></string></string>

...and for the jQuery to generate to insert into the HTML file, something like this:

$.goMap.createMarker({
address: 'Chico, CA',
title: 'Aaron Rodgers',
html: '<h1>Aaron Rodgers</h1><h2>Chico, California</h2><p>December 2, 1983</p>'
});

Note: the goMap jQuery plugin is available here

The Greatest Thing Since Sliced Breadfruit of the Loom

With this utility, a user could (theoretically, anyway) simply provide the URL for a website that contains a list of names, and the HTML map file would be generated in 3.14 shakes of a lamb's tail (AKA "Shepherd's Pi"). It would take a little longer than that to write the utility, of course, but after 10 gazillion people used the utility, it would make the expended time seem a mere pittance in comparison.

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