2019-01-01から1年間の記事一覧
CCDカメラは読み出し方式による縞々模様(1行ごとに輝度の濃淡が発生する)現象が起こる。 通常、ハードウェア側で調整されるものだが、ソフトウェア側で調整する必要に迫られたので、そのコードを公開する。 なお、Visual Studio + C# + OpenCVSharp と C++を…
Windows の堅牢性の高いファイル コピー よく使うコマンド robocopy "C:\src" "C:\dst" /S /E /R:0 /NP 1>log.txt /MIRはdstの削除をするので注意 /S :: サブディレクトリをコピーしますが、空のディレクトリはコピーしません。 /E :: 空のディレクトリを含…
thinkami.hatenablog.com PowerShellを使ってメール送信部分を書く。 email.ps1 等で次の内容のファイルを作成する。最近はUTF-8で保存しがちであるが、日本語環境では必ず Shift-JISで保存すべし。 $mail = @{ from = "送信元@gmail.com"; to = "送信先@gma…
sortedはリストが返ってくるので、dictに入れてdictに変換するのがポイント dct = { 2: 3, 3: 4, 1: 2, 0: 8, 4: 2 } # keyで昇順 dct =dict(sorted(dct .items())) print(dct) # {0: 8, 1: 2, 2: 3, 3: 4, 4: 2} # keyで降順 dct = dict(sorted(dct.items()…
TeXはテフ、LaTeXはラテックとかラテフとか呼ぶ。ただ、LaTeXもテフと呼ぶし、日本語対応したpLaTeXもテフと呼ぶので、テフが表す範囲は広いようだ。 LaTeXのインストールガイド 及び サンプルコードを次のリンクに用意した gitlab.com
Visual StudioにバインドされたGitで、変更したファイルを比較しようとした時に 2つのファイルのコンテンツは異なっています と出るのはなぜ?
Azure Dev Tools for Teaching (旧 Microsoft Imagine) を登録している所属機関の学生が、製品・プロダクトキーをダウンロードする公式ガイドは、執筆時点で存在しないと思われる。なので、ここで簡単に紹介しておく。 まず、次のサイトへアクセス Azure Dev…
VSCodeでSSH経由やWindows Subsystem for Linux (WSL)などの環境で作業できるようになった。 多段SSH接続する時、 ProxyCommand の設定でハマったのでメモを残しておく。2段SSH(英語ではjumphostと言うらしい)を行う場合のconfig設定は以下の通り。 Host jum…
3体崩壊で、粒子が完全にランダムに崩壊したとすると、粒子1と粒子2の不変質量の2乗と、粒子1と粒子3の不変質量の2乗分布が一様になるように崩壊する。 ROOT のライブラリを使って、これを実際に発生してみる。BΞとΔBΛΛは0としている。 #include <iostream> #include <fstream> </fstream></iostream>…
Can I call a constructor from another constructor (do constructor chaining) in C++? stackoverflow.com class Foo { public: Foo(char x, int y) {} Foo(int y) : Foo('a', y) {} };
1>x:\boost_1_65_0\boost\operators.hpp(839): error C4996: 'std::iterator<std::output_iterator_tag,void,void,void,void>': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The <iterator> header is NOT deprecated.) The C++ Standard</iterator></std::output_iterator_tag,void,void,void,void>…
#include <future> #include <mutex> #include <iostream> std::mutex mtx3; class MyClass3 { int long_calc1(int j) { std::this_thread::sleep_for(std::chrono::milliseconds(1000)); mtx3.lock(); std::cout << "1 a" << std::endl; mtx3.unlock(); std::this_thread::sleep_for(</iostream></mutex></future>…
#include <future> #include <thread> #include <vector> #include <iostream> #include <mutex> // 標準出力のmutex std::mutex mtx_; int long_calc(int i) { std::this_thread::sleep_for(std::chrono::milliseconds(1000)); mtx_.lock(); std::cout << "a" << i << std::endl; mtx_.unlock(); std:</mutex></iostream></vector></thread></future>…
#include <thread> std::this_thread::sleep_for(std::chrono::milliseconds(1));</thread>
stackoverflow のコードがシンプルで良いだろう。 stackoverflow.com import matplotlib.pyplot as plt import numpy as np fig, axes = plt.subplots(nrows=2, ncols=1, sharex=True) for ax in axes: mesh = ax.pcolormesh(np.random.randn(30, 30), vmin=…
アーカイブファイル内のファイルのハッシュ値(CRC32)を取得するには、 l コマンドに加え、 -slt を使うべし。 -sltスイッチで得られる情報 Path Size Packed Size Modified Attributes CRC Encrypted Method Block 7-Zip 18.05 (x64) : Copyright (c) 1999-2…
Windows Updateのタイミングを自分で調整する方法 スケジュールされた自動更新のインストールで、ログオンしているユーザーがいる場合には自動的に再起動しない 自動更新を構成する -> ダウンロードと自動インストールを通知
最新の投稿 phst.hateblo.jp 過去の投稿 phst.hateblo.jp これを少し汎用化して、リスト、ビンの数、最小値、最大値を与えて、正規分布でフィッティングする関数を作ってみた。 オプションで平均値の初期値、標準偏差の初期値、グラフを描画するかどうかを与…
phst.hateblo.jp
日々バージョンが新しくなってるので、2019/08/21時点で。 Cuda Toolkit 10.0 ダウンロードとインストール https://developer.nvidia.com/cuda-10.0-download-archive 現時点での最新版は10.1だったが、pipからインストールできるtensorflow-gpuは10.0だった…
Windowsだとシステムからの文字コードはshift_jisなのでそれに対応 stderr = subprocess.PIPE にすると、 proc.stdout.readline を先に書いたとき、 stderr側での出力が貯まりすぎると、デッドロックが発生することがあるらしい。なので、stderrもSTDOUT側に…
import colorama colorama.init() print(colorama.Back.GREEN + colorama.Fore.RED + "これがテストです") print("設定は引き継がれる") print(colorama.Style.RESET_ALL,end="") print("リセットでもとに戻る") colorama.deinit() colorama.deinit() をしな…
放射線の飛跡のように、座標(cx, cy) 角度 (ax = dx/dz, ay = dy/dz)で表すことの出来る量の比較をする時、しばしば飛跡の進行方向(Radial方向)と垂直方向(Lateral方向)に分離して考えることがある。 飛跡1 (cx1, cy1, ax1, ay1)、飛跡2 (cx2, cy2, ax2, ay2…
arxiv.org の付録Bの日本語訳です。一部に筆者の意訳を含みます。 原子核乾板は、その高分解能により各フィルムに記録された膨大な量のイベント又はオーダーの飛跡の陽子反応を再構成することができる。 これは、位置分解能0.4 μmと角度分解能2mradのベクト…
filename_yml という YAML形式のファイルがあり、filename_msgというMessagePack形式で出力したいとする。 filename_yml = "test.yml" filename_msg = "test.msg" import yaml import msgpack obj = yaml.load(open(filename_yml),Loader=yaml.CLoader) msgp…
import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages pdf_path = "test.pdf" pdf = PdfPages(pdf_path) #グラフ生成 fig, ax = plt.subplots() pdf.savefig() #グラフ生成 fig, ax = plt.subplots() pdf.savefig() pdf.c…
Windows ServerでRAMディスクを作成する方法 本方法は、Windows Server 2016で試したが、2019でも同様のことは可能。 下記のサイトが参考になったので、日本語訳しつつ紹介する model-technology.com まず、「役割と機能の追加ウィザード」からiSCSI ターゲ…
pythonパッケージに比べて簡単すぎた。参考にしたのは以下のサイト qiita.com ソースファイル Masahiro Yoshimoto / affine6p-cs · GitLab パッケージ NuGet Gallery | Affine6P 1.0.2
.suo を削除する
The limitation of the size for the std::ofstream write is not 2GB in Visual Studio 2017. The limitation would be 64bit limits. std::vector<uchar> v(0x100000000); // 4GB (=2^32) std::ofstream ofs("o", std::ios::binary); ofs.write((char*)&v[0], v.s</uchar>…