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

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

2025年6月
1234567
891011121314
15161718192021
22232425262728
2930  

カテゴリー

アーカイブ

ブログ統計情報

  • 116,000 アクセス


ファイルの検索

あるフォルダ内のファイルを列挙するコード 

MFC
v_tstring	EnumFiles_MFC	(c_tstring& path,const bool skipDot=true)
{
	v_tstring	foundFiles ;
	{
		iFileFind	ff ;
		BOOL		isWorking = ff.FindFile((::Path_AddLastSP(path)+_T("*.*")).c_str()) ;
		while	(isWorking)	{
			 	isWorking = ff.FindNextFile() ;
			if (skipDot && ff.IsDots()) {	continue ;	}
			tstring	fileName = ff.GetFileName() ;
			if (ff.IsDirectory()) {
				fileName = ::Path_AddLastSP(fileName) ;
				}
			foundFiles.push_back(::Path_AddLastSP(path)+fileName) ;
			}
		}
	return	foundFiles ;
	}

MSC
v_tstring	EnumFiles_MSC	(c_tstring& path,const bool skipDot=true)
{
	v_tstring	foundFiles ;
	{
		tstring	fffPath = ::Path_AddLastSP(path)+_T("*.*") ;
		WIN32_FIND_DATA	fd ;
		memset(&fd,0,sizeof(WIN32_FIND_DATA)) ;
		HANDLE	hFind = ::FindFirstFile(fffPath.c_str(),&fd) ;
		if (hFind != INVALID_HANDLE_VALUE) {
			while	(TRUE)	{
				tstring	fileName = fd.cFileName ;
				if (skipDot) {
					if (fileName == _T("."))   {	fileName = _T("") ;	}
					if (fileName == _T(".."))  {	fileName = _T("") ;	}
					}
				if (!fileName.empty()) {
					if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
						fileName = ::Path_AddLastSP(fileName) ;
						}
					foundFiles.push_back(::Path_AddLastSP(path)+fileName) ;
					}
				if (!::FindNextFile(hFind,&fd)) {
					break ;
					}
				}
			::FindClose(hFind) ;
			}
		}
	return	foundFiles ;
	}

GNUC
v_tstring	EnumFiles_GNUC	(c_tstring& path_,const bool skipDot=true)
{
	tstring 	path = path_ ;
	v_tstring	foundFiles ;
	{
		DIR*	dp = ::opendir(path.c_str()) ;
		struct	dirent*	dent = NULL ;
		do	{
			dent = readdir(dp) ;
			if (dent != NULL)	{
				tstring	fileName = dent->d_name ;
				if (skipDot) {
					if (fileName == _T("."))   {	continue ;	}
					if (fileName == _T(".."))  {	continue ;	}
					}
				if (dent->d_type & DT_DIR) {
					fileName = ::Path_AddLastSP(fileName) ;
					}
				foundFiles.push_back(::Path_AddLastSP(path)+fileName) ;
				}
			}	while (dent != NULL) ;
		::closedir(dp) ;
		}
	return	foundFiles ;
	}

MFC 版で,iFileFind としているのは,VC 6 MFC MBCS 版でのバグのため.

class	iFileFind	:	public	CFileFind	{
	public:
		virtual	CString GetFilePath() const	{
			ASSERT(m_hContext != NULL);
			ASSERT_VALID(this);
			CString strResult = m_strRoot;
			#ifdef	____VC_6_______MBCS_BUG___
			{
				if (strResult[strResult.GetLength()-1] != '\\' &&
					strResult[strResult.GetLength()-1] != '/')	{
					strResult += m_chDirSeparator;
					}
				}
			#else
			{
				LPCTSTR pszResult;
				LPCTSTR pchLast;
				pszResult = strResult;
				pchLast = _tcsdec( pszResult, pszResult+strResult.GetLength() );
				VERIFY(pchLast!=NULL);
				if ((*pchLast != _T('\\')) && (*pchLast != _T('/')))	{
					strResult += m_chDirSeparator;
					}
				}
			#endif
			strResult += GetFileName();
			return strResult;
			}
		} ;

MFC 7 以降であれば,CFileFind として利用可能.


i_FileF.hxx
enumfile.hxx

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

vector<Xxxx<T>> の利用でのエラー

