Fanchao's Nest

The happy marriage of SQLite and JSON

Published:

I’ve been writing yet another CRUD app, shameless promotion here: simple-logbook. Its sole purpose was to learn Rust, React and record my own finances! It’s such a fun project: I made some very satisfying database design that I just want to share here with you. The curse of object oriented models in the database Think about the accounting software I’ve written: you have a bunch of financial transactions, for each transaction, you will have some properties like amount, date, etc.

More

Why I Like Room

Published:

This article talks about the Room Persistent Framework, part of Android’s de-facto standard library: Jetpack. Working with Java for so many years, one of the things I really want to see is a nice to use ORM framework. The last thing I want to do is debugging some weird data issues with live Hibernate objects. I had been an early adopter of Android’s Room library, I must admit this is the one thing that satisfies me on every aspect.

More

A Better Qt + SQL Experience

Published:

When I was developing a match maker app for the local badminton club, I missed Java so much. Not that I miss the heavy JVM hoarding all your memory, but all the convenience Java brings when it comes to database access. The most crucial part of that convenience, in my opionion, is no need to bind variables to a result row manually. Imagine this query: SELECT id, name, age FROM users; In Java you can pretty much do this;

More

Hugo with docker and automatic deployment

Published:

Hello! 你好!Kia Ora! This is the first post of this blog, so I might just write down how I made this website from scratch.

I run a server at home with couples of utility websites on it, using docker-compose with traefik.

The goals of this blog are simple:

  • The blog will be self-hosted using docker
  • The blog posts will be written in markdown
  • Data loss should be easily avoided
  • Changes should be deployed automatically

The solution I come up with:

  • Hugo as the content generator
  • Hugo project hosted on Gitlab
  • Upon push, Gitlab CI will deploy the website into a Docker image
  • watchtower automatically updates the website’s docker image and restart the container.

The advantages of writing blog this way:

  • No maintenance needed. All the content is on Gitlab, and I trust Gitlab to be competent.
  • Markdown is great. Standard, easy and clean to read even without being rendered, No more writing HTML.

I have a few notes along the way when working this out:

Using multi-staged Dockerfile to build a slim image

When running docker build, it will pull down the hugo image and run hugo commands to generate the website. However, because the website is all static, once generated, hugo is no longer necessary. We just need the nginx to serve the static files.

More