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

作者アーカイブ: Iwao

2025年2月
 1
2345678
9101112131415
16171819202122
232425262728  

カテゴリー

アーカイブ

ブログ統計情報

  • 106,328 アクセス


GLUT でのメニュー

GLUT を使用してのテストコードで,起動後データを切替える方法がないかと…
メニューの利用で何とかできるか?


glutCreateMenu などで検索したがわかりやすい情報が少なかった.
https://seesaawiki.jp/w/mikk_ni3_92/d/%b4%f0%cb%dc%ca%d418
https://www.jstage.jst.go.jp/article/itej/67/5/67_417/_pdf
http://opengl.jp/glut/section06.html


以前作成した雛型に対して追加.メニュー部分はほぼリンク先のコードのまま.
https://jml.mish.work/index.php/cpp/cb-glut.html

#include	"glut_cb.hxx"
#include	<iostream>

void	cb_menu	(int val)
{
	std::cout << "menu val=" << val << std::endl ;
	}

int	main(int argc, char* argv[])
{
	::glutInitWindowPosition(200,100) ;
	::glutInitWindowSize	(600,400) ;
	::glutInitDisplayMode	(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH) ;
	::glutInit           	(&argc,argv) ;
	::glutCreateWindow   	(argv[0]) ;
	::glutReshapeFunc    	(cb_resize) ;
	::glutDisplayFunc     	(cb_display) ;
	::glutKeyboardFunc    	(cb_keyboard) ;
	::glutMouseFunc      	(cs_mouse) ;
	{
		::glutCreateMenu(cb_menu) ;
		::glutAddMenuEntry("name 1",1) ;
		::glutAddMenuEntry("name 2",2) ;
		::glutAddMenuEntry("name 3",3) ;
		::glutAttachMenu(GLUT_RIGHT_BUTTON) ;
		}
	::cb_init            	() ;
	::glutMainLoop      	() ;
	return	0 ;
	}

GLUT メニュー
結局はこの方法ではなく,予めリスト化して キー入力 により切り替える方法に.

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

Debian 環境に pip のインストール

PyOpenGL を使おうとして pip コマンドを打つと,コマンドがない.
どうも pip が入っていないみたいで,次の様に入力してインストール.
sudo apt install python-pip
更に PyOpenGL のインストール.
pip install PyOpenGL
Debian 環境に PyOpenGL のインストール


pip3 のインストールは
sudo apt install python3-pip


C:\WINDOWS\System32>cd C:\Users\Iwao\AppData\Local\Temp

C:\Users\Iwao\AppData\Local\Temp>ssh -l admin -p 22 lxcdebian10
admin@lxcdebian10's password:
Linux lxcdebian10 4.14.x #1 SMP Wed May 13 00:37:48 CST 2020 x86_64

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 Jul  9 10:51:02 2020 from fe80::ed6f:4991:21c9:1882%eth0
admin@lxcdebian10:~$ cat /usr/bin/pip
#!/usr/bin/python
# GENERATED BY DEBIAN

import sys

# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
from pip._internal import main
if __name__ == '__main__':
    sys.exit(main())
admin@lxcdebian10:~$ cat /usr/bin/pip3
#!/usr/bin/python3
# GENERATED BY DEBIAN

import sys

# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
from pip._internal import main
if __name__ == '__main__':
    sys.exit(main())
admin@lxcdebian10:~$  

Debian  cat pip , pip3

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

AS5202T Debian 10 に Image Magick

Raspberry Pi などと同様
sudo apt install imagemagick
Debian 環境に Image Magick のインストール
特に難しいことはない.
Debian 環境に Image Magic インストール後 display コマンド

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

AS5202T Debian 10 と VC

VC で ASUSTOR NAS Linux Center の Debian 10 Desktop を使用するための設定.


SSH 接続を可能にして gcc などをインストールしておく必要がある.
Linux development with C++ in Visual Studio


VC の「ツール」-「オプション」,「クロスプラットフォーム」-「接続マネージャー」-「追加」.
Debian 10 への接続の設定
SSH 接続する時の情報を設定する.
追加後「接続マネージャー」-「リモートヘッダー…」で「更新」するとエラー.
エラーが発生しました。Could not start the ‘rsync’ command on the remote host, please install it using your system package manager. Please see https://aka.ms/AA23jat for troubleshooting。詳細については、C:\Users\Iwao\AppData\Local\Temp\vslinux_header_update_log.txt を参照してください。トラブルシューティングを行うには、https://aka.ms/AA23jat をご覧ください。
エラーが発生しました。Could not start the 'rsync' command on the remote host, please install it using your system package manager.
この部分の対応方法はよくわからない.