template <class T> Extent2<T> E2_GetExtent (const std::vector<VLine2<T>>& lins)     //  エラー
template <class T> Extent2<T> E2_GetExtent (const std::vector< VLine2<T> >& lins)   //  OK

vector<VLine2<T>> の様にスペースがないとエラーになる.
vector<  VLine2<T>  > の様に空ければ OK .

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

ActiveX.exe , ActiveX.dll の登録

何年かに 1 度ある問合せ.普段あまりやってないとすぐ忘れてしまう.

dll や ocx の登録は,RegSvr32 .
 管理者として起動したコマンドプロンプトで,以下の様に入力して登録できる.
  RegSvr32.exe ActiveX.dll
 RegSvr32 で ocx などの登録
 OCX x64
exe は,管理者として起動したコマンドプロンプトで実行.
  ActiveX.exe
 IIS 環境の再設定

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

Magical Finder + WN-AC1167R

moto g5 を Android 8.1 に更新した.

ダウンロードする所の評価はかなり低いが…
Android 7 の時もそうだったが,特に問題なし.

「Web設定画面を開く」で,正しく開くことができる.


Magical Finder は,IPv4 のアドレスを調べる程度の利用.
今は ASUS Router アプリ があるので,あまり必要ではない.

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

STL(Stereolithography) 読込みで…

STL(Stereolithography,Standard Triangulated Language) バイナリ読込みで,VC 14 でビルドした exe でダウンする.
VC 6 でビルドしたものは通っているが,たまたまエラーにならなかっただけ.
コードは,

    {
        size_t  hStart = 0 ;
        v_char  head ;
        head.resize(STL_B_HEADER_SIZE+100,0x00) ;
        memmove(&head,&readBuf[hStart],sizeof(STL_B_HEADER_SIZE)) ;
        stl.SetName(::To_tstring(head).c_str()) ;
        }

::To_tstring で head を利用した時にエラーとなる.
ここをコメントにすると,ブロックを抜けた時に head の解放?でエラーになる.


memmove で &head ではなく &head[0] としなければならない.

正しくは,

    {
        size_t	hStart = 0 ;
        v_char	head ;
        head.resize(STL_B_HEADER_SIZE+100,0x00) ;
        memmove(&head[0],&readBuf[hStart],STL_B_HEADER_SIZE) ;
        stl.SetName(::To_tstring(head).c_str()) ;
        }

v_char は次の様に定義.
 typedef std::vector<char> v_char ;

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

3D ファイルの表示で黒?

個人的な形式の ipl .直接読込んで OpenGL で表示する様にコードを修正中…
表示すると黒くなる.
3D データの表示で黒くなる
STL などはそれなりの色で表示される.
ワイヤフレームなどでは,色で表示されている.
原因は,ipl では法線ベクトルを持っていないので 0,0,0 として表示されていた.
法線ベクトルを正しく設定しているので面の色で表示される


2021/12/27
GonsA GonsA_CalcNormal (const GonsA& gnsa_,…)

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

ログが途中までしか表示されない

変なアクセスがあり,ログが途中までしか表示されなくなった.
‘\x0’ が含まれていて,そこを文字列の終わりと解釈しているためだった.

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

wordpress で更新できない

次の所を編集しようとして,「更新」を押しても反映されない.
https://mish.myds.me/wordpress/i-tools/about/
元に戻ってしまう.
一度ログアウトして,再度入ろうとすると入れない.
Synology NAS DS116 を再起動することで対応.


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

C1076 ヒープの領域を…

——————–構成: MkCmf – Win32 Debug——————–
コンパイル中…
ComPrj03.cpp
c:\program files\microsoft visual studio\vc98\include\comip.h(46) : fatal error C1076: コンパイラの制限 : ヒープの領域を使い果たしました; 上限を設定するために /Zm オプションを使用してください。
cl.exe の実行エラー
ComPrj03.obj – エラー 1、警告 0


VC 7 では,
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\ostream(632) : fatal error C1076: コンパイラの制限 : 内部ヒープの上限に達しました。上限を変更するには /Zm オプションを使用してください。


MSDN /Zm
コンパイルのオプションに /Zm150 を追加.
VC 6 /Zm の設定

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

template でのキャスト

次の様なベクトルの template .

	template <typename T>
	struct	Vector3 {
	//	...
		void	Normalize	(void)	{
			if (Length() > 0) {
				double	s = 1.0f / Length() ;
				x *= s;
				y *= s;
				z *= s;
				}
			}
	//	...
		T	x ;
		T	y ;
		T	z ;
		} ;	

