<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Jekyll Bootstrap</title>
 <link href="http://localhost:4000/atom.xml" rel="self"/>
 <link href="http://localhost:4000"/>
 <updated>2017-10-04T03:21:08+00:00</updated>
 <id>http://localhost:4000</id>
 <author>
   <name>Name Lastname</name>
   <email>blah@email.test</email>
 </author>

 
 <entry>
   <title>new post</title>
   <link href="http://localhost:4000/2017/10/04/new-post"/>
   <updated>2017-10-04T00:00:00+00:00</updated>
   <id>http://localhost:4000/2017/10/04/new-post</id>
   <content type="html">
</content>
 </entry>
 
 <entry>
   <title>hcicmder python sample</title>
   <link href="http://localhost:4000/2017/09/29/new-post"/>
   <updated>2017-09-29T00:00:00+00:00</updated>
   <id>http://localhost:4000/2017/09/29/new-post</id>
   <content type="html">
&lt;h1 id=&quot;git_homeworkspacepythonhcicmdercmder1&quot;&gt;git_home\workspace\python\hcicmder\cmder1&lt;/h1&gt;

&lt;h1 id=&quot;jenkinsapi-sphinx-sample&quot;&gt;jenkinsapi sphinx sample&lt;/h1&gt;

&lt;h2 id=&quot;use-sphinx-quickstart&quot;&gt;use sphinx-quickstart&lt;/h2&gt;

&lt;h2 id=&quot;change-confpy&quot;&gt;change conf.py&lt;/h2&gt;

&lt;h2 id=&quot;change-theme-setting-inside-confpy&quot;&gt;change theme setting inside conf.py&lt;/h2&gt;

&lt;h2 id=&quot;add-autodoc-inside-confpy&quot;&gt;add autodoc inside conf.py&lt;/h2&gt;
</content>
 </entry>
 
 <entry>
   <title>gn and ninja on windows</title>
   <link href="http://localhost:4000/2017/09/28/new-post"/>
   <updated>2017-09-28T00:00:00+00:00</updated>
   <id>http://localhost:4000/2017/09/28/new-post</id>
   <content type="html">
&lt;h2 id=&quot;why&quot;&gt;why&lt;/h2&gt;
&lt;p&gt;build a system evolution&lt;/p&gt;

&lt;p&gt;manual » script » makefile » auto-make » gn&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;adv: quick, small, tree-structure(makefile has)&lt;/li&gt;
  &lt;li&gt;disadv: it need all headers/libraries/source in side a package
auto-make are created to use some uitiles to generate a makefile&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;reference:
&lt;a href=&quot;https://blog.simplypatrick.com/posts/2016/01-23-gn/&quot;&gt;https://blog.simplypatrick.com/posts/2016/01-23-gn/&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;由於 GN 是用 C++ 撰寫，比起用 Python 寫的 GYP 快了將近 20 倍，GN 新的 DSL 的語法也被認為是比較好讀及維護的。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;usage&quot;&gt;Usage&lt;/h2&gt;

&lt;p&gt;Use Steps&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;configure some args&lt;/li&gt;
  &lt;li&gt;Use gn to generate a build.ninja a inside ‘out’ folder&lt;/li&gt;
  &lt;li&gt;Use ninja to read build.ninja and do its work!&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;mkdir out
&amp;gt;copy gn.args to out

&amp;gt;gn gen out
&amp;gt;ninja -C out
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 id=&quot;download-ninja&quot;&gt;download ninja&lt;/h3&gt;
&lt;p&gt;https://github.com/ninja-build/ninja/releases&lt;/p&gt;

