Use GraphQL subscription to show progress of time-consuming operations

GraphQL is feature-rich query language designed to fit majority of needs of generic online applications. The 3 main types of operations in GraphQL are query, mutation and subscription. While queries and mutations are send in HTTP requests, subscriptions are running on WebSocket, which enables it to receive updates in real time. In this article, I would like to talk about using the subscription to report real-time results and/or progresses to time-consuming operations.

Measure per-letter dimension of text in JavaScript

TL;DR: Create a Range, set proper start and end points up to the text node with proper offset, then use Range.getBoundingClientRect() to get the dimensions.

As a part of the Lyricova Jukebox, we wanted to support inline karaoke swipe animation. With the time tags in the data, it is easy to figure out the time when the animation must reach a certain character. Then we need to figure out a way measure per character dimension for the animation to work.

How LyricsX keeps track of progress of media players

LyricsX is an open source software for macOS to download and display lyrics of current playing track on Music (previously iTunes), Spotify, Audirvana, Vox, Swinsian, or the Now Playing indicator in the OS. It gets time-tagged lyrics files from local storage or internet, and then display the lyrics in sync with the player.

As a crucial component of the development of Lyricova Jukebox, I have researched multiple implementations of real time lyrics display programs, and I found the mechanism behind LyricsX particularly interesting. Here in this article, I’d share with you how LyricsX tracking the player progress in a unique and resource-saving way.

中西文混合排版中标点符号的渲染

本文又是一篇从 Telegram 的投票评语里面引申出来博文。不知不觉发现这一话题写了很长,就索性再添上一些写进这里。我们不争论我们是否「应该」在中文里面用弯引号云云。如果没有硬性规定,按个人偏好就好。

首先,不同于大部分中文/全角标点,Unicode 里面有一些常用的中文标点是和西文中同样作用的标点共享相同的码位的:

Switch Galaxy Wearable Store Location using XPrivacyLua

Update 6 July 2020: Added alternative method using Riru Location Report Enabler.

Galaxy Wearable Store (GWS) is the app store for Galaxy wearable devices of Samsung. GWS is strongly region-dependent, just like other aspects of the device (you have to do some software hacking for a device purchased in one region to use Samsung Pay in another region). Being able to run with non-Samsung devices means that it cannot rely on the region-of-sale on the phone (and for some reason they didn’t choose to use the region of the device), GWS decided to use the region of your SIM card on the device to determine the store location.

Monitor Connected Devices to an ASUS Router Using Raspberry Pi

Title should have explained it all. A simple Python script to monitor if a certain device has connected to the router via Wi-Fi, and send notifications accordingly. You can use this script for whatever purpose you want1I used it to monitor whether my parent has left home when I am “seemingly asleep”. , though probably you might not be able to find one like most of others.

To use this script, you need SSH access to the router, something in your LAN that is always running (in my case, a Raspberry Pi), and the list of MAC addresses to monitor. In this example, I am using an Asus RT-AC1200GU as the router. Other brand or make might need a different command.

NLP を使わず簡単に中国語と日本語を仕分ける方法

このブログの他の記事と同じ、この記事も自分のオープンソースプロジェクトを作るときに発見したものである。音楽ライブラリーのタイトル、歌詞などのデータに読みがなをつけたいときに、中国語と日本語のテキストを区別する方法が欲しかった。ボクの音楽ライブラリーに中国語、日本語とアルファベット系の言語しかなかった。アルファベット系の言語は大した処理をいらす、簡単にソートすることができるだが、中国語と日本語はそんなに簡単ではなかった、特に漢字に対する処理の仕方が違う。

一种简单粗暴无需 NLP 的区分中文和日文文本的方法

和博客里其他大多数的文章一样,这篇文章也是来自我平时开发个人项目时候的发现。在处理我的音乐库、歌词和其他数据的标音时,我需要一种简单的方式来区分中文文本和日文文本。因为我的曲库里面基本上只有中文、日文和其他拉丁字母构成的语种。而那些拉丁语种不需要太多复杂的处理就能够直接自然的排序,而中文和日文就没有这么简单,尤其是两种语言在对汉字的处理上有着截然不同的方法的时候。