現役プログラマのWordPressカスタマイズ相談

WordPress(ワードプレス)のお悩み、うまくいかなくてお困りなこと、不具合調査、新規制作依頼まで、ウェブアプリケーションエンジニアがあなたをサポートします。

WordPressプラグインRinkerの商品検索ができなかった件(自サーバーの環境問題)

f:id:jsaz:20190212234132p:plain:w480

あれ、動かない。。。

Rinkerの商品検索(amazon)が動きません。

amazonトークンやキーはあっている。。。

ソースコード追っかけてみました。

リクエストのURLを抜き出して、ブラウザに貼り付けて実行すると上手くいきます。

怪しいと思い「simplexml_load_string php7」で検索するとSimpleXMLが入っていないことがわかった。

ubuntuのパッケージ検索 https://packages.ubuntu.com/ja/

私のサーバーはphp7.2なので、「php7.2-xml」で検索してみる。

php7.2-xml を入れれば良いらしい

$ sudo apt-get install php7.2-xml
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  php7.2-xml
0 upgraded, 1 newly installed, 0 to remove and 26 not upgraded.
Need to get 107 kB of archives.
After this operation, 456 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.2-xml amd64 7.2.14-1+ubuntu18.04.1+deb.sury.org+1 [107 kB]
Fetched 107 kB in 1s (91.8 kB/s)
Selecting previously unselected package php7.2-xml.
(Reading database ... 143503 files and directories currently installed.)
Preparing to unpack .../php7.2-xml_7.2.14-1+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.2-xml (7.2.14-1+ubuntu18.04.1+deb.sury.org+1) ...
Setting up php7.2-xml (7.2.14-1+ubuntu18.04.1+deb.sury.org+1) ...

Creating config file /etc/php/7.2/mods-available/dom.ini with new version

Creating config file /etc/php/7.2/mods-available/simplexml.ini with new version

Creating config file /etc/php/7.2/mods-available/wddx.ini with new version

Creating config file /etc/php/7.2/mods-available/xml.ini with new version

Creating config file /etc/php/7.2/mods-available/xmlreader.ini with new version

Creating config file /etc/php/7.2/mods-available/xmlwriter.ini with new version

Creating config file /etc/php/7.2/mods-available/xsl.ini with new version
Processing triggers for php7.2-fpm (7.2.14-1+ubuntu18.04.1+deb.sury.org+1) ...

こんな感じでインストール完了

無事動くようになりました。 キーなどを疑っていたので無駄に時間を使っちゃいました。

この記事を見ているあなた、お困りなことあればお気軽にご連絡ください!

Flutterの画像縦横比"BoxFit"をソフトバンクホークスのロゴ画像で検証

Flutterで画像を配置した際のサイズを指定に関して

f:id:jsaz:20181224181723p:plain:w480

FlutterでImageを使って画像を表示させる際、

縦横比"BoxFit"がどのようになっているのかを確認したくプログラムを書いてみた。

ドキュメントはコチラ

docs.flutter.io

BoxFitは7つのタイプがあったので、それぞれタイプ名とそのタイプでの画像出力を下記のようなプログラムで検証してみた。

画像はソフトバンクホークスのロゴ画像を一瞬拝借。

※一部ソースは省略。 listViewItems()を呼び出せば確認できる(はず)

ソースコード

// タイプ名とBoxFitのPropertyのクラスを定期
class BoxFitType {
  final String name;
  final BoxFit type;
  BoxFitType({this.name, this.type});
}

// BoxFitType のリストを作成
List<BoxFitType> listBoxFitType = [
  BoxFitType(name: "fill", type: BoxFit.fill),
  BoxFitType(name: "contain", type: BoxFit.contain),
  BoxFitType(name: "cover", type: BoxFit.cover),
  BoxFitType(name: "fitWidth", type: BoxFit.fitWidth),
  BoxFitType(name: "fitHeight", type: BoxFit.fitHeight),
  BoxFitType(name: "none", type: BoxFit.none),
  BoxFitType(name: "scaleDown", type: BoxFit.scaleDown)
];

//-途中省略-

// リストを出力
List<Widget> listViewItems() {
    List<Widget> listWidget = [];

    for (var boxFitType in listBoxFitType) {
      print(boxFitType.name);

      listWidget.add(SizedBox(
        height: 70.0,
        child: Container(
            color: Colors.black38,
            padding: EdgeInsets.all(8.0),
            child: ListTile(
              leading: Image.network(
                  "http://www.softbankhawks.co.jp/pc/_pl_img/footer/logo_footer_l02.png",
                  height: 60.0,
                  width: 60.0,
                  fit: boxFitType.type),
              title: Text(boxFitType.name),
            )),
      ));
    }

    return listWidget;
}

画面

リストにBoxFitTypeをループして出力している。

画像は高さ60、幅60で指定しており、上からfill, contain, cover, fitWidth, fitHeight, none, scaleDownとなっている

f:id:jsaz:20181223234229p:plain:w480

こういう場合は coverを使うべきなのかな。

Android開発 エミュレータ(AVD Manager)のサイズ変更はとても簡単だった

f:id:jsaz:20181219235439p:plain:w360

半年以上Android開発をしていて、今日初めて知りました。

Androidエミュレータのサイズ変更方法に関してです。

なんと設定は不要でした!

  • デフォルトは大きすぎて使い辛い
  • 動画付きで操作説明
  • みんな知ってたのかな?
続きを読む

ふるさと納税-商品券ジャンルなら小山町

ふるさと納税商品券金券

今年2度目のふるさと納税です。

恥ずかしながら給料が高い会社で働いている訳ではないため、たくさん寄付できる状況ではありません。かといって少額をいろいろ試すのも管理が面倒、また還元率も悪くなってしまいます。ということで高額なもの1つで2018年は終わらせようと考えました。

ちょうどよかったのが

静岡県小山町 QUOカード 1万円分 」寄付金額25,000円

高額返礼品問題で今は終了しています。

が、類似の返礼品も出ているのでそちらも紹介しておきます。

続きを読む

Mi Band 3 を中国から取り寄せたけどiPhone7(iOS12)で心拍数と睡眠ログが同期しない

f:id:jsaz:20181101233659p:plain

やはり自分だけじゃなかったか。。。

www.reddit.com

中華ガジェットはすぐ壊れるから予備でもう一台購入していて、そっちも開けて試したけどダメだった。。。

続きを読む