Author | Logan

  1. Manage Chroot Environments with Schroot

    Schroot 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.

    Besides, schroot has good balance between isolation and convenience. By default, it will mount the home directory …

    More

  2. Build qemu-user-static from source code

    qemu-user-static is an important tool for cross-architecture developers. It allows developers to create a chroot environment and run the cross-compiled programs. For example, a developer may run an AArch64 executable without the overhead of system-level emulation.

    I usually install the qemu-user-static binaries from Ubuntu apt repository. However, I encountered some …

    More

  3. Find Undefined Behavior with Clang UBSan

    Two weeks ago, I came across an interesting bug. The convert() function below returns 0x80000001 when p points to 0x01, 0x00, 0x00, 0x80, but the expected return value is 0x00000001 instead.

    int32_t convert(const uint8_t *restrict p) {
      uint32_t x = (                  p[0] +
                    256 *             p[1] +
                    256 * 256 *       p[2] +
                    256 * 256 …

    More

  4. POSIX Shared Memory

    POSIX shared memory 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 …

    More

  5. Full-text Search with Django and PostgreSQL

    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.

    In this post, I would like to build an demo app with full-text search. This post covers several PostgreSQL-specific …

    More

  6. Introduction to qemu-debootstrap

    User-mode QEMU translates the instructions and the system calls. To run a static executable, you may wrap the command line with qemu-${arch}. For example, you may wrap an ARM64 static executable with qemu-aarch64:

    $ qemu-aarch64 /path/to/static-executable
    

    However, running a dynamically linked executable requires more efforts. To run a …

    More

  7. Django ORM and Updating Counters

    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 Django ORM.

    In this post, I would like to cover three ways …

    More

  8. Python Property Decorator

    Recently, I was tracing the source code of PyPy, and a special decorator named @property caught my attention. It seems to be a mechanism for Python programmers to create a getter, a setter, and a deleter for an instance variable. For example, how could we intercept the access to a …

    More

  9. Experience with Atom Editor

    I have been a Vim 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 reStructuredText previewer, but I am not very satisfied with InstantRst. I wish to have a two-panel editor that I can …

    More

Page 1 / 7 Next »