double の時は問題ないが,float だとワーニング.
T(value) として対応.

				double	s = 1.0f / Length() ;
				x = T(x*s) ;
				y = T(y*s) ;
				z = T(z*s) ;	
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

システムメニューに項目の追加

あまり使用しないので,メモ.
「ダイアログベース」の AP に「設定」メニューの追加.
コードのサンプルなどは以下の所や,CXxxDlg::OnInitDialog .
MSDN CWnd::GetSystemMenu


IDS_… と IDM_… のリソースを追加.

	pSysMenu->AppendMenu(MF_SEPARATOR);
	pSysMenu->AppendMenu(MF_STRING, IDM_SETTING, _T("設定(&S)...")) ;	

今回は,面倒だったのでメニュー名は文字列として直接指定.


IDM_… の値は 0x0020 など.
メニューの「編集」-「リソース シンボル」で表示されるダイアログで追加する.
メニュー項目の IDM_... を追加する
CXxxxDlg::OnSysCommand でイベントを受け取る.

	if ((nID & 0xFFF0) == IDM_ABOUTBOX)	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
		}
	else if ((nID & 0xfff0) == IDM_SETTING) {
		OnSetting() ;
		}
	else 	{
		CDialog::OnSysCommand(nID, lParam);
		}	
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

pgons.Material::operator=(pgons1)

	d3D_PgonsA	pgsa = c3d.GetPgonsA() ;
	{
		d3D_PgonsA	pa_tri ;
		for (long index=0 ; index<pgsa.GetCount() ; index++) {
			d3D_Pgons1	pgns1 = pgsa[index] ;
			d3D_Pgons1	pgons = pgns1 ;
			{
					pgons = ::Pgons_ToTriangle(pgns1) ;
				//	pgons.SetColor  (pgns1.GetColor  ()) ;
				//	pgons.SetTexture(pgns1.GetTexture()) ;
				//	pgons.SetName   (pgns1.GetName   ()) ;
					pgons.Material::operator=(pgns1) ;
				}
			pa_tri.Add(pgons) ;
			}
		pgsa = pa_tri ;
		}
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

vector 型のデフォルト引数

あまり使うことがないかもしれないが…
関数に std::vector<Vd2> を渡す時,デフォルト引数を指定可能にしたかった.

	typedef	std::vector<Vd2>  Vd2A ;

	Vd2A	pnt2s = ::ToVd2A(pnts) ;
	v_Vd2A	v_v2a = ::V2_Triangulation(pnt2s) ;
		v_v2a = ::V2_Triangulation(pnt2s,ext2s) ;

	通常は上の呼び方だが,デバッグ用のデータのダンプで全体の範囲を与えたい時がある.
	上の方法では,デバッグ用のデータが個別の範囲となってしまう.

検索すると,[C++]const参照は一時変数にバインドできる
次の様に指定すれば良いとあった.
 const std::vector<int>& param = std::vector<int>()

v_Vd2A	V2_Triangulation	(const Vd2A& pnts,const Vd2A& ext2s=Vd2A())
{
	Poly_1_2D	ply2d(pnts) ;
	ply2d.AddPosition(ext2s) ;
	vv_long		tri_a = ply2d.Triangulation() ;
	Vd2A		tri_p = ply2d.GetPosition() ;
	v_Vd2A		tri_ary ;
	{
		//	...
		}
	return	tri_ary ;
	}
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

SVG スライドの埋め込み

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

https で鍵マークが…

https で鍵マークが消えてしまうことがあった.
最近アップロードしたページでは問題ない.

以前アップしてまだ修正が残っているページを見ると,
「このページの一部(画像など)は安全ではありません。」となる.

ここの画像を修正して OK になった.

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

PolyPolygon

あまり利用していないが,PolyPolygon を使ったコード.

	CArray<P2A,P2A>	p2aAry ;
	p2aAry.Copy(P2A_Ary) ;
	::P2AA_InvY(&p2aAry) ;
	CRect		rect ;
	m_Image.GetClientRect(rect) ;
	::P2AA_Scale(&p2aAry,rect) ;
	//	...
	CArray<CPoint,CPoint>	points ;
	CUIntArray		polyCounts ;
	int		nCount = ::P2AA_ToPointAry(p2aAry,&points,&polyCounts) ;
	CClientDC	dc(&m_Image) ;
	dc.PolyPolygon	(points.GetData(),  (int*)polyCounts.GetData(),nCount) ;
	//	...

