オーバーライドとは何なのか。それは。

2023.11.27

Logging

おはよう御座います、もう20年前になるのかな駆け出しのエンジニアだった頃の話。そのころ、オブジェクト指向が何なのかなんてことも知らないのに粋がっていました。その事を思い出すと恥ずかしいばかりです。その駆け出しのエンジニアの頃にオブジェクト指向のことをどうしても勉強しないといけなくて参考書を買ったのは良いのだけど専門用語が多くてついて行けなかった、そんな記憶があります。今ではchatGPTという何でも適当にだいたい正しそうな回答してくれる優しくてひねくれ者のツールがあるので、本当に良いなって思います。

さて、オーバーライドとは何なのかという事ですがchatGPTよりもっと要約した回答を書くと継承クラスの上書きです。これでもチンプンカンプンな人に例文を書いてみました。これで分からない方は何かを諦めた方が良いかも知れません。

<?php
//testClass.php
trait testClass {
    public function Hello(){
        return 'Hello';
    }
}
<?php
//test.php
require './testClass.php';
class test1{
    use testClass;
    public function run (){
        print $this->Hello().PHP_EOL;
    }
}
class test2{
    use testClass;
    protected function Hello(){
        return 'Good night';
    }
    public function run (){
        print $this->Hello().PHP_EOL;
    }
}

(new test1)->run();
(new test2)->run();

この2つのファイル(コード)を保存してtest.php実行してみてください。そうするとよく分かると思います。ちなみに実行結果はこの様になります。
https://zip358.com/tool/demo79/

明日へ続く。

タグ

ChatGPT, gt, gt;Hello, lt, php, PHP_EOL, print, return, run, test.php require, testClass, testClass.php trait, this, use testClass, オーバーライド, オブジェクト指向, チンプンカンプン, ひねくれ者, 上書き, 例文,

I mutter using laravel’s schedule.

2023.06.23

Logging


Good morning! These days, I’ve been working on migrating the parts that used the twitteroauth library to Laravel. I think it was a good decision to migrate because it made it easier to incorporate new features. I wish I had initially started with Laravel for this.

Here are some technical hints, but you should be able to find more detailed methods by searching online:

  1. Install twitteroauth in Laravel’s vendor directory.
  2. Create a job using the command php artisan make:job YourPreferredName (e.g., ProcessPodcast).
  3. Register the job in the scheduler.
  4. Configure cron (in my case, * * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1).

With this setup, it will tweet at the specified time. I used to be able to retweet, but it seems my Twitter bot has been flagged, and now I can only tweet. So I’m doing my best with just tweeting.

Concerns about Twitter: I can’t help but think that it’s only a matter of time before either Jack Dorsey leaves or Twitter gets acquired and disappears. Even with a new CEO, I don’t expect things to improve immediately, and as long as Jack Dorsey remains, I believe it will continue to be problematic. Twitter has lost some of its appeal for individual developers who can no longer enjoy developing on the platform. The various services that were created using Twitter’s API in the past were possible because Twitter was developer-friendly.

タグ

artisan schedule, CEO, Configure cron, created using Twitter, dev, gt, hints, I've been working, Install twitteroauth, job YourPreferredName, library to Laravel, past were possible because Twitter was developer-friendly, path, php, Platform, run, setup, that were, These days, vendor directory,

dockerでlaravel環境構築したお話。 #hosts

2022.12.08

Logging

おはようございます、今日は早朝に明日の記事を書いています😆。

さて、dockerでlaravel環境構築したお話を書いていきます、Dockerの環境でApacheをインストールし、バーチャルホストを設定してwindows側のhostsも変更しDocker側のhostsも設定、起動確認も取れたので、一旦Dockerを終了し再度立ち上げるとDocker側のhostsが初期値に戻っている🤔。

これDockerの仕様らしいので、下記のようにdocker-compose.ymlを設定(extra_hosts)するか、Docker runでコンテナを立ち上げる場合はパラメーター–add-hostを付与してあげないといけない😳。

version: "3"
services:
  web:
    image: almalinux:latest
    container_name: Apache_v2.4
    ports:
      - 80:80
    privileged: true
    command: /sbin/init
    extra_hosts:
      - "example1.com:127.0.0.1"
      - "example2.com:127.0.0.1"
    volumes:
      - E:\var\www\html:/var/www/html
docker run --add-host=example1.com:127.0.0.1 .....

尚、Docker側のhostsを変更しないまま、立ち上げてもLaravelは動かないと思います。何故、動かないかはここでは割愛させて頂きます🙇。

タグ

--add-host, , almalinux, ap, Apache, container, docker, docker-compose, extra, hosts, image, Laravel, latest, name, quot, run, services, Version, web, Windows, yml, インストール, お話, これ, こんてな, バーチャル, パラメーター, ホスト, 一旦, 下記, 今日, 仕様, 付与, , 再度, 初期, 場合, 変更, 早朝, 明日, 構築, 環境, 確認, 終了, 記事, 設定, 起動,

Dockerは楽だなという事を今頃理解しましたよ。 #vbox #docker

2022.10.03

Logging

おはようございます、月曜日の朝はテンション低めな方も多いはず😇。

