|
MINISTRY OF EDUCATION AND SCIENCE OF THE REPUBLIC OF KAZAKHSTAN
INTERNATIONAL INFORMATION TECHNOLOGIES UNIVERSITY
Department of Computer Science, Software Engineering and Telecommunications
REPORT ON SUMMER PRACTICE PROJECT
Supervisor: Azamat Tolegenov
Done by: Rustamov Ali, CSSE-111K.
17 June, 2013
Almaty 2013
Content
Familiarity with the place of practical training.........................................................2
Statement of the problem........................................................................................3
Task performance.....................................................................................................4
Result......................................................................................................................12
Conclusion..............................................................................................................13
Reference...............................................................................................................14
Familiarity with the place of training
Alem Research company is one of the leaders in the development of high-tech software. They are trusted by the development and integration of information systems major companies of the CIS countries, international corporations and government agencies.
Alem Research Company develops its own software, with minimal use of the major vendors. Alem Research - a young and dynamically developing company, whose main objective is the development of innovative sphere of Kazakhstan. The company provides a full range of services in the field of software, which includes its development, implementation and continued support.
Statement of the problem
I had a practice based in the International Information Technologies University in the “Alem research” company. At the beginning of my first practice day, I have learnt about company’s aims, goals and structure. Also I have learnt how to work with “Play” framework and got introduction lessons, than the instructor of the practical training revealed and introduced me with certain type of task. The task was to create a Play application, make a “todolist” (an application that performs input and output of the data), then to connect the application to the “PostgreSQL” database. The main purpose of my learning is to understand how to work with play framework, and know its features and differences from other frameworks.
Date | Tasks |
05.06.13 | Familiarity with the place of practical training and company's purpose. Introduction with play framework, and its feautures. |
07.06.13 | Starting the task. Creating the “todolist” application. |
10.06.13 | Connecting to the “PostgreSQL” database. |
12.06.13 | Working with the application connected to the “PostgreSQL” database. |
14.06.13 | Working with the “PostgreSQL” database. |
17.06.13 | Preparation of the practice report. |
Task performance
The “Play” framework makes easy the process of developing of the web applications. It is written in java and scala. Play is based on a lightweight, stateless, web-friendly architecture. Play provides predictable and minimal resource consumption (CPU, memory, threads) for large-scale applications. Here I have launched the play framework application with appropriate parameters to create new play web application.
As you can see from the screenshot you can develop your applications using java and scala. To create java application we should press choose “2”, and then “myapp” application is successfully created.
Then we should move to the project directory to with it, and then type “play eclipse” to generate an “eclipse” project:
Then we run the server with this application using command “play run”:
going to localhost:9000 address we can see the initial interface of the default play application and consequently be sure that the application is created successfully:
Then I have created “todolist” application:
Creating two tasks: “Go to university” and “Do homework”:
After deleting “Go to university”:
Application controller:
Application.java:
package controllers;
import play.*;
import play.mvc.*;
import views.html.*;
import play.data.*;
import models.*;
public class Application extends Controller {
static Form<Task> taskForm = Form. form (Task. class);
public static Result index() {
return redirect (routes. Application.tasks());
}
public static Result tasks() {
return ok (
views.html.index. render(Task. all (), taskForm)
);
}
public static Result newTask() {
Form<Task> filledForm = taskForm. bindFromRequest();
if (filledForm.hasErrors()) {
return badRequest (
views.html.index. render(Task. all (), filledForm)
);
} else {
Task. create (filledForm.get());
return redirect (routes. Application.tasks());
}
}
public static Result deleteTask(Long id) {
Task. delete (id);
return redirect (routes. Application.tasks());
}
}
Task model:
Task.java:
package models;
import java.util.*;
import play.db.ebean.*;
import play.data.validation.Constraints.*;
import javax.persistence.*;
@Entity
public class Task extends Model {
@Id
public Long id;
@Required
public String label;
public static Finder<Long,Task> find = new Finder(
Long. class, Task. class
);
public static List<Task> all() {
return find. all();
}
public static void create(Task task) {
task.save();
}
public static void delete(Long id) {
find. ref(id).delete();
}
}
index.scala.html:
@(tasks: List[Task], taskForm: Form[Task])
@import helper._
@main(" Todo list") {
<h1> @tasks.size () task(s)</h1>
<ul>
@for(task <- tasks) {
<li>
@task.label
@form(routes.Application.deleteTask(task.id)) {
<input type="submit" value="Delete">
}
</li>
}
</ul>
<h2>Add a new task</h2>
@form(routes.Application.newTask()) {
@inputText(taskForm("label"))
<input type="submit" value="Create">
}
}
Connecting to the “PostgreSQL” database:
SQL query:
create table Category
(
id integer,
name varchar(255) unique,
constraint id_category primary key(id)
);
create table Job
(
id integer,
category_id integer,
type varchar(255),
company varchar(255),
logo varchar(255),
url varchar(255),
position varchar(255),
location varchar(255),
description varchar,
how_to_apply varchar,
token varchar(255),
is_public boolean,
is_validated boolean,
email varchar(255),
expires_at timestamp,
created_at date,
updated_at date,
constraint id_job primary key(id),
foreign key (category_id) references category(id)
);
create table Affiliate
(
id integer,
email varchar(255)unique,
token varchar(255),
is_active boolean,
created_at date,
constraint id_affliate primary key(id)
);
create table Category_Affiliate
(
category_id integer,
affiliate_id integer,
foreign key (category_id) references category(id),
foreign key (affiliate_id) references affiliate(id)
);
Configuration file:
db.default.driver="org.postgresql.Driver"
db.default.url="jdbc:postgresql://localhost:5432/mydb"
db.default.user= "postgres"
db.default.password= "webuser"
ebean.default="models.*"
PostgreSQL “pgAdmin III” software application window:
Result
I have created the “todolist” application using Play framework, then connected it to “PostgreSQL” database. It can receive, store and delete the information entered by the user in the database.
Conclusion
To conclude, I want to say that I had a very good practice working with Play framework in the “Alem research” company. So my work was very sophisticated and interesting because I have learnt certain skills such as working in team, implying communication skills, and taking responsibility for work. Frankly, at the beginning of my practice, the task was not so due to the lack of experience with that. However, I have managed it and created an application in Play framework successfully.
Reference
1. http://www.playframework.com/documentation/2.1.0
2. http://www.postgresql.org/docs/
3. http://docs.oracle.com/javase/7/docs/api/
Дата добавления: 2015-09-30; просмотров: 18 | Нарушение авторских прав
<== предыдущая лекция | | | следующая лекция ==> |
| | Ergänzt bitte die folgenden E-Mails. |