&lt;p&gt;tutorial
(https://ninja-build.org/manual.html#ref_rule)[https://ninja-build.org/manual.html#ref_rule]&lt;/p&gt;

&lt;h3 id=&quot;download-gn&quot;&gt;download gn&lt;/h3&gt;
&lt;p&gt;gn is a tool to help build chrome browse in windows
it is a part of source code inside chrome
use git’s sha1 hash-value to download the file&lt;/p&gt;

&lt;p&gt;cheat sheet&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;gn ls out
; see all the taregets
gn check out
; check target dependences
gn desc out &amp;lt;target&amp;gt;
; descript the detail of target
gn refs out &amp;lt;target&amp;gt;
; list parent-targets that refs to target
gn path out &amp;lt;target1&amp;gt; &amp;lt;target2&amp;gt;
; show all paths from target1 to targets
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;tutorial
https://chromium.googlesource.com/chromium/src/+/lkgr/tools/gn/docs/quick_start.md&lt;/p&gt;

&lt;p&gt;gn download tool
https://github.com/cpu-chromium/gn_tool&lt;/p&gt;

&lt;p&gt;download code&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  with open(gn_path, 'wb') as f:
    f.write(urllib2.urlopen('https://chromium-gn.storage-download.googleapis.com/' + sha1).read())
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 id=&quot;gn-help&quot;&gt;gn help&lt;/h3&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;J:\git_home\temp\fluoride_src\fluoride\bt&amp;gt;gn help

Commands (type &quot;gn help &amp;lt;command&amp;gt;&quot; for more help):
  analyze: Analyze which targets are affected by a list of files.
  args: Display or configure arguments declared by the build.
  check: Check header dependencies.
  clean: Cleans the output directory.
  desc: Show lots of insightful information about a target or config.
  format: Format .gn file.
  gen: Generate ninja files.
  help: Does what you think.
  ls: List matching targets.
  path: Find paths between two targets.
  refs: Find stuff referencing a target or file.
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;file-format&quot;&gt;file format&lt;/h2&gt;

&lt;h3 id=&quot;gn-use&quot;&gt;gn use&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;variables: use ‘=’ to assign&lt;/li&gt;
  &lt;li&gt;rules: use a block (indent with spaces) to define&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ninja_required_version = 1.3

#variable

cc = g++
cflags = -Wall

# rule
rule cc
    command = gcc $cflags -c $in -o $out
rule link
    command = gcc $cflags $in -o $out
build foo.o: cc foo.c
build 
build .exe: link foo.c
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;another example by me&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;use germ.c =&amp;gt; germ.lib&lt;/li&gt;
  &lt;li&gt;use foo.c =&amp;gt; foo.o&lt;/li&gt;
  &lt;li&gt;use foo.o + germ.lib =&amp;gt; foo.exe&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ninja_required_version = 1.3

#variable

cc = g++

cflags = -Wall

# rule

rule cc
    command = gcc $cflags -c $in -o $out
rule ar
    command = ar rcs $out $in
rule link
    command = gcc $in -o $out -lgerm -L.
#build foo.o: cc foo.c


build germ.o: cc germ.c
build foo.o: cc foo.c
build germ.lib: ar germ.o
build foo.exe: link foo.o
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>new post</title>
   <link href="http://localhost:4000/2017/09/23/new-post"/>
   <updated>2017-09-23T00:00:00+00:00</updated>
   <id>http://localhost:4000/2017/09/23/new-post</id>
   <content type="html">
</content>
 </entry>
 
 <entry>
   <title>scapy</title>
   <link href="http://localhost:4000/2017/09/19/new-post"/>
   <updated>2017-09-19T00:00:00+00:00</updated>
   <id>http://localhost:4000/2017/09/19/new-post</id>
   <content type="html">
&lt;h2 id=&quot;scapy-usage&quot;&gt;scapy usage&lt;/h2&gt;
&lt;p&gt;Has the basic BT commands/packets encode/decode capability
from scapy.layers.bluetooth import *&lt;/p&gt;

&lt;h3 id=&quot;scapy-python3&quot;&gt;scapy-python3&lt;/h3&gt;
&lt;p&gt;use pyusb to send BT hci commands
Try to do&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Inquiry BR devices&lt;/li&gt;
  &lt;li&gt;Connect to a BR device&lt;/li&gt;
  &lt;li&gt;Get SDP data from a BR device&lt;/li&gt;
  &lt;li&gt;Connect a service of BR profiles&lt;/li&gt;
  &lt;li&gt;Inquiry LE devices&lt;/li&gt;
  &lt;li&gt;Connect to a LE device&lt;/li&gt;
  &lt;li&gt;Get a GATT service (any one)&lt;/li&gt;
  &lt;li&gt;Get a GATT data&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;20170919 progress: Add LE inquiry and set up event-filter&lt;/p&gt;

&lt;h3 id=&quot;pybluetooth--scapy2&quot;&gt;pybluetooth + scapy2&lt;/h3&gt;
&lt;p&gt;a LE inqury and connect sample&lt;/p&gt;

&lt;h3 id=&quot;scapy-python2&quot;&gt;scapy-python2&lt;/h3&gt;
&lt;p&gt;Basic scapy sample&lt;/p&gt;

&lt;h3 id=&quot;scapy-ironpython2&quot;&gt;scapy-ironpython2&lt;/h3&gt;
&lt;p&gt;use c# to use winusb driver&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>pyqt5 sip swig callback</title>
   <link href="http://localhost:4000/2017/09/18/new-post"/>
   <updated>2017-09-18T00:00:00+00:00</updated>
   <id>http://localhost:4000/2017/09/18/new-post</id>
   <content type="html">
&lt;h2 id=&quot;swig&quot;&gt;swig&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;wxWidows(python) uses swig to communite with wxwidget(Clang)&lt;/li&gt;
  &lt;li&gt;PyQT(python) use its sip to commuite with QT (Clang)&lt;/li&gt;
  &lt;li&gt;python use builtin ctypes to do communicate with DLL files&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;swig-vs-sip&quot;&gt;swig vs sip&lt;/h3&gt;

&lt;p&gt;swig has tutorial
sip only has a few articles in his document website
Both generates PyObject to do the bridge between Clang and python&lt;/p&gt;

&lt;h3 id=&quot;wxwidget-sample&quot;&gt;wxwidget sample&lt;/h3&gt;

&lt;p&gt;https://wiki.wxpython.org/C%2B%2BExtensions&lt;/p&gt;

&lt;h3 id=&quot;swig-sample-at-windows&quot;&gt;swig sample at windows&lt;/h3&gt;

&lt;p&gt;http://falldog7.blogspot.tw/2013/07/python-swig-c-function.html&lt;/p&gt;

&lt;h3 id=&quot;bluetooth-stack-for-swigsip&quot;&gt;Bluetooth Stack for swig/sip&lt;/h3&gt;
&lt;p&gt;Thinking to use swig/sip with one of bluetooth stack on windows&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;BOSS - BLE only open source, embedded-type&lt;/li&gt;
  &lt;li&gt;BlueCove - java, profile-level, no-core&lt;/li&gt;
  &lt;li&gt;32feet - csharp, profile-level, no-core&lt;/li&gt;
  &lt;li&gt;btstack - dual, clang, use POSIX linux-path, embedded-type&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;swig-for-callback&quot;&gt;swig for callback&lt;/h3&gt;

&lt;p&gt;both sip and swig doesn’t support callback direclty&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;%module test

%{
#include &quot;test.hh&quot;

class PyCallback
{
    PyObject *func;
    PyCallback&amp;amp; operator=(const PyCallback&amp;amp;); // Not allowed
public:
    PyCallback(const PyCallback&amp;amp; o) : func(o.func) {
      Py_XINCREF(func);
    }
    PyCallback(PyObject *func) : func(func) {
      Py_XINCREF(this-&amp;gt;func);
      assert(PyCallable_Check(this-&amp;gt;func));
    }
    ~PyCallback() {
      Py_XDECREF(func);
    }
    void operator()(const std::string&amp;amp; s) {
      if (!func || Py_None == func || !PyCallable_Check(func))
        return;
      PyObject *args = Py_BuildValue(&quot;(s)&quot;, s.c_str());
      PyObject *result = PyObject_Call(func,args,0);
      Py_DECREF(args);
      Py_XDECREF(result);
    }
};
%}

%include &quot;test.hh&quot;

%inline%{
  void register_handler(const QQEvent&amp;amp; e, PyObject *callback) {
    register_handler(e, PyCallback(callback));
  }
%}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

</content>
 </entry>
 
 <entry>
   <title>Use sip pyqt5 to generate pyd</title>
   <link href="http://localhost:4000/2017/09/16/new-post"/>
   <updated>2017-09-16T00:00:00+00:00</updated>
   <id>http://localhost:4000/2017/09/16/new-post</id>
   <content type="html">
&lt;h2 id=&quot;object---use-sipexe-of-pyqt5-of-windows-to-write-a-sample-with-mingw&quot;&gt;Object - Use sip.exe of pyqt5 of windows to write a sample with mingw&lt;/h2&gt;

&lt;p&gt;python-to-clang extension&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;pyqt uses sip&lt;/li&gt;
  &lt;li&gt;wxwidget uses swig&lt;/li&gt;
  &lt;li&gt;kivy uses cython&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;env&quot;&gt;Env&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;python –vesion
Python 3.5.2&lt;/li&gt;
  &lt;li&gt;python -m pip -V
pip 9.0.1 from c:\python35\lib\site-packages (python 3.5)&lt;/li&gt;
  &lt;li&gt;mingw64 **x64 **
x86_64-7.1.0-win32-seh-rt_v5-rev2&lt;/li&gt;
  &lt;li&gt;2015 visual studio (optional)&lt;br /&gt;
‘msvc’ MicroSoft Visual studio Compiler&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;/h3&gt;

&lt;p&gt;2 way to build pyd&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;configure way: split origin library and generate pyd&lt;br /&gt;
&lt;img src=&quot;/assets/screenshot/sip_pyqt5_configure.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;setup way: build and generate pyd in setup.py script&lt;br /&gt;
Same as configure way. but it builds libword.a in setup.py&lt;br /&gt;
&lt;img src=&quot;/assets/screenshot/sip_pyqt5_setup.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;mingw-normal-usage&quot;&gt;mingw normal usage&lt;/h3&gt;

&lt;p&gt;C:\mingw64&amp;gt;mingw-w64&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;PATH c:\mingw64\mingw64\bin;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Has native tools&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;mingw32-make&lt;/li&gt;
  &lt;li&gt;gcc.exe&lt;/li&gt;
  &lt;li&gt;g++.exe&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;**Caution!**
mingw uses dos filepath, not unix-like filepath
msys uses unix-like filepath
cygwin uses unix-like filepath
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 id=&quot;mingw-build-static-library&quot;&gt;mingw build static library&lt;/h3&gt;
&lt;p&gt;use g++ to compile object files
use ar to compile static library&lt;/p&gt;

&lt;p&gt;https://www.codeproject.com/Articles/84461/MinGW-Static-and-Dynamic-Libraries&lt;/p&gt;

&lt;p&gt;Compiling the static library&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;gcc -c add.c -o add.o
&amp;gt;ar rcs libadd.a add.o
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;compiling the dynamic library&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;gcc -c add.c -o add.o
gcc -shared -o libadd.so add.o
gcc -o main.exe main.c libadd.so
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h2 id=&quot;pyqt4-sip-sample-tutorial&quot;&gt;PyQt4 sip sample tutorial&lt;/h2&gt;

&lt;h3 id=&quot;pyqt4-sample---error-run-with-pyqt5--no-sipconfig--no-sipdistutils&quot;&gt;pyqt4 sample - Error run with pyqt5 ! no sipconfig ! no sipdistutils&lt;/h3&gt;

&lt;p&gt;ImportError: No module named ‘sipconfig’
change to sipdistutils. Still failed&lt;/p&gt;

&lt;p&gt;BOTH are Not longer support at PyQt5 and sip5 further&lt;/p&gt;

&lt;p&gt;http://pyqt.sourceforge.net/Docs/sip4/using.html&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;solution!&lt;/strong&gt;&lt;br /&gt;
    &lt;blockquote&gt;
      &lt;p&gt;download sip source and generate win32-g++ or msvc sipconfig.py&lt;br /&gt;
copy sipconfig.py and sipdistutils.py to project folder&lt;br /&gt;&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;how-to-get-sipconfigpy-for-configurepy&quot;&gt;How to get sipconfig.py for configure.py&lt;/h3&gt;

&lt;p&gt;We need to generate it from sip source code&lt;/p&gt;

&lt;p&gt;sipconfig.py is used to generate a Makefile&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &amp;gt;python configure.py --platform win32-g++
  or
  &amp;gt;python configure.py --platform msvc
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 id=&quot;how-to-get-sipdistutilspy-for-setuppy&quot;&gt;How to get sipdistutils.py for setup.py&lt;/h3&gt;

&lt;p&gt;sipdistutils.py is exists inside sip source code&lt;/p&gt;

&lt;p&gt;sipdistutils.py is used by distutil module / setup.py of python&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;discussion
https://github.com/wbsoft/python-poppler-qt5/issues/14&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;download url
https://www.riverbankcomputing.com/hg/sip/file/14685a6e736e/sipdistutils.py&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;setup.py not found gcc
change to use msvc&lt;/li&gt;
  &lt;li&gt;setup.py not found sipconfig.py
copy sip source’s sipconfig.py to local&lt;/li&gt;
  &lt;li&gt;setup.py can not find the sip.h and sip.exe
change sipconfig.py setting
https://docs.python.org/2/distutils/setupscript.html&lt;/li&gt;
  &lt;li&gt;cannot find word.h/word.cpp
add  include_dirs to setup.py
  Extension(“word”, [“word.sip”, “word.cpp”], include_dirs=[’.’, ]),
  ],&lt;/li&gt;
  &lt;li&gt;build pass but run-time error. assert at sip.dll&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;get-spiconfigpy-from-sip-ssurce-code&quot;&gt;Get spiconfig.py from sip ssurce code&lt;/h3&gt;

