カテゴリー: 技術系memo

  • 「Nintendo Switch Online」はAWSを使ってる

    アマゾンウェブサービスジャパンが、AWSの事例として、「Nintendo Switch Online」で使われていることを発表した。

    なんとなくわかっていたけれど、正式にAWSを使っていると発表されるとやっぱりかとわかって楽しい。もともとスプラトゥーン2のマッチングサーバがAWS上にあると話題になった(マッチングに失敗するという文脈から調べた人が多かったから)。

    世界規模のサービスだったりすると、やっぱりパブリッククラウドもAWSやAzureなどのクラウドサービスを使うのかと。日本のクラウド事業者も使ってほしい気はするが、使っているゲームメーカーのところは障害に当たったりするから、大規模だと辛いんだろうな、と思う。価格、安定性、競争力で、対抗できるクラウド事業者が日本から出て欲しい。

    https://www.itmedia.co.jp/news/articles/2012/25/news096.html

  • JavaScriptのwindowのコールバック関数が動かなかった

    子画面から親画面に情報の引継ぎを行うために、下記のサイトを参考にして、子画面からコールバック関数の実行を行うように実装して、テストしたが動かず。

    https://qiita.com/hidehito108/items/f7ad9fe23736049a76d6

    問題の切り分けのために、これだけのテストページを作ったり、変数化されているところをベタ書きにしたりもしたがダメだった。動いていない箇所を特定するために、コメントアウトしたりして、確認して、子画面からのコールバック関数の実行がエラーになっていることはわかった。なにかJSのモジュールでも足りないのかも、と思い調べたが標準のもので動くことがわかり、手詰まり。

    画面上は、何も表示されないのでわからず。ダメ元で、ブラウザの開発者ツールを立ち上げてみた。標準のところには何も出ず。それで、いろいろとやっていたら、Consoleにエラーが表示されていた。そこには、下記の内容が表示されていた。

    Uncaught DOMException: Blocked a frame with origin "null" from accessing a cross-origin frame.

    このエラーを調べてみると、ウェブサーバ上のコンテンツを実行していない場合に発生するとのこと。たしかに、確認はWindowsで、フォルダにあるHTMLファイルをブラウザで実行しており、ウェブサーバは介していなかった。テスト用のHTMLファイル2つ(親画面用と子画面用)をウェブサーバに配置して、httpでアクセスしたら、正常に動作した。問題はコードではなく、テスト実行していた環境が原因だった。

  • .NET Framework 4.8のサポート期限(EOSL)

    .NET Framework 4.8のサポート期限は、動作するOSのサポート期限に影響される。

    .NET Framework 4.8が動作するOSで一番サポートが長いのは、Windows Server Standard 2019(の仲間)になる。Windows Server Standard 2019のメインストリームサポート終了が2024/1/9、延長サポートが2029/1/9までなので、.NET Framework 4.8は、2029/1/9までは安心して使用できる(というか延命できる)。

    参考:
    https://docs.microsoft.com/ja-jp/lifecycle/faq/dotnet-framework

    https://support.microsoft.com/ja-jp/lifecycle/search?alpha=Windows%20Server%202019

  • WordPress5.6にしたら、投稿画面がエラーになった

    WordPress 5.6にアップデートしたら、投稿画面の表示でエラーになった。ブラウザの画面には、エラーになったことしか表示されないので、詳しいエラー内容をコピーして確認した。

    確認したところ、Javascriptばかりがエラーになっていた。なので、ブラウザのキャッシュに残っているものが悪さをしている。ブラウザのキャッシュを削除して、再度Wordpressの管理画面にアクセスしたところ、正常に投稿画面が使えるようになった。このアップデート後の問題は、忘れたことに発生するので、少しびっくりする。

    エラー内容は下記。

    TypeError: Object(...) is not a function
        at WithSpokenMessages(WithInstanceId(WithFilters(n))) (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/components.min.js:7:280912)
        at we (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:84:293)
        at zj (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:226:496)
        at Th (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:152:223)
        at tj (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:152:152)
        at Te (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:146:151)
        at https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:61:68
        at unstable_runWithPriority (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react.min.js:26:340)
        at Da (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:60:280)
        at Pg (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:61:14)
  • WP Mail SMTP でエラーになる

    WordPressからメールを送るために、プラグインのWP Mail SMTPを入れた。送信先をMicrosoft365にしようとしたところ、Proのライセンスが求められるので、その設定を使うのは断念。

    次に、「Other SMTP」を指定して、SMTPを「smtp.office365.com」を指定して、実在するユーザを使ったが下記のエラーが出て失敗した。

    2020-12-03 03:34:42 SERVER -> CLIENT: 535 5.7.3 Authentication unsuccessful [xxxxxxxxxxxxx.namprd18.prod.outlook.com]
    2020-12-03 03:34:42 SMTP ERROR: Password command failed: 535 5.7.3 Authentication unsuccessful [xxxxxxxxxxxxx.namprd18.prod.outlook.com]
    SMTP Error: Could not authenticate.
    2020-12-03 03:34:42 CLIENT -> SERVER: QUIT

    接続は行えているが、ユーザの認証ではじかれているので、Microsoft365側のセキュリティ設定でエラーになっている。接続先のSMTPサーバを、MXレコードで設定しているものに変えてみたが、これもエラーになる。

    わかったことは、フリーのWP Mail SMTPだと、Microsoft365(Office365)を使ってメール送信はできない。

  • .NET5がリリースされている

    .NET5がリリースされている。が、.NET5はLTSではないので、サポート期間が短いので、使いにくい。試しには、使ってみるけれど。

    とはいえ、.NET core 3.1を使うのも、.NET Framework4.8を使うのも、どちらも悩ましい。移行前提になってしまう。サポート期間は.NET Framework4.8が長くてよいのだけど、技術移行が発生するし。来年の.NET6が待ち遠しい。

    https://docs.microsoft.com/ja-jp/dotnet/core/dotnet-five

  • Magento 2.3.5で初期セットアップに繰り返したら、LogicExceptionエラーになった

    Magento 2.3.5で、ウェブ上から初期セットアップを行って、インストールの部分で躓く。いろいろと対処をしていく中で、何回も行っていたのだが、突然、成功していたインストールの部分(というか最初)で、エラーが出るようになってしまった。

    Unknown module in the requested list: 'Magento_CatalogRuleSampleData'
    [ERROR] exception 'LogicException' with message 'Unknown module in the requested list: 'Magento_BundleSampleData'' in setup\src\Magento\Setup\Model\Installer.php:403
    Stack trace:

    原因は、ブラウザのキャッシュだった。キャッシュをクリアしたところ、正常な動作(というか、もともとの別の場所で躓く)に戻った。なかなか、Magento2のインストールは大変。

  • Magento2.3.5のインストール後に管理ページが404エラーになる

    Ubuntuに、Magento 2.3.5をインストールした後に、管理ページにアクセスしたところ、ページが404エラーになった。他にも、いくつかのページが404エラーになった。

    原因は、Apacheのmod_rewriteの設定がMagentoのディレクトリで有効になっていないからだった。

    Apacheには、mod_rewriteを入れているし、読み込ませてもいるが、肝心のMagentoのディレクトリで使うように設定されていなかったのが原因。

    • .htaccess がMagentoのフォルダになかった
    • apache.confで、.htaccessによる設定の上書きができないようになっていた

    対処としては、後述の参考ページの設定をいれただけだ。

    まずMagentoのインストールディレクトリに下記の .htaccessを保存する。

    ###############################################
    ## overrides deployment configuration mode value
    ## use command bin/magento deploy:mode:set to switch modes
    #   SetEnv MAGE_MODE developer
    ############################################
    ## uncomment these lines for CGI mode
    ## make sure to specify the correct cgi php binary file name
    ## it might be /cgi-bin/php-cgi
    #    Action php5-cgi /cgi-bin/php5-cgi
    #    AddHandler php5-cgi .php
    ############################################
    ## GoDaddy specific options
    #   Options -MultiViews
    ## you might also need to add this line to php.ini
    ##     cgi.fix_pathinfo = 1
    ## if it still doesn't work, rename php.ini to php5.ini
    ############################################
    ## this line is specific for 1and1 hosting
        #AddType x-mapp-php5 .php
        #AddHandler x-mapp-php5 .php
    ############################################
    ## default index file
        DirectoryIndex index.php
    <IfModule mod_php5.c>
    ############################################
    ## adjust memory limit
        php_value memory_limit 768M
        php_value max_execution_time 18000
    ############################################
    ## disable automatic session start
    ## before autoload was initialized
        php_flag session.auto_start off
    ############################################
    ## enable resulting html compression
        #php_flag zlib.output_compression on
    ###########################################
    ## disable user agent verification to not break multiple image upload
        php_flag suhosin.session.cryptua off
    </IfModule>
    <IfModule mod_php7.c>
    ############################################
    ## adjust memory limit
        php_value memory_limit 768M
        php_value max_execution_time 18000
    ############################################
    ## disable automatic session start
    ## before autoload was initialized
        php_flag session.auto_start off
    ############################################
    ## enable resulting html compression
        #php_flag zlib.output_compression on
    ###########################################
    ## disable user agent verification to not break multiple image upload
        php_flag suhosin.session.cryptua off
    </IfModule>
    <IfModule mod_security.c>
    ###########################################
    ## disable POST processing to not break multiple image upload
        SecFilterEngine Off
        SecFilterScanPOST Off
    </IfModule>
    <IfModule mod_deflate.c>
    ############################################
    ## enable apache served files compression
    ## http://developer.yahoo.com/performance/rules.html#gzip
        # Insert filter on all content
        ###SetOutputFilter DEFLATE
        # Insert filter on selected content types only
        #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
        # Netscape 4.x has some problems...
        #BrowserMatch ^Mozilla/4 gzip-only-text/html
        # Netscape 4.06-4.08 have some more problems
        #BrowserMatch ^Mozilla/4\.0[678] no-gzip
        # MSIE masquerades as Netscape, but it is fine
        #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
        # Don't compress images
        #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
        # Make sure proxies don't deliver the wrong content
        #Header append Vary User-Agent env=!dont-vary
    </IfModule>
    <IfModule mod_ssl.c>
    ############################################
    ## make HTTPS env vars available for CGI mode
        SSLOptions StdEnvVars
    </IfModule>
    ############################################
    ## workaround for Apache 2.4.6 CentOS build when working via ProxyPassMatch with HHVM (or any other)
    ## Please, set it on virtual host configuration level
    ##    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
    ############################################
    <IfModule mod_rewrite.c>
    ############################################
    ## enable rewrites
        Options +FollowSymLinks
        RewriteEngine on
    ############################################
    ## you can put here your magento root folder
    ## path relative to web root
        #RewriteBase /magento/
    ############################################
    ## workaround for HTTP authorization
    ## in CGI environment
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    ############################################
    ## TRACE and TRACK HTTP methods disabled to prevent XSS attacks
        RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
        RewriteRule .* - [L,R=405]
    ############################################
    ## redirect for mobile user agents
        #RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
        #RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
        #RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]
    ############################################
    ## never rewrite for existing files, directories and links
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-l
    ############################################
    ## rewrite everything else to index.php
        RewriteRule .* index.php [L]
    </IfModule>
    ############################################
    ## Prevent character encoding issues from server overrides
    ## If you still have problems, use the second line instead
        AddDefaultCharset Off
        #AddDefaultCharset UTF-8
    <IfModule mod_expires.c>
    ############################################
    ## Add default Expires header
    ## http://developer.yahoo.com/performance/rules.html#expires
        ExpiresDefault "access plus 1 year"
        ExpiresByType text/html A0
        ExpiresByType text/plain A0
    </IfModule>
    ###########################################
    ## Deny access to root files to hide sensitive application information
        RedirectMatch 404 /\.git
        <Files composer.json>
            order allow,deny
            deny from all
        </Files>
        <Files composer.lock>
            order allow,deny
            deny from all
        </Files>
        <Files .gitignore>
            order allow,deny
            deny from all
        </Files>
        <Files .htaccess>
            order allow,deny
            deny from all
        </Files>
        <Files .htaccess.sample>
            order allow,deny
            deny from all
        </Files>
        <Files .php_cs>
            order allow,deny
            deny from all
        </Files>
        <Files .travis.yml>
            order allow,deny
            deny from all
        </Files>
        <Files CHANGELOG.md>
            order allow,deny
            deny from all
        </Files>
        <Files CONTRIBUTING.md>
            order allow,deny
            deny from all
        </Files>
        <Files CONTRIBUTOR_LICENSE_AGREEMENT.html>
            order allow,deny
            deny from all
        </Files>
        <Files COPYING.txt>
            order allow,deny
            deny from all
        </Files>
        <Files Gruntfile.js>
            order allow,deny
            deny from all
        </Files>
        <Files LICENSE.txt>
            order allow,deny
            deny from all
        </Files>
        <Files LICENSE_AFL.txt>
            order allow,deny
            deny from all
        </Files>
        <Files nginx.conf.sample>
            order allow,deny
            deny from all
        </Files>
        <Files package.json>
            order allow,deny
            deny from all
        </Files>
        <Files php.ini.sample>
            order allow,deny
            deny from all
        </Files>
        <Files README.md>
            order allow,deny
            deny from all
        </Files>
    ################################
    ## If running in cluster environment, uncomment this
    ## http://developer.yahoo.com/performance/rules.html#etags
        #FileETag none
    ############################################
    ## Add custom headers
    <IfModule mod_headers.c>
        Header set X-Content-Type-Options "nosniff"
        Header set X-XSS-Protection "1; mode=block"
    </IfModule>

    次に、/etc/apache/の中のconfファイル(vhosts.confやapache.confなどから適切なものを書き換え)に下記を追加する。ディレクトリは、Magentoをインストールしたディレクトリに変える。

    <Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                allow from all
     </Directory>

    最後に、Apacheの再起動を行う。

    参考: https://qastack.jp/magento/89125/how-to-fix-magento-2-2-0-0-rc-admin-page-not-found-after-installation

  • VS2008のアプリをVS2019で開いて、デバック実行したら「Assembly.csが見つかりません」が表示された

    VS2008のアプリをVS2019で開いて、デバック実行したら「Assembly.csが見つかりません」が表示された。「Assembly.cs」を探したが見つからず。元のプロジェクトはVB.NETで書かれている。

    VS2019上には、逆コンパイルで作成も選択できたので、実行してみたが失敗した。

    失敗したので、今度は、Assenbly情報を再作成した。

    1. ソリューションエクスプローラーでプロジェクトを選び、右クリックからプロパティを開く。
    2. 「アプリケーション」を選択する。
    3. 「アセンブリ情報(Y)」をクリックする。
    4. ウィンドウが立ち上がるので、確認してOKをクリックする(なにも変更しなくてもよい)
    5. プロジェクトのリビルドを行う。
    6. デバック実行して、同じエラーにならないかを確認する。

    これでエラーが出なくなった。

  • VS2008のソリューションをVS2019に変更したら、Request.ServerVariables(“LOGON_USER”)で値がとれなくなったら

    Visual Studio 2008のソリューションを、Visual Studio 2019の形式に変換した。.NET Frameworkも3.5から4.8に変更した。Visual Studio 2019でデバック実行したところ、ログインユーザの値が「Request.ServerVariables(“LOGON_USER”)」でとれなくなった。

    言語のバージョンか、.NET Frameworkのバージョン違いか、調べたが、ちゃんと残っていた。

    変わっていたのは、Visual Studio 2019上での開発サーバー(IIS)の設定値だった。プロジェクトのプロパティを開いたところ、開発サーバーの設定があり、そこの設定では、「Windows認証」が無効で、「匿名認証」が有効になっていた。これだと、LOGONしたことになっていないので、「LOGON_USER」の値は、空になる。

    開発サーバーの設定を、「Windows 認証」を有効にし、「匿名認証」を無効にした。その後、デバック実行して確認したところ、正常にログオンユーザが取れた。