To Be Constant or Not to Be Constant

Naming a variable is an important job and you have to think twice before pressing down your key. Recently I’ve found that naming a constant depends on mutability of the variable and its elements (in case it’s a collection). From that, we can confidently give it an appropriate name.

// Constant
static final ImmutableList NAMES = ImmutableList.of("Ed", "Ann");

// Not a constant
static final ImmutableSet mutableElements = ImmutableSet.of(mutable);

Read more at Google Java Style Guide

CSS Transform Pitfall

When working with Vaadin TreeTable, we run into a serious scrolling issue. The tree scroll accidentally jumps to top every time we do some actions below the fold.

For example:

  • Inline-edit a row then click aside or Enter
  • Right-click unselected row
  • Click aside selected row to close context menu
  • etc.

After investigating and testing around, we found that the issue comes from CSS transform.

.v-table-body {
  -webkit-backface-visibility: hidden;
  -webkit-transform: translateZ(0);
}

The snippet originates from an improvement that accelerates hardware rendering on iOS. Commenting or removing it out has fixed the problems.

We also notice that Firefox 49+ added support for -webkit prefixed versions of a number of CSS transform properties. That explains why the issue occurs severely on both Chrome and Firefox.

Mapping GoDaddy Domain to Github Pages

For the goal of developing my personal brand, I’ve spent all my money and effort on buying a 10-dollar domain and mapped it to my Github pages. In fact, I had struggled with this job myself for 1 hour until I got it done with the help of my friend Google. These are the steps.

1) Create your Github pages

I’ll assume you already have a website like [yourUsename].github.io.

Don’t know how to create it? Follow this.
Don’t have much time? Go with Jekyll Now.

2) Create a CNAME file

Add your custom domain to that file e.g. “emeraldhieu.me” in my case.

create-cname-file

3) Configure GoDaddy

Login GoDaddy. In “Domain Details”, select “DNS Zone File”.

Create a record “@” that points to “192.30.252.153” in table “A (Host)”.

create-an-a-record

Create a record “www” that points to .github.io in table “CName (Alias)”

create-a-cname-record

4) Wait for changes to be updated

Check your work with this command

dig +nostats +nocomments +nocmd

wait-for-changes

DONE!

Work Journal

Today my friend @Genzer told me he was writing a work journal to take notes of what he had done in the day.

I think it’s very interesting for everyone to have a place to share professional knowledge, what problems we have and how we solve it.

That’s a good idea indeed.