&lt;p&gt;Get spiconfig.py from sip_src.zip’s configure.y&lt;/p&gt;

&lt;p&gt;generate a mingw64 vesrion sipconfig.py&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python configure.py --platform win32-g++
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;generate a vs2015 version sipconfig.py&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python configure.py --platform msvc
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;if you don’t want to pass ‘–platform wn32-g++’ to python distutil module&lt;/p&gt;

&lt;p&gt;C:\python35\Lib\distutils\distutils.cfg&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[build]
compiler=msvc
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 id=&quot;fix-makefile-from-python-configurepy&quot;&gt;Fix Makefile from ‘python configure.py’&lt;/h3&gt;

&lt;p&gt;Use “python configure.py” to generate Makefile&lt;/p&gt;

&lt;p&gt;the default Makefile has some bugs&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &amp;gt;/Library/mingw-w64/lib/gcc/x86_64-w64-mingw32/7.1.0/include/c++/cmath:1136:11: error: '::hypot' has not been declared
               using ::hypot;
        
                       ^~~~~
        I found a solution at
        `g++ error on import of Theano on Windows 7 &amp;lt;https://stackoverflow.com/questions/38536788/g-error-on-import-of-theano-on-windows-7&amp;gt;`_.

        The solution is to create a file in the user folder called ``.theanorc`` which contains:
        ::
            [gcc]
            cxxflags = -D_hypot=hypot
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -shared -Wl,-subsystem,windows -Wl,-s -o word.pyd sipwordcmodule.o sipwordWord.o -Lc:\python35\libs -lword -lpython35 -L.
c:/mingw64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lword
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [Makefile:36: word.pyd] Error 1
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 id=&quot;python-setuppy-bdist-screenshot&quot;&gt;python setup.py bdist screenshot&lt;/h3&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;running bdist
running bdist_dumb
running build
running build_ext
installing to build\bdist.win-amd64\dumb
running install
running install_lib
creating build\bdist.win-amd64
creating build\bdist.win-amd64\dumb
creating build\bdist.win-amd64\dumb\python35
creating build\bdist.win-amd64\dumb\python35\Lib
creating build\bdist.win-amd64\dumb\python35\Lib\site-packages
copying build\lib.win-amd64-3.5\word.cp35-win_amd64.pyd -&amp;gt; build\bdist.win-amd64\dumb\python35\Lib\site-packages
running install_egg_info
Writing build\bdist.win-amd64\dumb\python35\Lib\site-packages\word-0.0.0-py3.5.egg-info
creating J:\git_home\workspace\qt\siptest\sip_tutorial1\dist
creating 'J:\git_home\workspace\qt\siptest\sip_tutorial1\dist\word-0.0.0.win-amd64.zip' and adding '.' to it
adding 'python35\Lib\site-packages\word-0.0.0-py3.5.egg-info'
adding 'python35\Lib\site-packages\word.cp35-win_amd64.pyd'
removing 'build\bdist.win-amd64\dumb' (and everything under it)