VC のプロジェクトの設定を「lxcdebian10」に.
VC リモートビルドマシンを「lxcdebian10」に設定


これでビルドすれば大丈夫なはずだが,何故かエラー.
VC を再起動したり,プロジェクトを読み直したりしていたら通る様になった.
AS5202T Debuan 10 VC ビルド

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

AS5202T Debian 10

以前 インストールしてそのままになっていた環境.
その時わからなかったのが「タイムゾーン」の設定.
次の所を参考にさせてもらって設定.
Debian 10 busterをインストールして最初に行う設定と確認 10項目
Linux Center Debian 10 タイムゾーンの設定


共通のソースなどを参照するために…
Linux から Windows 環境への接続
Linux Center Debian 10 mount
接続先は,最終的には変更する予定.

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

弦と矢と半径 – 11

JavaScript 版で Canvas を使用する様にしてみた.
弦と矢と半径 JavaScript Canvas
https://mish.myds.me/Test/blog/r_cs/b/

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

AS5202T に mono インストール

Synology NAS にもあるので気になっていた mono
以前 MonoDevelop をインストールして少しは試したことがある.
それで,どこまでのものとして入るかをやってみた.
AS5202T App Central Mono

Iwao@AS5202T:/volume1/home/Iwao/test/mono $ ls /usr/local/AppCentral/mono/bin/
al*                        gacutil2*                  mono-api-info*             nunit-console2*
al2*                       genxs*                     mono-boehm*                nunit-console4*
asp-state*                 httpcfg*                   mono-cil-strip*            pdb2mdb*
asp-state2*                ikdasm*                    mono-configuration-crypto* pedump*
asp-state4*                ilasm*                     mono-find-provides*        permview*
caspol*                    illinkanalyzer*            mono-find-requires*        peverify*
cccheck*                   installvst*                mono-gdb.py                resgen*
ccrewrite*                 lc*                        mono-heapviz*              resgen2*
cert-sync*                 macpack*                   mono-package-runtime*      secutil*
cert2spc*                  makecert*                  mono-service*              setreg*
certmgr*                   mconfig*                   mono-service2*             sgen*
chktrust*                  mcs*                       mono-sgen*                 sgen-grep-binprot*
crlupdate*                 mdassembler*               mono-sgen-gdb.py           signcode*
csc*                       mdbrebase*                 mono-shlib-cop*            sn*
csc-dim*                   mdoc*                      mono-symbolicate*          soapsuds*
csharp*                    mdoc-assemble*             mono-test-install*         sqlmetal*
csi*                       mdoc-export-html*          mono-xmltool*              sqlsharp*
dbsessmgr*                 mdoc-export-msxdoc*        monodis*                   svcutil*
dbsessmgr2*                mdoc-update*               monodocer*                 vbc*
dbsessmgr4*                mdoc-validate*             monodocs2html*             wsdl*
disco*                     mdvalidater*               monodocs2slashdoc*         wsdl2*
dmcs*                      mkbundle*                  monograph*                 xbuild*
dtd2rng*                   mod*                       monolinker*                xsd*
dtd2xsd*                   mod-mono-server*           monop*                     xsp*
fastcgi-mono-server*       mod-mono-server2*          monop2*                    xsp2*
fastcgi-mono-server2*      mod-mono-server4*          mozroots*                  xsp4*
fastcgi-mono-server4*      mono@                      mprof-report*
gacutil*                   mono-api-html*             nunit-console*
Iwao@AS5202T:/volume1/home/Iwao/test/mono $                      

AS5202T AppCentral mono bin
mono 使い方」で検索.
mcs test.cs でコンパイル,mono test.exe で実行できるみたい.


2020/06/24
phpinfo() を見てみると mod_mono が読み込まれている.
AS5202T phpinfo() apache2handler mod_mono


mcs で出来上がった exe は Windows のコマンドプロンプトで実行できる.
Mono 環境でできた exe を実行

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

弦と矢と半径 – 10

JavaScript 数値入力で更新.

	<body>

