Project Implementation and Coding: 6.1 Overview of Project Modules
Project Implementation and Coding: 6.1 Overview of Project Modules
Raspberry Pi Display
Fetching notice from cloud: In second module, we are configured a cloud and real-time
database to store the real-time notices that can be accessible from anywhere and anytime.
We are using google cloud (firebase) to store the notices on cloud.
Dashboard: The dashboard is developed using the HTML, CSS, Javascript and
bootstrap. Using dashboard user can post new notice or ads, update notice and delete
notice. User can view logs, statistics, time scheduling with the help of dashboard from
any location and anytime.
MQTT:
Why MQTT?
MQTT has unique features you can hardly find in other protocols, like:
It’s a lightweight protocol. So, it’s easy to implement in software and fast in data
transmission.
It’s based on a messaging technique. Of course, you know how fast your
messenger/WhatsApp message delivery is. Likewise, the MQTT protocol.
Minimized data packets. Hence, low network usage.
Low power usage. As a result, it saves the connected device’s battery.
It’s real time! That’s is specifically what makes it perfect for IoT applications.
o HTML
Hypertext Markup Language (HTML) is the standard markup language used to
create web pages. A markup language is your way of making notes in a digital
document that can be distinguished from regular text. It’s the most basic building
block you’ll need for developing websites.
o CSS
CSS (Cascading Style Sheets) is the language used to present the document you
create with HTML. Where HTML comes first and creates the foundation for your
page, CSS comes along next and is used to create the page’s layout, color, fonts,
and…well, the style!
o JavaScript
Another MAJOR tool in your front-end developer toolbox is going to be
JavaScript (JS). Where HTML is a markup language and CSS is a style sheet
language, JS is the first language I’ve mentioned that’s a Bonafede programming
language. What’s the difference? Where HTML and CSS determine the
presentation of a page, JS determines the function.
Bulma CSS
Bulma CSS frameworks take some of the hassles out of CSS, by providing standardized
criteria, concepts, and practices for dealing with common issues found in frontend web
development. There are multiple CSS framework options out there to choose from like
Bootstrap, Semantic UI, and Foundation. You might wonder, which CSS framework is
best? As a new player recenThe Bulma framework is a free CSS solution based on the
Flexbox layout. With Bulma, the extensive range of built-in features means faster
turnaround and less CSS code writing. Bulma is also fully open-source, which means that
Bulma’s original source code is freely available for download — there’s no limit to how
far you (and the growing Bulma community) can extend its functionality.tly entering the
game, we think Bulma CSS has a lot to offer application and website developers.
6.3 Project Code
Main Notice / Signage UI
<!DOCTYPE HTML>
<html>
<head>
<title>Smart Notice Board</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1,
user-scalable=no" />
<link rel="stylesheet" href="assets/css/main.css" />
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css
">
<style>
.carousel-item {
height: 370px;
}
.carousel-item img {
position: absolute;
top: 0;
left: 0;
min-height: 370px;
}
</style>
</head>
<body>
<div class="container">
<header id="header">
<a href="index.html" class="logo"><strong>Smart </strong>Notice
Board<strong> MVP’s KBTCOE, Nashikstrong> </a>
<ul class="icons">
<img src="logo.png" height="80px">
<img src="naac.jpg" height="80px">
</ul>
</header>
<section>
<div class="row" style="margin-top:2%;">
<div class="col-4">
<div class="content">
<header>
<h5>Important Notice</h5>
<div>
<ul id="head_notice"></ul>
</div>
</header>
</div>
</div>
<div class="col-8">
<div id="carouselExampleCaptions" class="carousel slide"
data-ride="carousel">
<div class="carousel-inner">
</div>
</div>
</div>
</div>
</section>
<section>
<hr>
<marquee>
<h5 id="marquee_msg">WELCOME- </h5>
</marquee>
</section>
</div>
<script src="assets/js/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js
"></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"><
/script>
<script src="assets/js/skel.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.10.0/firebase-
app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.10.0/firebase-
storage.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.10.0/firebase-
database.js"></script>
<script>
let outputDate;
$(document).ready(function(){
let dateObj = new Date();
let month = String(dateObj.getMonth() + 1).padStart(2, '0');
let day = String(dateObj.getDate()).padStart(2, '0');
let year = dateObj.getFullYear();
outputDate = year + '-' + month + '-' + day;
});
var config = {
apiKey: "AIzaSyBhe6buAjQleakFU-wfMsGp2C7WAjLh93o",
authDomain: "crud-95d6b.firebaseapp.com",
databaseURL: "https://crud-95d6b.firebaseio.com",
projectId: "crud-95d6b",
storageBucket: "crud-95d6b.appspot.com",
messagingSenderId: "499306463820",
appId: "1:499306463820:web:6d1128eadbc1b2e3872ae9",
measurementId: "G-8RKXJRNENM"
};
firebase.initializeApp(config);
var database = firebase.database();
var storageRef = firebase.storage().ref();
database.ref('notice').on('child_added', function(data) {
add_data(data.val().date, data.val().head_notice,
data.val().notice_body, data.key);
return;
});
database.ref('notice').on('child_removed', function(data){
location.reload();
return;
//console.log(data.val());
});
database.ref('notice').on('child_changed', function(data){
location.reload();
return;
});
storageRef.child('images/').listAll().then(function(result){
var i=0;
result.items.forEach(function(imageRef){
imageRef.getDownloadURL().then(function(url){
//console.log(url);
if(i==0){
item = '<div class="carousel-item active"><img class="d-
block w-100" src="'+url+'" alt="Slide"/></div>';
i++; console.log(i);
}else{
item = '<div class="carousel-item"><img class="d-block w-
100" src="'+url+'" alt="Slide"/></div>';
}
$('.carousel-inner').append(item);
});
});
});
</script>
</body>
</html>
<div class="container">
<h1 class="title">
Gallary Images
</h1>
<div class="content">
<input class="button" type="file" id="files" name="files[]"
multiple />
<input class="button" type="date" id="datePicker" />
<button class="button" id="btn" onclick="uploadFile()">Upload
</button>
</div>
<div id="card-list" class="columns is-mobile">
</div>
</tbody>
</table>
</div>
</section>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
<script src="https://www.gstatic.com/firebasejs/7.10.0/firebase-
app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.10.0/firebase-
storage.js"></script>
<script>
var config = {
apiKey: "AIzaSyBhe6buAjQleakFU-wfMsGp2C7WAjLh93o",
authDomain: "crud-95d6b.firebaseapp.com",
databaseURL: "https://crud-95d6b.firebaseio.com",
projectId: "crud-95d6b",
storageBucket: "crud-95d6b.appspot.com",
messagingSenderId: "499306463820",
appId: "1:499306463820:web:6d1128eadbc1b2e3872ae9",
measurementId: "G-8RKXJRNENM"
};
firebase.initializeApp(config);
var storageRef = firebase.storage().ref();
});
});
function dele(a){
var name = $(a).closest('tr').find('.imgName').text();
console.log(name);
var desertRef = storageRef.child('images/'+name);
desertRef.delete().then(function() {
alert('File deleted successfully');
location.reload();
}).catch(function(error) {
alert('Uh-oh, an error occurred!');
});
}
var t = $("#datePicker").val();
// Created a Storage Reference with root dir
var storageRef = firebase.storage().ref();
// Get the file from DOM
var file = document.getElementById("files").files[0];
console.log(file);
</script>
</body>
</html>
Notice Upload Dashboard UI
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Digital Signage</title>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.6.2/css/bulma.min.css">
<script defer
src="https://use.fontawesome.com/releases/v5.0.0/js/all.js"></script>
</head>
<body>
</div>
</section>
<section class="section">
<div class="container">
<h1 class="title">
Scheduled Notice
</h1>
<div class="content">
<button id="btnAdd" class="button"><i class="fa fa-plus"></i>
Add Notice</button>
</div>
<div id="card-list" class="columns is-mobile">
</div>
</div>
<div id="modal" class="modal">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">New Notice</p>
<button class="btnClose delete" aria-
label="close"></button>
</header>
<section class="modal-card-body">
<div class="field">
<label class="label">Notice</label>
<div class="control">
<input type="hidden" id="txtType">
<input type="hidden" id="txtKey">
<input class="input" id="txtName" type="text"
placeholder="Name">
</div>
<p class="help"> </p>
</div>
<div class="field">
<label class="label">Scrolling</label>
<div class="control">
<input class="input" id="txtnotice_body"
type="text" placeholder="notice_body">
</div>
<p class="help"> </p>
</div>
<div class="field">
<label class="label">Date</label>
<div class="control">
<input class="input" id="txtPic" type="date"
placeholder="Choose Date">
</div>
<p class="help"></p>
</div>
</section>
<footer class="modal-card-foot">
<button id="btnSave" class="button is-success">Save
changes</button>
<button id="btnClose" class="button">Cancel</button>
</footer>
</div>
</div>
</section>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
<script
src="https://www.gstatic.com/firebasejs/4.10.0/firebase.js"></script>
<script>
var nextkey =0;
var config = {
apiKey: "AIzaSyBhe6buAjQleakFU-wfMsGp2C7WAjLh93o",
authDomain: "crud-95d6b.firebaseapp.com",
databaseURL: "https://crud-95d6b.firebaseio.com",
projectId: "crud-95d6b",
storageBucket: "crud-95d6b.appspot.com",
messagingSenderId: "499306463820",
appId: "1:499306463820:web:6d1128eadbc1b2e3872ae9",
measurementId: "G-8RKXJRNENM"
};
firebase.initializeApp(config);
var database = firebase.database();
database.ref('notice').on('child_added', function(data) {
add_data_table(data.val().head_notice,data.val().date,data.val().notice_body,d
ata.key);
var lastkey = data.key;
nextkey = parseInt(lastkey)+1;
});
database.ref('notice').on('child_changed', function(data) {
update_data_table(data.val().head_notice,data.val().date,data.val().notice_bod
y,data.key)
});
database.ref('notice').on('child_removed', function(data) {
remove_data_table(data.key)
});
function add_data_table(name,pic,notice_body,key){
$("#card-list").append('<div class="column is-3" id="'+key+'"><div
class="card"><div class="card-image"><figure class="image is-4by3"><img
src="'+'https://encrypted-tbn0.gstatic.com/images?q=tbn
%3AANd9GcRp_1fR1FUAG31dHTucqszte3DpUhSN5lR1CRxDq3bTCRcFMN6O'+'"></figure></div
><div class="card-content"><div class="media"><div class="media-content"><p
class="title is-4">'+name+'</p><p class="subtitle is-
6">@'+notice_body+'</p></div></div></div><footer class="card-footer"><a
href="#" data-key="'+key+'" class="card-footer-item btnEdit">Edit</a><a
href="#" class="card-footer-item btnRemove" data-
key="'+key+'">Remove</a></footer></div></div>');
}
function update_data_table(name,pic,notice_body,key){
$("#card-list #"+key).html('<div class="card"><div class="card-
image"><figure class="image is-4by3"><img src="'+pic+'"></figure></div><div
class="card-content"><div class="media"><div class="media-content"><p
class="title is-4">'+name+'</p><p class="subtitle is-
6">@'+notice_body+'</p></div></div></div><footer class="card-footer"><a
href="#" class="card-footer-item btnEdit" data-key="'+key+'">Edit</a><a
data-key="'+key+'" href="#" class="card-footer-item
btnRemove">Remove</a></footer></div>');
}
function remove_data_table(key){
$("#card-list #"+key).remove();
}
function new_data(name,notice_body,pic,key){
database.ref('notice/' + key).set({
head_notice: name,
notice_body: notice_body,
date : pic
});
}
function update_data(name,notice_body,pic,key){
database.ref('notice/' + key).update({
head_notice: name,
notice_body: notice_body,
date : pic
});
}
$( "#btnAdd" ).click(function() {
$("#txtName").val("");
$("#txtnotice_body").val("");
$("#txtPic").val("");
$("#txtType").val("N");
$("#txtKey").val("0");
$( "#modal" ).addClass( "is-active" );
});
$("#btnSave" ).click(function() {
if($("#txtType").val() == 'N'){
database.ref('notice').once("value").then(function(snapshot) {
if(snapshot.numChildren()==0){
nextkey = 1;
}
new_data($("#txtName").val(),$("#txtnotice_body").val(),$
("#txtPic").val(),nextkey);
});
}else{
update_data($("#txtName").val(),$("#txtnotice_body").val(),$
("#txtPic").val(),$("#txtKey").val());
}
$("#btnClose").click();
});
$(document).on("click",".btnEdit",function(event){
event.preventDefault();
key = $(this).attr("data-key");
database.ref('notice/'+key).once("value").then(function(snapshot){
$("#txtName").val(snapshot.val().head_notice);
$("#txtnotice_body").val(snapshot.val().notice_body);
$("#txtPic").val(snapshot.val().date);
$("#txtType").val("E");
$("#txtKey").val(key);
});
$( "#modal" ).addClass( "is-active" );
});
$(document).on("click",".btnRemove",function(event){
event.preventDefault();
key = $(this).attr("data-key");
database.ref('notice/' + key).remove();
})
$( "#btnClose,.btnClose" ).click(function() {
$( "#modal" ).removeClass( "is-active" );
});
</script>
</body>
</html>
Chapter 7
Software Testing
6.1 Types of Testing
Testing is the process of evaluating a system or its component(s) with the intent to find whether
it satisfies the specified requirements or not. Testing is executing a system in order to identify
any gaps, errors, or missing requirements in contrary to the actual requirements.
Mastering the domain of a system always gives the tester an edge over someone with limited
domain knowledge. Unlike black-box testing, where the tester only tests the application's user
interface; in grey-box testing, the tester has access to design documents and the database. Having
this knowledge, a tester can prepare better test data and test scenarios while making a test plan.