ホーム » 2017 » 6月

月別アーカイブ: 6月 2017

2017年6月
 123
45678910
11121314151617
18192021222324
252627282930  

カテゴリー

アーカイブ

ブログ統計情報

  • 79,625 アクセス



実行時のエラー OpenMP

普段通っているコードなのに,ある条件(操作)で実行時にエラー.
エラーの場所はある範囲(DelFileE への登録)ではあるが,固定されてない.
 CStringArray に CString の追加.
コールスタックを見ると MakeFace$omp$1 とある.


   ucrtbased.dll!__VCrtDbgReportA () 不明
   ucrtbased.dll!__CrtDbgReport () 不明
   mfc140ud.dll!AfxAssertFailedLine(const char * lpszFileName, int nLine) 行 333 C++
   mfc140ud.dll!CWnd::DestroyWindow() 行 1055 C++
   mfc140ud.dll!CToolTipCtrl::DestroyToolTipCtrl() 行 73 C++
   mfc140ud.dll!AFX_MODULE_THREAD_STATE::~AFX_MODULE_THREAD_STATE() 行 253 C++
   mfc140ud.dll!AFX_MODULE_THREAD_STATE::`scalar deleting destructor'(unsigned int) C++
   mfc140ud.dll!CThreadSlotData::DeleteValues(CThreadData * pData, HINSTANCE__ * hInst) 行 354 C++
   mfc140ud.dll!CThreadSlotData::DeleteValues(HINSTANCE__ * hInst, int bAll) 行 396 C++
   mfc140ud.dll!AfxTermLocalData(HINSTANCE__ * hInst, int bAll) 行 494 C++
   mfc140ud.dll!DllMain(HINSTANCE__ * hInstance, unsigned long dwReason, void * __formal) 行 663 C++
   mfc140ud.dll!dllmain_dispatch(HINSTANCE__ * const …, void * const reserved) 行 195 C++
   mfc140ud.dll!_DllMainCRTStartup(HINSTANCE__ * const …, void * const reserved) 行 248 C++
   ntdll.dll!_LdrpCallInitRoutine@16 () 不明
   ntdll.dll!_LdrShutdownProcess@0 () 不明
   ntdll.dll!_RtlExitUserProcess@4 () 不明
   kernel32.dll!_ExitProcessStub@4 () 不明
   ucrtbased.dll!__crt_hmodule_traits::close(struct HINSTANCE__ *) 不明
   ucrtbased.dll!__crt_hmodule_traits::close(struct HINSTANCE__ *) 不明
   ucrtbased.dll!__Exit () 不明
   ucrtbased.dll!_raise () 不明
   ucrtbased.dll!__acrt_lock_and_call<class <lambda_fe…55> >(enum __acrt_lock_id,class <…; &&) 不明
   ucrtbased.dll!___acrt_MessageWindowA () 不明
   ucrtbased.dll!__VCrtDbgReportA () 不明
   ucrtbased.dll!__CrtDbgReport () 不明
   mfc140ud.dll!AfxAssertFailedLine(const char * lpszFileName, int nLine) 行 333 C++
   mfc140ud.dll!CStringArray::SetSize(int nNewSize, int nGrowBy) 行 165 C++
   mfc140ud.dll!CStringArray::SetAtGrow(int …, const ATL::CStringT<wchar_t,… > & newElement) 行 265 C++
   mfc140ud.dll!CStringArray::Add(const ATL::CStringT<wchar_t, … > & newElement) 行 322 C++
   BlockIn.exe!DelFileE::Add(const wchar_t * fileName) 行 51 C++
   BlockIn.exe!CacheFile::GetCF_Name(const wchar_t * srcName, const unsigned int dibWidth) 行 415 C++
   BlockIn.exe!PartsA_To::ToIPX(const wchar_t * ipxName) 行 257 C++
   BlockIn.exe!PartsA_To::DumpDebug(const int delFE, const wchar_t * pre_) 行 297 C++
   BlockIn.exe!PartsA_To::DumpDebug(const wchar_t * pre) 行 47 C++
   BlockIn.exe!PartsA_Fnc_DebugDump(PartsA & partsAry, const wchar_t * pre) 行 818 C++
   BlockIn.exe!MaPat__DebugDump(const Parts & parts) 行 3293 C++
   BlockIn.exe!MaPat::MakePartsFace(const int makeEdge) 行 3481 C++
   BlockIn.exe!BAPat::MakePartsFace(const int makeEdge) 行 1508 C++
   BlockIn.exe!BAPat::GetPartsFace(const int makeEdge) 行 1935 C++
   BlockIn.exe!BlockInf::MakeFace(const int makeEdge) 行 3465 C++
> BlockIn.exe!BlockLay::MakeFace$omp$1() 行 4320 C++
   [外部コード]


次の様に #pragma omp critical を追加.
  BOOL DelFileE::Add (LPCTSTR fileName)
  {
     #ifdef _OPENMP
       #pragma omp critical (DelFileE_Add)
     #endif
     {
       CString filePath = ::FolderDelLastSP(fileName) ;
       DelFileName.Add(filePath) ;
       }
     return TRUE ;
     }

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

IIS+PHP-2

先日 php のインクルードなどに PHP_OS を利用していたが,
  $base = “/…/web” ;
  if (PHP_OS == ‘WINNT’) { $base = “c:/…/web” ; }
  else { $base = “/…/web” ; }
  include ($base . “/_lib/…/log.php”) ;
$_SERVER[“DOCUMENT_ROOT”] を見つけたので,
  include ($_SERVER[“DOCUMENT_ROOT”] . “/_lib/…/log.php”) ;


他に,実行ファイルは OS に合った指定が必要な様で,
 <?php
   include ($_SERVER[“DOCUMENT_ROOT”] . “/…/log.php”) ;
   logging () ;
   exec (change_sp(“./bin/DrawNow”)) ;
   // …
   ?>
Synology/DrawNow/

IIS 7/DrawNow/

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

DS115j 3D データ読込

今度は,imo(obj を拡張した 3D データ)の読込み.


次の様なコードで …/…imo  -nan -nan -nan となってしまう.
   GonsA ga = ::OBJ_ToGonsA(imoFile.c_str()) ;
   std::tout << imoFile << _T("\t") ;
   std::tout << ::V3_To_tstring(::GonsA_GetVolume(ga)) << std::endl ;


単純に読込んで,保存するのは OK .
   v_tstring txtAry = ::LoadTextFile(imoName.c_str()) ;
   ::SaveTextFile((imoName+_T(“.mox”)).c_str(),txtAry) ;
3D データとして取り込み,出力すると,全体的に -nan や nan となる.
   GonsA gt = ::OBJ_ToGonsA(imoName.c_str()) ;
   ::GonsA_ToOBJ(gt,_T(“./7_boxes.mox”)) ;


次の様にすると
   long v1 = ::ttoi4(_T(“10”)) ;
   long v2 = ::ttoi4(_T(“10 “)) ;
   long v3 = ::ttoi4(_T(“10.5”)) ;
   double f1 = ::ttof (_T(“10”)) ;
   double f2 = ::ttof (_T(“10 “)) ;
   double f3 = ::ttof (_T(“10.5”)) ;
   double d1 = ::ttod (_T(“10”)) ;
   double d2 = ::ttod (_T(“10 “)) ;
   double d3 = ::ttod (_T(“10.5”)) ;
   Vl3 v(v1,v2,v3) ;
   Vd3 f(f1,f2,f3) ;
   Vd3 d(d1,d2,d3) ;
   std::tout << ::V3_To_tstring(v) << std::endl ;
   std::tout << ::V3_To_tstring(f) << std::endl ;
   std::tout << ::V3_To_tstring(d) << std::endl ;
本来は,
  10 10 10
  10 10 10.5
  10 10 10.5
DS115j では,
  10 10 10
  0 0 0
  -nan -nan -nan


内部的に呼んでいるのは,strtol と strtod など.


2017/06/20
atof も同様.
sscanf を利用することで対応.
  double ttod_scan (LPCTSTR str) {
     double value = 0 ;
     sscanf(str,_T(“%lg”),&value) ;
     return value ;
     }
 
原因と言うか対応は次の内容と同じなのかとは思うが,
 個人的に理解できるレベルには達していない.
Armadillo-840でstrtodを使った浮動小数点文字列の変換が出来ない

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

WLI-UC-AG300N 追加

DS115j 用に WLI-UC-AG300N を追加.

DSM の「コントロールパネル」-「ネットワークマップ」には次の 3 つがある.
 ワイヤレス AP
 ワイヤレス ルーター
 ワイヤレス ネットワークに接続する
やりたかったのは,どちらかと言うと DHCP サーバ.
 「ワイヤレス ルーター」として,Android などからの接続を確認.


2017/06/19
以前購入して使ってなかった LAN-RPT01BK で子機として HUB に接続.
LAN 内は意図した動作となったが,Internet 接続が不安定になった.
はっきりわからないが「ネットワークの場所」が,増えてしまった影響か?
次の所を参考にさせてもらって,増えたものを削除.
  Windows 7の「ネットワークの場所」を結合・削除する

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

DSM 更新で…

DSM を更新した影響か? g++ などが通らなくなってしまった.


sudo -i
 
mkdir -p /volume1/@entware-ng/opt
ln -sf /volume1/@entware-ng/opt /opt
 
wget -O - http://pkg.entware.net/binaries/armv7/installer/entware_install.sh | /bin/sh
 
root@DS115j:/etc# cat rc.local
#!/bin/sh
#
/bin/ln -sf /volume1/@entware-ng/opt /opt
/opt/etc/init.d/rc.unslung start
#
 
/root/.profile
. /opt/etc/profile
 
reboot

sudo -i
opkg -v


また,更新してしばらく?は,何か動作が安定していない気がする.
php や c++ での動作が何か変?

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

IIS+PHP

先週まで DS115j 上の PHP と exe環境を作っていたが,今度は IIS 上の PHP .
次の所を参考にさせてもらった.
 Windows 8/7/Vista に PHP をインストール
 IIS での PHP Web サイトの構成
以前の Win7 に IIS を入れた環境に設定.


PHP がうまく動作しているかの確認は,
 コマンドプロンプトで,php -v や php -r “phpinfo() ;” .

 次の内容を php として保存し,ブラウザで開く.
  <?php phpinfo(); ?>


DS115j 上で動かしたものと同等の日時の表示は,何とか動作する様になった.
ほとんどが C++ のコードなので,今回の範囲ではあまり変更はなかった.
ただ exe を呼出す PHP のパスの指定や %TMP% にあたる部分がいろいろとありそう.
パス区切りは,’/’,’\’,’\\’ などで動作するみたいだが完全なのは ‘\\’ か?
ハードコードの部分は ‘/’ として PHP_OS により ‘\\’ に変換する関数を用意する.
 コードは次の様なもの.
   function Path_Normalize ($path_) {
     $path = $path_ ;
     if (PHP_OS == ‘WINNT’) {
       $path = str_replace (“/”,DIRECTORY_SEPARATOR,$path) ;
       }
     return $path ;
     }


単に,str_replace で良さそう.
  $path = str_replace (“/”,DIRECTORY_SEPARATOR,$path) ;
c の関数マクロの様な使い方はわからなかったので,change_sp($path) の関数とした.
さらに,php ファイルのインクルードは次の様な感じで振り分け.
   if (PHP_OS == ‘WINNT’) {
     include (“./lib.php”) ;
     }
   else {
     include (“/…/i_lib/2017.06/lib.php”) ;
     }


用途によっては,realpath でもいける?

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

T5400 …


C ドライブの空きが 10 GB 程度だったので,35 GB まで空けて様子見.
これで解消すると助かるのだが…

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

moto g5

MR03LN も 2 年になったのと,107SH の調子が…
内蔵メモリが足りなくて,AP の更新ができなかったり,SMS が受信できないなど.
それと丁度のタイミングで,3GB でもシェア SIM が利用できる様になったので,Moto G5 追加.


107SH だったこともあるが,やはり大きい.
今は当たり前なのかもしれないが,指紋認証センサの使い勝手が良い.
WebGL(three.js)のデータの表示が,思ったより遅い.
私の使い方では,バッテリーは 24 時間持つ.

moto g5

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

T5400 また …

戻ってきたらまた,

DSC_0195

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

DS115j std::tostringstream

DS115j で,次の様なコードの str が “123” にならない(”0″ になる).


 {
   double checkValue = 123 ;
   tstring str ;
   std::tostringstream strBuf ;
   {
     strBuf << checkValue ;
     str = strBuf.str() ;
     }
   // …
   }


sprintf を利用することで対応.
 {
   std::string str ;
   tstring fmt = _T(“%.”) + ::To_tstring(p) + _T(“f”) ;
   str.resize(512,0) ;
   sprintf(&str[0],fmt.c_str(),v) ;
   // …
   }

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

文字列の連結

C++ tstring  strS = str1 + str2 ;
CString strM = str3 + str4 ;
JavaScript var str = str1 + str2 ;
VBScript Dim str As String
str = str1 & str2
PHP $str = $str1 . $str2 ;
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

DS115j Web での日本語

DS115j の標準出力をブラウザで表示すると,日本語部分が表示できない.


コードはこんな感じ.

  #include	"i_DrawLg.hxx"
  #include	<iostream>
  int	_tmain	(int argc,TCHAR* argv[])
  {
	_tsetlocale(LC_ALL,_T("")) ;
	tstring	orgCode1 = _T("ostrstream-%E3%81%AE%E5%88%A9%E7%94%A8%E3%81%A7%E3%83%A1%E3%83%A2%E3%83%AA%E3%83%AA%E3%83%BC%E3%82%AF/") ;
	tstring	orgCode2 = _T("url=http%3A%2F%2Fiwao.synology.me%2Fwordpress%2Fdev%2F2011%2F12%2F01%2Fvirtual-pc-%25E3%2581%258C%25E9%2581%2585%25E3%2581%2584%2F&usg=AFQ") ;
	tstring	deco_1_1 = ::PL_Decode_url(orgCode1) ;
	tstring	deco_2_1 = ::PL_Decode_url(orgCode2) ;
	tstring	deco_1_2 = ::PL_Decode_url(deco_1_1) ;
	tstring	deco_2_2 = ::PL_Decode_url(deco_2_1) ;
	std::tout <<    tstring(orgCode1.c_str()) << std::endl ;
	std::tout <<  ::UTF8_To(deco_1_1.c_str()) << std::endl ;
	std::tout <<  ::UTF8_To(deco_1_2.c_str()) << std::endl ;
	std::tout <<    tstring(orgCode2.c_str()) << std::endl ;
	std::tout <<  ::UTF8_To(deco_2_1.c_str()) << std::endl ;
	std::tout <<  ::UTF8_To(deco_2_2.c_str()) << std::endl ;
	return	0 ;
	}

コンソールでの出力 Iwao@DS115j:~/www/T_php/temp/test/DecodeU$ Iwao@DS115j:~/www/T_php/temp/test/DecodeU$ php index.php <pre> ostrstream-%E3%81%AE%E5%88%A9%E7%94%A8%E3%81%A7%E3%83%A1%E3%83%A2%E3%83%AA%E3%83%AA%E3%83%BC%E3%82%AF/ ostrstream-の利用でメモリリーク/ ostrstream-の利用でメモリリーク/ url=http%3A%2F%2Fiwao.synology.me%2Fwordpress%2Fdev%2F2011%2F12%2F01%2Fvirtual-pc-%25E3%2581%258C%25E9%2581%2585%25E3%2581%2584%2F&usg=AFQ url=http://iwao.synology.me/wordpress/dev/2011/12/01/virtual-pc-%E3%81%8C%E9%81%85%E3%81%84/&usg=AFQ url=http://iwao.synology.me/wordpress/dev/2011/12/01/virtual-pc-が遅い/&usg=AFQ </pre> Iwao@DS115j:~/www/T_php/temp/test/DecodeU$
ブラウザでの出力 ostrstream-%E3%81%AE%E5%88%A9%E7%94%A8%E3%81%A7%E3%83%A1%E3%83%A2%E3%83%AA%E3%83%AA%E3%83%BC%E3%82%AF/ ostrstream- ostrstream- url=http%3A%2F%2Fiwao.synology.me%2Fwordpress%2Fdev%2F2011%2F12%2F01%2Fvirtual-pc-%25E3%2581%258C%25E9%2581%2585%25E3%2581%2584%2F&usg=AFQ url=http://iwao.synology.me/wordpress/dev/2011/12/01/virtual-pc-%E3%81%8C%E9%81%85%E3%81%84/&usg=AFQ url=http://iwao.synology.me/wordpress/dev/2011/12/01/virtual-pc-

どこかの設定の問題とは思うが,場所がわからない.
それとも,変換がかかる部分を NOP とすべきか?


2017/06/02
Linux の場合 UTF8 となっていると思うので,::UTF8_To をしなくても良いはず.
Windows の場合は,tstring への変換(UTF8 から S-JIS または UTF16)が必要.
UTF8_To を _MSC_VER で振り分ける様に修正.


と思ってやって,上のコードではクリアしたが,
他にもうまくないコードがある様で,drawlog.htm が途中で切れている.
(/tmp/…/i_Tools.tmp/…/dump.txt は意図したデータで出力されている)


html 出力 (HtmOut::Export) の ::SaveUTF8 から呼んでいる ::To_UTF8 も同様に修正.
Windows の場合は,tstring (S-JIS または UTF16)から UTF8 の変換が必要.

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