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

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

2025年6月
1234567
891011121314
15161718192021
22232425262728
2930  

カテゴリー

アーカイブ

ブログ統計情報

  • 116,159 アクセス


CHttpFile を使用したアップロード

CHttpFile を使用したアップロードのコードを整理.
サーバ側は先日の php と同様.
https://jml.mish.work/index.php/i-tools/upload-htm-php.html


//*******************************************************************************
//	send request define
//	Create	:	2017/08/28
//*******************************************************************************
#define	C_CRLF			_T("\r\n") ;
#define	CT_ct_mp_fd_b_		_T("Content-Type: multipart/form-data; boundary=")
#define	CT_boundary__		_T("--")
#define	CD_cd_f_d_n_		_T("Content-Disposition: form-data; name=")
#define	CD_cd__fn_		_T("; filename=") ;
#define	CT_ct_a_o_s		_T("Content-Type: application/octet-stream")

//*******************************************************************************
//	make send data
//	Create	:	2017/08/28
//*******************************************************************************
inline	v_char	Make_send_data	(LPCTSTR upFile,LPCTSTR ___boundary)
{
	v_char	up_Data = v_c_Load (upFile) ;
	v_char	sndData ;
	{
		tstring	ct_boundary	= ___boundary ;
		tstring	file_img	= ::QuotM_Add(_T("file_img")) ;
		tstring	fileName	= ::QuotM_Add(::Path_GetName(upFile)) ;
		tstring	dataPre ;
		tstring	dataPst ;
		dataPre+=	CT_boundary__	+	ct_boundary				+	C_CRLF ;
		dataPre+=	CD_cd_f_d_n_	+	file_img	+	CD_cd__fn_	;
		dataPre+=							fileName	+	C_CRLF ;
		dataPre+=	T_ct_a_o_s								C_CRLF ;
		dataPre+=										C_CRLF ;
		dataPst+=										C_CRLF ;
		dataPst+=	CT_boundary__	+	 ct_boundary	+	CT_boundary__		C_CRLF ;
		v_char	vc_pref = ::To_v_char(::To__string(dataPre.c_str())) ;
		v_char	vc_post = ::To_v_char(::To__string(dataPst.c_str())) ;
		sndData.insert(sndData.end(),vc_pref.begin(),vc_pref.end()) ;
		sndData.insert(sndData.end(),up_Data.begin(),up_Data.end()) ;
		sndData.insert(sndData.end(),vc_post.begin(),vc_post.end()) ;
		}
	#ifdef	_DEBUG
	{
		::i_Dump(sndData,(::Path_GetName(upFile)+_T(".txt")).c_str()) ;
		}
	#endif
	return	sndData ;
	}

//*******************************************************************************
//	upload
//	Create	:	2017/08/28
//*******************************************************************************
inline	bool	UploadFile	(LPCTSTR svrName,LPCTSTR php,LPCTSTR upFile)
{
	{
		if (::File_IsNothing(upFile))			{	return	false ;		}
	//	if (::File_GetSize  (upFile) > 2048*1024)	{	return	false ;		}
		}
	tstring	head ;
	v_char	sndData ;
	{
		tstring	___boundary = _T("-----UpFile__2017_08_30") ;
			___boundary = _T("-----") + ::Path_GetName(_T(__FILE__)) + _T("__") + ::Now_Format(_T("%H%M%S")) ;
		head	= CT_ct_mp_fd_b_	+ ___boundary ;
		sndData = Make_send_data(upFile,  ___boundary.c_str()) ;
		}
	tstring	serverN = svrName ;
	tstring	portStr ;
	{
		v_tstring	strAry = ::String_Split(svrName,false,_T(":")) ;
		if (strAry.size() >= 2) {
			serverN = strAry[0] ;
			portStr = strAry[1] ;
			}
		}
	INTERNET_PORT	nPort = 0 ;
			nPort = ::ttou2(portStr) ;
	tstring		userAgent = _T("drop_up") ;
			userAgent = ::Path_GetName(_T(__FILE__)).c_str() ;
	#ifdef	_WIN32
	{
		userAgent = ::Path_GetName(::i_GetModuleFileName()) ;
		{
			tstring	osVer	= _T("Windows NT ") + ::To_tstring_rz(::GetWinVer_exe()) ;
				osVer	+=  tstring(_T(" "))+ Bracket_Add(::GetWinVerStr_exe(),_T('(')).c_str() ;
			userAgent += _T(" ") + osVer ;
			userAgent += EXE_AddVerBuildStr() ;
			}
		}
	#endif
	CInternetSession	session(userAgent.c_str()) ;
	CHttpConnection*	pServer = NULL ;
	CHttpFile*		pFile = NULL ;
	DWORD			dwStatus = 0 ;
	try	{
				pServer = session.GetHttpConnection(serverN.c_str(),nPort) ;
				if (pServer == NULL)				{	return	false ;		}
			{
				CString	headStr = head.c_str() ;
				pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_POST,	php) ;
				if (pFile == NULL)				{	return	false ;		}
				pFile->SendRequest(headStr,(LPVOID)(&sndData[0]),DWORD(sndData.size())) ;
				pFile->QueryInfoStatusCode(dwStatus) ;
				}
			{
				delete	(pFile) ;
				delete	(pServer) ;
				}
		}
	catch	(CInternetException* e) {
		CString	errMsg ;
		e->GetErrorMessage(errMsg.GetBuffer(1024),1024) ;
		errMsg.ReleaseBuffer() ;
		std::tout << LPCTSTR(errMsg) << std::endl ;
		return	false ;
		}
	session.Close() ;
	return	true ;
	}