<pre>
c : <input  type='number'  id='in__c'  value='8'  style='width:100px;'  step='any' /> <span  id='out_c'> </span>  <br />
s : <input  type='number'  id='in__s'  value='2'  style='width:100px;'  step='any' /> <span  id='out_s'> </span>  <br />
r : <input  type='number'  id='in__r'  value='5'  style='width:100px;'  step='any' /> <span  id='out_r'> </span>  <br />
</pre>
		<img	src='r_cs.png'	width='300px'>

		<script>

			function	r_cs	(c , s)		{	return	(        ( c*c )  / ( 8*s )  +  s/2 ) ;		}
			function	s_rc	(r , c)		{	return	( r-Math.sqrt(r*r - (c/2)*(c/2) )   ) ;		}
			function	c_rs	(r , s)		{	return	(   Math.sqrt(r*r - (r-s)*(r-s) )*2 ) ;		}

			function	f_c_rs	() {
				var	oc = document.querySelector("#out_c") ;
				var	os = document.querySelector("#out_s") ;
				var	or = document.querySelector("#out_r") ;
				var	ic = document.querySelector("#in__c") ;
				var	is = document.querySelector("#in__s") ;
				var	ir = document.querySelector("#in__r") ;
				var	fc = parseFloat(ic.value) ;
				var	fs = parseFloat(is.value) ;
				var	fr = parseFloat(ir.value) ;
				oc.textContent = "" ;
				os.textContent = "" ;
				or.textContent = "" ;
				os.textContent = s_rc(fr,fc) ;
				or.textContent = r_cs(fc,fs) ;
				}
		//	...
			{
				var	ec = document.getElementById("in__c") ;
				var	es = document.getElementById("in__s") ;
				var	er = document.getElementById("in__r") ;
				ec.addEventListener("keyup",f_c_rs, false) ;
				es.addEventListener("keyup",f_s_rc, false) ;
				er.addEventListener("keyup",f_r_cs, false) ;
				}

			</script>

		</body>

弦と矢と半径 JavaScript 版
https://mish.myds.me/…/r_cs/a/

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

弦と矢と半径 – 9

JavaScript で.

<body>
	c : <input	type='number'	id='in__c'	value='80.0'	size='10'	step='any'	/><input	type='submit'	value='c_rs'	id='c_rs'	/>	<span	id='out_c'> </span>	<br />
	s : <input	type='number'	id='in__s'	value='20.0'	size='10'	step='any'	/><input	type='submit'	value='s_rc'	id='s_rc'	/>	<span	id='out_s'> </span>	<br />
	r : <input	type='number'	id='in__r'	value='50.0'	size='10'	step='any'	/><input	type='submit'	value='r_cs'	id='r_cs'	/>	<span	id='out_r'> </span>	<br />
	<img	src='r_cs.png'	width='300px'>

	<script>
		function	r_cs	(c , s)		{	return	(        ( c*c )  / ( 8*s )  +  s/2 ) ;		}
		function	s_rc	(r , c)		{	return	( r-Math.sqrt(r*r - (c/2)*(c/2) )   ) ;		}
		function	c_rs	(r , s)		{	return	(   Math.sqrt(r*r - (r-s)*(r-s) )*2 ) ;		}

		function	f_c_rs	() {
			var	oc = document.querySelector("#out_c") ;
			var	os = document.querySelector("#out_s") ;
			var	or = document.querySelector("#out_r") ;
			var	ic = document.querySelector("#in__c") ;
			var	is = document.querySelector("#in__s") ;
			var	ir = document.querySelector("#in__r") ;
			var	fc = parseFloat(ic.value) ;
			var	fs = parseFloat(is.value) ;
			var	fr = parseFloat(ir.value) ;
			oc.textContent = "" ;
			os.textContent = "" ;
			or.textContent = "" ;
			oc.textContent = c_rs(fr,fs) ;
			}
		//	...
		{
			var	ec = document.getElementById("c_rs") ;
			var	es = document.getElementById("s_rc") ;
			var	er = document.getElementById("r_cs") ;
			ec.addEventListener("click",f_c_rs, false) ;
			es.addEventListener("click",f_s_rc, false) ;
			er.addEventListener("click",f_r_cs, false) ;
			}
		</script>
	</body>

R S C JavaScript
https://mish.myds.me/…/r_cs/9/

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

弦と矢と半径 – 8

Python を使用しないで PHP のみで.

