Go 1.4.1 Build Failure and Solution

Today I tried to build Go 1.4.1 from source but it failed with this error: go/src/liblink/anames9.c:6:29: fatal error: ../cmd/9l/9.out.h: No such file or directory At first I thought the building routine might have be changed so I opened and read Installing Go from Source again, carefully, and found nothing special. Then I searched for the error source and it turned out that I should deleted anames*.c, manually. There is no document and no automatic cleaning script, and you would have to figure it out yourself if no one ever mentioned it (source). ...

January 29, 2015

How to configure a custom domain name in GAE?

Steps: Visit Developers Console. In your project: Compute -> App Engine -> Settings. On the tab labelled CUSTOM DOMAINS, you can verify your domain and assign it and/or its subdomains to your GAE project. Add the DNS settings provided by Google into the DNS server of your domain provider. Notes: Only HTTP is supported, HTTPS is not. It will not work if you only modify the DNS record without actually assigning the custom domain in the Developer Console.

January 19, 2015

How to install a self-signed CA Certificate to Android 4.4

See this blog Remove “Network May Be Monitored by an Unknown Third Party” in Android 4.4 KitKat.

January 17, 2015

A Shorter Domain Name

This year, I decided not to renewal the previous domain name (hailiang.ws) last year, but to register a shorter one. There are two reasons: Both the site URL and the email address will be cleaner. A more friendly Go import path will be possible for my repositories on Github. After comparing various choices on major domain providers, I chose h12.io as the new domain. It is the shortest but still meaningful domain that I can afford. H is the initial letter of my given name, 12 is simply the number of letters of my full name, and .me is a top level domain quite suitable for a personal website. ...

December 16, 2014

Gombi: Creating Your Own Parser is Easier than Regular Expressions

Gombi is a combinator-style scanner & parser library written in Go. It is practical, reasonably fast and extremely easy to use. Quick start go get -u h12.io/gombi Design Combinator parsers are straightforward to construct, modular and easily maintainable, compared to parser generators like Lex/Yacc. Internal DSL no additional code generation and compilation. Composable a subset of the syntax tree is also a parser. a language can be easily embedded into another one. Gombi is inspired by but not limited to parser combinators. Unlike a combinator parser, Gombi neither limits its API to functional only, nor limits its implementation to functional combinators. Go is not a pure functional language as Haskell, so cloning a combinator parser like Parsec to Go will only lead to an implementaion much worse than Parsec. Instead, Gombi is free to choose any Go language structures that are suitable for a modular and convenient API, and any algorithms that can be efficiently implemented in Go. ...

August 7, 2014

Learning Resources on Parser Combinator

Monadic Parser Combinators Parsec: Direct Style Monadic Parser Combinators for the Real World Combinator Parsing: A Short Tutorial

August 4, 2014

Resources on Offline Hyphenation

CSS hyphenation is supported by latest version of Firefox, Safari & IE. However, Chrome does not support it. Though Hyphenator.js can solve this problem, it runs in the browser and affects the rendering speed of above-the-fold content. So there is only one option left: soft hyphen (U+00AD, ­). Here is a list of resources that leads to its implementation: An article about CSS3 hyphenation by Hyphenator.js Hunspell: the spell checker & hyphenator used by LibreOffice English Dictionary of LibreOffice Pyphen: A Python hyphenator using Hunspell dictionary file A test page for soft hyphen

July 30, 2014

Learning Haskell the Hard Way

When I was reading the collection of learning resources on Haskell and tried to find a good start, I quickly realized that none of the books or tutorials are suitable for me: the easier a tutorial claims to be, the harder to really understand Haskell by reading it. What I need is a terse documentation that introduces the syntax and semantics of Haskell systematically and clearly, but unfortunately none was found. ...

July 26, 2014

About 301 Moved Permanently

When building a website, there is one inevitable thing: 301 permanent redirection. The cases that have to involve 301 includes: Redirection from www subdomain to naked domain or vise versa. Redirection from slashed pretty URL to unslashed URL or vise versa. 301 is easy to implement with Go: func redirect301(w http.ResponseWriter, url string) { w.Header().Set("Location", url) w.WriteHeader(http.StatusMovedPermanently) } There is one more thing that needs attention: The root path of a domain always contains a slash (GET / in HTTP request), regardless the user enters the slash or not, so the root path needs no redirection. ...

July 25, 2014

How to Achieve a Perfect PageSpeed Insights Score

Indtroduction PageSpeed Insights is an online tool by Google to measure the performance of an web page for mobile and desktop devices. It has a set of heuristic rules considering the network-independent aspects of page performance. Each rule has a weight and the total score ranges from 0 to 100 points. The desktop and mobile tests have the same set of rules for performance and mobile test has some extra rules about user experience. ...

July 24, 2014