Neovim Quick Bites EP02: Plugins
Packer.nvim packer is a plugin/package management tool for Neovim. You can write a ‘spec’ like lua file to manage all Neovim plugins. Installation Clone the latest packer repository to a folder as a ‘start’ package: git clone --depth 1 https://github.com/wbthomason/packer.nvim\ ~/.local/share/nvim/site/pack/packer/start/packer.nvim Usage You can write a plugin spec file in lua to manage all plugins. For example, you can create a plugins.lua in ~/.config/nvim/lua/: return require('packer').startup(function() -- Packer can manage itself use 'wbthomason/packer.
Neovim Quick Bites EP01: Basic
Introduction Neovim is a hyperextensible Vim-based text editor. Different than Vim, it uses lua as plugin language. It also supports most of existing Vim plugins. Personally, I think lua is easier and has a more smooth learning curve than vimscripts. I’m going to start a series of posts to talk about neovim. This post will start with basics: installation and configuration. Installation On Mac, most straightforward way is to use homebrew:
How to Handle UTF-8 URIs in Spring MVC
Introduction UTF-8 is a commonly used encoding for URIs, for example, https://zh.wikipedia.org/wiki/進擊的巨人. However, in Servlet Spec, the default request character encoding is ISO-8859-1. As browser doesn’t not send a content-type header with encoding for GET requests. The servlet engine will try to decode the URI using ISO-8859-1 enoding by default. It will cause issue when extracting the URI for other processing. In Spring MVC and Spring Security, the decoded URI is used in many places.
How to handle output parameter of callable statement in MyBatis
MyBatis is a first class persistence framework for Java. It’s feature rich and very straightforward in most cases. However, it’s missing documentation for advanced usage. The official document doesn’t have an concrete example for how to handle OUT parameters from an SQL procedure, specifically, a CURSOR type OUT parameter. In this post, we will walk through a simple use case and demonstrate how to call a DB procedure with CURSOR type OUT parameter.
Introducing go-awslogs
At my current job (Arena Solutions), we have 2 production environments. One of them is in AWS. Migrating a legacy application to AWS is not an easy job. I was the tech lead of that migration project. It was a time consuming and frustrating experience. Luckily, we eventually conquered most of the challenges and now we have the AWS production instance running smoothly. After the migration, another challenge fell on us.
How to Add LaTeX Support in Hugo
hugo doesn’t support LaTex natively. LaTex is very useful and essential for writing math related content. I run across KaTex. It’s a LaTex renderer in JavaScript. It has an extension to render all math content automatically. The basic idea is to inlude KaTex in the pages generated by hugo and render all math content with the auto-render extension. Hook to Existing Theme Usually, we all use a 3rd party theme. For example, this site is using hyde.
How to Parse String as Time in Go
I have been a Java developer for many years. Few months ago, I started learning Golang. One of the surprising difference between Java and Golang is how to parse a string to a time. In Java, we’re all familiar with java.time.format.DateTimeFormatter and the magic letters, y, d, M, h, m, s, etc. When I see a string representing a time or date, I’ll automatically map the string to a pattern in my mind.
How to Parse XML with Non-UTF8 Encoding in Go
I was working on a small project for parsing maven POM files. The problem I encountered was, not all POM xml were encoded with UTF-8. Most of them were, in fact encoded with UTF-8. However, some of the ancient projects or very old versions of popular projects, didn’t strictly stick to UTF-8. ISO-8859-1 and Windows-1252 are both seen in POM xml files in my tests. There might be more. <?xml version="1.
My First Post
Update: I’m now using netlify for hosting The first half of year 2020 is awful. It looks like the second half might be even worse. So I thought I’d better do something, at least make a change for myself. I’m going to start a personal blog. As a tech guy, I didn’t start writing right away. Instead, I did some research on different personal web site platforms and technologies.