Tuesday, September 22, 2015

高效用的追蹤科技

How do parents keep track of small children? Do they attach some sort of IoT-enabled, smartphone connected, rechargeable GPS+bluetooth indoor positioning??

Nope, they just give them cute, squeaky shoes to wear.

Python on Windows

想用 Windows 的命令行執行 Python 應該做兩件事

  1. Python 根目錄資料夾 e.g. C:\Python27 或是 C:\WinPython-64bit-2.7.9.1\python-2.7.9.amd64 把這個資料夾加入Windows的path環境變數
  2. 在Python根目錄找 Scripts 資料夾 加入path
    這樣可以在命令行執行常用的python執行檔像是 ipython, pygmentize, pylint等等

Wednesday, September 16, 2015

IPython 簡報檔案

IPython 其實可以把筆記本(notebook)轉成投影片。

首先要在你的筆記本指定投影片的metadata

去 "Cell Toolbar" 選 "Slideshow":

現在每一單元格都有 Slide Type 選項單:

有六種選項:
  • -
    • 跟Slide一起出現的
  • Slide
    • 主要簡報分割單位,左右軸的
  • Sub-slide
    •  隸書一個Slide,上下軸
  • Fragment
    • 隸屬一個Slide或Subslide,按一次才出現

  • Note
    • 演講稿
  • Skip
    • 顧名思義就是跳過這單元格不要加入簡報 
參考:https://github.com/ipython/ipython/wiki/IPEP-9:-Slideshow-from-the-notebook#structure-behind-the-static-slideshow

筆記本調好了後再用 nbconvert 產生簡報

ipython nbconvert 筆記本檔案.ipynb --to slides --reveal-prefix "http://cdn.jsdelivr.net/reveal.js/2.6.2" --post serve

要用reveal-prefix因為目前最新版的reveal跟ipython不相容,要降級
請參考這個stack overflow 答案

簡報範例 
(註:Dropbox host 是https 所以我需要把所產生的網頁的 CDN 連結從http改成https,不然的話瀏覽器會抱怨就不會跑reveal.js的簡報呈現程式
打開瀏覽器的開發者工具就知道了)

我的字體怎麼了

我現在用的作業系統是 Ubuntu 14.04。Chrome瀏覽器會有這種問題:

來源:蘋果日報

Firefox 卻沒問題 ……