<?php
	function	r_cs	($c , $s)	{	return	(    ( $c*$c )  / ( 8 *$s )   +  $s/2 ) ;	}
	function	s_rc	($r , $c)	{	return	( $r-sqrt($r*$r - ($c/2)*($c/2) )     ) ;	}
	function	c_rs	($r , $s)	{	return	(    sqrt($r*$r - ($r-$s)*($r-$s) )*2 ) ;	}
	?>

PHP のみで実装
https://mish.myds.me/…/r_cs/8/

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

AS5202T VirtualBox – 2

AS5202T の CPU 温度を見るといつもより高い.
「プロセス」情報を見ると VirtualBox が消費している.
AS5202T の「プロセス」状態
VNC で接続すると TiWorker.exe が CPU を食っている.
DevX  TiWorker.exe
丁度 Windows Update のタイミングみたい.
VNC 接続の仮想マシンは遅くて操作できないが,接続しているクライアントからソースなどは見える.
TiWorker が CPU を食っている
前回 の様なネットワークが途切れる状態にはまだなっていない.


「リモートデスクトップ」であれば仮想マシンも操作できた.
落ち着くまでそのままにしておくしかなさそう.


その後「再起動」待ちになっていたので仮想マシンを再起動.
また止まったような表示.
Windows Update の再起動で,止まったような状態?
CPU は食っているのでこのまま様子見.


2020/06/11
そのまま変わらないので,仮想マシンの「電源オフ」.
PC の VirtualBox で再起動.
2020/06 Windows Update
Windows Update での再起動がうまく動作しないのか?


AS5202T VirtualBox の仮想マシンとして起動した時,いつもより時間がかかることがある.
また,ネットワークがうまく接続されていないこともあり.
安定するまで何度か再起動の必要があるのかもしれない.
起動時止まった様に見えても 30 分程度はそのままにして様子を見た方が良さそう.
仮想マシンの CPU や HDD などのリソースへのアクセス状況が見えると良いのに…

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

FBX SDK 2020.1

FBX SDK の脆弱性」の記事を先日読んでいた.
それで SDKダウンロード する所を見ると,対応版と思われる 2020.1 があった.
FBX SDK 2020.1


「追加のインクルードディレクトリ」と「追加のライブラリディレクトリ」を 2020.1 に.
追加のインクルードディレクトリ
追加のライブラリディレクトリ
ビルドすると大量の warning .

LibXml2-MD.lib(buf.obj) : warning LNK4099: PDB 'libxml2-md.pdb' が 'LibXml2-MD.lib(buf.obj)' で、または 'c:\Temp\...\Debug.141\Win32\libxml2-md.pdb' に見つかりません。デバッグ情報がないものとして、オブジェクトにリンクします。
Zlib-MD.lib(adler32.obj) : warning LNK4099: PDB 'zlib-md.pdb' が 'Zlib-MD.lib(adler32.obj)' で、または 'c:\Temp\...\Debug.141\Win32\zlib-md.pdb' に見つかりません。デバッグ情報がないものとして、オブジェクトにリンクします。
LibFbxSDK-MD.lib(OArchive.cpp.obj) : warning LNK4099: PDB 'alembic-md.pdb' が 'LibFbxSDK-MD.lib(OArchive.cpp.obj)' で、または 'c:\Temp\...\Debug.141\Win32\alembic-md.pdb' に見つかりません。デバッグ情報がないものとして、オブジェクトにリンクします。

FBX SDK 2020.1 で LNK4099
どこか,プロジェクトの設定を間違えたか?


2021/04/29
LNK4099 のエラーは,pdb がないため.
FBX SDK 2020.1.1 以降であれば用意されているので,それぞれにあったものをインストールする.
FBX SDK 2020.1.1 pdb

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

Win10 インストール 用 USB 作成

Win10 インストール用の USB を作成しようと思い調べていたら


Windows 用のインストール メディアを作成する
その先の「Windows 10 のダウンロード」に入り「ツールを今すぐダウンロード」.
ダウンロードしたファイル MediaCreationTool2004.exe を起動.
ライセンス条項に「同意」して,実行する操作を選択.
実行する操作を選択
Windows の種類を選択.
Windows の種類を選択
メディアを選択.
メディアを選択
ドライブを選択.
ドライブを選択
Windows 10 をダウンロード.
Windows 10 をダウンロード
USB メモリに書き込み.メディアの作成時間は 15 分位.
メディアの作成


