ホーム » 2019 » 1月

月別アーカイブ: 1月 2019

2019年1月
 12345
6789101112
13141516171819
20212223242526
2728293031  

カテゴリー

アーカイブ

ブログ統計情報

  • 79,651 アクセス



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 で 32 ビット色の BMP に変換

3D データの相互変換を書き直していて,32 ビット DIB が必要になってきた.
Windows 環境では,自前の Image クラスがあるのでそれを利用している.
Linux 環境は,先日見つけた convert コマンドが使えそうと思って調べるとなかなか情報が少ない.
次の -depth 32 で行けそうと思うが,24 ビットのまま.
convert dib_24.png -depth 32 dib_32.bmp
それで検索して見つけたのが,Convert to 32-bit depth BMP
次の様に存在しないアルファの情報を指定(-alpha set)する必要があるみたい.
convert dib_24.png -depth 32 -alpha set dib_32.bmp

ImageMagick

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

Let’s Encrypt certificate renewals

Let’s Encrypt からのメール.
Hello,
Action may be required to prevent your Let’s Encrypt certificate renewals from breaking.
If you already received a similar e-mail, this one contains updated information.
Your Let’s Encrypt client used ACME TLS-SNI-01 domain validation to issue a certificate in the past 60 days. Below is a list of names and IP addresses validated (max of one per account):
mish.myds.me (27.92.169.109) on 2018-12-30
TLS-SNI-01 validation is reaching end-of-life. It will stop working temporarily on February 13th, 2019, and permanently on March 13th, 2019.
Any certificates issued before then will continue to work for 90 days after their issuance date.
You need to update your ACME client to use an alternative validation method (HTTP-01, DNS-01 or TLS-ALPN-01) before this date or your certificate renewals will break and existing certificates will start to expire.
Our staging environment already has TLS-SNI-01 disabled, so if you’d like to test whether your system will work after February 13, you can run against staging: https://letsencrypt.org/docs/staging-environment/
If you’re a Certbot user, you can find more information here:
https://community.letsencrypt.org/t/how-to-stop-using-tls-sni-01-with-certbot/83210
Our forum has many threads on this topic. Please search to see if your question has been answered, then open a new thread if it has not:
https://community.letsencrypt.org/
For more information about the TLS-SNI-01 end-of-life please see our API
announcement:
https://community.letsencrypt.org/t/february-13-2019-end-of-life-for-all-tls-sni-01-validation-support/74209
Thank you,
Let’s Encrypt Staff


どうも TLS-SNI-01 が利用できなくなると言うことらしい.
それで Synology NAS と Let’s Encrypt で検索すると
Synology TLS-SNI-01 End of Life Email? – Help – Let’s Encrypt …
今(2019/01/27)の時点では,はっきりした対応方法が読み取れなかった.
取りあえず,「証明書の更新」を行って 3 ヶ月後に延ばした.
Synology NAS 証明書の更新


2019/04/03 自動的に更新されたことを確認.
DS116 の Let's Encrypt は更新済み

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

Linux での zip スクリプト

先日の zip の呼び出しを C の system 関数で呼出していたが,それだけではうまくなかった.
pushd などは一時的に機能するが,zip コマンドの時には効かなくなってしまっている.


次の様なコマンドをスクリプトファイルとして作成して,それを実行する方法で対応.
pushd /home/pi/Desktop/test_c/test/zip/t_which
zip /tmp/pi/i_Tools.tmp/20190124/t_which.zip -r *
Raspberry Pi zip スクリプト


2019/01/28
上のスクリプトファイルを Synology NAS 上で,php から system (“./call_zip.sh”) として呼び出し.
/…/zip/t_call_z /…/test
/…/t_call_z
updating: a.out (deflated 71%)
updating: bak/ (stored 0%)
updating: bak/a.out (deflated 71%)
updating: bak/zip_gnu.hxx (deflated 74%)
updating: bak/cdzip.sh (deflated 18%)
updating: bak/cdzip.BAK (deflated 17%)
updating: bak/t_call_z.BAK (deflated 78%)
updating: bak/le_crlf.BAK (deflated 18%)
updating: bak/t_call_z.cpp (deflated 78%)
updating: bak/le_crlf.sh (deflated 19%)
updating: cdzip.sh (deflated 18%)
updating: le_crlf.sh (deflated 19%)
updating: t_call_z.cpp (deflated 78%)
/…/test


2021/05
zip_gnu.hxx
zip_func.hxx

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.

moto g5 入れない