//*******************************************************************************
//	upload files
//	Create	:	2017/08/29
//*******************************************************************************
inline	bool	UploadFiles	(c_v_tstring& upFiles)
{
	v_tstring	svr_php = ::UF_get_server_php() ;
	tstring		serverN = svr_php[0] ;
	tstring		phpName = svr_php[1] ;
	for (size_t index=0 ; index<upFiles.size() ; index++) {
		tstring	upFile = upFiles[index] ;
		if (::File_IsNothing(upFile))		{	continue ;		}
		if (!::UploadFile(serverN.c_str(),phpName.c_str(),upFile.c_str()))	{
			return	false ;
			}
		}
	return	true ;
	}

UploadFile


これらを使用したツールは以下にあります.
https://i-tools.mish.work/2019/10/up-htm.html


2020/09
日本語を含むファイル名のアップロード

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

データ送信 htm , php

html で複数のファイルを指定,php でそれを move_upload_file .


up_data.htm


<form enctype="multipart/form-data" action="up_data.php" method="POST">
    upload file:<br/>
    <input name="file_1" type="file" /><br/>
    <input name="file_2" type="file" /><br/>
    <input type="submit" value="send" />
    </form>


up_data.php


<?php
    if (!file_exists("./data")) {
        mkdir("./data") ;
        }
    foreach ($_FILES as $keys => $values) {
        $file_e = $values ;
        $tempfile =                $file_e[‘tmp_name’] ;
        $filename = ‘./data/’ .  $file_e[‘name’] ;
        if (is_uploaded_file($tempfile)) {
            move_uploaded_file($tempfile,$filename) ;
            }
        }
    $scan_f = scandir("./data") ;
    foreach ($scan_f as $key => $value) {
        echo $value . "<br/>\r\n" ;
        }
    ?>


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

DS115j が見えない

DS115j が見えなくなった.192.168.0.x では開ける.
外からも問題なく見えている.


幾つか試したが,変化なし.
 「ネットワークアダプタ」の無効化,有効化.
 PC の再起動.
 2 つのルータの再起動.
DS115j も再起動したいが,DSM に入れない.


暫くわからなかったが,WLI-UC-AG300N を見るとランプがついてない.
指し直すと,ランプも点滅して,うまく動作するようになった.

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

ダイアログバーに CCheckListBox

通常のダイアログに CCheckListBox を追加するには,次のような手順.
  CCheckListBox の使い方
ダイアログバーでは,次の様にしてもデータが表示されない.

CCheckListBox*  clb = (CCheckListBox*)m_wndDlgBar.GetDlgItem(IDC_CHECK_LB) ;
clb->AddString("....") ;

以前作成した,オーナー描画のドロップダウンを思い出しコードを見ると,

CMainFrame に変数を追加して,サブクラス化している.
CMainFrame::OnCreate でダイアログバーを Create した後,
 m_ODCB.SubclassDlgItem(IDC_COMBO,&m_wndDlgBar) ;

このコードの最初は,2004/07.
手元にある幾つかの本を見たが見つからなかった.
何を参考にしたかは今となっては不明.


LBN_SELCHANGE で選択された状態がイマイチ.
 内容を更新(PostMessage)するとインデックス 0 の項目に薄い点線が付く.
SendMessage として更新後,選ばれていた項目を SetCurSel することで対応.

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

iframe を右下に

左上を指定して下や右をフィットさせるのが意外と面倒だったので…


