and some theory...

Industrial Code and Solutions

for Getting Things Done


Specialized Google Searches
XML Schemas

Database Normalization Basics

First Normal Form (1NF)

First normal form (1NF) sets the very basic rules for an organized database:
  • Eliminate duplicative columns from the same table.
  • Create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key).

Second Normal Form (2NF)

Second normal form (2NF) further addresses the concept of removing duplicative data:
  • Meet all the requirements of the first normal form.
  • Remove subsets of data that apply to multiple rows of a table and place them in separate tables.
  • Create relationships between these new tables and their predecessors through the use of foreign keys.

Third Normal Form (3NF)

Third normal form (3NF) goes one large step further:
  • Meet all the requirements of the second normal form.
  • Remove columns that are not dependent upon the primary key.

Fourth Normal Form (4NF)                                                                              Back  to  Top

Finally, fourth normal form (4NF) has one additional requirement:
  • Meet all the requirements of the third normal form.
  • A relation is in 4NF if it has no multi-valued dependencies. 

Specialized Google Searches                  Back  to  Top

Getting Latitude and Longitude from Google Maps

When the location you want is in the center of the map, copy and paste this code into the location bar of your browser and press enter:


Advanced Search Techniques

  1. Explicit Phrases:
    Looking for content about hot air ballooning?  Put it in quotes.  
    Example: "hot air ballooning"
  2. Exclude Words:
    Want to exclude results containing a certain word?  Do this: use "-" in front of the word you don't want.
    Example: hot air -ballooning
  3. Site Specific Search:
    Google to search a Website.
    Example: "safety"
  4. Similar Words and Synonyms:
    Use the "~" in front of the word.
    Example: "hot air" ~politician
  5. Specific Document Types:
    Want to find only Portable Document Format (.pdf) docs?
    Example: "ballooning" filetype:pdf
  6. Hot OR Air:
    Google normally includes all of the words you type in the search box.  Use the OR operator to have it find any of the terms separate from the others.
    (Note:  OR must be capitalized).
    Example: hot air OR mamas
  7. Phone Listing:
    Use the phonebook feature.
    Example: phonebook:123-456-7890
  8. Area Code Lookup:
    If all you need to do is to look-up the area code for a phone number, just enter the 3-digit area code and Google will tell you where it’s from.
    Example: 617
  9. Numeric Ranges:
    Finds all numbers within the entered range.
    Example: california earthquakes 1960..2008
  10. Stock (Ticker Symbol):
    Today's financials and a chart for the stock.
    Example: INTC
  11. Calculator:
    Enter the text the way you would write it.
    Example: pi * 3^2
  12. Word Definitions:
    Use the "define:" command.
    Example: define: onomatopoetic                                                Back  to  Top

XML schemas

With XML schemas, you have more power to define what valid XML documents look like. They have several advantages over DTDs:

  • XML schemas use XML syntax. In other words, an XML schema is an XML document. That means you can process a schema just like any other document. For example, you can write an XSLT style sheet that converts an XML schema into a Web form complete with automatically generated JavaScript code that validates the data as you enter it.
  • XML schemas support datatypes. While DTDs do support datatypes, it's clear those datatypes were developed from a publishing perspective. XML schemas support all of the original datatypes from DTDs (things like IDs and ID references). They also support integers, floating point numbers, dates, times, strings, URLs, and other datatypes useful for data processing and validation.
  • XML schemas are extensible. In addition to the datatypes defined in the XML schema specification, you can also create your own, and you can derive new datatypes based on other datatypes.
  • XML schemas have more expressive power. For example, with XML schemas you can define that the value of any <state> attribute can't be longer than 2 characters, or that the value of any <postal-code> element must match the regular expression [0-9]{5}(-[0-9]{4})?. You can't do either of those things with DTDs.

Back  to  Top

XML programming interfaces

Which interface is right for you?

To determine which programming interface is right for you, you need to understand the design points of all of the interfaces, and you need to understand what your application needs to do with the XML documents you're going to process. Consider these questions to help you find the right approach.

  • Will your application be written in Java? JAXP works with DOM, SAX, and JDOM; if you're writing your code in Java, you should use JAXP to isolate your code from the implementation details of various parsers.
  • How will your application be deployed? If your application is going to be deployed as a Java applet, and you want to minimize the amount of downloaded code, keep in mind that SAX parsers are smaller than DOM parsers. Also be aware that using JDOM requires a small amount of code in addition to the SAX or DOM parser.
  • Once you parse the XML document, will you need to access that data many times? If you need to go back to the parsed version of the XML file, DOM is probably the right choice. When a SAX event is fired, it's up to you (the developer) to save it somehow if you need it later. If you need to access an event you didn't save, you have to parse the file again. DOM saves all of the data automatically.
  • Do you need just a few things from the XML source? If you only need a few things out of the XML source, SAX is probably the right choice. SAX doesn't create objects for everything in the source document; you can decide what's important. With SAX, you can look at each event to see if it's relevant to your needs, then process it appropriately. Even better, once you've found what you're looking for, your code can throw an exception to stop the SAX parser altogether.
  • Are you working on a machine with very little memory? If so, SAX is your best choice, despite all the other factors that you might consider.

Be aware that XML APIs exist for other languages; the Perl and Python communities in particular have very good XML tools.