さて、今日は先週の木曜日と金曜日にふと今後のためにDockerをもう少し触ってみようと思い作業終了後触ってみました、触れて気づいた事は開発環境を作るのがとても楽だということ(気づくの遅い?🫠)。自分は昔の人間なのでvisualboxばかり触っていたのですがDockerは素晴らしい。サーバー周りが得意な人にイメージを作ってもらってそれを共有すれば皆、同じ環境下で開発が出来るので良いという事に今頃気づいた・・・。

 docker run -it -d -v C:\var\www\html\:/var/www/html --privileged -p 80:80 --name こんてな命名 イメージid /sbin/init

※Visualboxでも可能ですけどね。Dockerのだとそこが楽だしマウント(フォルダ共有)もスムーズに行くので自分は良いなと感じました。

ちょっと残念だった点は自宅で作業している中、バッファローのNAS🍆に作業ファイルを入れているのですが、それとは共有出来なかった点です、対応として実PCをrobocopyしてNASと同期を取るという形にしました。これで問題はなくテスト環境下で開発ができます。尚、高級なNASではそういう問題なく上手くいくそうですよ。※NASはバックアップデータになりました。

robocopy <コピー元> <コピー先> /E /DCOPY:DAT

尚、mirのオプションにしなかったのには理由があります。コピー元のファイルが消えたり、ディレクトリが破損した場合、コピー先のファイルやディレクトリが消えて無くなるらしいので・・・。完璧なミラーリングは辞めました。

こんな感じで快適なテスト環境が作れます(上記のコマンド参考に)。

タグ

--privileged, -p, -v, 80, D-, docker, html, ID, init, IT, name, run, sbin, var, vbox, Visualbox, www, イメージ, こと, こんてな, サーバー, スムーズ, そこ, それ, ため, テンション, パス, フォルダ, マウント, , , 人間, 今後, 今日, 今頃, 低め, 作業, 先週, 共有, 可能, 周り, 命名, 得意, , , 月曜日, , 木曜日, 理解, 環境, , 終了, 自分, , 金曜日, 開発,

androidアプリをはじめて申請しました。リリースされるかは?

2021.07.21

Logging

高知県も梅雨明け宣言したころだと思います、そんな事を考えながら雷の音を聞きながらこの記事を書いています。
この記事が公開された時にはandroidアプリがリリースされている頃だと思います。
この記事はアンドロイドアプリ(Flutterアプリ)を作ったときに戸惑ったところなどを本人しかわからない形で箇条書きにしたものです。他人が見てもわかるようには書いていません。

尚、参考にしたサイトはこちらになります。
https://passe-de-mode.uedasoft.com/ja/tips/software/device/flutter/flutter04.htm

flutter_icons:
  android: true
  ios: true
  image_path: "lib/assets/icon.png"
flutter pub get
flutter pub run flutter_launcher_icons:main
keytool -genkey -v -keystore C:\android\jks\key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
    signingConfigs {
        release {
            storeFile file("C:\\android\\jks\\key.jks")
            storePassword "Password"
            keyAlias "key"
            keyPassword "Password"
        }
    }
    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
        }
    }
flutter build appbundle

タグ

04, Android, assets, com, device, fl, flutter, GET, htm, https, icon, icons, image, iOS, ja, lib, passe-de-mode, path, png, pub, quot, run, software, tips, true, uedasoft, アプリ, アンドロイド, こちら, ころ, サイト, とき, ところ, もの, リリース, , 他人, 公開, 参考, 宣言, , , 本人, 梅雨明け, 申請, 箇条書き, 記事, , , , 高知県,

VirtualBoxで共有フォルダ設定とApacheが表示されるまで。

2020.11.29

Logging

前処理としてこのコマンドを打つ。

yum -y groupinstall "Development Tools"
yum -y update kernel
yum -y install kernel-devel kernel-headers gcc gcc-c++

起動したらメニューから[デバイス]-[Guest Additions CDイメージの挿入]

mount /dev/cdrom /mnt
cd /mnt
./VBoxLinuxAdditions.run

reboot
cd /var/www/
ln -s マウント先 sf_html
gpasswd -a oreore vboxsf
gpasswd -a apache vboxsf

mount -t vboxsf -o dmode=0755,fmode=0755 (共有名) (マウント先)

reboot

Apacheのconfig設定ではリンク先はシンボルリンクを参照させとこう、これでリブートさせて完了やねん。さてこれで理解できたら、あなたは凄いです。これは単なるメモ書き記載なので、わからないと思います。

なので、参考にしたサイトのリンクを貼っときます。
http://itemy.net/?p=1355
https://www.codelab.jp/blog/?p=2587

これらでおそらく大体の人が理解できたと思います。

タグ

-o, -s, -t, -y, 0755, A`, Additions, Apache, cd, cdrom, dev, Development, dmode, fmode, gcc, gcc-c, gpasswd, groupinstall, Guest, html, install, kernel, kernel-devel, kernel-headers, ln, mnt, mount, oreore, quot, reboot, run, SF, Tools, UPDATE, var, VBoxLinuxAdditions, vboxsf, virtualBOX, www, yum, イメージ, コマンド, デバイス, フォルダ, マウント, メニュー, 共有, 前処理, 挿入, 表示, 設定, 起動,