c:\python35\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'versione'
  warnings.warn(msg)
running install
running build
running build_ext
running install_lib
copying build\lib.win-amd64-3.5\word.cp35-win_amd64.pyd -&amp;gt; c:\python35\Lib\site-packages
running install_egg_info
Writing c:\python35\Lib\site-packages\word-0.0.0-py3.5.egg-info

&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>btstack compiled on windows with msys</title>
   <link href="http://localhost:4000/2017/09/14/new-post"/>
   <updated>2017-09-14T00:00:00+00:00</updated>
   <id>http://localhost:4000/2017/09/14/new-post</id>
   <content type="html">
&lt;h2 id=&quot;official-resource&quot;&gt;Official resource&lt;/h2&gt;
&lt;p&gt;github
&lt;a href=&quot;https://github.com/bluekitchen/btstack&quot;&gt;https://github.com/bluekitchen/btstack&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;manuual
&lt;a href=&quot;http://bluekitchen-gmbh.com/btstack/&quot;&gt;http://bluekitchen-gmbh.com/btstack/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;License&lt;/p&gt;

&lt;p&gt;Commercial !!!&lt;/p&gt;

&lt;h3 id=&quot;install&quot;&gt;Install&lt;/h3&gt;

&lt;p&gt;follow the installation instructions at ‘manual’&lt;/p&gt;

&lt;p&gt;install python, msys2 (POSIX command line), mingw64 (gcc), git, winpty&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;To install with MSYS2 : pacman -S mingw-w64-x86_64-gcc
To install with unzip : pacman -S unzip
To install with git   : pacman -S git
To install with winpty: pacman -S winpty
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;http://bluekitchen-gmbh.com/btstack/quick_start/#compiling-the-examples-and-loading-firmware&quot;&gt;compiling-the-example&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;modify-makeifle&quot;&gt;Modify Makeifle&lt;/h3&gt;
&lt;p&gt;Use ~/git_home/btstack/port/windows-winusb  as sample&lt;/p&gt;

&lt;p&gt;Modify ~/git_home/btstack/port/windows-winusb/Makefile&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Example=lecounter hfp_hf_demo
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;to&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Example=lecounter hfp_hf_demo gap_inquiry
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 id=&quot;run-sample&quot;&gt;Run sample&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;winpty ./gap_inquiry.exe&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Inquiry near bluetooth devices&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;winpty ./hfp_hf_demo.exe&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Use a phone as hfp ag and connect to this demo&lt;/p&gt;

&lt;p&gt;Press ‘X’ or ‘W’ in winpty console to show-status or do redial action&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/screenshot/btstack_sample1.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;architecture&quot;&gt;Architecture&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/assets/screenshot/btstack_architecture.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>sikuli automation test</title>
   <link href="http://localhost:4000/2017/09/09/new-post"/>
   <updated>2017-09-09T00:00:00+00:00</updated>
   <id>http://localhost:4000/2017/09/09/new-post</id>
   <content type="html">
&lt;h2 id=&quot;sikuli&quot;&gt;sikuli&lt;/h2&gt;
&lt;p&gt;用java + python 寫出的graphic script language&lt;/p&gt;

&lt;p&gt;offical url&lt;/p&gt;

&lt;p&gt;http://www.sikuli.org/&lt;/p&gt;

&lt;p&gt;tutorial&lt;/p&gt;

&lt;p&gt;https://www.techbang.com/posts/1907-drawings-to-write-programs-sikuli-will-change-the-world?comment_page=2#comments-list&lt;/p&gt;

&lt;p&gt;強制中止的話要按alt+shift+c&lt;/p&gt;

&lt;p&gt;開發過程&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;想要一個script, 一直監看左方螢幕有X 時, 去關掉視窗&lt;/li&gt;
  &lt;li&gt;找到region 說明. http://doc.sikuli.org/region.html&lt;/li&gt;
  &lt;li&gt;看不懂. 找了sample. 還是不懂&lt;/li&gt;
  &lt;li&gt;看說明跟debug 方式. 圖上有show &amp;amp; show-in, 分別可以在cursor現在後面圖
去做比對的動作&lt;/li&gt;
  &lt;li&gt;先抓一個X, 命名為ps(如下圖). 然後按下show 按鈕. 發現畫面左邊一點才可以match&lt;/li&gt;
  &lt;li&gt;發現會抓到後, 但若馬上畫面上沒有x, 就會timeout而failed. 找’find forever sikuli’&lt;/li&gt;
  &lt;li&gt;改搜尋wait() 不timeout  的設定. 原來要另外setAutoWaitTimeout(), 或是find(, timeout) 要設定第二個參數. 沒有forever&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;參考&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;sample1
https://kkboxsqa.wordpress.com/2014/04/21/ui-%E8%87%AA%E5%8B%95%E5%8C%96%E6%B8%AC%E8%A9%A6%E4%BD%BF%E7%94%A8-sikuli-%E6%93%8D%E4%BD%9C%E4%BB%8B%E7%B4%B9-part-2/&lt;/li&gt;
  &lt;li&gt;sample2
https://answers.launchpad.net/sikuli/+question/206657&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/screenshot/sikulix_1.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;sikulix-at-android---ankulua&quot;&gt;sikulix at android - ankulua&lt;/h2&gt;
&lt;p&gt;現在可以直接在Android 上面使用Sikuli 了
AnkuLua = Android + Sikuli + Lua
我們是AnkuLua 開發者
歡迎試用介紹並給我們指教&lt;/p&gt;