今日の朝,パターンロックの画面から入れなくなってしまった.
72 時間のロックなので,画像は少し異なる.

パターンロック 入力画面
パターンロック 入力画面

異なるパターンを入力すると弾かれているので,正しい入力は認識はされている様子.
ただその後,ホーム画面に遷移しない.
幾つかの入り方を試したが,全てダメ.


PC 関連などで問合せをかけると,よく言われる「再起動」.
「電源」ボタンを押して「再起動」を選択.
暫く待ってパターンロックの入力画面で正しく入力すると通った.

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

Joomla! 本入手

先日から空いた時間で Joomla! 関係を触っているが,システムの考え方が理解できないでいる.
単にブログとしての利用は対応するテンプレートを利用すれば良さそうだが,それなら WordPress の方が簡単.


Joomla! のことが書かれている本を,近くの何軒かの本屋で探したがやはり置いていない.
昨日時間が空いたので,ちょっと離れた本屋にも行ったがやはりない.
その駅に着く前に BOOK OFF の看板が目に入っていたので,探すと,

10 年位前に書かれた Joomla! 1.5 の内容なので,あまり期待はできない.
まだ 60/430 しか読めてないが,購入金額相当の情報が得られればと思う.


2019/01/27
112 ページまででは,バージョンが異なるためかあまり有用な情報は得られなかった.
その中で「URLリライトの使用」があった.が,そこにあった方法とは異なるみたい.
検索すると,htaccess.txt を .htaccess にコピーらしい.
DS115j で試すとうまくいったが,DS116 ではなぜかエラーになってしまう.


2019/02/05
DS116 に入れた Joomla! をアンインストール.
再度インストールして「URLリライトの使用」の設定をしたらうまくいった.

Is this 投稿 useful? Useful Useless 0 of 0 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.

Joomla! の更新

先日 Synology NAS に Joomla! をインストールした.
まだ使い方を理解できてないので,これでサイトを管理するには「ほど遠い」状態.


Synology NAS でのアップデートは,ここにある「更新のインストール」で行うのが簡単と思われる.

Joomla! パッケージ更新
Joomla! パッケージ更新

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.

Synology NAS で IP アドレス検索

先日の「IP 検索」をブラウザから利用できる様にしてみた.
“whois 27.92.169.109” としているので,他の検索サイトよりは情報が少ないが自分用なのでこれで十分.
IP アドレス 検索 whois

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

xml の読込み – 2

昨日の xml 読込み で,データが大きい場合に比例ではなく極端に遅くなる?
それで,次の様なコードで計測してみた.

bool Test (c_tstring& str)
{
    for (size_t index=0 ; index<str.size() ; index++) {
        ElapseTime et ;
        tstring s_str = ::Parse_xml_quot(str,_T('|'), &index) ;
        std::cerr << ::To_tstring_Ki(long(s_str.size())) << _T("\t") << et.GetElapse() << std::endl ;
        }
    return true ;
    }

bool Test (void)
{
    tstring outPath = ::Get_i_Tools_tmp_date() ;
    tstring now_hms = ::Now_Format(_T("%H%M%S")) ;
    tstring out_txt = ::Path_AddLastSP(outPath) + now_hms + _T(".txt") ;
    tstring outrtxt = ::Path_AddLastSP(outPath) + now_hms + _T("_.txt") ;
    tstring str ;
    {
        v_tstring strAry ;
        {
            tstring str_1000 ;
            {
                tstring str_10 = _T("0123456789") ;
                for (long indexS=0 ; indexS<100 ; indexS++) {
                    str_1000 += str_10 ;
                    }
                }
            for (long index=0 ; index<2000 ; index++) {
                strAry.push_back(str_1000) ;
                }
            }
        str = ::String_Join_Line(strAry) ;
        }
    str[0] = _T('|') ;
    str += _T('|') ;
    size_t len = str.length() ;
    while (len > 100) {
        len = len/2 ;
        str[len-0] = _T('|') ;
        str[len-1] = _T('|') ;
        }
    {
        tstring tmp = str ;
        v_tstring tmpAry = ::String_Split(tmp.c_str(),false) ;
        tmpAry = ::SkipEmpty(tmpAry) ;
        str = ::String_Join_Line(tmpAry) ;
        }
    {
        ::SaveUTF8(out_txt.c_str(),str) ;
        ::Test(str) ;
        }
    {
        tstring rev = str ;
        {
            std::reverse(rev.begin(),rev.end()) ;
            v_tstring revAry = ::String_Split(rev.c_str(),false) ;
            revAry = ::SkipEmpty(revAry) ;
            rev = ::String_Join_Line(revAry) ;
            }
        ::SaveUTF8(outrtxt.c_str(),rev) ;
        ::Test(rev) ;
        }
    return true ;
    }