作成される Windows のバージョンにはご注意ください.

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

弦と矢と半径 – 7

input タグで number を使用している部分.
step=’0.001′ などとすれば小数値を入力できるが,欲しい動作ではない.
例えば 1.23456789 など任意の値を入力可能にしたかった.
step=’any’ と指定することで小数部を入力できるようになる.
<input type=’number’ name=’c’ value=’1.234567890′ size=’15’ step=’any’ />
https://mish.myds.me/…/r_cs/7/
弦と矢と半径 7

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

PHP escapeshellarg

以前から気にはなっていた PHP の escapeshellarg を調べてみた.


次の様なコードがうまくない.

<?php
	$param  = ($_REQUEST['input']) ;
	$cmd_to = "cal " . $param ;
	system	( $cmd_to ) ;
	?>

次の様な入力を意図しているが,
…/cal/?input=2020
cal 2020
後ろに次のコマンドを付加されるとうまくない.
…/cal/?input=2020;ls -l
cal 2020 ; ls -l
cal 2020 が表示された後 ls -l が動作している.
コマンドインジェクション」と呼ぶらしく,検索するといろいろと出てくる.


コマンドの引数にあたる部分に escapeshellarg を使用するか,$param をチェックするする必要がある.

	$cmd_to  = "cal " . escapeshellarg ( $param ) ;
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

弦と矢と半径 – 6

Python のコードを修正して「結果のみ」を出力する様に変更.

import	sys
import	math

def	r_cs	(c , s)	:	return	(        ( c*c )  / ( 8 *s ) +  s/2 )
def	s_rc	(r , c)	:	return	( r-math.sqrt(r*r - (c/2)*(c/2) )   )
def	c_rs	(r , s)	:	return	(   math.sqrt(r*r - (r-s)*(r-s) )*2 )

cmd =       sys.argv[1]
p1  = float(sys.argv[2])
p2  = float(sys.argv[3])

#print	(cmd + " " + str(p1) + " " + str(p2))

if  	cmd == "r_cs"	:	print	(r_cs(p1,p2))
elif	cmd == "s_rc"	:	print	(s_rc(p1,p2))
elif	cmd == "c_rs"	:	print	(c_rs(p1,p2))
#else	            	:	print	("error")

#print	("")

弦と矢と半径 スマートフォンからアクセス
PHP
あまり綺麗なコードでないので,ここには張り付けていません.リンク先を見てください.
PHP から Python の呼び出し
https://mish.myds.me/…/r_cs/6/

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

弦と矢と半径 – 5

PHP から Python の呼び出しで,Python のコマンドライン引数を使用する.

<?php

	echo	("call python\n") ;

	echo	("\n") ;
	system	("python r_cs.py r_cs 6 1") ;
	system	("python r_cs.py s_rc 5 6") ;
	system	("python r_cs.py c_rs 5 1") ;

	echo	("\n") ;
	system	("python r_cs.py r_cs 8 2") ;
	system	("python r_cs.py s_rc 5 8") ;
	system	("python r_cs.py c_rs 5 2") ;

	?>

Python のコードは,

import	sys
import	math

def	r_cs	(c , s)	:	return	(        ( c*c )  / ( 8 *s ) +  s/2 )
def	s_rc	(r , c)	:	return	( r-math.sqrt(r*r - (c/2)*(c/2) )   )
def	c_rs	(r , s)	:	return	(   math.sqrt(r*r - (r-s)*(r-s) )*2 )

cmd =       sys.argv[1]
p1  = float(sys.argv[2])
p2  = float(sys.argv[3])

print	(cmd + " " + str(p1) + " " + str(p2))

if  	cmd == "r_cs"	:	print	(r_cs(p1,p2))
elif	cmd == "s_rc"	:	print	(s_rc(p1,p2))
elif	cmd == "c_rs"	:	print	(c_rs(p1,p2))
else	            	:	print	("error")

print	("")

Python がよくわかっていないので,いろいろなエラーが…
PHP から Python の呼び出し コマンドライン引数
https://mish.myds.me/…/r_cs/5/

弦,矢,半径

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

弦と矢と半径 – 4

先日の Python コードのバグ(整数で計算されてしまうため結果が異なる).
原因はすぐわかるが,対応は悩む所.
コードを分解して動作を確認してみた.

