First Normal Form (1NF)
- no duplicate columns, e.g. teacher, student1, student2, student3
- no non-atomic columns, e.g. teacher, students
- rows must be have unique identifier (primary key), e.g. teacher, studentID, studentName
Second Normal Form (2NF)
- satisfied 1NF
use foreign key (move subset of data/column that apply to multiple rows of a table to another table and connect them through the foreign key)
e.g.
studentID, studentName, courseID, courseName to
studentID, studentName, courseID and courseID, courseName
Third Normal Form (3NF)
- 2NF
- remove columns that are not dependent upon primary key
e.g.
Boyce-Codd Normal Form (BCNF or 3.5NF)
Fourth Normal Form
Tuesday, May 22, 2012
Sunday, May 20, 2012
Tuesday, May 15, 2012
HTML
Complete list of HTML tags: http://www.w3schools.com/tags/default.asp
- HTML stands for Hyper Text Markup Language
- HTML is not a programming language, it is a markup language
- Practically speaking, there is no difference between the htm and html extensions
- In XHTML, all elements must be closed. Adding a slash inside the start tag, like
, is the proper way of closing empty elements in XHTML (and XML)
- HTML tags, attribute names and attribute values are not case sensitive but World Wide Web Consortium (W3C) recommends lowercase in HTML 4, and demands lowercase tags in XHTML. Newer versions of (X)HTML will demand lowercase attributes
- In XHTML, XML, elements with no end tag (closing tag) are not allowed
- attribute id vs name: id must be unique and is used as an identifier of an HTML element while name is used for form elements and form elements can share the same name
- HTML comment sample:
- Always add a trailing slash to subfolder references. If you link like this: href="http://www.w3schools.com/html", you will generate two requests to the server, the server will first add a slash to the address, and then create a new request like this: href="http://www.w3schools.com/html/"
- HTML frames are obsolete in HTML5. Cons: http://webdesign.about.com/od/framesprosandcons/a/aaframesyuck_2.htm
- The doctype declaration refers to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that the browsers render the content correctly.
Reference: http://www.w3schools.com
- HTML stands for Hyper Text Markup Language
- HTML is not a programming language, it is a markup language
- Practically speaking, there is no difference between the htm and html extensions
- In XHTML, all elements must be closed. Adding a slash inside the start tag, like
, is the proper way of closing empty elements in XHTML (and XML)
- HTML tags, attribute names and attribute values are not case sensitive but World Wide Web Consortium (W3C) recommends lowercase in HTML 4, and demands lowercase tags in XHTML. Newer versions of (X)HTML will demand lowercase attributes
- In XHTML, XML, elements with no end tag (closing tag) are not allowed
- attribute id vs name: id must be unique and is used as an identifier of an HTML element while name is used for form elements and form elements can share the same name
- HTML comment sample:
<!-- This is a comment -->- The <center>, <font>, <basefont>, <s>, <strike> and <u> tags and align, bgcolor and color attributes are deprecated in HTML 4, and removed from HTML5. Style sheets (CSS) should be used to define the layout and display properties for many HTML element
- Always add a trailing slash to subfolder references. If you link like this: href="http://www.w3schools.com/html", you will generate two requests to the server, the server will first add a slash to the address, and then create a new request like this: href="http://www.w3schools.com/html/"
- HTML frames are obsolete in HTML5. Cons: http://webdesign.about.com/od/framesprosandcons/a/aaframesyuck_2.htm
- The doctype declaration refers to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that the browsers render the content correctly.
<!-- This is a comment -->
Reference: http://www.w3schools.com
Wednesday, May 9, 2012
How to create Sublabels / Hierarchical Labels in Blogspot
I always wanted my label section to look like the archive section where labels can have hierarchy and the number of posts is displayed beside each label. I learned how to create the hierarchical tree from this blog but the nodes have to be added one by one and the number of posts per label are not displayed so I tweaked it a little to suit my needs. Here are the steps:
- Add the Labels gadget if is not yet added
From your dashboard, click Layout -> Add a Gadget and select Labels - Add an HTML gadget. This is where you will create your hierarchical labels.
From your dashboard, click Layout -> Add a Gadget and select HTML/Javascript - Ensure that the Labels gadget comes first before the HTML gadget in your layout.
From your dashboard, click Layout and arrange your gadgets by dragging them to the desired location so that the Labels gadget is on top or comes first before the HTML gadget - Update the Template
-
Add the dtree javascript.
From your dashboard, click Template -> Edit HTML -> Proceed and check Expand Widget Templates. Copy and paste this code<link href='https://sites.google.com/site/efekefek/file-js/dtree.css' rel='StyleSheet' type='text/css'/> <script src='https://sites.google.com/site/efekefek/file-js/createdtree.js' type='text/javascript'/>
after this tag
<b:skin><![CDATA[/*
- Remove the Label widget content
Find the Label widget code. It looks like this<b:widget id='Label1' locked='false' title='Labels' type='Label'> <b:includable id='main'> ... </b:includable> </b:widget>
Replace the code inside <b:includable id='main'> and </b:includable> with this code<script type='text/javascript'> var labelCountMap = {}; <b:loop values='data:labels' var='label'> labelCountMap ["<data:label.name/>"] = "<data:label.count/>"; </b:loop> </script>
- Save template
-
Add the dtree javascript.
- Prepare the code of the Hierarchical Labels
Copy the code below and replace the data with your own Labels. The data is in format
parentLabel: { subLabels }
The subLabels are comma separated. If the parentLabel doesn't have subLabels, replace it with {}.
<div class="dtree"> <p><a href="javascript: d.openAll();">open all</a> | <a href="javascript: d.closeAll();">close all</a></p> <script type="text/javascript"> <!-- function isEmpty(obj) { for(var prop in obj) { if(obj.hasOwnProperty(prop)) return false; } return true; } function addMap(d, startingNode, parentNode, map) { for (var key in map) { if (isEmpty(map[key])) { d.add(startingNode++,parentNode,key+' ('+labelCountMap[key]+')','/search/label/'+key); } else { d.add(startingNode++,parentNode,key+' ('+labelCountMap[key]+')','/search/label/'+key); startingNode = addMap(d, startingNode, startingNode-1, map[key]); } } return startingNode; } var data = { 'Label 1' : { 'Label 1.1' : {}, 'Label 1.2' : { 'Label 1.2.1' : {} }, 'Label 1.3' : {} }, 'Label 2' : { 'Label 2.1' : {}, 'Label 2.2' : {} }, 'Label 3' : {}, 'Label 4' : {}}; d = new dTree('d'); d.config.useLines = true; d.config.useIcons = false; d.config.inOrder = true; d.add(0,-1,''); addMap(d, 1, 0, data); document.write(d); //--> </script> </div>
- Paste the code in the HTML widget
From your dashboard, click Layout and Edit the HTML widget. Paste the code inside Content and Save
Tuesday, August 16, 2011
Wednesday, July 27, 2011
Maven POM
- all POM inherits from Super POM
- if the configuration details are not specified in your POM, Maven will use their defaults(from Super POM)
- to display the final POM (Super POM + your own POM) generated, use command:
mvn help:effective-pom
- hot to skip tests: http://maven.apache.org/plugins/maven-surefire-plugin/examples/skipping-tests.html
Source: http://maven.apache.org/guides/introduction/introduction-to-the-pom.html
Monday, July 25, 2011
Basic UNIX commands
- man - manual/help
- pwd - print working/current directory
- ls - list files
- ls -l - lists files in 'long format', which contains lots of useful information, e.g. the exact size of the file, who owns the file and who has the right to look at it, and when it was last modified
- cd - change directory
- mkdir [dir] - creates dir
- rmdir [dir] - removes dir
- more [options] file(s) - Display contents of files
- less [options] file(s) - Display contents of files
Useful commands while viewing a file with 'more' or 'less':- <spacebar> - scroll forward one page
- ^b (control-b) - scroll backward one page
- /<text> - search for string
- n - find next occurence of string
- N - find previous occurence of string (search for string in opposite direction)*
- g - go to the beginning of the file*
- G - go to the end of the file*
- v - edit the current file with 'vi'*
- :n - go to the next file*
- :p - go to the previous file*
- q - quit
*works in 'less', not 'more' - grep [options] <pattern> [files] - search inside files for the given pattern
Useful options:- -i - ignore case
- -r or -R - search files in directories/subdirectories recursively
- -v - nvert match: select non-matching lines
- tail [options] [filenames] - show tail/end of file
- tail -f temp.log - follow/monitor the file, display the last 10 lines of temp.log and append new lines to the display as new lines are added to temp.log
- vi filename - edit the file
Modes:- command mode - letters of the keyboard will be interpreted as commands
- insert mode - letters of the keyboard will type or edit text
- x - deletes the character the cursor is under
- dd - deletes the line the cursor is on
- a - append after the cursor
- i - insert before the cursor
- ESC - non edit mode
- :wq - saves the current changes and exits vi
- :w - saves the current changes but does not exit vi
- :q - exits vi without saving any change
References:
http://claymore.rfmh.org/public/computer_resources/unix_commands.html
http://mally.stanford.edu/~sr/computing/basic-unix.html
http://cmgm.stanford.edu/classes/unix/vi.html
http://en.wikipedia.org
http://www.ccsf.edu/Pub/Fac/vi.html
Subscribe to:
Posts (Atom)