Category: ‘技術情報’

Docker で、denied: requested access to the resource is denied エラー

2020年11月6日 Posted by PURGE

Dockerで、 ローカル環境からDockerhub へpush しようとしたが、 denied: requested access to the resource is denied エラーが出た。結論から言うと、下記のように Dockerhubの名前空間に変更しなければならないようだ。

denied: requested access to the resource is denied

>docker push hello
The push refers to repository [docker.io/library/hello]
75b7d7e2d2e1: Preparing                                                                                                 1a5ad2344ee1: Preparing                                                                                                 ace0eda3e3be: Preparing                                                                                                 denied: requested access to the resource is denied

docker image tag で名前空間のtag 名を付加する

>docker image tag hello:1.0 dockerhub_name/hello:1.0

再度、Dockerhubへpush。

>docker push dockerhub_name/hello:1.0
The push refers to repository [docker.io/dockerhub_name/hello]
75b7d7e2d2e1: Pushed                                                                                                    1a5ad2344ee1: Pushed                                                                                                    ace0eda3e3be: Pushed                                                                                                    1.0: digest: sha256:abcdefghijklmnopqrstuvwxyz123456789 size: 946

Synfony2.8 パラメータ受け渡し(Controller ⇒ View)

2020年10月23日 Posted by PURGE

class SceduleController extends Controller
{
    /**
     * @Route("/schedule")
     */
    public function indexAction()
    {
        $scheduleList = [
            [
                "date" => "2020年11月1日",
                "time" => "12:00",
                "place" => "群馬",
            ],
            [
                "date" => "2020年11月2日",
                "time" => "13:30",
                "place" => "横浜",
            ],
            [
                "date" => "2020年11月3日",
                "time" => "18:00",
                "place" => "東京",
            ],
        ];
        return $this->render('AppBundle:Scedule:index.html.twig',
            ['scheduleList' => $scheduleList]
        );
    }
}
{% extends "::base.html.twig" %}

{% block title %}AppBundle:Scedule:index{% endblock %}

{% block body %}
<h1>Game Date</h1>
    <ul>
    {% for schedule in scheduleList %}
        <li>{{ schedule.date }} {{ schedule.time }} {{ schedule.place }}</li>
    {% endfor %}
    </ul>
{% endblock %}

Symfony2.8 リンク作成

2020年10月23日 Posted by PURGE

<a href="{{ path("app_member_index") }}">Member Page</a>

今更 symfony2.8 をインストール

2020年10月21日 Posted by PURGE

プロジェクト作成

$ php composer.phar create-project symfony/framework-standard-edition project-name "2.8.*"

サーバ起動

$ php app/console server:start

コントローラ作成

$ php app/console generate:controller

Flutter TextField Decoration サンプル

2020年5月13日 Posted by PURGE

TextField(
              style: TextStyle(
                color: Colors.black,
              ),
              decoration: InputDecoration(
                filled: true,
                fillColor: Colors.white,
                icon: Icon(
                  Icons.location_city,
                  color: Colors.white,
                ),
                hintText: 'Enter Name',
                hintStyle: TextStyle(
                  color: Colors.grey,
                ),
                border: OutlineInputBorder(
                  borderRadius: BorderRadius.all(
                    Radius.circular(10.0),
                  ),
                  borderSide: BorderSide.none,
                ),
              ),
            ),

Flutter TextField のテーマサンプル

2020年5月7日 Posted by PURGE

Theme(
  data: Theme.of(context).copyWith(splashColor: Colors.transparent),
  child: TextField(
    autofocus: false,
    style: TextStyle(fontSize: 22.0, color: Color(0xFFbdc6cf)),
    decoration: InputDecoration(
      filled: true,
      fillColor: Colors.white,
      hintText: 'Username',
      contentPadding:
          const EdgeInsets.only(left: 14.0, bottom: 8.0, top: 8.0),
      focusedBorder: OutlineInputBorder(
        borderSide: BorderSide(color: Colors.white),
        borderRadius: BorderRadius.circular(25.7),
      ),
      enabledBorder: UnderlineInputBorder(
        borderSide: BorderSide(color: Colors.white),
        borderRadius: BorderRadius.circular(25.7),
      ),
    ),
  ),
);

Flutter Firebase Authenticationの操作

2020年5月5日 Posted by PURGE

Firebase Authenticationへの登録

  FirebaseAuth firebaseAuth = FirebaseAuth.instance;
  DatabaseReference dbRef = FirebaseDatabase.instance.reference().child('Users');

    firebaseAuth
        .createUserWithEmailAndPassword(
          email: emailController.text,
          password: passwordController.text).then((result){
          dbRef.child(result.user.uid).set({
            'email': emailController.text,
          })

Firebase Authenticationへのログイン

  FirebaseAuth firebaseAuth = FirebaseAuth.instance;
    firebaseAuth.signInWithEmailAndPassword(
        email: emailController.text,
        password: passwordController.text)
        .then((result){
          Navigator.pushReplacement(
              context,
              MaterialPageRoute(builder: (context) => HomePage(uid: result.user.uid)),
          );
    })

Firebase Authentication存在確認

    FirebaseAuth.instance.currentUser().then((response) { }

Firebase Authenticationログアウト

              FirebaseAuth auth = FirebaseAuth.instance;
              auth.signOut().then((response){}
               

Dart の非同期処理/同期処理

2020年4月26日 Posted by PURGE

thenを使用 (非同期処理)

void main(){
  print("A");
  futurePrint(Duration(milliseconds: 2000), "B")
    .then((status) => print(status));
  print("C");
  futurePrint(Duration(milliseconds: 1000), "D")
    .then((status) => print(status));
  print("E");
}

Future<String> futurePrint(Duration dr, String msg){
  return Future.delayed(dr).then((onValue) => msg);
}

//A
//C
//E
//D
//B

async / await を使用 (同期処理)

void main() async {
  print("A");
  await futurePrint(Duration(milliseconds: 2000), "B")
    .then((status) => print(status));
  print("C");
  await futurePrint(Duration(milliseconds: 1000), "D")
    .then((status) => print(status));
  print("E");
}

Future<String> futurePrint(Duration dr, String msg){
  return Future.delayed(dr).then((onValue) => msg);
}

//A
//B
//C
//D
//E

Elixir 値取得方法

2020年4月22日 Posted by PURGE

# List からの値取り出し
list = [1,2,3,4]

IO.inspect(Enum.at(list, 0))
IO.inspect(Enum.at(list, 1))

# Map からの値取り出し
map = %{a: 1, b: 2, c: 3, d: 4}

IO.inspect(Map.get(map, :a))
IO.inspect(Map.get(map, :b))

# Tuple からの値取り出し
tuple = {1, 2, 3, 4}

IO.inspect(elem(tuple, 0))
IO.inspect(elem(tuple, 1))

Phoenix Server をバックグラウンドにて動作させる方法

2020年4月20日 Posted by PURGE

$ elixir --erl "-detached" -S mix phx.server