ソーラーパネル入力40V以上に対応した5000円以下のチャージコントローラ
ソーラーパネルが45Vくらいの出力で大抵のチャージコントローラが40V以下しか対応してないので、調べたついでに簡単にまとめておく。
上3つは2000円弱で格安、一番下のは5000円弱だけとMPPTがついてるので少し高機能。
https://amzn.to/2OxxIzf:SODIAL 20A 12V 24V自動作業PWMソーラー充電コントローラーLCDデュアルUSB 5V出力ソーラーパネル充電器レギュレーター付き
https://amzn.to/2OwPx1e:Y-SOLAR 2017新版30AバックライトLCDディスプレイソーラー充電コントローラ5V 2.5A携帯電話充電用デュアルUSB出力
4つとも購入したのでまた届いたら、使用感などを追加する…かも。
Laravel: MethodNotAllowedHttpException No message
エラー情報が少なすぎてはまった。
MethodNotAllowedHttpException No message
結果的には web.php のルートのメソッドが間違っていることに起因するエラーだった。
Route::post('button', 'UserHogeController@store')->name('user.hoge');
↓
Route::get('button', 'UserHogeController@store')->name('user.hoge');
的な。Postしてないのにgetしようとしてたみたいなやつ。
mac: laradock 起動できない
以下のようなエラー。
ERROR: for laradock_nginx_1 Cannot start service nginx: driver failed programming external connectivity on endpoint laradock_nginx_1 (fa5c31a81c9f2f22dd6....896449cd949aabf9bca0c5c): Error starting userland proxy: Bind 0.0.0.0:80: unexpected error (Failure EAStarting laradock_phpmyadmin_1 ... done
$ sudo apachectl stop
// 駄目な人はDocker自体を再起動してみるといいかも。
vagrant:PHP7:aws:s3:doesBucketExist/doesObjectExist で常に false になる
vagrant環境でテストしているときにawsのs3にあるファイルとバケットがあるかどうかを確認できる以下のメソッドを使ってみたが、何故かfalseしか帰って来ない。
$result = $s3->doesBucketExist($bucket); $result = $s3->doesObjectExist($bucket], $path);
getObject()は動いていたので
$auth = [ 'key' => getenv('AWS_ACCESS_KEY_ID') , 'secret' => getenv('AWS_SECR ET_ACCESS_KEY'), "region" => "ap-northeast-1", 'version' => 'latest', ]; $s3 = S3Client::factory($auth); $s3_result = $s3->getObject( [ 'Bucket' => $bucket, 'Key' => $path, ]);
とか、書いて試してみたら
Error executing "GetObject" on "https://s3.ap-northeast-1.amazonaws.com/バケット名/キー"; AWS HTTP error: cURL error 6: Could not resolve host: s3.ap-northeast-1.amazonaws.com; Unknown error (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
というエラーがでて、そんなわけ無いだろ…と思って確認しようとしたら、vagrant上のapacheは普通に生きてて、ブラウザで動作確認はできるのに、vagrant自体が半分死んでてssh接続できなくなってたので再起動したら、普通に使えるよになった。無駄にはまったので、メモを残しておく。
MacOSX + PHP7.2 + PHPStorm +Xdebug をセットアップする
brewで一発でやりたかったけどまだ対応してないぽかったので。
をみるとPHP7.2に対応してるのは2.6.0以降。
HomebrewよりPECL推奨みたいで
# pecl install xdebug
で最新のものがインストールされる。2.6.0だった。 PHP.iniには自動的に追加されて、phpinfo() で確認するとインストール済なのが確認できる。
後はphp.iniかxdebug.iniにでも以下のような設定を入れてやればOK
[xdebug] zend_extension="xdebug.so" xdebug.remote_enable=1 xdebug.remote_port="9000" xdebug.profiler_enable=1 xdebug.profiler_output_dir="/tmp" xdebug.max_nesting_level=1000 xdebug.idekey = "PHPSTORM"
残りの設定はどこかでググってください
composer updateでエラーが出たけど解決したので貼っとく
検索したけど、結局PHPのバージョンが古くなってるだけだった。 5.x系だとダメで7.x系なら動いたので入れた…というか入ってたはずなのに消えてた…orz
検索しづらかったので、ログ貼って検索しやすくしとく
$ composer update Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update Generating autoload files
Incenteev\ParameterHandler\ScriptHandler::buildParameters Updating the "app/config/parameters.yml" file Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
In Configuration.php line 69:
Warning: date_default_timezone_get(): It is not safe to rely on the system'
s timezone settings. You are required to use the date.timezone setting or
the date_default_timezone_set() function. In case you used any of those me
thods and you are still getting this warning, you most likely misspelled th
e timezone identifier. We selected the timezone 'UTC' for now, but please s
et date.timezone to select your timezone.
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an
[RuntimeException]
error when the "'cache:clear --no-warmup'" command:
In Configuration.php line 69:
Warning: date_default_timezone_get(): It is not safe to rely on the system's
timezone settings. You are required to use the date.timezone setting or
the date_default_timezone_set() function. In case you used any of those methods
and you are still getting this warning, you most likely misspelled the
timezone identifier. We selected the timezone 'UTC' for now, but please
set date.timezone to select your timezone.
PHP:Symfony3:Doctrine:createNativeQuery:in句 の利用についてざっくり
ORMなんて嫌いだー。
とりあえず、複雑なSQLと仮定して、ナマでSQLを叩きたくなったら以下のような感じでいける。 ここらへん資料少くて辛い。誰かの役に立てば幸い。
$entityManager = $this->getDoctrine()->getManager(); $idlist= array(); for($i=0;$i<count($hogeList);$i++){ $idList[] = $hogeList[$i]; // in句で渡したい配列を入れる } $sql = "select hoge1,hoge2 from foo_table where var_clm in (:idList);"; $rsm = new ResultSetMapping(); $rsm->addScalarResult('hoge1', 'hogehoge'); // 結果セットのカラムのマッピング必須 $rsm->addScalarResult('hoge2', 'hogehage'); // 結果セットのカラムのマッピング必須(無いとselectに書いてても取得されない) $query = $entityManager->createNativeQuery($sql,$rsm) $query->setParameter("idList", $idList, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY); //配列を引数に渡す $data = $query->getResult();