<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Logan's Note</title><link>http://logan.tw/</link><description></description><lastBuildDate>Mon, 30 Dec 2024 23:21:00 +0800</lastBuildDate><item><title>Thoughts on the Developement of PyPy RISC-V JIT Backend</title><link>http://logan.tw/posts/2024/12/30/pypy-riscv-jit-backend-dev/</link><description>&lt;p&gt;After eight years of development, my patch implementing a RISC-V JIT backend
for PyPy was merged upstream in 2024. This work is now included in the
&lt;a class="reference external" href="https://pypy.org/posts/2024/08/pypy-v7317-release.html"&gt;PyPy v7.3.17&lt;/a&gt; release in this August. To share my journey and my insights,
I decided to write this article.&lt;/p&gt;
&lt;div class="section" id="a-brief-introduction-to-pypy-and-rpython"&gt;
&lt;h2&gt;A brief introduction …&lt;/h2&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Mon, 30 Dec 2024 23:21:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2024-12-30:/posts/2024/12/30/pypy-riscv-jit-backend-dev/</guid><category>programming</category><category>python</category><category>pypy</category><category>compiler</category><category>jit</category></item><item><title>Django: Count Aggregates with Conditions</title><link>http://logan.tw/posts/2019/01/06/django-count-aggregates-with-conditions/</link><description>&lt;p&gt;In Django, One-to-Many relations are modeled by the &lt;code&gt;ForeignKey&lt;/code&gt;.  Under
some circumstances, we may wish to collect some information (e.g. &lt;strong&gt;count&lt;/strong&gt;,
&lt;strong&gt;min&lt;/strong&gt;, &lt;strong&gt;max&lt;/strong&gt;, &lt;strong&gt;avg&lt;/strong&gt;, etc) from related objects.  For example, in a blog
app, we may wish to build a table which lists the title and the number of …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 06 Jan 2019 18:39:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2019-01-06:/posts/2019/01/06/django-count-aggregates-with-conditions/</guid><category>programming</category><category>django</category><category>python</category></item><item><title>Manage Chroot Environments with Schroot</title><link>http://logan.tw/posts/2018/02/24/manage-chroot-environments-with-schroot/</link><description>&lt;p&gt;&lt;a class="reference external" href="https://gitlab.com/codelibre/schroot"&gt;Schroot&lt;/a&gt; allows users to switch between different Linux distributions or
releases conveniently.  As a software developer, I have to test software between
different Debian and Ubuntu releases.  Schroot perfectly fits my use case.&lt;/p&gt;
&lt;p&gt;Besides, schroot has good balance between &lt;strong&gt;isolation&lt;/strong&gt; and &lt;strong&gt;convenience&lt;/strong&gt;. By
default, it will mount the home directory …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 24 Feb 2018 22:33:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2018-02-24:/posts/2018/02/24/manage-chroot-environments-with-schroot/</guid><category>programming</category><category>schroot</category><category>linux</category></item><item><title>Build qemu-user-static from source code</title><link>http://logan.tw/posts/2018/02/18/build-qemu-user-static-from-source-code/</link><description>&lt;p&gt;&lt;code&gt;qemu-user-static&lt;/code&gt; is an important tool for cross-architecture developers.
It allows developers to create a &lt;em&gt;chroot environment&lt;/em&gt; and run the
&lt;em&gt;cross-compiled&lt;/em&gt; programs.  For example, a developer may run an AArch64
executable without the overhead of system-level emulation.&lt;/p&gt;
&lt;p&gt;I usually install the &lt;code&gt;qemu-user-static&lt;/code&gt; binaries from Ubuntu apt
repository.  However, I encountered some …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 18 Feb 2018 15:50:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2018-02-18:/posts/2018/02/18/build-qemu-user-static-from-source-code/</guid><category>programming</category><category>qemu</category></item><item><title>Find Undefined Behavior with Clang UBSan</title><link>http://logan.tw/posts/2018/01/27/find-undefined-behavior-with-clang-ubsan/</link><description>&lt;p&gt;Two weeks ago, I came across an interesting bug.  The &lt;code&gt;convert()&lt;/code&gt; function
below returns &lt;code&gt;0x80000001&lt;/code&gt; when &lt;code&gt;p&lt;/code&gt; points to &lt;code&gt;0x01&lt;/code&gt;,
&lt;code&gt;0x00&lt;/code&gt;, &lt;code&gt;0x00&lt;/code&gt;, &lt;code&gt;0x80&lt;/code&gt;, but the expected return value is
&lt;code&gt;0x00000001&lt;/code&gt; instead.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kt"&gt;int32_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;convert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;uint8_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="kr"&gt;restrict&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;                  &lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt;             &lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt;       &lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;256 …&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 27 Jan 2018 20:01:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2018-01-27:/posts/2018/01/27/find-undefined-behavior-with-clang-ubsan/</guid><category>programming</category><category>cxx</category><category>clang</category><category>sanitizer</category></item><item><title>POSIX Shared Memory</title><link>http://logan.tw/posts/2018/01/07/posix-shared-memory/</link><description>&lt;p&gt;&lt;strong&gt;POSIX shared memory&lt;/strong&gt; is an inter-process communication (IPC) mechanism
defined in POSIX specification.  After setting up the shared memory, two (or
more) processes may read from and write to the shared memory region.  Compared
to other IPC mechanisms (e.g. pipe, socket, etc), POSIX shared memory does not
impose copy …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 07 Jan 2018 08:23:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2018-01-07:/posts/2018/01/07/posix-shared-memory/</guid><category>programming</category><category>system</category><category>linux</category></item><item><title>Full-text Search with Django and PostgreSQL</title><link>http://logan.tw/posts/2017/12/30/full-text-search-with-django-and-postgresql/</link><description>&lt;p&gt;Django has several PostgreSQL database functions to support full-text search.
If you are using PostgreSQL as the database backend, then it is easy to add
full-text search to your Django app.&lt;/p&gt;
&lt;p&gt;In this post, I would like to build an demo app with full-text search.  This
post covers several PostgreSQL-specific …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 30 Dec 2017 19:50:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2017-12-30:/posts/2017/12/30/full-text-search-with-django-and-postgresql/</guid><category>programming</category><category>django</category><category>sql</category><category>postgresql</category><category>python</category></item><item><title>Introduction to qemu-debootstrap</title><link>http://logan.tw/posts/2017/01/21/introduction-to-qemu-debootstrap/</link><description>&lt;p&gt;User-mode &lt;a class="reference external" href="https://www.qemu.org/"&gt;QEMU&lt;/a&gt; translates the instructions and the system calls. To run a
&lt;strong&gt;static executable&lt;/strong&gt;, you may wrap the command line with &lt;code&gt;qemu-${arch}&lt;/code&gt;.
For example, you may wrap an ARM64 static executable with &lt;code&gt;qemu-aarch64&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$&lt;span class="w"&gt; &lt;/span&gt;qemu-aarch64&lt;span class="w"&gt; &lt;/span&gt;/path/to/static-executable
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;However, running a &lt;strong&gt;dynamically linked executable&lt;/strong&gt; requires more efforts.  To
run a …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 21 Jan 2017 22:49:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2017-01-21:/posts/2017/01/21/introduction-to-qemu-debootstrap/</guid><category>programming</category><category>qemu</category><category>linux</category><category>aarch64</category><category>arm64</category></item><item><title>Django ORM and Updating Counters</title><link>http://logan.tw/posts/2016/12/03/django-orm-and-updating-counters/</link><description>&lt;p&gt;Counters are common in website development.  Most websites collect the number of
page views with counters.  E-commerce websites keep track of the quantity of a
commodity with counters.  However, it is hard to implement a correct counter
with &lt;a class="reference external" href="https://docs.djangoproject.com/en/1.10/topics/db/models/"&gt;Django ORM&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In this post, I would like to cover three ways …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 03 Dec 2016 22:04:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2016-12-03:/posts/2016/12/03/django-orm-and-updating-counters/</guid><category>programming</category><category>django</category><category>python</category></item><item><title>Connect to Freenode with Irssi through SSL and SASL</title><link>http://logan.tw/posts/2016/03/19/connect-to-freenode-with-irssi-through-ssl-and-sasl/</link><description>&lt;p&gt;My dynamic IP address, which is provided by my ISP, seems to be blocked by
&lt;a class="reference external" href="https://freenode.net"&gt;Freenode&lt;/a&gt; (because it is easy for us to get another IP.)  According to the error
message, I should connect and login with &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer"&gt;SASL&lt;/a&gt;.  It took me a while to figure
out a solution, thus I …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 19 Mar 2016 16:47:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2016-03-19:/posts/2016/03/19/connect-to-freenode-with-irssi-through-ssl-and-sasl/</guid><category>programming</category><category>irc</category><category>irssi</category></item><item><title>Python Property Decorator</title><link>http://logan.tw/posts/2016/03/12/python-property-decorator/</link><description>&lt;p&gt;Recently, I was tracing the source code of &lt;a class="reference external" href="http://pypy.org"&gt;PyPy&lt;/a&gt;, and a special decorator named
&lt;code&gt;&amp;#64;property&lt;/code&gt; caught my attention.  It seems to be a mechanism for &lt;a class="reference external" href="http://python.org"&gt;Python&lt;/a&gt;
programmers to create a getter, a setter, and a deleter for an instance variable.
For example, how could we intercept the access to &lt;code&gt;a …&lt;/code&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 12 Mar 2016 20:09:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2016-03-12:/posts/2016/03/12/python-property-decorator/</guid><category>programming</category><category>python</category></item><item><title>Experience with Atom Editor</title><link>http://logan.tw/posts/2016/03/05/experience-with-atom-editor/</link><description>&lt;p&gt;I have been a &lt;a class="reference external" href="http://vim.org"&gt;Vim&lt;/a&gt; user for a long time.  However, I found that Vim is not good
enough for me to write blog with Pelican.  I need a good &lt;a class="reference external" href="http://docutils.sourceforge.net/rst.html"&gt;reStructuredText&lt;/a&gt;
previewer, but I am not very satisfied with &lt;a class="reference external" href="https://github.com/Rykka/InstantRst"&gt;InstantRst&lt;/a&gt;.  I wish to have a
two-panel editor that I can …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 05 Mar 2016 11:02:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2016-03-05:/posts/2016/03/05/experience-with-atom-editor/</guid><category>programming</category><category>atom</category></item><item><title>Colon Built-in in Bash</title><link>http://logan.tw/posts/2016/02/27/colon-built-in-in-bash/</link><description>&lt;p&gt;I came across a weird line in a shell script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;parameter&lt;/span&gt;&lt;span class="p"&gt;:=word&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It is so weird that I don't even know how to search for further information.
Fortunately, I found a &lt;a class="reference external" href="http://stackoverflow.com/questions/3224878/"&gt;post&lt;/a&gt; after searching &lt;strong&gt;bash colon&lt;/strong&gt;.  It is a
built-in utility which simply exits with 0.  In the other words …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 27 Feb 2016 15:17:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2016-02-27:/posts/2016/02/27/colon-built-in-in-bash/</guid><category>programming</category><category>bash</category><category>shell</category></item><item><title>Open and Close Files in Bash</title><link>http://logan.tw/posts/2016/02/20/open-and-close-files-in-bash/</link><description>&lt;p&gt;In a shell script, file descriptor 0 stands for &lt;em&gt;stdin&lt;/em&gt;, file descriptor 1
stands for &lt;em&gt;stdout&lt;/em&gt;, and file descriptor 2 stands for &lt;em&gt;stderr&lt;/em&gt;.  In addition,
programmers can &lt;strong&gt;open&lt;/strong&gt;, &lt;strong&gt;close&lt;/strong&gt;, or &lt;strong&gt;duplicate&lt;/strong&gt; file descriptors with the
&lt;code&gt;exec&lt;/code&gt; built-in command and the I/O redirection operator:&lt;/p&gt;
&lt;table border="1" class="docutils"&gt;
&lt;colgroup&gt;
&lt;col width="39%" /&gt;
&lt;col width="61%" /&gt;
&lt;/colgroup&gt;
&lt;thead valign="bottom"&gt;
&lt;tr&gt;&lt;th class="head"&gt;Syntax&lt;/th&gt;
&lt;th class="head"&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;exec $fd&amp;lt; &amp;quot;${filepath}&amp;quot;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Open …&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 20 Feb 2016 16:05:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2016-02-20:/posts/2016/02/20/open-and-close-files-in-bash/</guid><category>programming</category><category>bash</category><category>shell</category></item><item><title>JavaScript Object.defineProperty()</title><link>http://logan.tw/posts/2016/01/30/javascript-objectdefineproperty/</link><description>&lt;p&gt;In Javascript, we can add a property to an object with:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;property&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;However, sometimes we would like to have fine-grained control over properties.
With &lt;code&gt;Object.defineProperty()&lt;/code&gt;, we can decide:&lt;/p&gt;
&lt;table border="1" class="docutils"&gt;
&lt;colgroup&gt;
&lt;col width="16%" /&gt;
&lt;col width="62%" /&gt;
&lt;col width="22%" /&gt;
&lt;/colgroup&gt;
&lt;thead valign="bottom"&gt;
&lt;tr&gt;&lt;th class="head"&gt;Descriptor&lt;/th&gt;
&lt;th class="head"&gt;Purpose&lt;/th&gt;
&lt;th class="head"&gt;Default&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td&gt;value&lt;/td&gt;
&lt;td&gt;Property value&lt;/td&gt;
&lt;td&gt;&lt;code&gt;undefined&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;writable&lt;/td&gt;
&lt;td&gt;Whether the property can be assigned&lt;/td&gt;
&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;get&lt;/td&gt;
&lt;td&gt;Getter of the …&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 30 Jan 2016 21:01:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2016-01-30:/posts/2016/01/30/javascript-objectdefineproperty/</guid><category>programming</category><category>javascript</category></item><item><title>NPM Package Manager</title><link>http://logan.tw/posts/2016/01/24/npm-package-manager/</link><description>&lt;p&gt;&lt;a class="reference external" href="https://npmjs.org/"&gt;NPM&lt;/a&gt; package manager plays an important role in &lt;a class="reference external" href="https://nodejs.org"&gt;Node.js&lt;/a&gt; ecosystem.  Every
serious Javascript developers should learn how to create a package with
&lt;code&gt;npm&lt;/code&gt;.  In this post, I am going to cover several important &lt;code&gt;npm&lt;/code&gt;
commands.&lt;/p&gt;
&lt;div class="section" id="initialize-a-npm-package"&gt;
&lt;h2&gt;Initialize a NPM Package&lt;/h2&gt;
&lt;p&gt;To start a project, we have to create &lt;code&gt;package.json …&lt;/code&gt;&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 24 Jan 2016 20:04:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2016-01-24:/posts/2016/01/24/npm-package-manager/</guid><category>programming</category><category>javascript</category><category>node</category></item><item><title>Flask and Socket.IO</title><link>http://logan.tw/posts/2016/01/16/flask-and-socketio/</link><description>&lt;p&gt;Under some scenarios, we would like to push a message from an HTTP server to
clients.  For example, in a group messaging application, whenever a user sends a
message to the server, the server has to push such message to everyone.  Since
2001, several techniques have been proposed.  Eventually, &lt;a class="reference external" href="https://en.wikipedia.org/wiki/WebSocket"&gt;WebSocket …&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 16 Jan 2016 15:03:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2016-01-16:/posts/2016/01/16/flask-and-socketio/</guid><category>programming</category><category>python</category><category>flask</category><category>socketio</category></item><item><title>Vim Ctrl-P Plug-in</title><link>http://logan.tw/posts/2016/01/09/vim-ctrl-p-plug-in/</link><description>&lt;p&gt;&lt;a class="reference external" href="https://github.com/ctrlpvim/ctrlp.vim"&gt;Ctrl-P plug-in&lt;/a&gt; allows us to open files with fuzzy names or regular expression
matches.  It boosts my productivity at lot!  I am glad to know about this
plug-in and I would like to share my experience with you.&lt;/p&gt;
&lt;div class="section" id="installation"&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;If you are managing Vim plug-ins with &lt;a class="reference external" href="https://github.com/VundleVim/Vundle.vim"&gt;Vundle&lt;/a&gt; &lt;a class="footnote-reference" href="#footnote-1" id="footnote-reference-1"&gt;[1]&lt;/a&gt;, you can …&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 09 Jan 2016 09:21:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2016-01-09:/posts/2016/01/09/vim-ctrl-p-plug-in/</guid><category>programming</category><category>vim</category></item><item><title>Python New Style Class</title><link>http://logan.tw/posts/2016/01/02/python-new-style-class/</link><description>&lt;p&gt;Recently, I am curious about this code snippet:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;object&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="fm"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="k"&gt;pass&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Why do we have to extend or inherit from &lt;code&gt;object&lt;/code&gt; type?&lt;/p&gt;
&lt;p&gt;There are no differences with or without &lt;code&gt;(object)&lt;/code&gt; in Python 3.  But
there are &lt;em&gt;significant&lt;/em&gt; differences in Python 2.  If a class inherits (either
directly …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 02 Jan 2016 19:08:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2016-01-02:/posts/2016/01/02/python-new-style-class/</guid><category>programming</category><category>python</category></item><item><title>A Quick Guide to Grunt</title><link>http://logan.tw/posts/2015/12/26/a-quick-guide-to-grunt/</link><description>&lt;p&gt;&lt;a class="reference external" href="https://gruntjs.com/"&gt;Grunt&lt;/a&gt; is a task runner for Javascript development.  &lt;a class="reference external" href="https://gruntjs.com/"&gt;Grunt&lt;/a&gt; automates the
process to bundle, transpile, uglify, and compress the Javascript source code.
This post would like to give a quick guide to &lt;a class="reference external" href="https://gruntjs.com/"&gt;Grunt&lt;/a&gt;.&lt;/p&gt;
&lt;div class="section" id="installation"&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;Our first step is to create a &lt;code&gt;package.json&lt;/code&gt;.  We will need a
&lt;code&gt;package.json&lt;/code&gt; to …&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 26 Dec 2015 17:34:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-12-26:/posts/2015/12/26/a-quick-guide-to-grunt/</guid><category>programming</category><category>javascript</category></item><item><title>JavaScript Prototype and Object Oriented</title><link>http://logan.tw/posts/2015/12/19/javascript-prototype-and-object-oriented/</link><description>&lt;p&gt;Javascript is a prototype-based object-oriented programming language.  Unlike
the conventional class-based object-oriented programming languages (e.g. C++ or
Java), which ask programmers to write a class and then instantiate several
similar objects from the class, Javascript adopts a different approach.  In the
world of Javascript, we have to craft a …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 19 Dec 2015 23:21:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-12-19:/posts/2015/12/19/javascript-prototype-and-object-oriented/</guid><category>programming</category><category>javascript</category></item><item><title>Read Lines from stdin in Node.js</title><link>http://logan.tw/posts/2015/12/12/read-lines-from-stdin-in-nodejs/</link><description>&lt;p&gt;It is easy to write a hello world program in Node.js:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Hello world!&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;However, due to the asynchronous nature of Javascript, reading inputs and
writing outputs are less straight-forward.  We have to pass the callback
functions or register event listeners.&lt;/p&gt;
&lt;div class="section" id="first-attempt"&gt;
&lt;h2&gt;First Attempt&lt;/h2&gt;
&lt;p&gt;For example, to read some …&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 12 Dec 2015 22:13:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-12-12:/posts/2015/12/12/read-lines-from-stdin-in-nodejs/</guid><category>programming</category><category>node</category><category>javascript</category></item><item><title>Browserify</title><link>http://logan.tw/posts/2015/12/05/browserify/</link><description>&lt;p&gt;It is common to organize the code in several modules when we are developing
Javascript applications.  In &lt;a class="reference external" href="https://nodejs.org"&gt;Node.js&lt;/a&gt; ecosystem, we can import a module with
the &lt;code&gt;require()&lt;/code&gt; function and export symbols by adding them to the
&lt;code&gt;module.exports&lt;/code&gt; object.  On the other hand, ES2015 adds &lt;code&gt;import&lt;/code&gt;
statements and &lt;code&gt;export …&lt;/code&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 05 Dec 2015 19:30:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-12-05:/posts/2015/12/05/browserify/</guid><category>programming</category><category>babel</category><category>es2015</category><category>es6</category><category>javascript</category></item><item><title>Run ES2015 with Babel 6</title><link>http://logan.tw/posts/2015/11/29/run-es2015-with-babel-6/</link><description>&lt;p&gt;&lt;a class="reference external" href="http://www.ecma-international.org/ecma-262/6.0/"&gt;ECMAScript 2015&lt;/a&gt; (also known as ES2015 or informally ES6) is the latest
standard for JavaScript.  It has been released for a while.  However, &lt;a class="reference external" href="https://developers.google.com/v8/"&gt;V8&lt;/a&gt;, the
JavaScript engine for &lt;a class="reference external" href="https://nodejs.org"&gt;Node.js&lt;/a&gt;, has only limited &lt;a class="reference external" href="http://www.ecma-international.org/ecma-262/6.0/"&gt;ES2015&lt;/a&gt; support.  As of
writing, according to &lt;a class="reference external" href="https://kangax.github.io/compat-table/es6/"&gt;ECMAScript 6 compatibility table&lt;/a&gt;, the feature coverage
of each Javascript …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 29 Nov 2015 18:45:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-11-29:/posts/2015/11/29/run-es2015-with-babel-6/</guid><category>programming</category><category>babel</category><category>es2015</category><category>es6</category><category>javascript</category></item><item><title>Bash Signal Handler and Traps</title><link>http://logan.tw/posts/2015/11/16/bash-signal-handler-and-traps/</link><description>&lt;p&gt;I would like to launch &lt;strong&gt;ssh-agent&lt;/strong&gt; and add my private key at the beginning of
my shell script and stop it before leaving the shell script.  How do I
guarantee that &lt;strong&gt;ssh-agent&lt;/strong&gt; will be shutted down properly?  What will happen
if the user press &lt;code&gt;Ctrl-C&lt;/code&gt; or even kill the shell …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Mon, 16 Nov 2015 01:25:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-11-16:/posts/2015/11/16/bash-signal-handler-and-traps/</guid><category>programming</category><category>linux</category><category>bash</category><category>shell</category></item><item><title>Autossh and Systemd Service</title><link>http://logan.tw/posts/2015/11/15/autossh-and-systemd-service/</link><description>&lt;p&gt;Several months ago, I wrote a &lt;a class="reference external" href="http://logan.tw/posts/2014/12/15/autossh-and-ubuntu-upstart-daemon/"&gt;post&lt;/a&gt; to describe how to setup an &lt;a class="reference external" href="http://www.harding.motd.ca/autossh/"&gt;autossh&lt;/a&gt; daemon
with &lt;a class="reference external" href="http://upstart.ubuntu.com/"&gt;upstart&lt;/a&gt;.  Since Ubuntu 15.04 has switched to &lt;a class="reference external" href="http://www.freedesktop.org/wiki/Software/systemd/"&gt;systemd&lt;/a&gt;, I would like to do
the same with &lt;a class="reference external" href="http://www.freedesktop.org/wiki/Software/systemd/"&gt;systemd&lt;/a&gt;.  I will give a brief introduction to &lt;a class="reference external" href="http://www.freedesktop.org/wiki/Software/systemd/"&gt;systemd&lt;/a&gt; in this
post.&lt;/p&gt;
&lt;div class="section" id="systemd-unit-file"&gt;
&lt;h2&gt;Systemd Unit File&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="http://www.freedesktop.org/wiki/Software/systemd/"&gt;Systemd&lt;/a&gt; services …&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 15 Nov 2015 22:35:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-11-15:/posts/2015/11/15/autossh-and-systemd-service/</guid><category>web</category><category>linux</category><category>systemd</category><category>autossh</category><category>ssh</category></item><item><title>Fix Nautilus Video Thumbnails</title><link>http://logan.tw/posts/2015/11/08/fix-nautilus-video-thumbnails/</link><description>&lt;p&gt;I have a clean &lt;a class="reference external" href="http://ubuntu.com"&gt;Ubuntu&lt;/a&gt; 15.10 installation these days.  However, I noticed
that video thumbnails (or previews) do not show up in Gnome &lt;a class="reference external" href="https://wiki.gnome.org/Apps/Nautilus"&gt;Nautilus&lt;/a&gt;:&lt;/p&gt;
&lt;img alt="Nautilus without video preview thumbnails" src="http://logan.tw/static/images/nautilus-no-video-thumbnail.png" /&gt;
&lt;p&gt;I prefer thumbnails to icons.  Besides, I remember that &lt;a class="reference external" href="https://wiki.gnome.org/Apps/Nautilus"&gt;Nautilus&lt;/a&gt; will generate
a thumbnail for each video in &lt;a class="reference external" href="http://ubuntu.com"&gt;Ubuntu&lt;/a&gt; 14.04.  Thus, I took some …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 08 Nov 2015 15:19:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-11-08:/posts/2015/11/08/fix-nautilus-video-thumbnails/</guid><category>misc</category><category>linux</category><category>ubuntu</category><category>gnome</category></item><item><title>Debug Multithreaded Program with GDB</title><link>http://logan.tw/posts/2015/11/01/debug-multithreaded-program-with-gdb/</link><description>&lt;p&gt;&lt;a class="reference external" href="http://www.gnu.org/software/gdb"&gt;GDB&lt;/a&gt; is a powerful debugger.  Without a doubt, we can debug multi-threaded
programs with &lt;a class="reference external" href="http://www.gnu.org/software/gdb"&gt;gdb&lt;/a&gt;.  In particular, we can switch between threads, inspect
the stack, and dump the registers.  In this post, I would like to start with
the &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Dining_philosophers_problem"&gt;Dining Philosophers Problem&lt;/a&gt;, which was first coined by
&lt;a class="reference external" href="https://en.wikipedia.org/wiki/Edsger_W._Dijkstra"&gt;Edsger Dijkstra&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 01 Nov 2015 20:37:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-11-01:/posts/2015/11/01/debug-multithreaded-program-with-gdb/</guid><category>programming</category><category>gdb</category><category>linux</category></item><item><title>Discourse Installation Notes</title><link>http://logan.tw/posts/2015/09/13/discourse-installation-notes/</link><description>&lt;p&gt;&lt;a class="reference external" href="https://www.discourse.org/"&gt;Discourse&lt;/a&gt; is a new generation discussion forum.  I found that &lt;a class="reference external" href="https://www.discourse.org/"&gt;Discourse&lt;/a&gt;
is very suitable for personal note taking.  One notable feature of &lt;a class="reference external" href="https://www.discourse.org/"&gt;Discourse&lt;/a&gt;
is that the users can focus on conversations.  Besides, it supports Markdown as
the message markup language.  This is the reason why I like it very
much …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 13 Sep 2015 22:28:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-09-13:/posts/2015/09/13/discourse-installation-notes/</guid><category>web</category><category>discourse</category></item><item><title>Global Git Ignore File</title><link>http://logan.tw/posts/2015/06/27/global-git-ignore-file/</link><description>&lt;p&gt;There are some files that shouldn't be tracked by &lt;a class="reference external" href="http://git-scm.org"&gt;Git&lt;/a&gt; at all.  For example,
the temporary files created by the text editors, the Python bytecode, and etc.&lt;/p&gt;
&lt;p&gt;How could we ignore those files?  In the &lt;a class="reference external" href="http://logan.tw/posts/2015/02/28/git-ignore-file/"&gt;previous post&lt;/a&gt;, I have mentioned
that we can create a &lt;code&gt;.gitignore&lt;/code&gt; file and list the …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 27 Jun 2015 21:19:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-06-27:/posts/2015/06/27/global-git-ignore-file/</guid><category>programming</category><category>git</category><category>linux</category></item><item><title>Comparison and Sorting in Python3</title><link>http://logan.tw/posts/2015/06/14/comparison-and-sorting-in-python3/</link><description>&lt;p&gt;Although I have written &lt;a class="reference external" href="http://python.org"&gt;Python&lt;/a&gt; for several years, I am still not very familiar
with its idioms.  In particular, I don't quite understand how to compare and
sort the objects in Python.  That's the reason why I am writing this article.&lt;/p&gt;
&lt;p&gt;The rest of this article consists of following sections …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 14 Jun 2015 23:45:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-06-14:/posts/2015/06/14/comparison-and-sorting-in-python3/</guid><category>programming</category><category>python</category></item><item><title>Troubleshooting adb No Permissions Problem</title><link>http://logan.tw/posts/2015/05/25/troubleshooting-adb-no-permissions-problem/</link><description>&lt;p&gt;I got an Android Nexus 7 (2013, Wi-Fi) device a short while ago.  I attached
the device to my computer and tried to list the devices with &lt;code&gt;adb
devices&lt;/code&gt; command.  But, unfortunately, I got the following error message:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$&lt;span class="w"&gt; &lt;/span&gt;adb&lt;span class="w"&gt; &lt;/span&gt;devices
List&lt;span class="w"&gt; &lt;/span&gt;of&lt;span class="w"&gt; &lt;/span&gt;devices&lt;span class="w"&gt; &lt;/span&gt;attached
????????????&lt;span class="w"&gt;    &lt;/span&gt;no&lt;span class="w"&gt; &lt;/span&gt;permissions
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the following of …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Mon, 25 May 2015 21:59:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-05-25:/posts/2015/05/25/troubleshooting-adb-no-permissions-problem/</guid><category>misc</category><category>android</category><category>udev</category><category>linux</category><category>ubuntu</category></item><item><title>Grub Install and Btrfs Root File System</title><link>http://logan.tw/posts/2015/05/17/grub-install-and-btrfs-root-file-system/</link><description>&lt;p&gt;Recently, the Linux operating system on my laptop no longer boots.  It seems
that the boot sector for &lt;a class="reference external" href="http://www.gnu.org/software/grub/"&gt;GRUB&lt;/a&gt; bootloader is corrupted.  I tried to
&lt;strong&gt;reinstall GRUB&lt;/strong&gt; with an Ubuntu LiveCD; however, I have encountered some
problem related to &lt;a class="reference external" href="https://btrfs.wiki.kernel.org/"&gt;Btrfs&lt;/a&gt; file system (which is the file system for my root …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 17 May 2015 01:44:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-05-17:/posts/2015/05/17/grub-install-and-btrfs-root-file-system/</guid><category>misc</category><category>linux</category><category>grub</category></item><item><title>Check Code Coverage with Clang and LCOV</title><link>http://logan.tw/posts/2015/04/28/check-code-coverage-with-clang-and-lcov/</link><description>&lt;p&gt;Code coverage is a metric to show the code being untested.  It can be considered
as a hint to add more test cases.  When we are writing C/C++, the most notable
code coverage testing tool is &lt;a class="reference external" href="https://gcc.gnu.org/onlinedocs/gcc/Gcov.html"&gt;gcov&lt;/a&gt;, which is a GCC built-in coverage testing
tool.  Besides, we can collect …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Tue, 28 Apr 2015 01:28:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-04-28:/posts/2015/04/28/check-code-coverage-with-clang-and-lcov/</guid><category>programming</category><category>llvm</category><category>clang</category><category>lcov</category><category>test</category></item><item><title>Trace Source Code with Vim and Ctags</title><link>http://logan.tw/posts/2015/03/10/trace-source-code-with-vim-and-ctags/</link><description>&lt;p&gt;&lt;a class="reference external" href="http://ctags.sourceforge.net/"&gt;Ctags&lt;/a&gt; is a source code indexing tool.  With &lt;a class="reference external" href="http://ctags.sourceforge.net/"&gt;ctags&lt;/a&gt;, we can easily find the
definitions of the classes, functions, and variables.  According to my
experiences, &lt;a class="reference external" href="http://ctags.sourceforge.net/"&gt;ctags&lt;/a&gt; can significantly reduce the time to browse the source
code.  In this post, I would like to give a brief introduction to &lt;a class="reference external" href="http://ctags.sourceforge.net/"&gt;ctags&lt;/a&gt; and …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Tue, 10 Mar 2015 23:01:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-03-10:/posts/2015/03/10/trace-source-code-with-vim-and-ctags/</guid><category>programming</category><category>c</category><category>cxx</category><category>vim</category><category>ctags</category></item><item><title>Git Ignore File</title><link>http://logan.tw/posts/2015/02/28/git-ignore-file/</link><description>&lt;p&gt;In some circumstances, we would like to ignore the files (or directories) under
the Git repository base directory.  How could we do this?  For example, assume
that we have a Git repository with following files:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;out/bin/conv
preprocessed/out/gen-case1.h
preprocessed/out/gen-case2.h
preprocessed/input.txt
conv …&lt;/pre&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 28 Feb 2015 14:19:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-02-28:/posts/2015/02/28/git-ignore-file/</guid><category>programming</category><category>git</category></item><item><title>Using Aria2 Download Manager</title><link>http://logan.tw/posts/2015/02/21/using-aria2-download-manager/</link><description>&lt;p&gt;I used to download the large files with &lt;code&gt;wget&lt;/code&gt; because I can simply
resume the download tasks with &lt;code&gt;-c&lt;/code&gt; option.  This option will check
the size of the output file, and download the rest of the file from the server.
I can even restart the download task with a &lt;strong&gt;different …&lt;/strong&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 21 Feb 2015 23:02:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-02-21:/posts/2015/02/21/using-aria2-download-manager/</guid><category>misc</category><category>linux</category><category>aria2</category></item><item><title>C++11 Unique Pointer</title><link>http://logan.tw/posts/2015/01/31/c11-unique-pointer/</link><description>&lt;p&gt;C++11 introduced three new &lt;a class="reference external" href="http://en.cppreference.com/w/cpp/memory"&gt;smart pointer class templates&lt;/a&gt;:
&lt;code&gt;std::unique_ptr&lt;/code&gt;, &lt;code&gt;std::shared_ptr&lt;/code&gt;, and &lt;code&gt;std::weak_ptr&lt;/code&gt;.
These smart pointer class templates are designed to replace the old
&lt;a class="reference external" href="http://en.cppreference.com/w/cpp/memory/auto_ptr"&gt;std::auto_ptr&lt;/a&gt; smart pointer, which is known to have some defect and
deprecated now.  In this post, I would like to give a …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 31 Jan 2015 23:04:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-01-31:/posts/2015/01/31/c11-unique-pointer/</guid><category>programming</category><category>cxx</category></item><item><title>C++ std::multimap and Equal Range</title><link>http://logan.tw/posts/2015/01/20/c-stdmultimap-and-equal-range/</link><description>&lt;p&gt;Today I have encountered a problem: Given that there are multiple equivalent
keys in an instance of &lt;code&gt;std::multimap&lt;/code&gt;, how could we list all of the
corresponding values?  For example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;map&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;multimap&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;xs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;xs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;make_pair&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;xs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std …&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Tue, 20 Jan 2015 23:17:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-01-20:/posts/2015/01/20/c-stdmultimap-and-equal-range/</guid><category>programming</category><category>cxx</category><category>stl</category></item><item><title>Waliki Installation</title><link>http://logan.tw/posts/2015/01/02/waliki-installation/</link><description>&lt;p&gt;&lt;a class="reference external" href="https://github.com/mgaitan/waliki"&gt;Waliki&lt;/a&gt; is a simple wiki app for &lt;a class="reference external" href="http://www.djangoproject.com/"&gt;Django&lt;/a&gt;.  We can write wiki contents with
&lt;a class="reference external" href="http://docutils.sourceforge.net/rst.html"&gt;reStructuredText&lt;/a&gt; and the contents will be stored in a &lt;a class="reference external" href="http://git-scm.com"&gt;Git&lt;/a&gt; repository.
In this post, I would like to introduce the instructions to install &lt;a class="reference external" href="https://github.com/mgaitan/waliki"&gt;Waliki&lt;/a&gt;.&lt;/p&gt;
&lt;div class="section" id="getting-started"&gt;
&lt;h2&gt;Getting Started&lt;/h2&gt;
&lt;p&gt;First, install the related Ubuntu packages:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$&lt;span class="w"&gt; &lt;/span&gt;sudo&lt;span class="w"&gt; &lt;/span&gt;apt-get&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;git …&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Fri, 02 Jan 2015 11:20:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-01-02:/posts/2015/01/02/waliki-installation/</guid><category>web</category><category>python</category><category>wsgi</category><category>waliki</category></item><item><title>Python Package Manager: PIP</title><link>http://logan.tw/posts/2015/01/01/python-package-manager-pip/</link><description>&lt;p&gt;The Python package manager &lt;a class="reference external" href="https://pip.pypa.io"&gt;pip&lt;/a&gt; is a tool to manage the installed site
packages.  With &lt;a class="reference external" href="https://pip.pypa.io"&gt;pip&lt;/a&gt;, we don't have to be worried about the package
dependencies anymore.  &lt;a class="reference external" href="https://pip.pypa.io"&gt;pip&lt;/a&gt; will download the required packages from
&lt;a class="reference external" href="https://pypi.python.org"&gt;Python Package Index&lt;/a&gt; automatically.&lt;/p&gt;
&lt;div class="section" id="install-packages"&gt;
&lt;h2&gt;Install Packages&lt;/h2&gt;
&lt;p&gt;To download and install the packages from &lt;a class="reference external" href="https://pypi.python.org"&gt;Python Package Index …&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Thu, 01 Jan 2015 00:14:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2015-01-01:/posts/2015/01/01/python-package-manager-pip/</guid><category>programming</category><category>python</category><category>linux</category></item><item><title>2014 Year End Review</title><link>http://logan.tw/posts/2014/12/31/2014-year-end-review/</link><description>&lt;p&gt;It's the end of 2014.  It has been an amazing year with a lot of astonishing
moments!&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;This is my first year to work as a &lt;em&gt;full-time software engineer&lt;/em&gt;.  I have
learned a lot from the real world software development, including the PMD,
annaul planning, software schedule estimation, and etc …&lt;/li&gt;&lt;/ul&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Wed, 31 Dec 2014 23:54:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-12-31:/posts/2014/12/31/2014-year-end-review/</guid><category>misc</category><category>diary</category></item><item><title>Debian Backports</title><link>http://logan.tw/posts/2014/12/20/debian-backports/</link><description>&lt;p&gt;It is well-known that &lt;a class="reference external" href="http://www.debian.org/"&gt;Debian&lt;/a&gt; stable release is very &lt;em&gt;stable&lt;/em&gt;, i.e. the
packages are very old and well-tested.  However, this become a problem to me.&lt;/p&gt;
&lt;p&gt;Since &lt;a class="reference external" href="http://www.git-scm.org/"&gt;Git&lt;/a&gt; 1.9, we have to run the following command to silence a warning
when we are running &lt;code&gt;git push&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$&lt;span class="w"&gt; &lt;/span&gt;git&lt;span class="w"&gt; &lt;/span&gt;config&lt;span class="w"&gt; &lt;/span&gt;--global …&lt;/pre&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 20 Dec 2014 22:04:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-12-20:/posts/2014/12/20/debian-backports/</guid><category>misc</category><category>linux</category><category>debian</category></item><item><title>Count Trailing Zeros</title><link>http://logan.tw/posts/2014/12/17/count-trailing-zeros/</link><description>&lt;p&gt;How to count the number of trailing zeros of an integer?  The simplest way is
to use the built-in function &lt;code&gt;__builtin_ctz()&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kt"&gt;uint64_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint64_t&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;__builtin_ctz&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;What will happen if we don't have &lt;code&gt;__builtin_ctz()&lt;/code&gt;?  If we have another
built-in function &lt;code&gt;__popcount()&lt;/code&gt;, which can compute the &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Hamming_weight"&gt;Hamming weight&lt;/a&gt;
(the …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Wed, 17 Dec 2014 23:34:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-12-17:/posts/2014/12/17/count-trailing-zeros/</guid><category>programming</category><category>compiler</category></item><item><title>RISC-V Microprocessor</title><link>http://logan.tw/posts/2014/12/16/risc-v-microprocessor/</link><description>&lt;p&gt;&lt;a class="reference external" href="http://riscv.org"&gt;RISC-V&lt;/a&gt; is an instruction set architecture (ISA) released by UC Berkeley.
Besides, a high performance, power efficient, and royalty-free open source
implementation &lt;a class="reference external" href="https://github.com/ucb-bar"&gt;Rocket Chip&lt;/a&gt; is available.&lt;/p&gt;
&lt;p&gt;RISC-V was developed by Krste Asanović and David A. Patterson.  In their
&lt;a class="reference external" href="http://www.eecs.berkeley.edu/Pubs/TechRpts/2014/EECS-2014-146.pdf"&gt;technical report&lt;/a&gt;, they claimed that an open instruction set can benefit both …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Tue, 16 Dec 2014 23:20:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-12-16:/posts/2014/12/16/risc-v-microprocessor/</guid><category>misc</category><category>processor</category><category>compiler</category></item><item><title>Autossh and Ubuntu Upstart Daemon</title><link>http://logan.tw/posts/2014/12/15/autossh-and-ubuntu-upstart-daemon/</link><description>&lt;p&gt;Since I am sharing the network without public IP, I would like to maintain a
SSH tunnel so that I can connect to my desktop from the remote site.  After
searching the web, I found that &lt;a class="reference external" href="http://www.harding.motd.ca/autossh/"&gt;Autossh&lt;/a&gt; fits my needs.  &lt;a class="reference external" href="http://www.harding.motd.ca/autossh/"&gt;Autossh&lt;/a&gt; is a
utility that can start and monitor the …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Mon, 15 Dec 2014 18:04:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-12-15:/posts/2014/12/15/autossh-and-ubuntu-upstart-daemon/</guid><category>web</category><category>ssh</category><category>autossh</category><category>upstart</category><category>init</category></item><item><title>LLVM Obfuscator</title><link>http://logan.tw/posts/2014/12/09/llvm-obfuscator/</link><description>&lt;p&gt;I came across the &lt;a class="reference external" href="https://github.com/obfuscator-llvm/obfuscator/wiki"&gt;LLVM obfuscator&lt;/a&gt; today.  It is a &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Obfuscation_%28software%29"&gt;code obfuscator&lt;/a&gt; working
mostly on LLVM IR level.  This means that most LLVM supported target platforms
are supported by the &lt;a class="reference external" href="https://github.com/obfuscator-llvm/obfuscator/wiki"&gt;LLVM obfuscator&lt;/a&gt; as well.&lt;/p&gt;
&lt;p&gt;Also, I have also read &lt;a class="reference external" href="http://blog.quarkslab.com/deobfuscation-recovering-an-ollvm-protected-program.html"&gt;an article&lt;/a&gt; which mentioned how to disassemble and
deobfuscate the binaries …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Tue, 09 Dec 2014 23:18:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-12-09:/posts/2014/12/09/llvm-obfuscator/</guid><category>programming</category><category>llvm</category></item><item><title>C++ Virtual Destructor and Inheritence</title><link>http://logan.tw/posts/2014/12/09/c-virtual-destructor-and-inheritence/</link><description>&lt;p&gt;It is a well-known idiom to define a virtual destructor for the classes with
virtual functions.  If we don't define a virtual destructor, then the base
class destructor will be invoked when you are deleting the object through the
base class pointer even if the object is an instance of …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Tue, 09 Dec 2014 19:00:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-12-09:/posts/2014/12/09/c-virtual-destructor-and-inheritence/</guid><category>programming</category><category>cxx</category></item><item><title>LLVM Bugpoint</title><link>http://logan.tw/posts/2014/11/26/llvm-bugpoint/</link><description>&lt;p&gt;In this post, I would like to introduce the &lt;a class="reference external" href="http://llvm.org/docs/CommandGuide/bugpoint.html"&gt;bugpoint&lt;/a&gt; command line tool.
This is a automatic test case reduction tool which can help us generate
minimal test case.&lt;/p&gt;
&lt;p&gt;As a compiler developer, the first step to debug is to create a minimal test
case which can still reproduce the …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Wed, 26 Nov 2014 23:03:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-26:/posts/2014/11/26/llvm-bugpoint/</guid><category>programming</category><category>clang</category><category>llvm</category><category>test</category></item><item><title>Vim Vundle</title><link>http://logan.tw/posts/2014/11/25/vim-vundle/</link><description>&lt;p&gt;In the past, I didn't like to install the &lt;a class="reference external" href="http://www.vim.org/"&gt;Vim&lt;/a&gt; plug-ins or new syntax
highlight because all of the files were messed up in the &lt;code&gt;.vim&lt;/code&gt; directory
which makes it difficult to uninstall a plug-in.&lt;/p&gt;
&lt;p&gt;Recently, I have come across with &lt;a class="reference external" href="https://github.com/VundleVim/Vundle.vim"&gt;Vim Vundle&lt;/a&gt;.  It is a vim plug-in manager
which …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Tue, 25 Nov 2014 22:41:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-25:/posts/2014/11/25/vim-vundle/</guid><category>programming</category><category>vim</category></item><item><title>Let's Encrypt</title><link>http://logan.tw/posts/2014/11/24/lets-encrypt/</link><description>&lt;p&gt;According to the &lt;a class="reference external" href="http://andreasgal.com/2014/11/18/lets-encrypt-one-more-step-on-the-road-to-tls-everywhere/"&gt;post&lt;/a&gt; by &lt;a class="reference external" href="http://andreasgal.com"&gt;Andreas Gal&lt;/a&gt;, &lt;a class="reference external" href="https://www.eff.org/"&gt;EFF&lt;/a&gt;, &lt;a class="reference external" href="https://mozilla.com/"&gt;Mozilla&lt;/a&gt;, Cisco, Akamai,
and IdenTrust are going to form Internet Security Research Group which will
start the &lt;a class="reference external" href="https://letsencrypt.org/"&gt;Let's Encrypt&lt;/a&gt; ceritificate authority service in 2015 Q2.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="https://letsencrypt.org/"&gt;Let's Encrypt&lt;/a&gt; is expected to become a free, automated, and open SSL
sertificate authority which aims to …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Mon, 24 Nov 2014 23:32:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-24:/posts/2014/11/24/lets-encrypt/</guid><category>web</category><category>http</category><category>ssl</category></item><item><title>Ubuntu Bluetooth Headset</title><link>http://logan.tw/posts/2014/11/24/ubuntu-bluetooth-headset/</link><description>&lt;p&gt;I have bought a Bluetooth headset recently.  After connecting the device, I
was quite disappointed with the sound quality.  Fortunately, after searching on
the web, it seems that I am using the &amp;quot;Telphony Duplex&amp;quot; mode, which has low
quality.&lt;/p&gt;
&lt;p&gt;Here are the steps to switch to the mode with better …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Mon, 24 Nov 2014 23:04:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-24:/posts/2014/11/24/ubuntu-bluetooth-headset/</guid><category>misc</category><category>linux</category><category>ubuntu</category></item><item><title>Install GCIN on Ubuntu 14.04</title><link>http://logan.tw/posts/2014/11/23/install-gcin-on-ubuntu-1404/</link><description>&lt;p&gt;I decided to look for some alternatives to &lt;a class="reference external" href="https://code.google.com/p/ibus/"&gt;IBus&lt;/a&gt; input method after tolerating
its long latency to switch between input methods for a long time.  As a
Taiwanese, both &lt;a class="reference external" href="http://hyperrate.com/dir.php?eid=67"&gt;gcin&lt;/a&gt; and &lt;a class="reference external" href="http://hime.luna.com.tw/"&gt;hime&lt;/a&gt; came up to my mind.  Unfortunately, both of
them need extra configuration after &lt;code&gt;apt-get&lt;/code&gt;.  Here's my note to …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 23 Nov 2014 14:36:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-23:/posts/2014/11/23/install-gcin-on-ubuntu-1404/</guid><category>misc</category><category>linux</category><category>ubuntu</category><category>gcin</category></item><item><title>Pre-compile the OpenCL Kernel Program - Part 2</title><link>http://logan.tw/posts/2014/11/22/pre-compile-the-opencl-kernel-program-part-2/</link><description>&lt;p&gt;In the &lt;a class="reference external" href="http://logan.tw/posts/2014/11/21/pre-compile-the-opencl-kernel-program-part-1/"&gt;part 1&lt;/a&gt; of this article, we have mentioned how to pre-compile the
OpenCL kernel program and load the pre-compiled binaries with the OpenCL API.&lt;/p&gt;
&lt;p&gt;However, I was using the &lt;code&gt;ioc64&lt;/code&gt; command from the &lt;a class="reference external" href="https://software.intel.com/en-us/intel-opencl"&gt;Intel OpenCL SDK&lt;/a&gt; to
pre-compile the kernel program.  This command might be unavailable in the …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 22 Nov 2014 12:22:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-22:/posts/2014/11/22/pre-compile-the-opencl-kernel-program-part-2/</guid><category>programming</category><category>opencl</category></item><item><title>Pre-compile the OpenCL Kernel Program - Part 1</title><link>http://logan.tw/posts/2014/11/21/pre-compile-the-opencl-kernel-program-part-1/</link><description>&lt;p&gt;In the &lt;a class="reference external" href="http://logan.tw/posts/2014/11/18/getting-started-with-opencl/"&gt;previous post&lt;/a&gt;, we have written a simple vector addition OpenCL
program.  We were compiling the OpenCL kernel program from source code at
run-time, thus we have to distribute the OpenCL source code to our users.&lt;/p&gt;
&lt;p&gt;However, in some cases, we may prefer to &lt;strong&gt;pre-compile the OpenCL kernel
program …&lt;/strong&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Fri, 21 Nov 2014 21:22:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-21:/posts/2014/11/21/pre-compile-the-opencl-kernel-program-part-1/</guid><category>programming</category><category>opencl</category></item><item><title>C++ Private Inheritence and Using Directive</title><link>http://logan.tw/posts/2014/11/20/c-private-inheritence-and-using-directive/</link><description>&lt;p&gt;I used to feel that the private inheritence is useless.  Although we can
implement the has-a semantics with private inheritence, it provides little
benefits compared with object composition.  Besides, in order to expose the
privately inherited members to public, C++ introduced an awkward syntax, i.e.
the &lt;code&gt;using&lt;/code&gt; directives.  These …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Thu, 20 Nov 2014 11:52:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-20:/posts/2014/11/20/c-private-inheritence-and-using-directive/</guid><category>programming</category><category>cxx</category></item><item><title>OpenCL 1.2 Manual Pages</title><link>http://logan.tw/posts/2014/11/19/opencl-12-manual-pages/</link><description>&lt;p&gt;There is a package for &lt;a class="reference external" href="https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/"&gt;OpenCL 1.2 manual pages&lt;/a&gt; in the Ubuntu repository.  To
install the &lt;code&gt;opencl-1.2-man-doc&lt;/code&gt; package, please run this command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$&lt;span class="w"&gt; &lt;/span&gt;sudo&lt;span class="w"&gt; &lt;/span&gt;apt-get&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;opencl-1.2-man-doc
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After installing this package, we can check the OpenCL API with &lt;code&gt;man&lt;/code&gt;
command.  For example, run &lt;code&gt;man 3 clGetPlatformIDs&lt;/code&gt; to read …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Wed, 19 Nov 2014 22:37:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-19:/posts/2014/11/19/opencl-12-manual-pages/</guid><category>programming</category><category>opencl</category></item><item><title>Getting Started with OpenCL</title><link>http://logan.tw/posts/2014/11/18/getting-started-with-opencl/</link><description>&lt;p&gt;I have heard of &lt;a class="reference external" href="http://www.khronos.org/opencl"&gt;OpenCL&lt;/a&gt; for a long time, but I haven't tried it until
recently.  Here's my note to write and run a simple &lt;strong&gt;vector addition&lt;/strong&gt; OpenCL
program.&lt;/p&gt;
&lt;p&gt;The following source code is compiled and tested with &lt;a class="reference external" href="https://software.intel.com/en-us/intel-opencl"&gt;Intel SDK for OpenCL
Applications&lt;/a&gt;.  The code should work with other OpenCL …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Tue, 18 Nov 2014 23:05:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-18:/posts/2014/11/18/getting-started-with-opencl/</guid><category>programming</category><category>opencl</category></item><item><title>Fix GRUB2 Warning</title><link>http://logan.tw/posts/2014/11/17/fix-grub2-warning/</link><description>&lt;p&gt;It has been for a while that my desktop PC was not showing the &lt;a class="reference external" href="http://www.gnu.org/software/grub/"&gt;GRUB2&lt;/a&gt; menu.
Besides, I noticed that there was a warning message during the execution of
&lt;code&gt;update-grub&lt;/code&gt;:&lt;/p&gt;
&lt;blockquote&gt;
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT
is set is no longer supported.&lt;/blockquote&gt;
&lt;p&gt;After checking the manual, I …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Mon, 17 Nov 2014 23:50:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-17:/posts/2014/11/17/fix-grub2-warning/</guid><category>misc</category><category>linux</category><category>grub</category></item><item><title>GitHub Pages and HTTPS</title><link>http://logan.tw/posts/2014/11/16/github-pages-and-https/</link><description>&lt;p&gt;&lt;a class="reference external" href="https://pages.github.com"&gt;GitHub Pages&lt;/a&gt; supports HTTPS protocol.  It will be good to prefer HTTPS to
HTTP.  However, I found that if the URLs are not written carefully, the
user might be redirected to HTTP URLs.&lt;/p&gt;
&lt;p&gt;For unknown reason, &lt;a class="reference external" href="https://pages.github.com"&gt;GitHub Pages&lt;/a&gt; are redirecting the directories without
trailing slash to the HTTP URLs.  For …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 16 Nov 2014 23:31:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-16:/posts/2014/11/16/github-pages-and-https/</guid><category>web</category><category>github</category><category>https</category></item><item><title>Pelican and GitHub Pages</title><link>http://logan.tw/posts/2014/11/16/pelican-and-github-pages/</link><description>&lt;p&gt;&lt;a class="reference external" href="http://docs.getpelican.com"&gt;Pelican&lt;/a&gt; has built-in support for &lt;a class="reference external" href="https://pages.github.com"&gt;GitHub Pages&lt;/a&gt;.  However, I noticed that
the &lt;code&gt;ghp-import&lt;/code&gt; command might screw up the commit log if your GitHub
Pages and your Pelican source code share the same branch name.&lt;/p&gt;
&lt;p&gt;According to the document of &lt;a class="reference external" href="https://pages.github.com"&gt;GitHub Pages&lt;/a&gt;, the user pages should be
committed to &lt;code&gt;master&lt;/code&gt; branch …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sun, 16 Nov 2014 23:01:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-16:/posts/2014/11/16/pelican-and-github-pages/</guid><category>web</category><category>github</category><category>pelican</category></item><item><title>SSL Certificate</title><link>http://logan.tw/posts/2014/11/15/ssl-certificate/</link><description>&lt;p&gt;I would like to run &lt;a class="reference external" href="https://code.google.com/p/shellinabox/"&gt;shellinabox&lt;/a&gt; and my private blog system through HTTPS
protocol.  However, an SSL certificate is really expensive, thus I decided to
run our own &lt;strong&gt;certificate authority&lt;/strong&gt; and distribute my &lt;em&gt;cacert.pem&lt;/em&gt; through
&lt;a class="reference external" href="https://pages.github.com"&gt;GitHub Pages&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In general, running a certificate authority requires three steps:&lt;/p&gt;
&lt;ol class="arabic simple"&gt;
&lt;li&gt;Create a RSA …&lt;/li&gt;&lt;/ol&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Sat, 15 Nov 2014 02:30:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-15:/posts/2014/11/15/ssl-certificate/</guid><category>web</category><category>https</category><category>apache2</category><category>ssl</category></item><item><title>C++ std::list Operations</title><link>http://logan.tw/posts/2014/11/14/c-stdlist-operations/</link><description>&lt;p&gt;To sort the doubly linked list &lt;code&gt;std::list&lt;/code&gt;, we can simply call the
&lt;code&gt;sort()&lt;/code&gt; member function.  For example,&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;list&amp;gt;&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;list&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;xs&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;xs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="c1"&gt;// Sort the std::list!&lt;/span&gt;

&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;auto&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;xs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We can't …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Fri, 14 Nov 2014 23:53:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-14:/posts/2014/11/14/c-stdlist-operations/</guid><category>programming</category><category>cxx</category></item><item><title>C++ Associative Container and Iterator Validness</title><link>http://logan.tw/posts/2014/11/13/c-associative-container-and-iterator-validness/</link><description>&lt;p&gt;I used to believe that iterators will be invalidated after calling the
member functions &lt;code&gt;insert()&lt;/code&gt; or &lt;code&gt;erase()&lt;/code&gt; of containers.  Thus, I
would adopt a conservative approach:&lt;/p&gt;
&lt;ol class="arabic simple"&gt;
&lt;li&gt;Create a temporary container.&lt;/li&gt;
&lt;li&gt;Copy the elements which I would like to keep to the temporary container.&lt;/li&gt;
&lt;li&gt;Swap the container.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For example, to remove …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Thu, 13 Nov 2014 22:38:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-13:/posts/2014/11/13/c-associative-container-and-iterator-validness/</guid><category>programming</category><category>cxx</category><category>stl</category></item><item><title>Git Merge Base and Checkout</title><link>http://logan.tw/posts/2014/11/13/git-merge-base-and-checkout/</link><description>&lt;p&gt;Today I have learned two different usages of &lt;code&gt;git&lt;/code&gt; command.  First, to
list the &lt;strong&gt;least common ancestor&lt;/strong&gt; of two refs, we may use following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$&lt;span class="w"&gt; &lt;/span&gt;git&lt;span class="w"&gt; &lt;/span&gt;merge-base&lt;span class="w"&gt; &lt;/span&gt;--octopus&lt;span class="w"&gt; &lt;/span&gt;&amp;lt;commit_1&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;lt;commit_2&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;...&lt;span class="w"&gt; &lt;/span&gt;&amp;lt;commit_n&amp;gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Please notice that &lt;code&gt;--octopus&lt;/code&gt; is mandatory; otherwise, &lt;code&gt;git&lt;/code&gt;
will create a hypothetical commit &lt;code&gt;M&lt;/code&gt;, which merges &lt;code&gt;commit_2&lt;/code&gt; ..
&lt;code&gt;commit_n&lt;/code&gt;, and …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Thu, 13 Nov 2014 22:04:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-13:/posts/2014/11/13/git-merge-base-and-checkout/</guid><category>programming</category><category>git</category><category>tips</category></item><item><title>Soundness and Completeness of the Type System</title><link>http://logan.tw/posts/2014/11/12/soundness-and-completeness-of-the-type-system/</link><description>&lt;p&gt;In the section 6 of  &lt;a class="reference external" href="https://class.coursera.org/proglang-003"&gt;Programming Languages&lt;/a&gt; course, Dan Grossman discussed
about the soundness and the completeness of the type system.  He said that:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;A type-system is &lt;strong&gt;sound&lt;/strong&gt; implies that all of type-checked programs are
correct (in the other words, all of the incorrect program can't be type
checked), i …&lt;/li&gt;&lt;/ul&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Wed, 12 Nov 2014 21:26:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-12:/posts/2014/11/12/soundness-and-completeness-of-the-type-system/</guid><category>programming</category><category>plt</category><category>logic</category></item><item><title>First Post</title><link>http://logan.tw/posts/2014/11/11/first-post/</link><description>&lt;p&gt;After using &lt;a class="reference external" href="https://blogger.com"&gt;Blogger&lt;/a&gt; for several years, I decided to switch to &lt;a class="reference external" href="http://docs.getpelican.com"&gt;Pelican&lt;/a&gt; and
&lt;a class="reference external" href="https://pages.github.com"&gt;GitHub Pages&lt;/a&gt;.  I feel it will be much easier to write down my thoughts,
notes, and ideas with reStructuredText.  As a result, I can update the blog
more frequently.&lt;/p&gt;
&lt;p&gt;In the foreseeable future, I will start to …&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Logan</dc:creator><pubDate>Tue, 11 Nov 2014 23:38:00 +0800</pubDate><guid isPermaLink="false">tag:logan.tw,2014-11-11:/posts/2014/11/11/first-post/</guid><category>misc</category></item></channel></rss>