Herokuで30秒以上かかるプログラム(メール送信、Push通知の送信 etc…)を実行させる場合はプログラムをバックグラウンドで実行させる必要があるのですが、APSchedulerというライブラリを使うと簡単に実装ができたので自分のためにメモしておきます。 Install まずは、APSchedulerをインストールします。 $ pip install apscheduler $ pip freeze > requirements.txt Coding 次にclock.pyを作成します。 例として平日はdo_workメソッドを呼び出して、休日はdo_restメソッドを日本時間の9時30分に定期的に実行するプログラムを書いてみます。 clock.py from apscheduler.schedulers.blocking import BlockingScheduler import
Pythonのイテレータ(iterator)とジェネレータ(generator)についてまとめてみます。 (追記2018.12.25: Python3の文法に全面的に置き換えました) イテレータ: 要素を反復して取り出すことのできるインタフェース ジェネレータ: イテレータの一種であり、1要素を取り出そうとする度に処理を行い、要素をジェネレートするタイプのもの。Pythonではyield文を使った実装を指すことが多いと思われる Python組み込みのコレクション(list, tuple, set, dictなど)はどれもイテレーション可能ですが、組み込みのコレクションを使った繰り返し処理ではあらかじめコレクションに値を入れておく必要があるため、以下のようなケースではイテレータやジェネレータを自分で実装したいというケースがあると思います。 無限に繰り返すイテレーション 要素すべてをあらかじめ
Free software, open standards, and web services for interactive computing across all programming languages JupyterLab: A Next-Generation Notebook Interface JupyterLab is the latest web-based interactive development environment for notebooks, code, and data. Its flexible interface allows users to configure and arrange workflows in data science, scientific computing, computational journalism, and ma
2016/12/15: にわかに閲覧者が増えたのでおかしなところを微修正 概要 統計学史をちょっと調べていておもしろかったのでまとめてみた 技術的にはすごく初歩的な話なので, 回帰分析 (最小二乗法) の入門的な「読み物」という位置づけになりそう 入門的な読み物なので, 特に最小二乗法の説明箇所は中学高校の数学の知識だけで理解できるような表現をしている, したつもり. PDF換算で 10 ページ (ただし画像が結構多い) 惑星の軌道を予測する連立方程式で惑星の軌道を予測する19世紀初頭にフランスの数学者ルジャンドル*1が最小二乗法のアイディアを最初に発表したが, ドイツの数学者ガウス*2が直後に自分こそが先に思いついたと主張し, 論争を生んだという (Abdulle & Wanner, 2002, 200 Years of Least Squares Method). しかし, いずれが先
CompanyEngineeringProductSunsetting AtomWe are archiving Atom and all projects under the Atom organization for an official sunset on December 15, 2022. January 30, 2023 Update: Update to the previous version of Atom before February 2 On December 7, 2022, GitHub detected unauthorized access to a set of repositories used in the planning and development of Atom. After a thorough investigation, we hav
CompanyEngineeringProductSunsetting AtomWe are archiving Atom and all projects under the Atom organization for an official sunset on December 15, 2022. January 30, 2023 Update: Update to the previous version of Atom before February 2 On December 7, 2022, GitHub detected unauthorized access to a set of repositories used in the planning and development of Atom. After a thorough investigation, we hav
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く