def	r_cs_o	(c , s)	:	return	(        ( c*c )  / ( 8 *s )  +  s/2  )
def	r_cs_n	(c , s)	:	return	(        ( c*c )  / ( 8.*s )  +  s/2. )

print   (6*6)
print   (8*1)

print   (36/8)
print   (36/8.)

print   (1/2)
print   (1/2.)

print	("")
print   (36/8 +1/2 )
print   (36/8.+1/2.)

print	("")
print	(r_cs_o(6,1))
print	(r_cs_n(6,1))

Python での「浮動小数点数」の動作テスト
https://docs.python.org/ja/3/howto/pyporting.html?highlight=除算


Synology NAS DSM では Python 2.7 が標準で入っているみたい.
「パッケージ センター」で Python3 を追加できる.

C:\Program Files\Microsoft Office\Office14>cd C:\Users\Iwao\AppData\Local\Temp

C:\Users\Iwao\AppData\Local\Temp>ssh -l Iwao -p 2200 192.168.1.116
Iwao@192.168.1.116's password:
Iwao@DS116:~$ python3
Python 3.5.1 (default, Jan 29 2018, 14:16:30)
[GCC 4.9.3 20150311 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Iwao@DS116:~$ python2
Python 2.7.12 (default, May 12 2020, 04:48:57)
[GCC 4.9.3 20150311 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Iwao@DS116:~$ python
Python 2.7.12 (default, May 12 2020, 04:48:57)
[GCC 4.9.3 20150311 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Iwao@DS116:~$

Synology NAS DS116  python コマンド
ASUSTOR NAS ADM では入ってない.「App Central」でインストール可能.
ASUSTOR NAS Python


2020/11/20
QNAP NAS での Python3 は,他の NAS と異なるみたい.
opkg install python3 でインストールしなければならなかった.
https://mish.myds.me/wordpress/dev/2020/08/29/ts253d-setup-3-opkg/
https://mish.myds.me/wordpress/dev/2020/08/17/ts-253d-setup-7-python3/

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

弦と矢と半径 – 3

JavaScript は html に埋め込んだ.

<!DOCTYPE html>
<html	lang="ja">
	<head>
		<meta	charset="UTF-8"	/>
		<meta	name="viewport"   	content="width=device-width,initial-scale=1.0">
		<title	>JavaScript</title>
		</head>
	<body>
		<script>

			function	r_cs	(c , s)		{	return	(        ( c*c )  / ( 8*s )  +  s/2 ) ;		}
			function	s_rc	(r , c)		{	return	( r-Math.sqrt(r*r - (c/2)*(c/2) )   ) ;		}
			function	c_rs	(r , s)		{	return	(   Math.sqrt(r*r - (r-s)*(r-s) )*2 ) ;		}

			document.write	("6 1 5") ; 	document.write	("<br/>\r\n") ;
			document.write	(r_cs(6,1)) ;	document.write	("<br/>\r\n") ;
			document.write	(s_rc(5,6)) ;	document.write	("<br/>\r\n") ;
			document.write	(c_rs(5,1)) ;	document.write	("<br/>\r\n") ;
			document.write	("") ;      	document.write	("<br/>\r\n") ;

			document.write	("8 2 5") ; 	document.write	("<br/>\r\n") ;
			document.write	(r_cs(8,2)) ;	document.write	("<br/>\r\n") ;
			document.write	(s_rc(5,8)) ;	document.write	("<br/>\r\n") ;
			document.write	(c_rs(5,2)) ;	document.write	("<br/>\r\n") ;
			document.write	("") ;      	document.write	("<br/>\r\n") ;

			</script>
		</body>
	</html>

動作は,
https://mish.myds.me/…/r_cs/3/
html に JavaScript を埋め込み

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

弦と矢と半径 – 2

今度は PHP からの呼び出し.

<?php

	echo	("call c++\n") ;
	system	("./a.out") ;

	echo	("call python\n") ;
	system	("python r_cs.py") ;

	?>

実際の動作を試すには,gcc と python が必要です.
cpp のコンパイルは
g++ -Wall r_cs.cpp
これで ./a.out が作成されます.
python の呼び出しは
python r_cs.py
r_cs.cpp のコンパイルと r_cs.py の実行
次の所で,同じ様な結果を表示します.
https://mish.myds.me/…/r_cs/2/

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