The Doc Dialer, Part 2: A Browser Independent Version | WebReference

The Doc Dialer, Part 2: A Browser Independent Version


The Doc Dialer, Part 2: A Browser Independent Version

The Doc Dialer is an information indexing and retrieval instrument. It is based on the fact that eight out of the ten numeric keys on the phone keypad are labeled with 24 characters of the English alphabet. Conceptually, you can use these keys to enter any string for either storage or retrieval of information. As the characters Q and Z are missing from the phone keypad, we assume these characters can be omitted from this indexing system with only a slight penalty on its usability.

In this column we continue our Doc Dialer series of columns. We extend Column 57's version in several aspects. First, we made the code browser-independent. In previous version we used the innerHTML feature which is not supported by Netscape Navigator. We overcame this classic incompatibility between the browsers and it now works for both Internet Explorer and Netscape Navigator.

Secondly, we enhanced the Doc Dialer to accept new entries. As you recall, we preloaded Column 57's version with eight US presidents. You could use the Doc Dialer to reach one of these entries, but you couldn't add new names. In this version, you can enter up to 10,000 entries, either interactively (by pressing the * button) or by a script. The new version preloads the eight presidents but this time it is via a script.

The third significant change is that we now store the entries at the lowest possible leaves of the trie data structure. If a name has 20 characters, for example, the depth of the trie data structure will be 20 as well. In previous version, we stored the entries at the lowest level at which they still keep their name uniqueness. We could do it because we knew apriori the exact population of the data structure. In the new version, the content of the data structure is dynamic and changes by the user's on-line entries. In order to avoid pushing old entries down the trie data structure when new entries are introduced, all entries are positioned at the lowest possible level.

In this column we introduce version 2 of our Doc Dialer. This phone includes a traditional phone keypad and a small display. The information subject is US presidents but you can add names of your own by pressing the * key. When you key in a name, the display shows two links for every matched name: a link to its biography and a four-digit indexing number that can be possibly used to retrieve additional information from some internet-based database. The Doc Dialer displays all names that could match the keys pressed so far. Go ahead and try now the Doc Dialer. The presidents we support are Ronald Reagan, Jimmy Carter, Richard Nixon, Bill Clinton, Gerald Ford, George Bush, Lyndon Johnson, and John Kennedy. You can key in their first name followed by their last name, or vice versa. For example: GERALDFORD, BUSHGEORGE, and LYNDON are all valid entries. Same applies when you add a name by yourself. For example, if you add John Smith, you can key in JOHNSMITH or SMITHJOHN. You can clear the display by pressing the 0 button.

In this column, you'll learn:

We also include the listing of our Doc Dialer and its zipped version.

Next: How to implement the global area

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

Created: February 28, 2000
Revised: April 26, 2000

URL: http://www.webreference.com/js/column58/