Saturday, January 22, 2011

Differences between HTML and XHTML

In order to know the differences between HTML and XHTML first you have to understand Elements, Tags, and Attributes.
Let's consider a simple example:
<a href="http://blastyourblog.com">All SEO Tools</a>
In the example,
- "<a href="http://blastyourblog.com">" is an opening tag which defines the start of an element.
- "</a>" is a closing tag which defines the end of an element.
- "href" is an attribute which defines the setting of an element.
- "http://blastyourblog.com" is an attribute value.
- "All SEO Tools" is content.

Now we got what is elements, tag and attributes.
- Full "<a href="http://blastyourblog.com">All SEO Tools</a>" is an element.
- <a> and </a> are tags.
- href is an attribute.

Differences
1) XHTML has a stricter syntax than older (non-X) HTML versions. In XHTML all tags and attributes must be lowercase while in HTML both lowercase and uppercase tags are valid. For example <p></p>
and <a></a> are valid in XHTML but <P></P> and <A></A> are not. In case of HTML both are valid.

2) In XHTML all tags must close. In the example we started with <a> and it is closed by </a>. If we start with <div> it must be closed
by </div> tag. Though there are special cases where an element has no content, such as br or input. In these cases there is
no explicit closing tag, but rather the single tag closes itself with the "/" character at the end, as in <br /> or <input />.

3) In XHTML all attribute values must be inside quotation marks. For example, <a href="http://blastyourblog.com">All SEO Tools</a>
is valid while <a href=http://blastyourblog.com>All SEO Tools</a> in invalid because attibute values are not within quotes.

4) In XHTML elements must be nested properly. For example, <p><a href="http://blastyourblog.com">All SEO Tools</a></p> is valid as
<a href="http://blastyourblog.com">All SEO Tools</a> element is nested inside <p></p> element. However,
<p><a href="http://blastyourblog.com">All SEO Tools</p></a> is not valid XHTML

How to remove duplicate rows using notepad++

With Notepad++ you can easily remove duplicate rows from a document.
1. Open the document with notepad ++ from where you want to remove duplicate rows.

2. Select CTRL+A to select entire document and then click TextFX --> TextFX Tools. Make sure "Sorts outputs only UNIQUE (at column) lines" is checked.

3. Then select block of text (CTRL+A to select the entire document) and from TextFX --> TextFX Tools click "Sort lines case sensitive (at column)" or "Sort lines case insensitive (at column)"

Note that, if you are on unix machine then there is sort, uniq and regular expression to sort easily.

Wednesday, January 19, 2011

Oracle Database Performance Tuning Exercises

1. (TCO 2) Which of the following queries does NOT involve a full table scan to execute? (Points: 3)
         
         
         
         


2. (TCO 2) To achieve better performance, database table design should ____________________. (Points: 3)
         
       
be always de-normalized

        
        



3. 
(TCO 2) An _______ index is automatically created for every PRIMARY KEY column and column with UNIQUE constraint. (Points: 3)
        

        

        

        



4. 
(TCO 2) For which of the folowing queries creting a bitmap index is most justified? Assume table PATIENT has columns" PATIENT_NO, PATIENT_NAME and BLOOD_TYPE. (Points: 3)
       

        
        

        



5. 
(TCO 2) What kind of index can facilitate a query like this one:
SELECT * FROM course WHERE course_name LIKE UPPER(dba%);
(Points: 3)
         
         
         
         


6. (TCO 2) OEM's Query Optimization tool allows you to enter a(n)________ and get an ________. (Points: 3)
         
         
         
         


7. (Points: 12)

Performance Tuning and Diagnostics - LAB 2

L A B   O V E R V I E W


Scenario/Summary
As part of analyzing the database performance issues that Ann and her company are experiencing, we will explore the diagnostic tools that are provided in Oracle Enterprise Manager (OEM). Ann needs to understand what detailed steps the Oracle Database Management System is performing when she is running various queries.
Deliverables
Submit a completed Lab 2 Report, to the DropBox for Week 2.

L A B   S T E P S

STEP 1: Examine query optimization (15 points)
Back to top
Oracle Enterprise Manager (OEM) provides a graphical tool for query optimization.
  1. Start OEM in your environment.
  2. Select Database Tools icon from the vertical tool bar and Select SQL Scratchpad icon from the expanded tool bar.  Paste and execute commands from Lab 1 initialization script to create the tables. You can paste the script from http://arjudba.blogspot.com/2009/12/practice-oracle-joins-examples.html
  3. Write a SQL statement to query all data from table COURSE. Click on Execute. Paste a screen shot that shows the results.
  4. Click on Explain Plan. Paste the screen shot.
  5. Write a comment how this query is executed.
  6. Write a SQL statement to query multiple tables from Ann's database. Specifically, display course names, client names and grades, and order the report by course name, and within the same course by client name.
  7. Click on Explain Plan and paste the screen shot.
  8. Write a comment how this query is executed.
Type your SQL statements and paste OEM screen shots into the LAB 2 Report document.
STEP 2: Create indexes and test queries (25 points)
Back to top
Indexes can help or hinder performance. Add an index to Ann's table and compare the difference in performance.
  1. Execute the SQL statement to query all data of a particular course, say course with code DBA12345. Paste a screen shot that shows the results.
  2. Click on Explain Plan. Paste the screen shot.
  3. Write a comment how this query is executed. In particular, explain what is the index that is used there and how it was created. How does the way table COURSE is accessed here differ from full table scan?
  4. Execute the SQL statement to query all data of a particular course, but this time use in the WHERE clause the course name rather than code, say DBA 101. Paste a screen shot that shows the results.
  5. Click on Explain Plan. Paste the screen shot.
  6. Write a comment how this query is executed. Compare with the way the previous query was executed.
  7. Using SQL Scratchpad, execute a statement that adds an index to table CLIENT on column CLIENT_NAME. Write your CREATE INDEX statement.
  8. Write a query that joins tables CLIENT and COURSE_ACTIVITY to display all data for client named Smithson. Paste a screen shot that shows the results.
  9. Click on Explain Plan. Paste the screen shot.
  10. Write a comment how this query is executed. In particular, explain which index is used and why.
  11. Write a query that joins three tables COURSE, CLIENT and COURSE_ACTIVITY to display a list of course names, client names and grades for the course with code DBA12345. Paste a screen shot that shows the results.
  12. Click on Explain Plan. Paste the screen shot.
  13. Write a comment how this query is executed. In particular, explain which index is used and why.
  14. Modify your previous query to order the report by client name. Paste a screen shot that shows the results.
  15. Click on Explain Plan. Paste the screen shot.
  16. Write a comment how this query is executed. In particular, explain which indexes are used and why.
Type your SQL statements, copy/paste results from SQL*Plus, and paste OEM screen shots into the LAB 2 Report document.
STEP 3: Provide a Recommendation (10 points)
Back to top
Based on the results of this lab, lecture and reading assignment, write a recommendation for indexing and performance tuning for Ann's company.
  • Consider that the audience will range from DBA to CIO.
  • Which indexes are created automatically, and what kind of queries can they help with?
  • Assuming that Ann wishes to be able to search for a particular course based on its code or name, and for particular client based on client number or name, which indexes should be added?
  • What are the benefits and risks associated with creating additional indexes on tables?
  • Use correct spelling and proper grammar.
  1. Identify the business problem.
  2. Present the recommended solution.
  3. Briefly address benefits and risks associated with the solution.
Write your recommendation in the LAB 2 Report document.