FAKE BOOK LIBRARY - Carleton · PDF file2 Abstract The basis of this project was to present...
Transcript of FAKE BOOK LIBRARY - Carleton · PDF file2 Abstract The basis of this project was to present...
1
Carleton University
FAKE BOOK LIBRARY
COMP 4905 - HONOURS PROJECT
Dr. Louis D. Nel
School of Computer Science
Vinh Nguyen - 100838814
12/12/2013
2
Abstract
The basis of this project was to present how to work with big database and specifically with the
Fake Book. The goal of this project was to collect and organize multiple Fake Books from
different sources as well as to build a website which makes use of this song database. Basically,
the scope was to make it easier for users to have access to thousands of songs digitally in the
fastest speed. The software that was used to create this database includes: XAMPP, Adobe
Acrobat Pro, Adobe Reader, PDFSam, and other self-developed Java software. Most of these
programs are popular among users in multiple operating systems.
3
Table of Contents
I. Introduction ............................................................................................................................ 6
II. Installation .............................................................................................................................. 7
1. XAMPP .................................................................................................................................. 7
XAMPP for Window: ......................................................................................................... 7
XAMPP for Linux: .............................................................................................................. 7
XAMPP for Mac OS X: ....................................................................................................... 7
XAMPP for Solaris: ............................................................................................................ 7
2. Recommended Tools: .......................................................................................................... 8
Adobe Reader XI: .............................................................................................................. 8
PDFSam: ........................................................................................................................... 8
III. Working with XAMPP .............................................................................................................. 9
1. Start, stop XAMPP ................................................................................................................ 9
2. Import .sql script ................................................................................................................ 11
IV. User Interface Design ............................................................................................................ 12
V. Database Design ................................................................................................................... 13
VI. Execution Sequence .............................................................................................................. 16
1. Search songs or books ....................................................................................................... 16
2. View a song ........................................................................................................................ 16
3. Upload new song ............................................................................................................... 17
4. Navigate My account tab ................................................................................................... 19
4
5. Add favorite songs ............................................................................................................. 20
6. Delete favorite songs ......................................................................................................... 21
7. Navigate Home tab ............................................................................................................ 22
8. Navigate Upload tab .......................................................................................................... 22
5
List of Figures
FIGURE 1. PDFSAM CONTROL PANEL 8
FIGURE 2. XAMPP CONTROL PANEL 10
FIGURE 3. XAMPP HOME PAGE 10
FIGURE 4. XAMPP TOOL BAR 11
FIGURE 5. XAMPP PHPMYADMIN HOME PAGE 11
FIGURE 6. PHPMYADMIN TOOL BAR 11
FIGURE 7. DATABASE E-R DIAGRAM 14
FIGURE 8. DATABASE TABLE SCHEMA 15
FIGURE 9. SEARCH BAR 16
FIGURE 10. PDF PREFERENCES FULL SCREEN WINDOW 16
FIGURE 11. PDF PREFERENCES PAGE DISPLAY WINDOW 17
FIGURE 12. UPLOAD NEW SONG PAGE 17
FIGURE 13. ADD A NEW BOOK OPTION 18
FIGURE 14. INPUT NEW BOOK TITLE AND BOOK CODE 18
FIGURE 15. LOG IN PAGE 19
FIGURE 16. CREATE A NEW ACCOUNT PAGE 19
FIGURE 17. SAVE SONGS TO FAVORITE LIST AFTER LOGGING IN 20
FIGURE 18. FAVORITE LIST 20
FIGURE 19. DELETE SONGS FROM FAVORITE LIST 21
FIGURE 20. HOME PAGE 22
6
I. Introduction
A Fake Book is a collection of musical lead sheets with the intention to help musicians to learn
new songs with the variety of musical instruments’ performances. Each song in a fake book is
arranged alphabetically and contains melody lines, basic chords, and certain possible lyrics.
With the given basic information, musicians would be able to create their own new versions by
making few chord and melody changes. Therefore, the same song can be found in different
books with different lead sheets and melody. The first fake book was created in May 1942 by
George Goodwin, a radio station director. In the 1950’s, piracy became an issue as Goodwin’s
Tune-Dex cards and other index cards at that time were copied illegally. For a long time, fake
books consist of illegal printed songs without copyrights. However, most of them were legalized
and copyrighted since the 1970’s and intellectual property enforcement has also improved
nowadays. This project is divided into two parts. First is to fix the database in order to accord to
the platform with simple codes and software. The second part is to design the website based
on the previous project but with a completely different interface. Additionally, details of the
installation, rationale for the chosen user interface and database design as well as execution
sequence will all be included in this project.
7
II. Installation
1. XAMPP
XAMPP is a free Apache distribution containing MySQL, PHP and Perl. Currently XAMPP works
on four different Operating Systems: Window, Linux, Mac OS X and Solaris. XAMPP is easy to
install and use.
XAMPP for Window:
XAMPP works on Window 2000, 2003, XP, Vista, 7 and 8. This version is claimed to contain:
Apache, MySQL, SQLite, PHP + PEAR, Perl, OpenSSL, phpMyAdmin, FileZilla FTP Serve, etc.
http://www.apachefriends.org/en/xampp-windows.html
XAMPP for Linux:
Linux version of XAMPP consists of Apache, MySQL, SQLite, PHP & PEAR, Perl, OpenSSL,
ProFTPD, phpMyAdmin, PDF class, ncurses and IMAP C-Client, etc.
http://www.apachefriends.org/en/xampp-linux.html#377
XAMPP for Mac OS X:
The distribution for Mac OS X contains: Apache, MySQL, SQLite, PHP & PEAR, Perl, OpenSSL,
ProFTPD, phpMyAdmin, etc.
http://www.apachefriends.org/en/xampp-macosx.html#5468
XAMPP for Solaris:
The distribution for Solaris (developed and tested with Solaris 8, tested with Solaris 9) contains:
Apache, MySQL, PHP & PEAR, Perl, OpenSSL, ProFTPD, phpMyAdmin, PDF class, etc.
http://www.apachefriends.org/en/xampp-solaris.html#229
8
2. Recommended Tools:
The following programs are recommended to work with PDF files:
Adobe Reader XI:
Adobe Reader is a free program that allows users to view, print and comment on PDF files. To
install Adobe Reader, go to http://get.adobe.com/reader/, and follow the instruction online.
PDFSam:
PdfSam is an open source tool that allows users to merge/extract, split, set password, rotate
page, swap page, and delete unwanted page(s).
http://sourceforge.net/projects/pdfsam/
Figure 1. PDFSam Control Panel
9
III. Working with XAMPP
After installing XAMPP, xampp folder will be installed directly in C:\ folder.
1. Start, stop XAMPP
There are two ways to start or stop XAMPP. Users can use XAMPP Control Panel Application,
and choose the features that they want to run or they can go to C:\xampp\ and run one of the
followings:
Apache & MySQL start:
C:\xampp\xampp_start.exe
Apache & MySQL stop:
C:\xampp\xampp_stop.exe
MySQL start:
C:\xampp\mysql_start.bat
MySQL stop:
C:\xampp\mysql_stop.bat
Mercury Mailserver start:
C:\xampp\mercury_start.bat
Mercury Mailserver stop:
C:\xampp\mercury_stop.bat
FileZilla Server start:
C:\xampp\filezilla_start.bat
FileZilla Server stop:
C:\xampp\filezilla_stop.bat
10
Figure 2. XAMPP Control Panel
After running XAMPP, go to http://localhost or http://127.0.0.1, index.html or index.php in
C:\xampp\htdocs will be showed on this page.
Figure 3. XAMPP Home page
11
2. Import .sql script
Select phpMyAdmin under Tools bar
Figure 4. XAMPP Tool Bar
Figure 5. XAMPP phpMyAdmin Home Page
Then click Import, and choose a single or zipped sql file(s) to upload.
Figure 6. phpMyAdmin Tool Bar
12
IV. User Interface Design
PDF is chosen to be the presentation of the song lead sheets for this project. PDF is commonly
used nowadays as the majority of people are familiar to work with it, which would make it
easier for users to use relative to other file formats. All the common browsers support PDF by
having pdf plug-in in their extensions. Additionally, the lead sheets are only available digitally in
pictures and in PDF. Users are allowed to view the file both online and offline, and are able to
view multiple files in one screen by changing the settings for page display. PDF differentiates
itself by having the comment and add note function available while remains the full content of
original document.
In terms of adding new song and book to the database, the previous project faced certain
challenges with the requirement of having specific format. This project is able to solve that
problem by restricting uploaded file to be in PDF and changing the file names accord to the
database design.
As for retrieving favorite songs, this website will require users to create and login to their
accounts in order to be able to save their favorite ones. This will create a more personalized
manner, especially for users who share the same device.
13
V. Database Design
The database is represented by four mySQL tables: songs, bookCodes, users and favorite_songs
in this project.
The first (main) table contains the most important data - songs in the Fake book. The
following songs’ attributes are included: song title, book code, page number and song
file’s name. The table is generated by the code below: CREATE TABLE songs (songTitle
varchar(200), bookCode varchar(10) REFERENCES bookCodes(book_code), page integer, songFile
varchar(200), PRIMARY KEY (songTitle, bookCode));
The second table consists of book codes and their titles. The following code would
construct this table: CREATE TABLE bookCodes (book_code varchar(10) PRIMARY KEY,
bookName varchar(100));
The third table contains users’ information such as first name, last name, email address
and password. It is created by this code: CREATE TABLE users (email varchar(100) PRIMARY
KEY, firstName varchar(100), lastName varchar(100), password varchar(100), favorite_song
varchar(200) REFERENCES songs(songTitle), favorite_book varchar(100) REFERENCES
bookCodes(book_code));
The last table contains users’ favorite songs and their original book code. The code is:
CREATE TABLE favorite_songs(email varchar(100 REFERENCES users(email), songTitle
varchar(100) REFERENCES songs(songTitle), bookCode varchar(100) REFERENCES
bookCodes(book_code));
There are two ways to add new books into the database. The website allows users to use the
upload functionality to insert new books (see section 3. Upload new song in Execution
Sequence). As the website is user-friendly, the format of song files’ names would be adjusted
automatically to be cohesive to previous existing files. Also, the songs will be added to the
different corresponding folders that are named by the book code.
14
The second way is for developers to use code to insert new book to the database. The certain
format for song files’ names will be applied for developer as:
“bookCode_songTitle_pageNumber”. This following code will be used to insert: insert into songs
(songTitle, bookCode, page, songFile) values (songTitle, bookCode, page,
"books/bookCode/bookCode_songTitle_page.PDF");
Figure 7. Database E-R Diagram
15
Figure 8. Database Table Schema
16
VI. Execution Sequence
1. Search songs or books
The website allows users to search songs using the partial or complete title, and search
books by book name or book code (See Figure 9).
Figure 9. Search Bar
2. View a song
o When users click on the search result, the song’s PDF file will be displayed in a new
window.
o Users can change the settings in order to view two pages at the same time by going to
Edit -> Preferences…
o Under Full Screen tab on the left-hand side, uncheck Fill screen with one page at a time
(See Figure 10).
Figure 10. PDF Preferences Full Screen Window
17
o Under Page Display tab, Default Layout and Zoom, select Two-Up for Page Layout (See
Figure 11).
Figure 11. PDF Preferences Page Display Window
3. Upload new song
o Users can add new songs or books information to the database from the website.
o Users will be asked to input new song’s title and its page number (See Figure 12).
o Book Title menu is the list of all existing books in the database. To add new songs in an
existing book, simply select the corresponding name in the menu.
Figure 12. Upload New Song Page
18
o If users want to add an entirely new book, select “------------Add a new book------------“,
then insert book title and book code (See Figure 13 & Figure 14).
Figure 13. Add a new book option
Figure 14. Input new book title and book code
o The Upload button will first validate all the information that users just enter by calling
fileValidate() function from util.js. fileValidate will check whether song title, page
number, book title and book code are filled with proper values and check if the
uploaded file is a pdf file.
19
o upload1.php will be called to perform actual insertion. The uploaded file will be
renamed to “bookCode_songTitle_pageNumber” format and will be saved in a proper
folder, whose name is the code of the song’s book (/4905/books/bookCode).
o The Reset button will reset all fields.
4. Navigate My account tab
o In My account tab, users can log in or create a new account.
o To log in their account, users will use their email address as user name, and password.
Figure 15. Log in page
o To create a new account for this website, users will have to provide their first name, last
name, and email address then choose a personal password. As the website treats email
address like user name, same email address cannot be used for two different people .
Figure 16. Create a new account page
20
5. Add favorite songs
After logging in the website, users can see their saved favorite songs and add new songs to
their favorite list (See Figure 17 & Figure 18).
Figure 17. Save songs to favorite list after logging in
Figure 18. Favorite list
21
6. Delete favorite songs
Users can easily delete their favorite songs by going to My account and choosing which songs to
be deleted (See Figure 19).
Figure 19. Delete songs from favorite list
22
7. Navigate Home tab
o Clicking on the Home tab will direct users to the website’s home page, where users can
find a list of existing book.
o Users can click on these pictures to view all the songs in that book.
Figure 20. Home page
8. Navigate Upload tab
To perform 3. Upload new song, click on Upload tab.
23
Reference
The following tools and websites were used in this project:
XAMPP Apache Web server
http://www.apachefriends.org/en/xampp.html
HTML, JavaScript, PHP, CSS
http://www.w3schools.com/
MySQL database
http://www.php.net/manual/en/ref.mysql.php
PDF conversion website
http://www.convertfiles.com/
PDF merge and split software
http://sourceforge.net/projects/pdfsam/
Adobe Reader
http://get.adobe.com/reader/
Fake Book History
http://voices.yahoo.com/the-history-fake-book-its-role-making-871395.html?cat=33