<!DOCTYPE html>
<html	lang="ja">
	<head>
		<meta	charset="UTF-8"	/>
		<title	>iframe</title>
		<style>
			body {
				margin		:	auto auto	auto auto	;
				overflow	:	hidden	;
				}
			</style>
		</head>

	<body>
		Text<br/>
		<iframe	
			src='/3D_Data/three_js/ThreeIMO.htm'	
			name='ifrm'
			style='
				position	:	absolute ;
				width   	:	99% ;
				height  	:	90% ;
				bottom  	:	2pt ;
				margin-left	:	2pt ;
				margin-right	:	2pt ;
				'
			>
			</iframe>
		</body>
	</html>

//itl.mish.work/~Iwao/…/test6/


2017/07/10 さらに変更したもの
itl.mish.work/…/to_wgl/

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

DS115j PHP 動作してない

DS115j を再起動したら,index.php が動作しなくなった.
 index.php の内容がそのまま表示される.
php を認識しなくなった様ではあるが,何で?


「Web Station」の設定で,一度「未構成」にして,「PHP x.x」で動作する様になった.

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

実行時のエラー 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

先週まで 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.

文字列の連結

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.

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.

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.

PHP が動かなくなっている

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

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


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

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

Synology NAS で CGI

今度は,CGI.
以前少しやってみたが,500 Internal Server Error となりそのままとなっていた.


cgi の先頭行の指定が怪しいと察しはついていたので検索すると,
通常は「#!/usr/bin/perl」か「#!/usr/local/bin/perl」とのこと.
それぞれのフォルダを見ると,
Iwao@DS115j:/usr/bin$
Iwao@DS115j:/usr/bin$ ls pe*
perl perror
Iwao@DS115j:/usr/bin$
Iwao@DS115j:/usr/bin$ cd /usr/local/bin/
Iwao@DS115j:/usr/local/bin$
Iwao@DS115j:/usr/local/bin$ ls pe*
perl perl5.24.0 perlbug perldoc perlivp perlthanks
Iwao@DS115j:/usr/local/bin$


さらに検索すると,改行の問題とのこと.
「#!/usr/bin/perl –」の様に後ろに “–” を付ければ良いらしい.
または,’LF’ にすれば良いみたい.
‘CR’ として試すと,”–” の有無に関係なく 502 Bad Gateway となってしまう.
また文字コードは,UTF-8 などを使用すると思うが,「BOM なし」の必要がある.


2021/01/03
SVG を出力するコード.

#!/usr/bin/perl --

print	"Content-type: text/html\n";
print	"\n";
print	"<!DOCTYPE html>\n";
print	"<html>\n";
print	"<head>\n";
print	"	<meta charset=\"utf-8\">\n";
print	"	<title>SVG</title>\n";
print	"	</head>\n";
print	"<body>\n";
print	"	<svg  viewBox=\"0 0 100 100 \"  xmlns=\"http://www.w3.org/2000/svg\" >\n";
print	"		<rect x=\"15\" y=\"10\" width=\"70\" height=\"40\" stroke=\"blue\" fill=\"white\" />\n";
print	"		</svg>\n";
print	"	</body>\n";
print	"</html>\n";

cgi draw_rect svg
/i_Tools/…/cgi/drawrect.cgi


更に cpp として書いたコード.
g++ drawrect.cpp として出来上がった a.out を rect_cpp.cgi としてコピー.
drawrect.cpp
/i_Tools/…/cgi/rect_cpp.cgi


https://jml.mish.work/index.php/various/nas/synology-nas.html

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

現在の時刻を文字列に

C++
 time_t tim_v = ::time(NULL) ;
 struct stm = ::localtime(&tim_v) ;
 tstring buff ;
 size_t size = 255 ;
 buff.resize(size+1,0) ;
 ::_tcsftime(&buff[0],size,_T(“%Y/%m/%d %H:%M:%S”),&stm) ;
 tstring str = buff.c_str() ;

MFC
 CString str = CTime::GetCurrentTime().Format(_T(“%Y/%m/%d %H:%M:%S”)) ;

JavaScript
 var time = new Date() ;
 var y_ = time.getFullYear() ;
 var m_ = time.getMonth() + 1 ;
 var d_ = time.getDate() ;
 var hh = time.getHours() ;
 var mm = time.getMinutes() ;
 var ss = time.getSeconds() ;
 var str= (y_+”/”+m_+”/”+d_+” “+hh+”:”+mm+”:”+ss) ;

PHP
 date_default_timezone_set(‘Asia/Tokyo’) ;
 $str = date(“Y/m/d H:i:s”) ;

timefmt.hxx

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

コンソール AP で MFC

コンソール AP で,MFC(AfxWin.h など)に依存したコードを利用