&lt;h2 id=&quot;按鍵精靈&quot;&gt;按鍵精靈&lt;/h2&gt;

&lt;p&gt;https://read01.com/Ay4RJo.html#.WbP0JcgjGUk&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/screenshot/button_wizard.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>TOEIC</title>
   <link href="http://localhost:4000/2017/09/06/new-post"/>
   <updated>2017-09-06T00:00:00+00:00</updated>
   <id>http://localhost:4000/2017/09/06/new-post</id>
   <content type="html">
&lt;h2 id=&quot;resource&quot;&gt;Resource&lt;/h2&gt;
&lt;p&gt;Exam Types&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;TOEIC&lt;/li&gt;
  &lt;li&gt;TOEIC SW  (speak and writing)&lt;/li&gt;
  &lt;li&gt;[TOEIC cert level] (http://cle.nkfust.edu.tw/ezfiles/123/1123/img/1825/165972056.pdf)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Resource&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://web.ydu.edu.tw/~chsini/toeic.pdf&quot;&gt;TOEIC_PDF&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://dictionary.cambridge.org/zht/%E8%A9%9E%E5%85%B8/%E8%8B%B1%E8%AA%9E/curriculum-vitae&quot;&gt;Dictionary&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.pass-the-toeic-test.com/media/Pass%20the%20TOEIC%20Test%20-%20TOEIC%20Word%20List.pdf&quot;&gt;TOEIC_WORD_LIST&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;backgound&quot;&gt;backgound&lt;/h2&gt;
&lt;p&gt;一年台灣5000考
平均分數 550
考一次$1500
考150 分鐘 (2.5hr)
可以上廁所, &lt;strong&gt;手機要靜音, 不然考試無效&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;exam&quot;&gt;exam&lt;/h2&gt;
</content>
 </entry>
 
 <entry>
   <title>how to use jekyll</title>
   <link href="http://localhost:4000/2017/09/05/new-post"/>
   <updated>2017-09-05T00:00:00+00:00</updated>
   <id>http://localhost:4000/2017/09/05/new-post</id>
   <content type="html">
&lt;p&gt;New a post&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;rake post
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;New a page&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;rake page
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Local preview and watch changes&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;jekyll server --watch
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Build changes to _sites folder&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;jekyll build
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

</content>
 </entry>
 
 <entry>
   <title>jekyll usage</title>
   <link href="http://localhost:4000/2017/09/04/new-post"/>
   <updated>2017-09-04T00:00:00+00:00</updated>
   <id>http://localhost:4000/2017/09/04/new-post</id>
   <content type="html">
&lt;h3 id=&quot;tutorial--sample&quot;&gt;tutorial &amp;amp; sample&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://jekyllcn.com/docs/usage/&quot;&gt;jekyll_usage&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://blog.lyhdev.com/2012/02/jekyll-github-pages.html&quot;&gt;jekyll-sample&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Jekyll Introduction</title>
   <link href="http://localhost:4000/lessons/2011/12/29/jekyll-introduction"/>
   <updated>2011-12-29T00:00:00+00:00</updated>
   <id>http://localhost:4000/lessons/2011/12/29/jekyll-introduction</id>
   <content type="html">
&lt;p&gt;This Jekyll introduction will outline specifically  what Jekyll is and why you would want to use it.
Directly following the intro we’ll learn exactly &lt;em&gt;how&lt;/em&gt; Jekyll does what it does.&lt;/p&gt;

&lt;h2 id=&quot;overview&quot;&gt;Overview&lt;/h2&gt;

&lt;h3 id=&quot;what-is-jekyll&quot;&gt;What is Jekyll?&lt;/h3&gt;

&lt;p&gt;Jekyll is a parsing engine bundled as a ruby gem used to build static websites from
dynamic components such as templates, partials, liquid code, markdown, etc. Jekyll is known as “a simple, blog aware, static site generator”.&lt;/p&gt;

&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;/h3&gt;

&lt;p&gt;This website is created with Jekyll. &lt;a href=&quot;https://github.com/mojombo/jekyll/wiki/Sites&quot;&gt;Other Jekyll websites&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;what-does-jekyll-do&quot;&gt;What does Jekyll Do?&lt;/h3&gt;

&lt;p&gt;Jekyll is a ruby gem you install on your local system.
Once there you can call &lt;code class=&quot;highlighter-rouge&quot;&gt;jekyll --server&lt;/code&gt; on a directory and provided that directory
is setup in a way jekyll expects, it will do magic stuff like parse markdown/textile files,
compute categories, tags, permalinks, and construct your pages from layout templates and partials.&lt;/p&gt;

&lt;p&gt;Once parsed, Jekyll stores the result in a self-contained static &lt;code class=&quot;highlighter-rouge&quot;&gt;_site&lt;/code&gt; folder.
The intention here is that you can serve all contents in this folder statically from a plain static web-server.&lt;/p&gt;

&lt;p&gt;You can think of Jekyll as a normalish dynamic blog but rather than parsing content, templates, and tags
on each request, Jekyll does this once &lt;em&gt;beforehand&lt;/em&gt; and caches the &lt;em&gt;entire website&lt;/em&gt; in a folder for serving statically.&lt;/p&gt;

&lt;h3 id=&quot;jekyll-is-not-blogging-software&quot;&gt;Jekyll is Not Blogging Software&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Jekyll is a parsing engine.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Jekyll does not come with any content nor does it have any templates or design elements.
This is a common source of confusion when getting started.
Jekyll does not come with anything you actually use or see on your website - you have to make it.&lt;/p&gt;

&lt;h3 id=&quot;why-should-i-care&quot;&gt;Why Should I Care?&lt;/h3&gt;

&lt;p&gt;Jekyll is very minimalistic and very efficient.
The most important thing to realize about Jekyll is that it creates a static representation of your website requiring only a static web-server.
Traditional dynamic blogs like Wordpress require a database and server-side code.
Heavily trafficked dynamic blogs must employ a caching layer that ultimately performs the same job Jekyll sets out to do; serve static content.&lt;/p&gt;

&lt;p&gt;Therefore if you like to keep things simple and you prefer the command-line over an admin panel UI then give Jekyll a try.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Developers like Jekyll because we can write content like we write code:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Ability to write content in markdown or textile in your favorite text-editor.&lt;/li&gt;
  &lt;li&gt;Ability to write and preview your content via localhost.&lt;/li&gt;
  &lt;li&gt;No internet connection required.&lt;/li&gt;
  &lt;li&gt;Ability to publish via git.&lt;/li&gt;
  &lt;li&gt;Ability to host your blog on a static web-server.&lt;/li&gt;
  &lt;li&gt;Ability to host freely on GitHub Pages.&lt;/li&gt;
  &lt;li&gt;No database required.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;how-jekyll-works&quot;&gt;How Jekyll Works&lt;/h1&gt;

&lt;p&gt;The following is a complete but concise outline of exactly how Jekyll works.&lt;/p&gt;

&lt;p&gt;Be aware that core concepts are introduced in rapid succession without code examples.
This information is not intended to specifically teach you how to do anything, rather it
is intended to give you the &lt;em&gt;full picture&lt;/em&gt; relative to what is going on in Jekyll-world.&lt;/p&gt;

&lt;p&gt;Learning these core concepts should help you avoid common frustrations and ultimately
help you better understand the code examples contained throughout Jekyll-Bootstrap.&lt;/p&gt;

&lt;h2 id=&quot;initial-setup&quot;&gt;Initial Setup&lt;/h2&gt;

&lt;p&gt;After &lt;a href=&quot;/index.html#start-now&quot;&gt;installing jekyll&lt;/a&gt; you’ll need to format your website directory in a way jekyll expects.
Jekyll-bootstrap conveniently provides the base directory format.&lt;/p&gt;

&lt;h3 id=&quot;the-jekyll-application-base-format&quot;&gt;The Jekyll Application Base Format&lt;/h3&gt;

&lt;p&gt;Jekyll expects your website directory to be laid out like so:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;.
|-- _config.yml
|-- _includes
|-- _layouts
|   |-- default.html
|   |-- post.html
|-- _posts
|   |-- 2011-10-25-open-source-is-good.markdown
|   |-- 2011-04-26-hello-world.markdown
|-- _site
|-- index.html
|-- assets
    |-- css
        |-- style.css
    |-- javascripts
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;_config.yml&lt;/strong&gt;
  Stores configuration data.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;_includes&lt;/strong&gt;
  This folder is for partial views.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;_layouts&lt;/strong&gt;
  This folder is for the main templates your content will be inserted into.
  You can have different layouts for different pages or page sections.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;_posts&lt;/strong&gt;
  This folder contains your dynamic content/posts.
  the naming format is required to be &lt;code class=&quot;highlighter-rouge&quot;&gt;@YEAR-MONTH-DATE-title.MARKUP@&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;_site&lt;/strong&gt;
  This is where the generated site will be placed once Jekyll is done transforming it.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;assets&lt;/strong&gt;
  This folder is not part of the standard jekyll structure.
  The assets folder represents &lt;em&gt;any generic&lt;/em&gt; folder you happen to create in your root directory.
  Directories and files not properly formatted for jekyll will be left untouched for you to serve normally.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(read more: &lt;a href=&quot;https://github.com/mojombo/jekyll/wiki/Usage&quot;&gt;https://github.com/mojombo/jekyll/wiki/Usage&lt;/a&gt;)&lt;/p&gt;

&lt;h3 id=&quot;jekyll-configuration&quot;&gt;Jekyll Configuration&lt;/h3&gt;

&lt;p&gt;Jekyll supports various configuration options that are fully outlined here:
(&lt;a href=&quot;https://github.com/mojombo/jekyll/wiki/Configuration&quot;&gt;https://github.com/mojombo/jekyll/wiki/Configuration&lt;/a&gt;)&lt;/p&gt;

&lt;h2 id=&quot;content-in-jekyll&quot;&gt;Content in Jekyll&lt;/h2&gt;

&lt;p&gt;Content in Jekyll is either a post or a page.
These content “objects” get inserted into one or more templates to build the final output for its respective static-page.&lt;/p&gt;

&lt;h3 id=&quot;posts-and-pages&quot;&gt;Posts and Pages&lt;/h3&gt;

&lt;p&gt;Both posts and pages should be written in markdown, textile, or HTML and may also contain Liquid templating syntax.
Both posts and pages can have meta-data assigned on a per-page basis such as title, url path, as well as arbitrary custom meta-data.&lt;/p&gt;

&lt;h3 id=&quot;working-with-posts&quot;&gt;Working With Posts&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Creating a Post&lt;/strong&gt;
Posts are created by properly formatting a file and placing it the &lt;code class=&quot;highlighter-rouge&quot;&gt;_posts&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Formatting&lt;/strong&gt;
A post must have a valid filename in the form &lt;code class=&quot;highlighter-rouge&quot;&gt;YEAR-MONTH-DATE-title.MARKUP&lt;/code&gt; and be placed in the &lt;code class=&quot;highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory.
If the data format is invalid Jekyll will not recognize the file as a post. The date and title are automatically parsed from the filename of the post file.
Additionally, each file must have &lt;a href=&quot;https://github.com/mojombo/jekyll/wiki/YAML-Front-Matter&quot;&gt;YAML Front-Matter&lt;/a&gt; prepended to its content.
YAML Front-Matter is a valid YAML syntax specifying meta-data for the given file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Order&lt;/strong&gt;
Ordering is an important part of Jekyll but it is hard to specify a custom ordering strategy.
Only reverse chronological and chronological ordering is supported in Jekyll.&lt;/p&gt;

&lt;p&gt;Since the date is hard-coded into the filename format, to change the order, you must change the dates in the filenames.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tags&lt;/strong&gt;
Posts can have tags associated with them as part of their meta-data.
Tags may be placed on posts by providing them in the post’s YAML front matter.
You have access to the post-specific tags in the templates. These tags also get added to the sitewide collection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Categories&lt;/strong&gt;
Posts may be categorized by providing one or more categories in the YAML front matter.
Categories offer more significance over tags in that they can be reflected in the URL path to the given post.
Note categories in Jekyll work in a specific way.
If you define more than one category you are defining a category hierarchy “set”.
Example:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;---
title :  Hello World
categories : [lessons, beginner]
---
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This defines the category hierarchy “lessons/beginner”. Note this is &lt;em&gt;one category&lt;/em&gt; node in Jekyll.
You won’t find “lessons” and “beginner” as two separate categories unless you define them elsewhere as singular categories.&lt;/p&gt;

&lt;h3 id=&quot;working-with-pages&quot;&gt;Working With Pages&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Creating a Page&lt;/strong&gt;
Pages are created by properly formatting a file and placing it anywhere in the root directory or subdirectories that do &lt;em&gt;not&lt;/em&gt; start with an underscore.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Formatting&lt;/strong&gt;
In order to register as a Jekyll page the file must contain &lt;a href=&quot;https://github.com/mojombo/jekyll/wiki/YAML-Front-Matter&quot;&gt;YAML Front-Matter&lt;/a&gt;.
Registering a page means 1) that Jekyll will process the page and 2) that the page object will be available in the &lt;code class=&quot;highlighter-rouge&quot;&gt;site.pages&lt;/code&gt; array for inclusion into your templates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Categories and Tags&lt;/strong&gt;
Pages do not compute categories nor tags so defining them will have no effect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sub-Directories&lt;/strong&gt;
If pages are defined in sub-directories, the path to the page will be reflected in the url.
Example:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;.
|-- people
    |-- bob
        |-- essay.html
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This page will be available at &lt;code class=&quot;highlighter-rouge&quot;&gt;http://yourdomain.com/people/bob/essay.html&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recommended Pages&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;index.html&lt;/strong&gt;
You will always want to define the root index.html page as this will display on your root URL.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;404.html&lt;/strong&gt;
Create a root 404.html page and GitHub Pages will serve it as your 404 response.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;sitemap.html&lt;/strong&gt;
Generating a sitemap is good practice for SEO.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;about.html&lt;/strong&gt;
A nice about page is easy to do and gives the human perspective to your website.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;templates-in-jekyll&quot;&gt;Templates in Jekyll&lt;/h2&gt;

&lt;p&gt;Templates are used to contain a page’s or post’s content.
All templates have access to a global site object variable: &lt;code class=&quot;highlighter-rouge&quot;&gt;site&lt;/code&gt; as well as a page object variable: &lt;code class=&quot;highlighter-rouge&quot;&gt;page&lt;/code&gt;.
The site variable holds all accessible content and metadata relative to the site.
The page variable holds accessible data for the given page or post being rendered at that point.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a Template&lt;/strong&gt;
Templates are created by properly formatting a file and placing it in the &lt;code class=&quot;highlighter-rouge&quot;&gt;_layouts&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Formatting&lt;/strong&gt;
Templates should be coded in HTML and contain YAML Front Matter.
All templates can contain Liquid code to work with your site’s data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rending Page/Post Content in a Template&lt;/strong&gt;
There is a special variable in all templates named : &lt;code class=&quot;highlighter-rouge&quot;&gt;content&lt;/code&gt;.
The &lt;code class=&quot;highlighter-rouge&quot;&gt;content&lt;/code&gt; variable holds the page/post content including any sub-template content previously defined.
Render the content variable wherever you want your main content to be injected into your template:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;...
&amp;lt;body&amp;gt;
  &amp;lt;div id=&quot;sidebar&quot;&amp;gt; ... &amp;lt;/div&amp;gt;
  &amp;lt;div id=&quot;main&quot;&amp;gt;
    &amp;#123;{content}&amp;#125;
  &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
...&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&quot;sub-templates&quot;&gt;Sub-Templates&lt;/h3&gt;

&lt;p&gt;Sub-templates are exactly templates with the only difference being they
define another “root” layout/template within their YAML Front Matter.
This essentially means a template will render inside of another template.&lt;/p&gt;

&lt;h3 id=&quot;includes&quot;&gt;Includes&lt;/h3&gt;
&lt;p&gt;In Jekyll you can define include files by placing them in the &lt;code class=&quot;highlighter-rouge&quot;&gt;_includes&lt;/code&gt; folder.
Includes are NOT templates, rather they are just code snippets that get included into templates.
In this way, you can treat the code inside includes as if it was native to the parent template.&lt;/p&gt;

&lt;p&gt;Any valid template code may be used in includes.&lt;/p&gt;

&lt;h2 id=&quot;using-liquid-for-templating&quot;&gt;Using Liquid for Templating&lt;/h2&gt;

&lt;p&gt;Templating is perhaps the most confusing and frustrating part of Jekyll.
This is mainly due to the fact that Jekyll templates must use the Liquid Templating Language.&lt;/p&gt;

&lt;h3 id=&quot;what-is-liquid&quot;&gt;What is Liquid?&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/Shopify/liquid&quot;&gt;Liquid&lt;/a&gt; is a secure templating language developed by &lt;a href=&quot;http://shopify.com&quot;&gt;Shopify&lt;/a&gt;.
Liquid is designed for end-users to be able to execute logic within template files
without imposing any security risk on the hosting server.&lt;/p&gt;

&lt;p&gt;Jekyll uses Liquid to generate the post content within the final page layout structure and as the primary interface for working with
your site and post/page data.&lt;/p&gt;

&lt;h3 id=&quot;why-do-we-have-to-use-liquid&quot;&gt;Why Do We Have to Use Liquid?&lt;/h3&gt;

&lt;p&gt;GitHub uses Jekyll to power &lt;a href=&quot;http://pages.github.com/&quot;&gt;GitHub Pages&lt;/a&gt;.
GitHub cannot afford to run arbitrary code on their servers so they lock developers down via Liquid.&lt;/p&gt;

&lt;h3 id=&quot;liquid-is-not-programmer-friendly&quot;&gt;Liquid is Not Programmer-Friendly.&lt;/h3&gt;

&lt;p&gt;The short story is liquid is not real code and its not intended to execute real code.
The point being you can’t do jackshit in liquid that hasn’t been allowed explicitly by the implementation.
What’s more you can only access data-structures that have been explicitly passed to the template.&lt;/p&gt;

&lt;p&gt;In Jekyll’s case it is not possible to alter what is passed to Liquid without hacking the gem or running custom plugins.
Both of which cannot be supported by GitHub Pages.&lt;/p&gt;

&lt;p&gt;As a programmer - this is very frustrating.&lt;/p&gt;

&lt;p&gt;But rather than look a gift horse in the mouth we are going to
suck it up and view it as an opportunity to work around limitations and adopt client-side solutions when possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Aside&lt;/strong&gt;
My personal stance is to not invest time trying to hack liquid. It’s really unnecessary
&lt;em&gt;from a programmer’s&lt;/em&gt; perspective. That is to say if you have the ability to run custom plugins (i.e. run arbitrary ruby code)
you are better off sticking with ruby. Toward that end I’ve built &lt;a href=&quot;http://github.com/plusjade/mustache-with-jekyll&quot;&gt;Mustache-with-Jekyll&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;static-assets&quot;&gt;Static Assets&lt;/h2&gt;

&lt;p&gt;Static assets are any file in the root or non-underscored subfolders that are not pages.
That is they have no valid YAML Front Matter and are thus not treated as Jekyll Pages.&lt;/p&gt;

&lt;p&gt;Static assets should be used for images, css, and javascript files.&lt;/p&gt;

&lt;h2 id=&quot;how-jekyll-parses-files&quot;&gt;How Jekyll Parses Files&lt;/h2&gt;

&lt;p&gt;Remember Jekyll is a processing engine. There are two main types of parsing in Jekyll.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Content parsing.&lt;/strong&gt;
  This is done with textile or markdown.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Template parsing.&lt;/strong&gt;
This is done with the liquid templating language.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And thus there are two main types of file formats needed for this parsing.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Post and Page files.&lt;/strong&gt;
All content in Jekyll is either a post or a page so valid posts and pages are parsed with markdown or textile.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Template files.&lt;/strong&gt;
  These files go in &lt;code class=&quot;highlighter-rouge&quot;&gt;_layouts&lt;/code&gt; folder and contain your blogs &lt;strong&gt;templates&lt;/strong&gt;. They should be made in HTML with the help of Liquid syntax.
  Since include files are simply injected into templates they are essentially parsed as if they were native to the template.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Arbitrary files and folders.&lt;/strong&gt;
Files that &lt;em&gt;are not&lt;/em&gt; valid pages are treated as static content and pass through
Jekyll untouched and reside on your blog in the exact structure and format they originally existed in.&lt;/p&gt;

&lt;h3 id=&quot;formatting-files-for-parsing&quot;&gt;Formatting Files for Parsing.&lt;/h3&gt;

&lt;p&gt;We’ve outlined the need for valid formatting using &lt;strong&gt;YAML Front Matter&lt;/strong&gt;.
Templates, posts, and pages all need to provide valid YAML Front Matter even if the Matter is empty.
This is the only way Jekyll knows you want the file processed.&lt;/p&gt;

&lt;p&gt;YAML Front Matter must be prepended to the top of template/post/page files:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;---
layout: post
category : pages
tags : [how-to, jekyll]
---

... contents ...
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Three hyphens on a new line start the Front-Matter block and three hyphens on a new line end the block.
The data inside the block must be valid YAML.&lt;/p&gt;

&lt;p&gt;Configuration parameters for YAML Front-Matter is outlined here:
&lt;a href=&quot;https://github.com/mojombo/jekyll/wiki/YAML-Front-Matter&quot;&gt;A comprehensive explanation of YAML Front Matter&lt;/a&gt;&lt;/p&gt;

&lt;h4 id=&quot;defining-layouts-for-posts-and-templates-parsing&quot;&gt;Defining Layouts for Posts and Templates Parsing.&lt;/h4&gt;

&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;layout&lt;/code&gt; parameter in the YAML Front Matter defines the template file for which the given post or template should be injected into.
If a template file specifies its own layout, it is effectively being used as a &lt;code class=&quot;highlighter-rouge&quot;&gt;sub-template.&lt;/code&gt;
That is to say loading a post file into a template file that refers to another template file with work in the way you’d expect; as a nested sub-template.&lt;/p&gt;

&lt;h2 id=&quot;how-jekyll-generates-the-final-static-files&quot;&gt;How Jekyll Generates the Final Static Files.&lt;/h2&gt;

&lt;p&gt;Ultimately, Jekyll’s job is to generate a static representation of your website.
The following is an outline of how that’s done:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Jekyll collects data.&lt;/strong&gt;
  Jekyll scans the posts directory and collects all posts files as post objects. It then scans the layout assets and collects those and finally scans other directories in search of pages.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Jekyll computes data.&lt;/strong&gt;
  Jekyll takes these objects, computes metadata (permalinks, tags, categories, titles, dates) from them and constructs one
  big &lt;code class=&quot;highlighter-rouge&quot;&gt;site&lt;/code&gt; object that holds all the posts, pages, layouts, and respective metadata.
  At this stage your site is one big computed ruby object.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Jekyll liquifies posts and templates.&lt;/strong&gt;
  Next jekyll loops through each post file and converts (through markdown or textile) and &lt;strong&gt;liquifies&lt;/strong&gt; the post inside of its respective layout(s).
  Once the post is parsed and liquified inside the the proper layout structure, the layout itself is “liquified”.
 &lt;strong&gt;Liquification&lt;/strong&gt; is defined as follows: Jekyll initiates a Liquid template, and passes a simpler hash representation of the ruby site object as well as a simpler
  hash representation of the ruby post object. These simplified data structures are what you have access to in the templates.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Jekyll generates output.&lt;/strong&gt;
 Finally the liquid templates are “rendered”, thereby processing any liquid syntax provided in the templates
 and saving the final, static representation of the file.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Notes.&lt;/strong&gt;
Because Jekyll computes the entire site in one fell swoop, each template is given access to
a global &lt;code class=&quot;highlighter-rouge&quot;&gt;site&lt;/code&gt; hash that contains useful data. It is this data that you’ll iterate through and format
using the Liquid tags and filters in order to render it onto a given page.&lt;/p&gt;

&lt;p&gt;Remember, in Jekyll you are an end-user. Your API has only two components:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The manner in which you setup your directory.&lt;/li&gt;
  &lt;li&gt;The liquid syntax and variables passed into the liquid templates.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All the data objects available to you in the templates via Liquid are outlined in the &lt;strong&gt;API Section&lt;/strong&gt; of Jekyll-Bootstrap.
You can also read the original documentation here: &lt;a href=&quot;https://github.com/mojombo/jekyll/wiki/Template-Data&quot;&gt;https://github.com/mojombo/jekyll/wiki/Template-Data&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;I hope this paints a clearer picture of what Jekyll is doing and why it works the way it does.
As noted, our main programming constraint is the fact that our API is limited to what is accessible via Liquid and Liquid only.&lt;/p&gt;

&lt;p&gt;Jekyll-bootstrap is intended to provide helper methods and strategies aimed at making it more intuitive and easier to work with Jekyll =)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thank you&lt;/strong&gt; for reading this far.&lt;/p&gt;

&lt;h2 id=&quot;next-steps&quot;&gt;Next Steps&lt;/h2&gt;

&lt;p&gt;Please take a look at &lt;a href=&quot;&quot;&gt;&lt;/a&gt;
or jump right into &lt;a href=&quot;&quot;&gt;Usage&lt;/a&gt; if you’d like.&lt;/p&gt;
</content>
 </entry>
 
 
</feed>
