Just upgraded Graylog to cluster in a project. Because syslog UDP is used as input, a UDP load balance is required to distribute logs to servers in the cluster. Since the servers are hosted in Aliyun, I tried Aliyun UDP Load Balance first. But it does not forward requests evenly, and health detection diagram cannot be disabled. The popular HTTP load balance tool HAProxy does not support UDP. Fortunately, Nginx can be used as a UDP load balance.
It is common to use Redis as read buffer。To read data, first check whether it exists in Redis. If so, use the cached data, otherwise read from the backend storage and save a copy into Redis. To write data, first save into backend storage, then clear or update Reids cache.
But if the system bottleneck is in writing, the solution above does not work. But it is easy to modify it into a write buffer.
- Read: Check whether the data exists in Redis. Read from backend storage if not.
- Write: Just write into Redis. Notify background worker via message queue to flush the cache into backend storage.
- The background worker watches message queue, save data and delete from Redis.
The message queue can be implemented using Redis LIST. Official RPOPLPUSH – Redis command document already described how to implement a reliable queue. The remaining issue is how to safely delete saved data from Redis.
- Add properties files into
- Global messages location:
src/main/resources/Messages.propertiesis for default locale
src/main/resources/Messages_en_US.propertiesis for locale
- Resource Bundle for component: Same directory structure to the class path. For example the resource bundle file for
views.Maincan be found in
src/main/resources/views/Main.properties, or file name
Main_en_US.propertiesfor specific locale.
- Enable native-to-ascii conversion in IntelliJ to ease editing UTF-8 values.
I have wrote many scripts to automate the work in macOS. This one is the most freqently used one. The script can capture the current selection in frontend most app in OmniFocus, and I can jump back to the app using URL.
Vcpkg is a tool published by Microsoft, which is used to manage C/C++ libraries in Windows. It makes libraries installation easier, and it works well with CMake.
But it is not straitforward to staticly link the depdendent libraries using vcpkg.
Concourse CI is an awesome open source continuous integration tool. If you are not using Gitlab, and want to setup a CI server, it is a good choice.
Concourse CI provides Docker image and docker compose sample config. But when I run the hello world example, I have met several problems.
Sometimes I want to install some apps, but the site is blocked by GFW. I only have a Shadowsocks server, so I made some research how to setup up an HTTP and HTTPS proxy using Shadowsocks server.
The solution is using Shadowsocks client, which will establish a socket proxy, then convert the socket proxy to HTTP/HTTPS proxy using polipo.
Update 2017-05-09: The bear current version made clipper easier to use.
- Select content in browser and copy.
- Open Ulysses and use menu
Edit > Paste from > Rich textto paste
- Select pasted text and use menu
Edit > Copy as > Markdownto copy
- Copy page URL.
- Use /grab-url x-callback-url
- After the article is grabbed, use menu
Edit > Markdownto copy
Ansible uses YAML to define tasks, playbooks and handlers. If the files follow some conventions, it is easy to index them using Exuberant Ctags.
It is a headache to find an available keyboard shortcuts in Mac OS X. I used Option + Letter and Shift + Option + Letter before, since they are preserved for inputting special characters. It has some problems:
- Emacs and terminal require a modifier for Meta. I choosed Command. It means if I want to use application shortcut with Command in these applications, such as Command+Q to quit the application, I have to use the right one.
- I always forget the shortcuts. Although I have listed them in a sheet, it is a pain to keep it synchronized with the shortcuts defined every where.
I switched to a new solution using keystroke sequence shortcuts recently. All my global shortcuts start with Command+M (⌘M). A menu is displayed when I typed prefix. If I forget the shortcut, I just need to glance through the menu.