DS116 では,比例と思われる.

login as: Iwao
Iwao@DS116's password:
Iwao@DS116:~$ source ./set_ds_inc.sh
Iwao@DS116:~$ cd gcc_test/Test/T_P_xm_q/
Iwao@DS116:~/gcc_test/Test/T_P_xm_q$ g++ T_P_xm_q.cpp
Iwao@DS116:~/gcc_test/Test/T_P_xm_q$ ll
total 204
drwxrwxrwx+  2 Iwao users   4096 Jan  8 14:10 .
drwxrwxrwx+ 10 Iwao users   4096 Jan  8 14:09 ..
-rwxrwxrwx   1 Iwao users 183528 Jan  8 14:10 a.out
-rwxrwxrwx+  1 Iwao users   3009 Jan  8 13:59 T_P_xm_q.cpp
Iwao@DS116:~/gcc_test/Test/T_P_xm_q$ ./a.out
     61         0.000384092
     61         6.10352e-05
    122         5.31673e-05
    245         5.19753e-05
    489         6.29425e-05
    979         8.70228e-05
  1.91 K        0.000140905
  3.82 K        0.000212908
  7.64 K        0.000381947
 15.29 K        0.000729799
 30.58 K        0.00145721
 61.16 K        0.0028069
122.32 K        0.00562811
244.63 K        0.011224
489.26 K        0.0223849
978.52 K        0.0462639
      0         5.38826e-05
      0         3.91006e-05
978.52 K        0.045109
489.26 K        0.022413
244.63 K        0.0112309
122.32 K        0.00556397
 61.16 K        0.00286198
 30.58 K        0.00143504
 15.29 K        0.000734806
  7.64 K        0.000383139
  3.82 K        0.000211
  1.91 K        0.000123024
    979         8.51154e-05
    489         6.19888e-05
    245         5.00679e-05
    122         4.3869e-05
     61         4.00543e-05
     61         3.91006e-05
      0         3.31402e-05
      0         3.31402e-05
Iwao@DS116:~/gcc_test/Test/T_P_xm_q$

VC 6 は比例でなく,もっとかかっている.VC 14 では問題ない.VC 8 以降?は大丈夫だと思う.

C:\Users\Iwao>C:\Users\Iwao\AppData\Local\Temp\MICS.tmp\Temp\Test.exe\T_P_xm_q.exe
     61         0
     61         0
    122         0
    245         0
    489         0
    979         0
  1.91 K        0
  3.82 K        0
  7.64 K        0
 15.29 K        0
 30.58 K        0.016
 61.16 K        0.016
122.32 K        0.109
244.63 K        0.531
489.26 K        2.433
978.52 K        14.68
      0         0
      0         0
978.52 K        14.664
489.26 K        1.342
244.63 K        0.374
122.32 K        0.125
 61.16 K        0.016
 30.58 K        0.015
 15.29 K        0
  7.64 K        0
  3.82 K        0
  1.91 K        0
    979         0
    489         0
    245         0
    122         0
     61         0
     61         0
      0         0
      0         0

C:\Users\Iwao>

parse_xml_quot をグラフ化
修正のコードは,

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 ;
                    }
                }
            */
            size_t pos = ::String__Find(str,qm,*index+1) ;
            if (pos == tstring::npos) {
                q_str = str.substr(*index) ;
                *index = str.length() ;
                }
            else {
                size_t q_len = pos+1 - *index ;
                q_str = str.substr(*index,q_len) ;
                *index = pos ;
                }
            }
        }
    return q_str ;
    }

parsexml.hxx


2019/06/06
2019/01 のコードは属性の値のネスト(attr='”a” “b”‘)に対応できてないバグあり.


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

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.

ジブン専用パソコンキット2 Scratch

はじめようジブン専用パソコン」連載のバックナンバーのスクラッチをやってみた.
第4回 スクラッチに挑戦!
第5回 猫を使ったゲームをつくろう!
第6回 ゲームを完成させて、ネットにアップしよう!
リモートデスクトップでは Scratch は起動できない?そのため Scratch 2 を利用.

Scratch 2
Scratch 2


2019/01/08
「ファイルマネージャー」でのネットワークの参照

「ファイルマネージャー」でのネットワークの参照
ファイルマネージャー

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