ホーム » Iwao の投稿 (ページ 38)

作者アーカイブ: Iwao

2025年5月
 123
45678910
11121314151617
18192021222324
25262728293031

カテゴリー

アーカイブ

ブログ統計情報

  • 114,655 アクセス


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.

php post , get の全ての引数を取得

$_REQUEST , $_GET など.

function  get_request_str () {
  $req ;
  foreach ($_REQUEST as $key => $value) {
   $req = $req . "$key=$value" . " " ;
   }
  return $req ;
  }
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Synology g++ DrawLog.cpp

前回 mac 上で動作する様にしたものを DS115j に.
CPATH などの設定も mac と同じ様な感じで指定.


php から呼び出し,実行ファイルが起動していることは確認できていた.
 DSM の「リソース モニタ」-「プロセス」で確認.
が,結果が正しく表示されない.
ssh で接続しての起動では正しく動作している.
原因は,デバッグ用にデータをダンプしていたディレクトリのアクセス権の設定.
書き込み可能にして OK

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

HVL-S3 追加

HVL-S3 を追加.本当は HVL-DR が欲しかったが,ちょっと高いので…


HDL-AHW を持っているので,「DiXiM Digital TV plus for I-O DATA」で再生.
  この AP が不安定なのは AHW と同様だが,他は特に問題ない.
AHW からの「コンテンツの操作」は他の機器と同様.

HVL-S での「コンテンツの操作」の「他から…」はできないみたい.
  コンテンツのチェック欄がない.
  「持ち出せる番組」にあるものはチェック欄がある.


2017/06/06
Z2 などでの再生は OK .
REC-ON HVTR-BCTX3 付属のテレキングプレイでは再生できないみたい.

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

g++ DrawLog.cpp

今まで xcode を利用していたが,他の PC からビルドするために…


コードは次の様なもの.ほとんどの動作はi_DrawLG.hxx 内に.
 // カレントのファイルを成型してファイルに出力
 #include “i_DrawLg.hxx”
 #include <iostream>
 int _tmain (int argc,TCHAR* argv[])
 {
   _tsetlocale(LC_ALL,_T(“”)) ;
   {
    std::tout << ::GetCWD() << std::endl ;
    }
   tstring logPath = _T("./") ;
   #ifdef _WIN32
     logPath = ::Get_i_Tools_tmp() ;
   #endif
   ::PL_DrawLog(logPath) ;
   return 0 ;
   }
 //———————–
 #include "MessBar.cxx"


次の様に -I で指定すれば,include が機能するのは知っていたが…
 g++ DrawLog.cpp -I/Users/…/__CPR_ -I/Users/…/__Iwao
環境変数を利用する様に
 export CPATH=/Users/…/__CPR_
 export CPATH=/Users/…/__Iwao:$CPATH
これらをスクリプトファイルに登録.
 呼出し元にも反映させるには bash env.sh ではなく
  source env.sh とする必要があるらしい.
sh ファイルを MIFES で編集していて,微妙にうまく動作していない.
 原因は改行コードで,「LF」で保存.
これで g++ DrawLog.cpp としてビルドできる様になった.


実行すると,Segmentation fault: 11.
xcode でもテストしてなかったのでデバッグすると,
 readdir で EXC_BAD_ACCESS .
ここは _WIN32 では通らないのでデバッグが不十分な部分.
 原因は,与えているファイルが
  ディレクトリでなかった.
  ファイルが存在していなかったこと.
コードを修正して OK .

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

Synology NAS で gcc

2022/06
https://dev.mish.work/wordpress/2022/06/15/ds116-entware/


2022/03
https://dev.mish.work/wordpress/2022/03/13/ds220-setup-4-opkg/


ssh などで接続した DS115j 上で, gcc などを使える様にするために…
ipkg や Opkg が必要らしい.
Install on Synology NAS
日本語で説明されている所があったので,参考にさせてもらった.
 2016/06/29 Synology DS216j Entware-ng 導入


次の様なコードを g++ でコンパイルして ./a.out を生成.

#include <iostream>

int main() {
	std::cout << "hello c++ php" << std::endl ;
	return 0 ;
	}

exec.php を開くと,
php から a.out の呼び出し


ASUSTOR NAS
QNAP NAS

Synology NAS DS223j

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

Web + exe

最終的に目指したい所は,
IIS+PHP 環境で exe を呼び出し
参考にさせてもらったのは,
第3回 極めてシンプルなCGIを体験する.


C:\...\Iwao>"C:\...\testCGI2\DmpSVG.exe"
Content-Type: text/html
 
<?xml version="1.0" encoding="UTF-8"?>
<svg  xmlns="http://www.w3.org/2000/svg"  >
    <rect x="15" y="10" width="70" height="40" stroke="blue" fill="white" />
    </svg>
 
C:\...\Iwao>

mac で,
先ず,php から ls の呼び出し.
exec_ls.php

 <?php
  system('ls') ;

ターミナルで実行(php exec_ls.php)すると,
ターミナルで php exec_ls.php
php から a.out の呼び出し.
main.cpp

 #include <iostream>
 int main() {
  	std::cout  <<  "hello c++ php"  <<  std::endl ;
  	return 0 ;
  	}

g++ main.cpp としてコンパイル.
exec.php
 <?php
  system('./a.out') ;

ターミナルで php から a.out の呼び出し
ターミナルから php -S 127.0.0.1:8000 などとしておくと,
php から a.out の呼び出し


DS115j で,
php から ls の呼び出しまでは同様.
Iwao@DS115j:~/www/T_php/temp/test$
Iwao@DS115j:~/www/T_php/temp/test$ ls
exec_ls.php index.php main.cpp
Iwao@DS115j:~/www/T_php/temp/test$
Iwao@DS115j:~/www/T_php/temp/test$ php exec_ls.php
exec_ls.php
index.php
main.cpp
Iwao@DS115j:~/www/T_php/temp/test$
Iwao@DS115j:~/www/T_php/temp/test$

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

Synology php

PHP 5.6 7.0
itl.mydns.jp/I****/phpinfo.php 5.6.30 7.0.16
itl.mydns.jp/~I***/phpinfo.php 5.6.30 5.6.30
itl.mydns.jp/~i_**/phpinfo.php  500  500
php -v 5.6.11 5.6.11
mac php -v 5.5.38
_SERVER[“SERVER_SOFTWARE”] 2.2 2.4 Nginx
itl.mydns.jp/I****/phpinfo.php 2.2.31 2.4.25 1.11.10
itl.mydns.jp/~I***/phpinfo.php 2.2.32 2.2.31 2.2.31
mac httpd -v 2.4.18
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

T5400 が…

離れていて戻ってくると T5400 が,

DSC_0192

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

PHP が動かなくなっている

Synology のパーソナルウェブサイトで PHP が動かなくなった?

先日までは動作していたと思う.
アップデートで設定が変わってしまったのか?


2017/05/10
DSM と Web Station のアップデートがあったので更新したら直った?

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

3D Builder 0x80510018

データにより,3D Builder の読込で 0x80510018 エラーに.

以前の 3mf 出力では,テクスチャファイル名を数字と ‘_’ にしていたが,
 先日他の 3D 形式の関係で,7 bit の文字の範囲に変更した.
どうもこれがいけなかったみたいで,
 3mf で出力する時は,newName.Format(_T(“Tex_%03d.png”),tIndex+1) に修正.

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