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 すると固まる はコメントを受け付けていません

Mathematica での定積分の評価に時間がかかる件

https://mathematica.stackexchange.com/questions/18327/definite-integral-takes-a-very-long-time

https://blog.wolfram.com/2008/01/19/mathematica-and-the-fundamental-theorem-of-calculus/

逆関数,連続性,被積分関数,極,不定積分 antiderivative

カテゴリー: 未分類 | Mathematica での定積分の評価に時間がかかる件 はコメントを受け付けていません

Mathematica tips

極座標(r,theta,phi) をデカルト座標 (x,y,z) で表示
FromSphericalCoordinates[{r, \[Theta], \[CurlyPhi]}]
{r Cos[\[CurlyPhi]] Sin[\[Theta]],r Sin[\[Theta]] Sin[\[CurlyPhi]],r Cos[\[Theta]]}

多重積分
Integrate[\[Rho]^2 Sin[\[Theta]], {\[Rho], 0, R}, {\[Theta], 0,\[Pi]}, {\[Phi], 0, 2\[Pi]}]

条件を付けて変形
Simplify[Sqrt[1-Cos[\[CapitalTheta]]^2], Assumptions->0<\[CapitalTheta]&&\[CapitalTheta]<\[Pi]/2] Sin[Θ] 条件を付けて積分 Integrate[f(x,y) ,{x, xmin, xmax}, {y, ymin, ymax}, Assumptions->{x,y} Esc el Esc Reals]

カテゴリー: 未分類 | Mathematica tips はコメントを受け付けていません