新しく書いたものは,次の様なコードで可能.

  #include	"EnhMetaF.hxx"
  #include	"i_trace.hxx"
  
  int _tmain(int argc, TCHAR* argv[])
  {
    	_tsetlocale(LC_ALL,_T("")) ;
    	{
      		EnhMetaF	emf ;
      		CMetaFileDC*	mfdc = emf.GetDC() ;
      		mfdc->Rectangle(10,10,30,20) ;
    		}
    	return 0 ;
    	}

古いコードは,うまく対応できてないので…

  #undef  	_CONSOLE
  #include	<AfxWin.h>
  #include	<AfxExt.h>
  #include	<AfxCmn.h>
  #ifdef	_WIN32
  #define  	_WINDOWS
  #endif
  #include	"MessCon.hxx"
  #include	"MessBar.hxx"
  #ifdef	MessageBar
    #undef	MessageBar
    #define	MessageBar	MessageCon
    #undef	I_SUPPORT_MESSAGE_MFC
  #endif
  #include	"MessWrap.hxx"
  // ...
  int _tmain(int argc, TCHAR* argv[])
  {
    	#ifdef	_MFC_VER
    	if (!::AfxWinInit(::GetModuleHandle(NULL),NULL,::GetCommandLine(),0)) {
      		return	1 ;
      		}
    	#else
    	_tsetlocale(LC_ALL,_T("")) ;
    	#endif
    //	...
    	}

undef の幾つかは,自コードの対応のために必要.

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

vector 要素の削除

MSDN vector::erase
MFC の CArray::RemoveAt(index,count=1)
 先頭要素の削除
  v1.erase( v1.begin( ) );
 [1] の削除
  v1.erase( v1.begin( )+1 );

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

コンマ演算子

古いデバッグ用のコードを見ていたら,こんなのがあった.
 while (_ftprintf(stderr,_T(“%s=”),_T(“入力してください”)) ,
  _fgetts(buf,sizeof(buf),stdin) != NULL) { … }


最近あまりこの様なコードを書くことがなく忘れていた.
 while の条件式の括弧の中に複数の文.コンマで区切られている.
 for ではインクリメントなどの変化式で使う.


MSDN コンマ演算子: ,
 次の様にすると,i には c が代入されるらしい.
   i = ( b , c ) ;
 括弧がないと b .
   i = b , c ;


MSDN コンマ演算子 (,) (JavaScript)
JavaScript でも同じ様な動作なら,今やっている所で使えそう.

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

SceneJS

Cube.imo (0,0,0)-(1000,1000,1000) のデータに対して,
 translate X:-500 , y:-500 , z:500


spinYaw で,回転.spinPitch は上下方向.
yaw , pitch で最初の位置(角度で単位は度?).
zoom が中心までの相対位置?
zoomSensitivity は拡大率.
 yaw : 30 ,
 pitch : -10 ,
 zoom : 2500,
 zoomSensitivity : 100 ,
 spinYaw : 0.3 ,
cube_imo.html


yaw : 90 で右から.180 で後ろから.
pitch : -20 としているので,
 translate の y は中心でなく高さの 30% の位置にしている.
どうも材質の指定(obj の mtl など)は,効いてないみたい.
 script 内の type:”texture” , src: … で指定する?

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

html style

今まで HTML の範囲としていたので次の様にしていたが,
 static Xml_E img   (c_tstring& src) {
   Xml_E img_(HTM_img) ;
     img_.AddAttribute(HTM_src,src) ;
   return img_ ;
   }

 static Xml_E img_b  (c_tstring& src) {
   Xml_E img = HtmOut::img(src) ;
     img.AddAttribute(HTM_border,_T("1")) ;
   return img ;
   }
 static Xml_E img_b_at_w (c_tstring& src,c_tstring& name,c_tstring& width) {
   Xml_E img = HtmOut::img_b(src) ;
     img.AddAttribute(HTM_alt, name) ;
     img.AddAttribute(HTM_title, name) ;
    if (!width.empty()) {
     img.AddAttribute(HTM_width, width) ;
     }
   return img ;
   }

css を利用することにより,もう少し簡単にできそう.


ここの記述で,タブサイズを指定したが,
<code style=” -o-tab-size: 4 ; -moz-tab-size: 4 ; tab-size: 4 ;”>
Blogger では,記事を書いて「保存」すると” “(半角スペース)に置換えられてしまう.


css のコメントは,C 等の様に /* */

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

BRD-UT16WX 追加

BRD-UT16WX を追加.
KYLIE HITS DVD EDITION の DVD を再生できることは確認.
BTF BD は,再生できてない.この環境(T5400)ではできないのか?


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