2x/(1+x^2) のグラフ

2x/(1+x^2) はx=1 のとき最大値 1 をとる.

カテゴリー: 未分類 | 2x/(1+x^2) のグラフ はコメントを受け付けていません

httpサーバーを立てる python one liner

python3 -m http.server 8000

カテゴリー: 未分類 | httpサーバーを立てる python one liner はコメントを受け付けていません

Install JsRoot on a Nginx server

[1] Set up a nginx web server. Check your URL shows a test page.

[2] Download the jsroot package “JsRootXXX.tar.gz” provided from
https://github.com/linev/jsroot/blob/master/docs/JSROOT.md

[3] Unpack it in your server e.g. /var/somewhere. The files in the package would not work out of the box. You may need to modify index.htm and put some root files in “files” directory to test. If you don’t have your own root file to test, hsimple.root can be found https://root.cern/js/files/hsimple.root

[4] Modify nginx root path or put the jsroot package in a proper path.

vi /etc/nginx/nginx.conf

server {
listen 80;
listen [::]:80;
server_name _;
root /path/to/jsroot; # the location including index.html, modules, etc.

Or you may put the jsroot package in nginx root location.

[5] Because some modules have “.mjs” extension not “.js”, you may get an error like:

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/octet-stream". Strict MIME type checking is enforced for module scripts per HTML spec.

Then you tell nginx the type “.mjs”:
sudo vi /etc/nginx/mime.types
Modify the following line: js => js mjs:
application/javascript js mjs;
Reload nginx:
sudo nginx -s reload
And you might want to clear your browser cache.

[6] Modify the provided example html file. The index.html may be like below (I have rewritten only <div id =”simpleGUI” path=”./files/” files=”hsimple.root”>)

<html lang="en">
<head>
<meta charset="utf-8">
<title>Read a ROOT file</title>
<link rel="shortcut icon" href="img/RootIcon.ico"/>
</head>
<body>
<div id="simpleGUI" path="./files/" files="hsimple.root">
loading scripts ...
</div>
<script type="module">
import { buildGUI } from './modules/gui.mjs';
buildGUI("simpleGUI");
</script>
</body>
</html>

[7] Access your URL and load hsimple.root.

JSRoot.core.js は使わなくなったのかな?いまはmodules 以下の mjs ファイルをimport するようになっているようだ.

カテゴリー: 未分類 | Install JsRoot on a Nginx server はコメントを受け付けていません

WSLでGUIがサポートされるようになった(Windows10でも)

これまでWSL上でグラフィカルユーザインターフェース(GUI)を利用する場合,Windows上で,例えば VcXsrv, Xming といったXサーバーを動かしておく必要があった.Windows11では数年前からその必要はなかったが,今般Windows10でもWSL2で Linux GUI アプリケーションが動作するようになった.

WSL で Linux GUI アプリを実行する | Microsoft Learn

したがって ↓のような問題はなくなった.
WSL 上で pip install すると固まる | n3956.net

別途立てたXサーバーのための .bashrc の
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk ‘{print $2}’):0とか
export DISPLAY=localhost:0.0
という設定は消しておく.





カテゴリー: 未分類 | WSLでGUIがサポートされるようになった(Windows10でも) はコメントを受け付けていません

WSL 上で pip install すると固まる

pip freeze は表示される.
pip install や pip list は Enter を押したあと何も表示されずハングアップする.

python3 -m pip install でも同じ.
私の環境の場合,X クライアント Xsrv などを立ち上げると pip が問題なく動くようになった.

^CTraceback (most recent call last):
File “get-pip.py”, line 27081, in
main()
File “get-pip.py”, line 139, in main
bootstrap(tmpdir=tmpdir)
File “get-pip.py”, line 115, in bootstrap
monkeypatch_for_cert(tmpdir)
File “get-pip.py”, line 96, in monkeypatch_for_cert
from pip._internal.commands.install import InstallCommand
File ““, line 991, in _find_and_load
File ““, line 975, in _find_and_load_unlocked
File ““, line 655, in _load_unlocked
File ““, line 618, in _load_backward_compatible
File ““, line 259, in load_module
…..

カテゴリー: 未分類 | WSL 上で pip install すると固まる はコメントを受け付けていません