51
Fifth International Students Conference on Informatics
–
ICDD 2015
May 21-23, 2015, Sibiu, Romania
needs of the children in the secondary school or high school, on their way to the desired performance
in the domain of programming.`
The present piece of work is structured in sections. The first section will present the general
development of the platform. The second section will deal with the Backend programming that was
necessary for developing the platform. The third part will focus on the Frontend development. The
fourth section will present some technical details. The fifth section will be about final ideas and the
future development of the platform. The sixth and final section will deal with references and
bibliography.
2. General development
In this section, the focus falls on presenting the general idea and an overview of the steps made in
creating this educational platform.
The general idea came to life at the moment when we, as pupils, started solving problems on
websites like pbinfo.ro and campion.edu.ro. However, in time, we noticed different drawbacks in these
websites, drawbacks like the lack of problems grouped by the age of study or chapters, or the
impossibility of learning from an official solution or unprocessed tests. Thus, we decided to build our
own website from ground up and make it more of an educational platform. We wanted to fix, from our
point of view, the drawbacks of the other websites and to introduce at the same time new and original
ideas.
The first step taken by us in this endeavor was to build a list of all the functions that our
educational platform had to have. After that, we sorted all of those from the most important ones(the
core ones) to the most insignificant ones. Moving on, we had then to divide the work among ourselves.
Being a team of two pupils and two teachers, we decided to make a simple division: one pupil will
take the Frontend development and the other one will deal with the Backend development. We took
this decision based on our knowledge and with the logistic help that we needed which our teacher
coordinators gave us.
The second step of this project was finding a way for coordinating our work. For this, we use a
source-control technology (Git) for storing and updating our project.
Last but not least, a problem we are still working on is deploying our educational platform on the
web and making it available for everyone that wants to use it.
The idea for the name of the platform was simple. We took the core meaning of it which is
“Programming Practice” and essentially cut the words until they had a certain ring bu
t kept their
meaning, leaving us with “ProPrac”.
3. Backend Development
The main objective of this section is to present the Backend side of the project.
A big part of the Backend development is the database of the platform. The database contains a big
amount of the data in the platform, such as the problems, tests, sources that need to be or were tested,
the usernames and the passwords of the users. The database in secured, the only permission that the
users have being that of writing at the moment when a new account is created or a source is sent to be
tested. The usernames and passwords are saved under the shape of hashes, thus being impossible to
obtain even if, in the worst-case scenario, the database would be accessed by someone without
authorization. The hashing key is a 256-bit key, the hashing algorithm that we use being SHA-2
(en.wikipedia.org/wiki/SHA-2) [4] developed in 2001 by NSA. On top of this, the database is
defended by attacks that want to fill it with useless information, the users being limited to only adding
sources and the number of sources that are memorized in the database for a problem for a user being
limited to one. In other words, the only source taken in consideration for a certain problem at a certain
34
59
Fifth International Students Conference on Informatics
–
ICDD 2015
May 21-23, 2015, Sibiu, Romania
point is the last one sent by the user. When a new source is sent, the one existing is deleted and the
new one takes its place.
Regarding the security of the sources received from the users, the educational platform block the
majority of the system calls(en.wikipedia.org/wiki/System_call)[2], permitting the use of only four,
instead of over 300. The compiler works on Linux and is protected by a security module named
seccomp(en.wikipedia.org/wiki/Seccomp)[3]. Seccomp intercepts the system calls when a source code
is ran and gives permission of running to only those system calls that are necessary. An example of a
blocked system call is sys_fork. This system call is used in the creation of a computer virus known as
a “rabbit virus”, a “wabbit” or a “fork bomb”
(en.wikipedia.org/wiki/Fork_bomb)[1]. This kind of
virus executes a DoS (denial of service) attack and is, basically, a piece of code that auto-replicates
until the resources of the system that it runs on run out and the system crashes. Plus, a second security
module of Linux, known as SeLinux, makes the use of processes, ports (TCP/UDP) and shared
memory segments impossible by the user through the running of the source code.
The main functionalities of the site are: adding problems by an admin, reading problems by the
user, sending of sources, testing of sources and receiving a certain score for the source sent and
verified.
In the following part of this section, some parts of the source code will be detailed and explained
accordingly.
def home(request):
"""
Handles the GET requests for the home page
:param request:
:return:
"""
template = "home.html"
latest_question_list = Problem.objects.order_by('-pub_date')[:5]
if not request.user.is_authenticated():
context = {'user.is_authenticated': False}
return render(request, template, context)
else:
useractiv = UserProfile.objects.get(user=request.user)
context = {'latest_question_list': latest_question_list, 'user.is_authenticated':
True,'username':request.user.username, 'userid':useractiv.ref_id }
return render(request, template, context)
This part of the code deals with the GET type requests that the user makes towards the home
page of the educational platform.
class Solution(models.Model):
problem = models.ForeignKey(Problem)
user = models.ForeignKey(User)
code = models.TextField()
score = models.IntegerField(default=0)
Language_CHOICES = (
('cpp', 'C++'),
('c', 'C'),
('py3', 'Python 3'),
('py2', 'python 2'),
('java', 'Java'),
)
log = models.TextField()
language = models.CharField(max_length=10,default="C++",choices=Language_CHOICES)
debugOutput = models.CharField(max_length=4000,blank=True)
def __str__(self):
return str(self.id)
35
51
Fifth International Students Conference on Informatics
–
ICDD 2015
May 21-23, 2015, Sibiu, Romania
This part of the code represents the form for the solutions sent by the user and verifies that all the
data is correct before sending the solution to the database to be tested.
from bash import bash
import time
import uuid
import os
def get_ref_id():
ref_id = str(uuid.uuid4())[:6].replace("-", "").lower()
return ref_id
def RunCode(solution_id, problem_id, problem_name, code, datains, dataouts,language,time,memory):
solution_id_provision = get_ref_id()
cmd = ("sh prepare.sh %s %s %s" %(problem_name,solution_id_provision,language))
b = bash(cmd)
print(os.getcwd())
f = open(os.path.join('./compiling/%s/%s/' %(problem_name,solution_id_provision), "%s.%s"
%(solution_id_provision,language)),'r+')
f.write(code)
f.close()
i=1
for datain in datains:
cmd = ("touch ./compiling/%s/in/input%s.txt" %(problem_name,i))
t = bash(cmd)
f = open(os.path.join('./compiling/%s/in/' %(problem_name), "input%s.txt" %(i)),'r+')
f.write(datain)
f.close()
This piece of code here deals with the preparation of the environment for compiling and running
the solution sent by the user.
4.Frontend Development
This section of the presentation will deal with the Frontend development of this project, as in
design and structure.
The platform is structured in a simple but modern way. The first page is composed of a slider and
a navigation bar that is accessible at any moment, on any section of the platform. The navigation bar
opens the possibility of fast change between the different sections of the platform, such as the solution
archive, the archive of problems structured by grade and the tutorials. The bar updates itself at the
moment of a login, the registration button being replaced by a profile button and the login button by a
logout button.
The design, although simple at the moment, is modern and user friendly. We tried our best to
avoid color schemes and designs that tire the eyes. Thus, we avoided neon colors and used a more
subtle scheme of colors that focuses of nuances of
blue and white, that don’t put as much stress on the
eyes on a long session of usage.
There are a few images on the platform. They are either created by us or used under an open-
source license.
In the following part of the section, some pieces of code will be detailed and explained.
<li><a href="/register/">Register</a></li>
<li class = "dropdown">
36
53
Fifth International Students Conference on Informatics
–
ICDD 2015
May 21-23, 2015, Sibiu, Romania
<a class = "dropdown-toggle" href = "#" data-toggle = "dropdown">Log in</a>
<div id="Login" class="dropdown-menu" style = "padding: 26px; padding-bottom: 15px;">
<form action="/login/" method="post" accept-charset="UTF-8">
{% csrf_token %}
<input id="username" placeholder="Username" style="margin-bottom: 15px;"
type="text" name="username" size="30" />
<input id="password" placeholder="Password" style="margin-bottom: 15px;"
type="password" name="password" size="30" />
<input class="btn btn-primary" style="margin-bottom: 15px; clear: left; width: 100%;
height: 32px; font-size: 16px;" type="submit" name="commit" value="Sign In" />
</form>
</div>
</li>
{% endif %}
</ul>
<ul class="nav navbar-nav">
{% if user.is_authenticated %}
<li id="Solutii"><a href="/solutions/">Solutii</a></li>
{% endif %}
</ul>
{% endblock %}
This piece of code is the small overlay/drop-menu from the main page used to log in to your
account.
5. Technical Details
The following part of this presentation is about the technical details such as technologies used and
the creation of the platform.
The platform was developed using a rather big amount of programming languages. For the visual
part, we used mainly HTML code, JavaScript and CSS, as well as images created in Gimp. The
HTML, JavaScript and CSS was all tied together by a framework named Bootstrap. Bootstrap is a
framework that was initially developed by Twitter, with the main objective of producing websites that
can adapt to any screen resolution, be it tablet, phone or PC. This framework is also used as a template
for CMS systems like WordPress or Joomla.
The database was created and is managed using a relational database system known as
PostgreSQL (en.wikipedia.org/wiki/PostgreSQL#Security)[5] which is open-source.
The Backend programming is realized, in a big proportion, in Python
(en.wikipedia.org/wiki/Python)[7], a dynamic programming language which is more and more used in
today’s society. However, the base version of Python didn’t have all that was necessary for our
platform to work, so we used a system of package management for Python, known as PIP. With the
help of PIP, we installed a framework for Python known as Django. Django is a high-level web
framework which encourages fast and clean development of websites. Besides this framework, we
used other packages like Pillow, Django Simple Captcha, Six and Bash.
The creation of this platform wasn’t as simple as it seemed in the beginning. Being made by a
small team of two people supervised by another two, we needed to divide our tasks in a fair way. In
order to work as efficient as possible, we used a host for source code which opened to us the
possibility of simultaneously working on different parts of the platform.
As for the way the platform functions, for compiling the sources, we use the newest version of
GCC for sources sent in C/C++ languages. For Java, we use OpenJDK. Ruby has its own interpreter,
as does Python with its official interpreter.
37
67
Fifth International Students Conference on Informatics
–
ICDD 2015
May 21-23, 2015, Sibiu, Romania
In the section dealing with the Backend development, we mentioned the security module for Linux
named seccomp (code.google.com/p/seccompsandbox/wiki/overview)[6]. Even though we mentioned
an exploit and the way it works, we didn’t explain why such a module is so important. This security
module is extremely important because of the way it interacts with the memory allocated by the user
in a certain program. It considers all the memory as possibly dangerous for the system.
6. Final Ideas and Future Development
In conclusion, even though the educational platform in hosted on a free server that doesn’t support
a great deal of users, it is functional and available at any time, with the only exception being during
server maintenance.
When it comes to future development, we have in plan the following ideas but we are not bound
by them:
The possibility for source codes to be sent in as many programming languages as
possible
Changing the name and the hosting of the platform
Creating a forum for the user to socialize or discuss solutions for different problems
on
Creating a blog or a news section for official announcements
Introducing competition rounds
Making the educational platform available in English
Creating a newsletter system
7. References
[1] en.wikipedia.org/wiki/Fork_bomb
[2] en.wikipedia.org/wiki/System_call
[3] en.wikipedia.org/wiki/Seccomp
[4] en.wikipedia.org/wiki/SHA-2
[5] en.wikipedia.org/wiki/PostgreSQL#Security
[6] code.google.com/p/seccompsandbox/wiki/overview
[7] en.wikipedia.org/wiki/Python
[8] conferences.ulbsibiu.ro/conf.pcid/2015/volum/Volum_Conf_Nat_Inf_Elevi_PCID_2015.pdf
Vlad Teodorescu
C. N. Mircea cel Batran
Software Educaţional
Rm. Valcea, Valcea
Romania
vladjohn2013@gmail.com
Vlad Badoiu
C. N. Mircea cel Batran
Software Educaţional
Rm. Valcea, Valcea
Romania
vlad_andrew@openmailbox.org
Mirela Mlisan
C. N. Mircea cel Batran
Software Educaţional
Rm. Valcea, Valcea
Romania
mirela_mlisan@yahoo.com
Antoanela F
ărcășanu
C. N. Mircea cel Batran
Software Educaţional
Rm. Valcea, Valcea
Romania
antfarm@yahoo.com
38
43
Fifth International Students Conference on Informatics
Imagination, Creativity, Design, Development
ICDD 2015, May 21-23
Sibiu, Romania
Smart Home Open Framework
Adrian Alexandru B
ă
rbos, Kim R
ă
zvan Velker, Andrei C
ă
lb
ăj
os
Teacher Coordinator: Camelia-M. Pintea
Abstract
The aim of the paper is to present a new smart home technology using an Android device as the
hub to control home appliances, as heaters, AC, fans, etc. via a profile-enabled cloud smart home open
framework. The entire smart home system will be managed through a user friendly application.
1 Introduction
We don’t like to manually tweak the heater/AC in the room. We also don’t like the pseudo
-
smart proprietary thermostats that will never understand why sometimes we need to keep the door
open when we sleep. Or why we sometime
s like the cold air in the room. Other times we don’t.
But mostly we hate when we go somewhere and can't bring our cosy home profile with us. Or
combine our profiles with others when we share a room.
We’re imagining a home that learns our behaviour and co
ntrols the appliances, and is kind enough
to accept and combine other behaviours so we can socially share our environment in a smart and
meaningful way.
For this to happen we need our home to have an easy to manage, open framework that
handles both the user and the home appliances. Using Android as the MVD, we can leverage this
need using today’s open source technologies.
2 Technologies used for the framework
2.1 Android
A mobile operating system developed by Google. The Android operating system is primarily
used in touchscreen mobile devices, such as cell phones and tablets. Its design allows users to
manipulate mobile devices intuitively, with phone interactions following common motions such as
pinching, swiping, and tapping.
Android application development is done in Android Studio which is the official IDE for
Android application development, based on IntelliJ IDEA
39
Documents you may be interested
Documents you may be interested