• Add properties files into src/main/resources
  • Global messages location:
    • src/main/resources/Messages.properties is for default locale
    • src/main/resources/Messages_en_US.properties is for locale en_US
  • Resource Bundle for component: Same directory structure to the class path. For example the resource bundle file for views.Main can be found in src/main/resources/views/Main.properties, or file name Main_en_US.properties for 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.

Ulysses way:

  1. Select content in browser and copy.
  2. Open Ulysses and use menu Edit > Paste from > Rich text to paste
  3. Select pasted text and use menu Edit > Copy as > Markdown to copy

Bear way:

  1. Copy page URL.
  2. Use /grab-url x-callback-url
  3. After the article is grabbed, use menu Edit > Markdown to 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.

Auto Toggle MacBook Internal Keyboard

I prefer using external keyboard with my MacBook. When no external monitors are used, a typical setup is placing the keyboard above the internal one, so I can still use the internal touchpad.

But sometimes the external keyboard may press some keys of the internal keyboard. There is a solution to disable the internal keyboard, but it is tedious to run the command manually.

# Disable, ignore the warning
sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/
# Enable
sudo kextload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/

Fortunately, Keyboard Maestro supports executing scripts when a USB device is attached or detached.

ActiveRecord has two query methods to eager load associations, includes and preload. Although the documentation of preload says

Allows preloading of args, in the same way that includes does.

Indeed the two methods have some differences.

In simple words, prefer includes to eager load associations. Use preload only when

  • you want to customize select columns, or
  • you meet error “Can not eagerly load the polymorphic association”.