P2A は 2 次元座標の配列で,一つの多角形を保持.
CArray<P2A,P2A> とすることにより,複数の多角形を持っている.
前半部分で表示用の座標に変換している.
次の様なデータの場合,2 次元座標の配列 points と,polyCounts が 9 と 8 ,nCount が 2 .

	
L
-1.390625,    6.5,        0,1,
 1.390625,    6.5,        0,1,
 5.640625,   -6.5,        0,1,
 3.734375,   -6.5,        0,1,
 2.21875,    -2.5,        0,1,
-2.21875,    -2.5,        0,1,
-3.75,       -6.5,        0,1,
-5.640625,   -6.5,        0,1,
-1.390625,    6.5,        0,1,
L
 1.59375,    -0.5,        0,1,
 0.734375,    2.203125,   0,1,
 0.28515625,  3.60546875, 0,1,
 0,           4.5,        0,1,
-0.2421875,   3.72265625, 0,1,
-0.59375,     2.640625,   0,1,
-1.59375,    -0.5,        0,1,
 1.59375,    -0.5,        0,1,

1つの多角形は閉じた状態で指定している.
ドキュメントには,次の様に書かれている.
「各多角形の最初の頂点と最後の頂点は、自動的に結ばれます。各頂点を 1 回だけ指定するべきです。」

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

DS115j と DS116 の熱状態

去年の夏は気付かなかったが,DS115j の本体の温度が高いので心配.

DS116 は気にならない.

実装しているハードディスクは,どちらも WD Red 3TB .
温度は,42 と 43 なので問題ない.

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

RT-AC86U 追加 – 9

AiProtection で,PC の脆弱性保護と,感染デバイス検出.
原因や対応がわからないので,画面をコピー.

Client Device Infected WEB Cross-site Scripting-36



C&C Server www.google.kg

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

RT-AC86U 追加 – 8

週末になると増える気がする.

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

http://mish.myds.me/… が審査を

http://mish.myds[.]me/… が審査を通過しませんでした.

原因を特定できなくて,そのままになっている.
それで,サイトをチェックするサイトへのリンク.
Google Transparency Report
Trend Micro Site Safety Center
Norton Safe Web
gred 無料のWeb安全チェックサービスといえばグレッド!


以前の http://iwao.synology.me で「再審査」をリクエストしたが,ダメだった.


2018/06/23
何とか通ったみたい.


Message type: [WNC-608000]
Search Console
http://mish.myds.me/ の審査が問題なく完了しました
http://mish.myds.me/ のウェブマスター様
セキュリティ審査のリクエストを受領し、処理いたしました。Google のシステムで、現在の http://mish.myds.me/ には有害なサイトやダウンロードへのリンクが含まれていないことを確認できましたのでお知らせいたします。サイトのユーザーに対して表示されていた警告は削除させていただきます。なお、この手続きには数時間かかることがありますのでご了承ください。
今後もサイトの安全を確保いただくため、以下の点にご注意ください。
1 攻撃からサイトを保護する
サイトのセキュリティが侵害される原因となった脆弱性を特定して解決し、管理アカウントのパスワードを変更してください。利用しているホスティング サービスに協力を要請することも検討してください。
2 望ましくないソフトウェアのポリシーを厳守する
サイトからダウンロードできるすべてのファイルが、ポリシーに明記されている基準を満たしていることを確認してください。これらの基準を満たしていないファイルは望ましくないソフトウェアと見なされます。
ポリシーを表示
サポートが必要な場合
• ヘルプセンターでマルウェアへの感染を防止する方法をご確認ください。
• プロダクト フォーラムに質問を投稿してください(その際はメッセージ タイプ [WNC-608000] の件である旨をお知らせください)。
Google LLC, 1600 Amphitheatre Parkway Mountain View, CA 94043 | このお知らせのメールは、Google Search Console にサイトが登録されているすべてのお客様にお送りしています。 このようなメッセージの配信を希望されない場合
パートナーを追加この Search Console アカウントについてのメッセージを受信するパートナーを追加できます

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