ホーム » メモ (ページ 11)

メモ」カテゴリーアーカイブ

2025年6月
1234567
891011121314
15161718192021
22232425262728
2930  

カテゴリー

アーカイブ

ブログ統計情報

  • 115,816 アクセス


WordPress でエラーが表示される

自分のブログを見ているとエラーが…
Warning: mysqli_query(): (HY000/14): Can’t change size of file (Errcode: 28 “No space left on device”) in /…/wp-db.php on line 1924 Warning: mysqli_query(): (HY000/1021): Disk full (/tmp/#sql_27c2_0.MAI); waiting for someone to free some space… (errno: 28 “No space left on device”) in /…/wp-db.php on line 1924
wordpress disk full /tmp
原因は,画像変換で /tmp 以下を使用していて,70 MB 位のファイルが幾つも存在する様になってしまっていた.

Iwao@DS116:~/gcc_test/Test/t_linux/call_im$ ./a.out ~/gcc_test/Test/gons_to/data/dib/IMG_20180624_185921.vr.jpg
Iwao@DS116:~/gcc_test/Test/t_linux/call_im$ ./a.out ~/gcc_test/Test/gons_to/data/dib/IMG_20180624_185921.vr.jpg
Iwao@DS116:~/gcc_test/Test/t_linux/call_im$ ./a.out ~/gcc_test/Test/gons_to/data/dib/IMG_20180624_185921.vr.jpg
convert: ImproperImageHeader `/tmp/Iwao/i_Tools.tmp/20190201/20190201/IMG_20180624_185921.vr.jpg.004.bmp' @ error/bmp.c/ReadBMPImage/590.
convert: NoImagesDefined `/tmp/Iwao/i_Tools.tmp/20190201/20190201/IMG_20180624_185921.vr.001.jpg' @ error/convert.c/ConvertImageCommand/3258.
Iwao@DS116:~/gcc_test/Test/t_linux/call_im$ df
Filesystem      1K-blocks      Used  Available Use% Mounted on
/dev/sda1         2385592    946808    1320000  42% /
none               513436         0     513436   0% /dev
/tmp               515324    515320          4 100% /tmp
/run               515324      3312     512012   1% /run
/dev/shm           515324         4     515320   1% /dev/shm
none                    4         0          4   0% /sys/fs/cgroup
/dev/sda3      2879506904 518855752 2360532368  19% /volume1
Iwao@DS116:~/gcc_test/Test/t_linux/call_im$

rm -r /tmp/Iwao/i_Tools.tmp/20190201/* とすることで一先ず対応.
他に,/tmp なので再起動すれば消去される.
デバッグ用にファイルを残していることもあるが,コードとしてどの様に対応するか検討が必要.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Linux 上での画像情報の表示

先日 Linux 上での zip などを調べていて見つけた convert など.
その中の,画像情報を表示する identify .

pi@raspberrypi:~ $ identify 2019-01-29-234500_1360x768_scrot.png 
2019-01-29-234500_1360x768_scrot.png PNG 1360x768 1360x768+0+0 8-bit sRGB 338KB 0.000u 0:00.010
pi@raspberrypi:~ $ 

identify -format  ... ....png
コマンドオプションに -verbose を指定する方法はいろいろな所に書かれているが,欲しかったのは限られた情報.
例えば「幅」や「高さ」,「色数」など.
identify -help とすると,-format “string” と言うのがあった.
例えば -format “%w\n%h\n” と指定すると,幅と高さを 2 行に表示できる.

pi@raspberrypi:~ $ identify -format "%w\n%h\n"  2019-01-29-234500_1360x768_scrot.png 
1360
768
pi@raspberrypi:~ $ 
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

コンパイルエラー C2664

次の様になっている _UNICODE のプロジェクトでエラー.
//#include “messbar.hxx
#include “i_dib_bg.hxx
#include “itls_tmp.hxx

--------------------構成: Tc_i_DIB - Win32 Release--------------------
コンパイル中...
Tc_i_DIB.cpp
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(71) : error C2664: 'wcscpy' : 1 番目の引数を 'char *' から 'unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(72) : error C2664: 'wcslen' : 1 番目の引数を 'const char *' から 'const unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(88) : error C2664: 'wcsncpy' : 1 番目の引数を 'char *' から 'unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(105) : error C2664: 'wcscat' : 1 番目の引数を 'char *' から 'unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(106) : error C2664: 'wcslen' : 1 番目の引数を 'const char *' から 'const unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(106) : error C2664: 'wcslen' : 1 番目の引数を 'char *' から 'const unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(127) : error C2664: 'wcsncat' : 1 番目の引数を 'char *' から 'unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(128) : error C2664: 'wcslen' : 1 番目の引数を 'const char *' から 'const unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(128) : error C2664: 'wcslen' : 1 番目の引数を 'char *' から 'const unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(171) : error C2664: '_wcslwr' : 1 番目の引数を 'char *' から 'unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(186) : error C2664: '_wcsupr' : 1 番目の引数を 'char *' から 'unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(211) : error C2664: '_wgetenv' : 1 番目の引数を 'const char *' から 'const unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(235) : error C2664: '_wcreat' : 1 番目の引数を 'const char *' から 'const unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\_s_func.hxx(259) : error C2664: '_wfopen' : 1 番目の引数を 'const char *' から 'const unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\ttox.hxx(32) : error C2664: 'wcstoul' : 1 番目の引数を 'const char *' から 'const unsigned short *' に変換できません。 (新しい機能 ; ヘルプを参照)
        指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
\\DevS\Documents\Develop\_.SRC\__CPR_\ttox.hxx(32) : fatal error C1903: 直前のエラーを修復できません; コンパイルを中止します。
cl.exe の実行エラー

Tc_i_DIB.exe - エラー 16、警告 0

_MBCS にすると OK .
また,コメントにした “messbar.hxx” のインクルードを外すと OK .
::DIB_resize_bg の実行結果
エラーは UNICODE 版の関数を使用しているのに char を与えているというもの.
wcscpy を呼び出すときの引数を char* ではなく wchar_t* にすれば良い.
または,_MBCS ,_UNICODE 共に動作する様に _tcscpy の様な関数と TCHAR を使用する.


2019/01/31
今回エラーになったのは次の様なコード.

bool	TcsCpy	(LPTSTR dst,size_t sizeD,LPCTSTR src)
{
	if (sizeD == 0)				{	return	false ;	}
	bool	rs = true ;
	#if(_MSC_VER >= 1400)
	{
		errno_t	err =	_tcscpy_s	(dst,sizeD,	src) ;
		if (err != 0)			{	rs = false ;	}
		}
	#else
	{
				_tcscpy 	(dst,		src) ;
		if (sizeD < _tcslen(src))	{	rs = false ;	}
		}
	#endif
	return	rs ;
	}

原因は _UNICODE が定義 されていて UNICODE が定義されていない ことによるもの.
ビルド環境?によってこれらの #define が矛盾してしまうことがある.
Windows.h をインクルードする前に両方が定義されている必要がある.
今回は自前の def_bmp.hxx の先頭に,i_define.hxx をインクルードすることで対応.
i_define.hxx 内では,次の様にしている.

//	(VS8)\VC\AtlMFC\Include\AfxV_W32.h 
#ifdef			_MSC_VER
	#ifdef		_UNICODE
		#ifndef	 UNICODE
		#define	 UNICODE		// UNICODE is used by Windows headers
		#endif
	#endif
	#ifdef		 UNICODE
		#ifndef	_UNICODE
		#define	_UNICODE		// _UNICODE is used by C-runtime/MFC headers
		#endif
	#endif
#endif

2020/09
i_def_aw.hxx を用意.
コンソール AP での define

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Linux での zip コマンド

先日から,zip 関連のコマンドの動作を調べている.
それで困っているのが,あるフォルダ以下を指定する方法.
例えば ~/Desktop/ 直下のファイルを指定する時,パスの home/pi/Desktop/ の部分を含めたくない.

pi@raspberrypi:~/Desktop $ ls
bak  myweb  scratch1_20190107.sb  scratch2_20181231.sb2  test_c  三角形.py  正方形.py
pi@raspberrypi:~/Desktop $ zip /tmp/pi/aaa.zip  *
  adding: bak/ (stored 0%)
  adding: myweb/ (stored 0%)
  adding: scratch1_20190107.sb (deflated 39%)
  adding: scratch2_20181231.sb2 (deflated 30%)
  adding: test_c/ (stored 0%)
  adding: 三角形.py (deflated 17%)
  adding: 正方形.py (deflated 16%)
pi@raspberrypi:~/Desktop $ zip /tmp/pi/aa.zip  ~/Desktop/*
  adding: home/pi/Desktop/bak/ (stored 0%)
  adding: home/pi/Desktop/myweb/ (stored 0%)
  adding: home/pi/Desktop/scratch1_20190107.sb (deflated 39%)
  adding: home/pi/Desktop/scratch2_20181231.sb2 (deflated 30%)
  adding: home/pi/Desktop/test_c/ (stored 0%)
  adding: home/pi/Desktop/三角形.py (deflated 17%)
  adding: home/pi/Desktop/正方形.py (deflated 16%)
pi@raspberrypi:~/Desktop $ unzip /tmp/pi/aaa.zip -l
Archive:  /tmp/pi/aaa.zip
caution: filename not matched:  -l
pi@raspberrypi:~/Desktop $ unzip -l /tmp/pi/aaa.zip 
Archive:  /tmp/pi/aaa.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2019-01-09 15:02   bak/
        0  2019-01-10 21:44   myweb/
    75455  2019-01-08 00:13   scratch1_20190107.sb
    69629  2019-01-08 00:13   scratch2_20181231.sb2
        0  2019-01-16 16:40   test_c/
      100  2019-01-04 15:13   三角形.py
       99  2019-01-04 15:11   正方形.py
---------                     -------
   145283                     7 files
pi@raspberrypi:~/Desktop $ unzip -l /tmp/pi/aa.zip 
Archive:  /tmp/pi/aa.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2019-01-09 15:02   home/pi/Desktop/bak/
        0  2019-01-10 21:44   home/pi/Desktop/myweb/
    75455  2019-01-08 00:13   home/pi/Desktop/scratch1_20190107.sb
    69629  2019-01-08 00:13   home/pi/Desktop/scratch2_20181231.sb2
        0  2019-01-16 16:40   home/pi/Desktop/test_c/
      100  2019-01-04 15:13   home/pi/Desktop/三角形.py
       99  2019-01-04 15:11   home/pi/Desktop/正方形.py
---------                     -------
   145283                     7 files
pi@raspberrypi:~/Desktop $ 


Synology NAS の 7z だと,ルートから指定?すれば省かれるっぽい.

Iwao@DS116:~/gcc_test/Test/T_zip/zip$ 7z a aa.zip t_call_z/*
Scanning

Creating archive aa.zip

Total: 652420
Compressing  t_call_z/a.out
Compressing  t_call_z/bak/a.out
Compressing  t_call_z/bak/l7z.out
Compressing  t_call_z/bak/t_call_z.BAK
Compressing  t_call_z/bak/t_call_z.cpp
Compressing  t_call_z/bak/t_call_z.dsp
Compressing  t_call_z/bak/zip.out
Compressing  t_call_z/t_call_z.cpp

Everything is Ok
Iwao@DS116:~/gcc_test/Test/T_zip/zip$ 7z a aaa.zip ~/gcc_test/Test/T_zip/zip/t_call_z/*
Scanning

Creating archive aaa.zip

Total: 652420
Compressing  a.out
Compressing  bak/a.out
Compressing  bak/l7z.out
Compressing  bak/t_call_z.BAK
Compressing  bak/t_call_z.cpp
Compressing  bak/t_call_z.dsp
Compressing  bak/zip.out
Compressing  t_call_z.cpp

Everything is Ok
Iwao@DS116:~/gcc_test/Test/T_zip/zip$ 7z l aa.zip

Listing archive: aa.zip

--
Path = aa.zip
Type = zip
Physical Size = 187879

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2019-01-22 11:02:30 .....       161544        46349  t_call_z/a.out
2019-01-22 09:38:18 D....            0            0  t_call_z/bak
2019-01-21 16:33:02 .....       158988        45396  t_call_z/bak/a.out
2019-01-21 16:18:56 .....       158628        45292  t_call_z/bak/l7z.out
2019-01-21 15:15:12 .....         2325          815  t_call_z/bak/t_call_z.BAK
2019-01-21 16:31:56 .....         2802          962  t_call_z/bak/t_call_z.cpp
2019-01-21 14:02:06 .....         4227         1141  t_call_z/bak/t_call_z.dsp
2019-01-21 15:44:20 .....       158656        45303  t_call_z/bak/zip.out
2019-01-22 11:01:32 .....         4569         1167  t_call_z/t_call_z.cpp
2019-01-22 14:41:22 D....            0            0  t_call_z/tmp
------------------- ----- ------------ ------------  ------------------------
                                651739       186425  8 files, 2 folders
Iwao@DS116:~/gcc_test/Test/T_zip/zip$ 7z l aaa.zip

Listing archive: aaa.zip

--
Path = aaa.zip
Type = zip
Physical Size = 187609

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2019-01-22 11:02:30 .....       161544        46349  a.out
2019-01-22 09:38:18 D....            0            0  bak
2019-01-21 16:33:02 .....       158988        45396  bak/a.out
2019-01-21 16:18:56 .....       158628        45292  bak/l7z.out
2019-01-21 15:15:12 .....         2325          815  bak/t_call_z.BAK
2019-01-21 16:31:56 .....         2802          962  bak/t_call_z.cpp
2019-01-21 14:02:06 .....         4227         1141  bak/t_call_z.dsp
2019-01-21 15:44:20 .....       158656        45303  bak/zip.out
2019-01-22 11:01:32 .....         4569         1167  t_call_z.cpp
2019-01-22 14:41:22 D....            0            0  tmp
------------------- ----- ------------ ------------  ------------------------
                                651739       186425  8 files, 2 folders
Iwao@DS116:~/gcc_test/Test/T_zip/zip$

Synology NAS 7z コマンド


bool	linux_zip_create	(LPCTSTR zip_name,LPCTSTR zip_root)
{
	{
		tstring	cmd_psd = _T("pushd ") + tstring(zip_root) ;
		_tsystem(cmd_psd.c_str()) ;
		}
	{
		tstring	l_z_name = zip_name ;
		tstring	l7z_name = ::Path_ChangeExt(l_z_name,_T("_7.zip")) ;
		tstring	root_zip = _T("*") ;
		tstring	root_7z_ = tstring(zip_root) + _T("/*") ;
		tstring	cmd_zip = l_cmd_zip _T("   ") +	l_z_name + _T(" -r ") + root_zip ;  // zip  zip_name -r zip_root
		tstring	cmd_7z_ = l_cmd_7z_ _T(" a ") +	l7z_name + _T("    ") + root_7z_ ;  // 7z a zip_name    zip_root
		if (which(l_cmd_zip)) {	_tsystem(cmd_zip.c_str()) ;	}
		if (which(l_cmd_7z_)) {	_tsystem(cmd_7z_.c_str()) ;	}
		_tsystem(l_cmd_popd) ;
		if (which(l_cmd_zip)) {	return	true ;	}
		if (which(l_cmd_7z_)) {	return	true ;	}
		}
	return	false ;
	}

pushd で,カレントを動かすことにより対応.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Synology NAS /tmp の空き容量

次の様に /tmp 以下に zip を作成していたら,エラー(No space left on device)に.

Iwao@DS116:/tmp/Iwao/i_Tools.tmp/20190121/tst$ zip /tmp/Iwao/i_Tools.tmp/20190121/tst/zzzzzz.zip -r /volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/
  adding: volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/ (stored 0%)
  adding: volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/a.out (deflated 71%)
  adding: volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/l7z.out (deflated 71%)
  adding: volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/zip.out (deflated 71%)
  adding: volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/bak/ (stored 0%)
  adding: volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/bak/t_call_z.dsp (deflated 73%)
  adding: volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/bak/t_call_z.BAK (deflated 65%)
  adding: volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/t_call_z.cpp (deflated 65%)
  adding: volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/tmp/ (stored 0%)
  adding: volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/tmp/tst_.zip.000._7.zip (stored 0%)
  adding: volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/tmp/tst_.zip_.000.zip (stored 0%)
  adding: volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/tmp/tst_.zip_.001.zip7.zip (stored 0%)
  adding: volume1/homes/Iwao/gcc_test/Test/T_zip/zip/t_call_z/tmp/t_call_z.001.zip
zip I/O error: No space left on device
zip error: Output file write failure (write error on zip file)
Iwao@DS116:/tmp/Iwao/i_Tools.tmp/20190121/tst$

空き容量を表示する df コマンドで確認すると,

Iwao@DS116:/tmp/Iwao/i_Tools.tmp/20190121/tst$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       2.3G  920M  1.3G  42% /
none            502M     0  502M   0% /dev
/tmp            504M  501M  2.7M 100% /tmp
/run            504M  4.9M  499M   1% /run
/dev/shm        504M  4.0K  504M   1% /dev/shm
none            4.0K     0  4.0K   0% /sys/fs/cgroup
/dev/sda3       2.7T  495G  2.2T  19% /volume1
Iwao@DS116:/tmp/Iwao/i_Tools.tmp/20190121/tst$

確かに空いていない.
NAS を再起動して対応.
DS116 ログイン画面

Is this 投稿 useful? Useful Useless 1 of 1 people say this 投稿 is useful.

Synology NAS で zip , unzip , 7z

以前調べた Synology NAS 上での zip ファイルの扱い.
今まで 3mfamf などは Windows 環境のみ(i_Zip.hxx)の対応としていた.


作成 展開
zip , unzip zip zip_name -r zip_root unzip -d out_dir zip_path
7z 7z a zip_name zip_root/* 7z x zip_path -oout_dir

7z の作成時の a は add .つまり zip が存在すると,それに追加になるみたい.


もう一つ見つけたのは,convert コマンド.
Synology NAS ,Raspberry Pi 共に可能.
Synology NAS ではダメだが,display コマンドで画像を表示できる.
Image Magick display


2019/01/18
Raspberry Pi のファイルマネージャの起動.
コンソールで pcmanfm
“pcmanfm /tmp/” とするとそこから開ける.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Raspberry Pi 再起動コマンド

ちょっと原因がわからないが「ジブン専用パソコンキット2」の HDMI 接続の画面が表示されなくなった.
リモートデスクトップや SSH では接続可能な状態.
Linux なので,端末から操作できるはずと思い検索すると
Raspberry Pi シャットダウンコマンド
shutdown -h now
sudo shutdown -h now を入力.
再起動は sudo shutdown -r now
起動すると,ちゃんと画面は表示されている.何だったのだろう?


「Raspberry Pi の設定」-「インターフェイス」に「VNC」の設定があったので,VNC 接続を試してみた.
設定を「有効」にして,RealVNC のサイトからダウンロード.
Raspberry Pi の VNC Viewer での表示
リモートデスクトップ(RDP)とは違い,VNC 接続では画面の表示状態を転送しているらしい.
RDP は,キーボードや画面などをつなぎ換えて利用している感じ.Raspberry Pi 本体の表示とは異なる.
それに対して VNC は,追加でキーボードや画面をつなげた様な感じ.本体の表示と同様.
VNC は,リモートアシスタンスの動作に近い?


VNC で,Scratch 1.4 は正しく起動し表示できる.
Minecraft Pi は,起動はするがウィンドウ内が表示されないみたい.


2020/05/07
他に reboot コマンド.

C:\Users\Iwao>ssh -l pi 192.168.1.36
pi@192.168.1.36's password:
Linux raspberrypi 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu May  7 17:05:07 2020
Linux raspberrypi 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu May  7 17:05:07 2020

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@raspberrypi:~ $ reboot --help
reboot [OPTIONS...] [ARG]

Reboot the system.

     --help      Show this help
     --halt      Halt the machine
  -p --poweroff  Switch off the machine
     --reboot    Reboot the machine
  -f --force     Force immediate halt/power-off/reboot
  -w --wtmp-only Don't halt/power-off/reboot, just write wtmp record
  -d --no-wtmp   Don't write wtmp record
     --no-wall   Don't send wall message before halt/power-off/reboot

See the halt(8) man page for details.
pi@raspberrypi:~ $ reboot
Failed to set wall message, ignoring: Interactive authentication required.
Failed to reboot system via logind: Interactive authentication required.
Failed to open initctl fifo: 許可がありません
Failed to talk to init daemon.
pi@raspberrypi:~ $ sudo reboot
Connection to 192.168.1.36 closed by remote host.
Connection to 192.168.1.36 closed.

C:\Users\Iwao>

Raspberry Pi reboot コマンド


Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

xml の読込み

幾つかの xml データを読んでみると,データにより msxml.dll を使用したときに比べて明らかに遅い.

bool Test (LPCTSTR pathName)
{
    tstring outPath = ::Get_i_Tools_tmp_date() ;
    tstring now_hms = ::Now_Format(_T("_%M%S")) ;
    tstring out_xml = ::Path_AddLastSP(outPath) + ::Path_GetName(pathName) + now_hms + _T(".o.xml") ;
    tstring new_xml = ::Path_AddLastSP(outPath) + ::Path_GetName(pathName) + now_hms + _T(".n.xml") ;
    {
        ElapseTime eto ;
        Xml_E xml = ::Xml_Import(pathName) ;
        std::cerr << eto.GetElapse() << std::endl ;
        Xml_Out::Export(xml,out_xml.c_str()) ;
        }
    {
        ElapseTime etn ;
        Xml_E xml = ::Load_xml_2018_12(pathName) ;
        std::cerr << etn.GetElapse() << std::endl ;
        Xml_Out::Export(xml,new_xml.c_str()) ;
        }
    return true ;
    }

データは次の様な x3d で,5 倍くらいかかる.

Parse_xml で時間がかかる x3d
Parse_xml で時間がかかる x3d

x3d の場合は,属性の値が長い.
そのため次のコード部分( q_str+=cq )がうまくない.

tstring Parse_xml_quot (c_tstring& str,const TCHAR qm,size_t* index)
{
    tstring q_str ;
    if (*index < str.length()) {
        TCHAR c = str[*index] ;
        if (c == qm) {
            q_str += c ;
            for (size_t indexQ=*index+1 ; indexQ<str.size() ; indexQ++) {
                TCHAR cq = str[indexQ] ;
                q_str += cq ;
                if (cq == qm) {
                    *index = indexQ ;
                    break ;
                    }
                }
            }
        }
    return q_str ;
    }

https://jml.mish.work/index.php/cpp/xml.html

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

送信された URL に noindex タグ…

先日 All in One SEO の設定を変更して「送信された URL に noindex タグが追加されています」となってしまった.

URL に noindex タグが追加されています

All in One SEO の「XML サイトマップ」の「日別アーカイブページを含める」のチェックを外した状態に変更.
日別アーカイブページを含める

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Wi-Fi と Bluetooth

以前に比べると T90Chi 付属のキーボードが反応しなくなることが増えた.
Bluetooth が途切れているみたいで,マウスも同様.
今年の 4 月,RT-AC86U などを追加したのでその影響と思われる.

2G帯のチャンネルの状態

T90Chi の Wi-Fi 設定で,2G での接続を止めてみた.
少しは良くなったので,この状態で様子見.


http://kiyosu.cs.chubu.ac.jp/JapanOpen2012/wireless_03_JOpen2011.pdf

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

マネタイズの…,日経Linux2019.1

Google AdSense マネタイズの教科書[完全版]と日経Linux 2019年1月号を購入.


Google AdSense マネタイズの教科書[完全版]

まだ半分くらいしか読めていないが,内容は濃いと思う.
ただ,自分でそこまでできるかとなるとかなり疑問が…
一先ず,「元を取ることを目標に」と思う.


日経Linux 2019年1月号

何年か前から,gcc が使える環境を探している.
以前は mac 上でやったり,仮想環境に Linux を入れたりしていた.
最近は Synology NAS 上が増えてきたが,あまり使い勝手がよくない.
いろいろと調べていると Raspberry Pi が使えそう.

今狙っているのは「ジブン専用パソコンキット2」.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

AMP for WordPress に AdSense

AMP for WordPress が更新されていた.
暫く気付かず…


html_start.php

<head>
    <!--	...	-->
    <script async custom-element="amp-auto-ads"  src="https://cdn.ampproject.org/v0/amp-auto-ads-0.1.js" > </script>
    <script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"> </script>
    <script async custom-element="amp-iframe"    src="https://cdn.ampproject.org/v0/amp-iframe-0.1.js"   > </script>
</head>
<body class="<?php echo esc_attr( $this->get( 'body_class' ) ); ?>">
    <amp-auto-ads type="adsense"
        data-ad-client="ca-pub-????????????????">
    </amp-auto-ads>

    <amp-analytics type="googleanalytics">
        <script type="application/json">
        {
            "vars": {
                "account": "UA-????????-?"
                },
            "triggers": {
                "trackPageview": {
                    "on": "visible",
                    "request": "pageview"
                    }
                }
            }
        </script>
    </amp-analytics>

html_end.php

    <div style="text-align: center;">
        <amp-iframe src='//itl.mydns.jp/f_index.html' sandbox="allow-scripts" width='250px' height='250px'> </amp-iframe>
    </div>

</body>
</html>
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Firefox 64 と Vivaldi

今日 Firefox の起動時に,バージョン 64.0 に更新された.
最初,タブを「新しいウィンドウへ移動」する方法がわからなかった.
タブを「右クリック」して表示されるメニューの「Move Tab」の下になった.

「タブ」を「新しいウィンドウへ移動」

他に気になる動作としては,
target=”_blank” と記述している所が「新しいウィンドウ」で開かれる.
以前は「新しいタブ」だった?


DS116 へのアクセスログを見ていた時,Vivaldi/2…. となっているのがあった.
wiki によるとシェアは高くない.
Vivaldi日本語公式ブログによると「動作がサクサク」とあるので,インストールしてみた.
まだ少ししか使ってないが,よく使う機能での不満は「レスポンシブデザインモード」.
それとも単に使い方がわかってないだけ?


2018/12/18
target=_”blank” となっている時,新しいウィンドウを開く様になってしまっていた.
初期値が変わったのか,間違って変更してしまったのかは不明.
設定場所は,メニューの「ツール」-「オプション」-「一般」-「タブグループ」にあった.

target=”_blank” を「タブ」で開く設定

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

All in One SEO の設定

Web で検索した時,ここの日付別アーカイブが列挙されることが多い気がする.
検索結果に表示されるページ内容の一部では,飛んだ先が判断できないものもあり.
All in One SEO の設定で「日付別アーカイブに noindex を使用」にチェックを入れて様子見.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Google アナリティクスの設定

analytics.js と gtag.js .


index.html など,エディタで書いた html .
Google アナリティクスに関して,次の 2 つの書き方が混在していた.

    <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

        ga('create', 'UA-TRACKING_ID', 'auto');
        ga('send', 'pageview');
    </script>

    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-TRACKING_ID"></script>
    <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
        gtag('config', 'UA-TRACING_ID');
    </script>

検索すると,上の analytics.js は古い形式みたい.

 Google アナリティクスの設定
 最新!?Google Analyticsの「Global Site Tag」(gtag.js)

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Synology NAS で zip

Synology NAS 内(SSH 接続)で,zip ファイルを扱えないかと…
検索すると,Linux 環境では zip や unzip があるらしい.
SSH で接続して確認すると,zip はあるが unzip は command not found .
さらに検索すると Synology Forum に情報があった.
 Unzip?
7z コマンドが利用できるみたい.

Iwao@DS116:~$ zip
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
  The default action is to add or replace zipfile entries from list, which
  can include the special name - to compress standard input.
  If zipfile and list are omitted, zip compresses stdin to stdout.
  -f   freshen: only changed files  -u   update: only changed or new files
  -d   delete entries in zipfile    -m   move into zipfile (delete OS files)
  -r   recurse into directories     -j   junk (don't record) directory names
  -0   store only                   -l   convert LF to CR LF (-ll CR LF to LF)
  -1   compress faster              -9   compress better
  -q   quiet operation              -v   verbose operation/print version info
  -c   add one-line comments        -z   add zipfile comment
  -@   read names from stdin        -o   make zipfile as old as latest entry
  -x   exclude the following names  -i   include only the following names
  -F   fix zipfile (-FF try harder) -D   do not add directory entries
  -A   adjust self-extracting exe   -J   junk zipfile prefix (unzipsfx)
  -T   test zipfile integrity       -X   eXclude eXtra file attributes
  -y   store symbolic links as the link instead of the referenced file
  -e   encrypt                      -n   don't compress these suffixes
  -h2  show more help
  -yf  store files/directories that symbolic links point to in an archive
  -cp  codepage, ex: fre,ger,ita,spn,cht,chs,jpn,krn,ptb,rus,dan,nor,sve,nld,plk,ptg,hun,trk,csy

Iwao@DS116:~$ unzip
-sh: unzip: command not found
Iwao@DS116:~$ 7z

7-Zip 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.utf8,Utf16=on,HugeFiles=on,2 CPUs)

Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
       [<@listfiles...>]

<Commands>
  a: Add files to archive
  b: Benchmark
  d: Delete files from archive
  e: Extract files from archive (without using directory names)
  l: List contents of archive
  t: Test integrity of archive
  u: Update files to archive
  x: eXtract files with full paths
<Switches>
  -ai[r[-|0]]{@listfile|!wildcard}: Include archives
  -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
  -bd: Disable percentage indicator
  -i[r[-|0]]{@listfile|!wildcard}: Include filenames
  -m{Parameters}: set compression Method
  -o{Directory}: set Output directory
  -p{Password}: set Password
  -r[-|0]: Recurse subdirectories
  -scs{UTF-8 | WIN | DOS}: set charset for list files
  -sfx[{name}]: Create SFX archive
  -si[{name}]: read data from stdin
  -slt: show technical information for l (List) command
  -so: write data to stdout
  -ssc[-]: set sensitive case mode
  -t{Type}: Set type of archive
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
  -v{Size}[b|k|m|g]: Create volumes
  -w[{path}]: assign Work directory. Empty path means a temporary directory
  -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
  -y: assume Yes on all queries
Iwao@DS116:~$    


Synology NAS で zip , unzip , 7z
Linux での zip コマンド


NAS で zip コマンドを使用したページ
https://itl.mydns.jp/i_Tools/up_bg_s/
up_bg_s
http://jml.mish.work/i-tools/360-panorama.html
http://jml.mish.work/i-tools/how-to-up-bg.html

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

カメラ座標からワールドに

{
    Prj ctow ;
    {   //  Prj の逆行列を求める
        Matrix pm ;
        Prj    prj(GetEyeChg().Get()) ;
        prj.Get(&pm) ;
        pm.Inv() ;	//  逆行列
        ctow.Set(pm) ;
        }
    for (size_t index=0 ; index<pnts.size() ; index++) {
        Vd3 pnt = pnts[index] ;
        for (size_t index3=0 ; index3<pntsXzY.size() ; index3++) {
            Vd3 pt3 = pntsXzY[index3] ;
            pt3.y = 0 ;
            if (::V3_is_near(pnt,pt3)) {
                Vd3 pntc = pntsXzY[index3] ;
                Vd3 pntw = ::ToVd3(ctow.P3to3(::ToP3(pntc))) ;  //  逆行列を掛けている
                pnts[index] = pntw ;
                break ;
                }
            }
        }
    }


Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

template の複数の型の順番

先日作成した template .
  template <class V3, class VT> V3 ToV3 (const VT& vt,const long type)
型の順番で,戻り値の型 V3 と,引数の型 VT .
どちらを先に指定した方が良いか悩んだが,呼び出しで省略する場合を考慮するとこれで良さそう.
  Vd4 v4(1,2,3,1) ;
  Vd3 v3(1,2,3) ;
  Vd2 v2(1,2) ;
  Vd3 v43 = ToV3<Vd3/*,Vd4*/>(v4,to_x0y) ;
  Vd3 v33 = ToV3<Vd3/*,Vd3*/>(v3,to_x0y) ;
  Vd3 v23 = ToV3<Vd3/*,Vd2*/>(v2,to_x0y) ;

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

::ToV3<Vd3,Vd2>(v2,to_x0y) で C2784

次の様な template の利用で,C2784 エラー.

    Vd2 v2(1,2) ;
    Vd3 v3 = ::ToV3<Vd3,Vd2>(v2,to_x0y) ;

\\DevS\...\tovxx.hxx(123) : error C2784: 'struct Vector3<T> __cdecl ToX0Y(const struct Vector4<T> &)' : 'const struct Vector4<T> & 用のテンプレート引数を 'const struct Vector2<double>' から減少できませんでした。 C:\... \VF3DView.cpp(236) : コンパイルされたクラスのテンプレートのインスタンス化 'struct Vector3<double> __cdecl ToV3(const struct Vector2<double> &,const long)' の参照を確認してください
template <class V3, class VT> V3 ToV3 (const VT& vt,const long type) { V3 v3 ; { switch (type) { case to_xyz : v3 = ::ToXYZ(vt) ; break ; case to_xzy : v3 = ::ToXZY(vt) ; break ; case to_x0y : v3 = ::ToX0Y(vt) ; break ; default : v3 = ::ToXYZ(vt) ; break ; } } return v3 ; }
Vector4 のものは昨日定義していたが,Vector2 のものを追加.ついでに Vector3 も. template <class T> Vector3<T> ToXYZ (const Vector2<T>& p) { return Vector3<T> (p.x,p.y, 0 ) ; } template <class T> Vector3<T> ToXYZ (const Vector3<T>& p) { return Vector3<T> (p.x,p.y,p.z) ; } template <class T> Vector3<T> ToXZY (const Vector2<T>& p) { return Vector3<T> (p.x, 0 ,p.y) ; } template <class T> Vector3<T> ToXZY (const Vector3<T>& p) { return Vector3<T> (p.x,p.z,p.y) ; } template <class T> Vector3<T> ToX0Y (const Vector2<T>& p) { return Vector3<T> (p.x, 0 ,p.y) ; } template <class T> Vector3<T> ToX0Y (const Vector3<T>& p) { return Vector3<T> (p.x, 0 ,p.y) ; }

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

template で複数の型を指定

template で複数の型を指定する場合は,カンマで区切って指定すれば良い.

    template <class V2, class V3> V2 ToV2 (const V3& v3,const long type)
    {
        V2 v2 ;
        switch (type) {
            case to_xy : v2 = ::ToXY(v3) ; break ;
            case to_yz : v2 = ::ToYZ(v3) ; break ;
            case to_zx : v2 = ::ToZX(v3) ; break ;
            case to_xz : v2 = ::ToXZ(v3) ; break ;
            default :    v2 = ::ToXY(v3) ; break ;
            }
        return v2 ;
        }

呼び出しは,次の様な感じ.

    Vd3 v3 = Vd3(1,2,3) ;
    Vd2 v2 = ::ToV2<Vd2,Vd3>(v3,to_xy) ;

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.