アプリ関連ニュース

Introduction To Database & DBMS systems

Today I will talk about database and DMBS systems. Lets take a look.

Database

The database is a systematic collection of data. Databases support data storage and manipulation. Databases facilitate data management. Let’s discuss some examples.

A Hospital would use a database to store patient’s name, age, diseases, contacts etc.

Consider also facebook & Instagram. You need to store, manipulate and present data related to members, your friends, member activities, messages, announcements and much more.

We can provide countless examples of database usage.

Database management system (DBMS)

The Database Management System (DBMS) is a collection of programs that allow its users to access the database, manipulate data, inform / represent data.

It also helps control access to the database.

Charles Bachmen’s Integrated Data Store (IDS) is said to be the first DBMS in history.

Over time, database technologies evolved a lot, while the expected use and functionality of databases has increased tremendously.

Types of DBMS

Hierarchical

This type of DBMS uses the “parent-child” data storage relationship. This type of DBMS is rarely used today. Its structure is like a tree with nodes that represent records and branches that represent fields. The Windows registry used in Windows XP is an example of a hierarchical database. Configuration settings are stored as tree structures with nodes.

Network DBMS

This type of DBMS supports many to many relationships. This generally results in complex database structures. RDM Server is an example of a database management system that implements the network model.

Relational DBMS

This type of DBMS defines database relationships in the form of tables, also known as relationships. Unlike network DBMS, RDBMS does not support many to many relationships. Relational DBMSs generally have predefined data types that they can support. This is the most popular type of DBMS in the market. Examples of relational database management systems include MariaDB, Oracle and the Microsoft SQL Server database.

Object-oriented relationship DBMS

this type supports the storage of new types of data. The data to be stored are in the form of objects. The objects that will be stored in the database have attributes (i.e. gender, ager) and methods that define what to do with the data. PostgreSQL is an example of an object-oriented relational DBMS.

Summary

  • – DBMS stands for Database Management System.
  • – We have four major types of DBMSs namely Hierarchical, Network, Relational, Object Oriented.
  • – The most widely used DBMS is the relational model that saves data in table formats. It uses SQL as the standard query language.

I will talk about SQL programming next week.

By Yuuma



CakePHP テーブルクラスとエンティティクラスについて(その2)

今回は前回作成したテーブルクラスおよびエンティティクラスに、コントローラークラスからアクセスをおこない、データベースに保存されているレコード内容をビューに表示する方法の説明をおこないたいと思います。

続きを読む

MVC Architecture

Today I will talk about what is MVC architecture with some PHP sample codes.

MVC means model, view, controller:

Model: refers to the data structure.
View: refers to the user interface (UI), with what the user sees and interacts.
Controller: is an “intermediate processor” located between the model and the view.
How it works: the user interacts with the view (UI) to enter some inputs. The controller processes the user’s request, works with the data model. Finally, the controller will update the view to show the results.

Model

It is the representation of information or data that you want to display to user. Model have classes (If you have heard or used Object oriented programming you might have heard about Class). Model gets all these data from database and data can be read, updated and deleted.

View

It is all the front end code via which the website is presented in front of the user (UI/UX). It includes all the CSS, HTML and JavaScript. Also Ajax calls are included. Using view, the user interacts with the website.

Controller

It contains all the logic of your website. Controller also has class with the all methods and application logic. It does as the interface between the Model and View. Most of the application codes are written in this part.

Check out the PHP sample codes below.

<?php

//Model Part
class Model 
{
    public $text;
    public function __construct() 
    {
        $this->text = 'Hello world!';
    }
}

//View Part
class View 
{
    private $model;
    public function __construct(Model $model) 
    {
        $this->model = $model;
    }

    public function output() 
    {
        return '<h1>' . $this->model->text .'</h1>';
    }
}

//Controller Part
class Controller 
{
    private $model;
    public function __construct(Model $model) 
    {
        $this->model = $model;
    }
}


//initiate the model class
$model = new Model();
//controller and the view share the model
$controller = new Controller($model);

$view = new View($model);

echo $view->output();

These are some popular PHP MVC frameworks.

  1. – Laravel
  2. – Symfony
  3. – Yii 2
  4. – CakePHP
  5. – CodeIgniter
  6. – Zend Framework
  7. – Phalcon
  8. – Slim Framework
  9. – FuelPHP

By Yuuma.



CakePHP テーブルクラスとエンティティクラスについて(その1)

今回はCakePHPのテーブルクラスとエンティティクラスについての説明をおこないます。

続きを読む

Androidでネットワーク上の動画を再生する

ネットワーク上に保存している動画を
VideoViewというViewを使用して再生するアプリを作成しました。

ネットワーク上のファイルを参照するので、
AndroidManifestにインターネットパーミッションを許可するために
<uses-permission android:name=”android.permission.INTERNET” />
を追加し、
平文通信を行う必要があるときは、同じく AndroidManifest のapplicationに
android:usesCleartextTraffic=”true”
を追加します。

stringsファイルに動画ファイルのURLを追加し
レイアウトファイルにVideoViewというViewを追加し、
javaファイルにコードを書いていきます。

以下ソースコードです。

package com.example.videoviewsample;

import androidx.appcompat.app.AppCompatActivity;

import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

public class MainActivity extends AppCompatActivity {

    private VideoView videoView;
    private int currentPosition = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        videoView = findViewById(R.id.videoView);

        // 動画へのURLを取得
        String Path = getString(R.string.video_path);
        Uri video = Uri.parse(Path);

        // 動画をコントロールするためMediaController
        MediaController mediaController = new MediaController(this);
        mediaController.setAnchorView(videoView);

        // VideoViewに動画URLとコントローラーを設定
        videoView.setMediaController(mediaController);
        videoView.setVideoURI(video);

        // 保存した値があれば取得
        if(savedInstanceState!=null)
        {
            // 値がなければ0
            currentPosition = savedInstanceState.getInt("CURRENT_POSITION", 0);
        }

        // 再生準備を待つリスナーを設定
        videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener()
        {
            @Override
            public void onPrepared(MediaPlayer arg0)
            {
                // 再生準備ができたら再生開始
                videoView.start();
            }
        });
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        // どこまで再生しているかを保存する
        outState.putInt("CURRENT_POSITION", currentPosition);
    }

    @Override
    protected void onPause() {
        // どこまで再生しているかを取得
        currentPosition = videoView.getCurrentPosition();
        super.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        // どこまで再生しているかを設定
        videoView.seekTo(currentPosition);
    }
}

ただ動画を再生するだけなら簡単ですが、
動画からアスペクト比情報を取得できないと、
アスペクト比が崩れてしまいますね。

水曜担当:Tanaka



アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム