This Week I Learned - 2017 Week 25

Last week post or you can explore the archive.

Writing and nothing but writing. Imagine starting from 8 in the morning until 12 in the night, minus the eating time and occasionally short breaks, you have to write up something to fill the remaining 12 pages. Staring at the monitor for 16 hours non-stop will definitely depleted you and causing much stress, especially to your eyes. The sudden and urgent feedback caught me by surprise. Totally messed up my daily routines. The aftermath of this last minute changes is you have become wordy, like one of those week I've experienced before. Therefore, this week blog post will be a bit wordy than usual.

One hard lesson I've learned during this writing period, reading and lots of reading is essential for writing. There is no way for you to churn out anything fast, if you don't even have a clue on what you're going to say. Want to be a better writer? Be a better reader. Reading a technical paper and a fiction requires different strategy. The former needs a systematic and structural way of extracting information. The later, you just need to use your imagination and indulge with it.

Another one. Statistics is very important, far more practical and relevant than other branches of mathematics. You never know when you going to need it, but when you do, you really do! Time for relearn and pick up some statistics.

The next lesson? I think I finally and partially understand what the heck is methodology, which in short, a set of practices or procedures. To explain in another way, a step-by-step procedure on how you going to tackle a particular problem. Particularly, you have to explain when, where, and how you're going to carry the procedures. It changed how I read, understanding, and absorb information. In the end, all the details, some ways or another, are transformed into a flow chart.


Back to the regular weekly ramblings.

Via Reddit. World oldest gymnast, Johanna Quaas, 91 years old to be exact. Nothing but good genetics, healthy and active lifestyle, be independent, and how to age gracefully. There are so many ways your body will let you down and kill you when you age. Genetics aside, which is out of our control, this is definitely doable, you just need to have the persistent and patience to do it. Seems that cycling is preferable than running, if you don't want to damage your knees due to running.


Do you plan your next day ahead? I've been facing the same problem in organizing my life. It's a long tedious process of trying different organizational systems (Four Quadrants / Eisenhower BoxGTD, Bullet Journal, and Pomodoro) to see which one sticks. Typically, nothing stick for a long time, after a while, you will drifted away and back to your old self. The main issue procrastination. You're aware of the priority, but don't feels like doing it. Then it dawned to me that time management is actually mood or mind management. If you need to to something important, schedule it at the time where mentally you're most alert and aware. For example, early in the morning when you first woke up is probably the golden hour of productivity.

Maybe the mentioned systems are way complicated as it can lead us to overly micro planning. Remember, there is no one true system, it's a mixed of everything with some adaptation. Why not going analogue and low tech with a simple pen and paper. Jot down your to-do list, prioritize, try to get things done within that day will work. Not every day is a perfect day. Accept it. Not everything will be completed within that day. Reschedule the unfinished tasks to the next day. For more refinement, break the day into four sessions of morning, afternoon, evening, and night.

Regardless how you optimize your day, the first thing is to plan ahead, way ahead like life goals from 6 months to 30 years. The longer the planning, the more you will aware that most things don't matter that much in life eventually. I agreed with the poster's four assumptions, especially that "productivity is getting the most important things done" and "most people don't have that many things they truly want to accomplish.".


Classic Papers: Articles That Have Stood The Test of Time. Collection of ten most cited papers from different area of research. Unfortunately, only from 2006. It would be nice the paper can be extended from far longer before 2006, say from 1900. Interesting found was this paper, Who should fix this bug? where the author was using machine learning to semi-auto assign a reported bug ticket to the a developer.


LaTeX, where what is hard is easy, and what is easy is hard. Editing LaTeX file with Vim? Plenty of errors that you probably needs to amend to make it go away. Generating PDF file and the page dimensions seems off? Readjust the page margin dynamically. Sigh. No matter how much I love typesetting, the hassle and effort of tweaking the layout is not worth the time.


When using Git, branching is easy and cheap. Two things that I need to use quite often when merging changes from different branches. First is create more throwaway branches and squash merge using the `--squash` parameter. Second is cherry picking using the -n parameter. Both ways do merge but not commit the changes.

This Week I Learned - 2017 Week 24

Last week post or from the archive.

Golden State Warrior won the 2017 NBA title. I've been following NBA these past few years back and it dawned to me that NBA as with other sports these days, is actually a sport entertainment, similar to WWE. The champion of the NBA, can be determined (ahem rigged) by how many shoes the athlete can sell or by the superstar (Kevin Durant in this case) having of the biggest impact on the overall market of the sport. Relevant comment that shared my sentiment, emphasis and spacing added.
Definitely. It is an entertainment business after all, and players are their own brand. Every single thing you do has an effect on your image; it has to be exhausting.
Some players feel so much more natural as superstars than others. I know some people don't like him, but Blake Griffin (for instance) never seems "fake" to me even when he does things to get himself exposure. He's very likable in interviews (one of the best Pardon My Take guests) and that helps push his brand.
Some players just feel so cold and calculated, even when they are doing things to make them seem likable. A lot of people probably will disagree and that's fine, but LeBron to me comes off as extremely manufactured. By no means do I think he's not a good person at heart, but he is VERY self-aware of what he does at all times. He has to be, so I can't blame him. Overall it's a good thing -- he doesn't have any blemishes on his record and he's a great role model for the kids -- but it has always slightly rubbed me the wrong way and I could never find myself rooting for him as a fan. Very well could be my Celtics bias though, who knows.

Struggle with sleeping? (via HN) To keep yourself healthy, we must have consistent sleep cycle of 7 to 8 hours as well as bedtime and wake-up time. Anything less than 6 hours will eventually lead to health problem. Unfortunately, inadequate sleep is a common thing these days due to heave mobile phone usage which caused light pollution and messed up the melatonin hormone.

Social good through programming? Somehow, some of us will go through the period of soul searching whether our development work contributes to society or make a difference? I asked the same question every year and yet, still haven't have a good answer. Maybe the 80000 hours is a good start?

It has been a while since I last really look into LaTeX. Some of the item I've learned along this week. First, how do we make sure that in bibliography, the font stay the same.

This Week I Learned - 2017 Week 23

Last week post or the stuff from the archive.

Busiest week ever. Spent lots of time tidy up all the loose end. Non-stop churning out words after words for the past few days depleted me both mentally and physically. Having to write the same thing again and again but in different ways exhausted me further. Nevertheless, it was an "interesting" experience. Cognitively it was challenging but your learn a lot at the same time. However, if the knowledge gained will be forgotten later, then why we need to pick up it in the first place?

#1 On work ethic. Emphasis added.
Work ethic is about showing up, being on time, being reliable, doing what you say you’re going to do, being trustworthy, putting in a fair day’s work, respecting the work, respecting the customer, respecting the organization, respecting co-workers, not wasting time, not making work hard for other people, not creating unnecessary work for other people, not being a bottleneck, not faking work. Work ethic is about being a fundamentally good person that others can count on and enjoy working with.
#2 Iomega's Zip drive. We used to own one and have a few disks lying around. Not sure what happened to it. But one thing for sure, recordable CD, which was superseded by DVD, and USB thumb drive really killed the product. I still can't remember what we used it for, maybe just to backup all our downloaded files?


#3 Best possible reason on why Intel is not putting any significant efforts or buying more times on tackling AMD's Ryzen Threadripper. Intel and Microsoft have completely missed or failed the mobile market. If Intel cannot produce anything that match up ARM's mobile market dominance, we will see a significant shift of Microsft from x86 platform to ARM. 

#4 Writing journal is the art of talking to yourself silently. However, the correct approach to journaling is to focus on both cognitions and emotions will have the best benefits. I was contemplating of getting an actual typewriter to switch to more manual way of writing but the cost of the typewriter is surprising expensive, roughly more than MYR500. You probably can buy a very decent second hand computer with that pricing. There exists also Freewrite, a digital version of distraction free typewriter, sort of. Or the predecessor, the Alphasmart Neo or the retro looking Cambridge Z88. However, the pricing is just ridiculous! Why not spend the money on getting a second hand laptop like a used ThinkPad instead? Heck, might as well just switch to pen and paper instead.

#5 Productivity is less about time management than it is about mind management.. Profound insight. Basically is all about "hacking" your brain and getting it to a desired state.


This Week I Learned - 2017 Week 22

Last week's post or the whole series.

Slow week. Lots of pending stuff needs to be cleared off.

One of the best thing in learning, always be the most stupid person in a class and ask a lot of questions. You never know you will learn something new or relearn something old. Or it may reaffirm some beliefs you always held truly to yourself.

#1 If you need to display CJK characters and emojis in MySQL, use 'utf8mb4_unicode_520_ci'. Historically (another good write-up), MySQL support 'utf8mb3', later changed to 'utfmb4', and changed again to 'utf8mb4_unicode_520_ci' (since MySQL 5.7), and lastly 'utf8mb4_0900_ai_ci' (since MySQL 8.0). Sometimes you wonder why you still stuck with the curse of MySQL where there are better solution out there.

`utf8mb4` is the superset of `utf8`. Meaning that the former also includes the later character set.

To show the supported character set in your MySQL installation.

First check your MySQL version.
mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+-------------------------+
| Variable_name           | Value                   |
+-------------------------+-------------------------+
| innodb_version          | 5.7.18                  |
| protocol_version        | 10                      |
| slave_type_conversions  |                         |
| tls_version             | TLSv1,TLSv1.1           |
| version                 | 5.7.18-0ubuntu0.17.04.1 |
| version_comment         | (Ubuntu)                |
| version_compile_machine | x86_64                  |
| version_compile_os      | Linux                   |
+-------------------------+-------------------------+
8 rows in set (0.33 sec)

Next list our the available character sets for `utf8mb4`.
mysql> SHOW COLLATION WHERE Charset = 'utf8mb4';
+------------------------+---------+-----+---------+----------+---------+
| Collation              | Charset | Id  | Default | Compiled | Sortlen |
+------------------------+---------+-----+---------+----------+---------+
| utf8mb4_general_ci     | utf8mb4 |  45 | Yes     | Yes      |       1 |
| utf8mb4_bin            | utf8mb4 |  46 |         | Yes      |       1 |
| utf8mb4_unicode_ci     | utf8mb4 | 224 |         | Yes      |       8 |
| utf8mb4_icelandic_ci   | utf8mb4 | 225 |         | Yes      |       8 |
| utf8mb4_latvian_ci     | utf8mb4 | 226 |         | Yes      |       8 |
| utf8mb4_romanian_ci    | utf8mb4 | 227 |         | Yes      |       8 |
| utf8mb4_slovenian_ci   | utf8mb4 | 228 |         | Yes      |       8 |
| utf8mb4_polish_ci      | utf8mb4 | 229 |         | Yes      |       8 |
| utf8mb4_estonian_ci    | utf8mb4 | 230 |         | Yes      |       8 |
| utf8mb4_spanish_ci     | utf8mb4 | 231 |         | Yes      |       8 |
| utf8mb4_swedish_ci     | utf8mb4 | 232 |         | Yes      |       8 |
| utf8mb4_turkish_ci     | utf8mb4 | 233 |         | Yes      |       8 |
| utf8mb4_czech_ci       | utf8mb4 | 234 |         | Yes      |       8 |
| utf8mb4_danish_ci      | utf8mb4 | 235 |         | Yes      |       8 |
| utf8mb4_lithuanian_ci  | utf8mb4 | 236 |         | Yes      |       8 |
| utf8mb4_slovak_ci      | utf8mb4 | 237 |         | Yes      |       8 |
| utf8mb4_spanish2_ci    | utf8mb4 | 238 |         | Yes      |       8 |
| utf8mb4_roman_ci       | utf8mb4 | 239 |         | Yes      |       8 |
| utf8mb4_persian_ci     | utf8mb4 | 240 |         | Yes      |       8 |
| utf8mb4_esperanto_ci   | utf8mb4 | 241 |         | Yes      |       8 |
| utf8mb4_hungarian_ci   | utf8mb4 | 242 |         | Yes      |       8 |
| utf8mb4_sinhala_ci     | utf8mb4 | 243 |         | Yes      |       8 |
| utf8mb4_german2_ci     | utf8mb4 | 244 |         | Yes      |       8 |
| utf8mb4_croatian_ci    | utf8mb4 | 245 |         | Yes      |       8 |
| utf8mb4_unicode_520_ci | utf8mb4 | 246 |         | Yes      |       8 |
| utf8mb4_vietnamese_ci  | utf8mb4 | 247 |         | Yes      |       8 |
+------------------------+---------+-----+---------+----------+---------+
26 rows in set (0.00 sec)

However conversion from `utf8` to `utf8mb4` will encounter these issue of `ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes`. There is a DAMN good guide (ironically better than official documentation) written to resolve that issue and planning for the migration. However, the SQL queries only works for MySQL 5.6.

Meanwhile, this is one good example of writing Perl unit test cases to evaluate `utf8mb4` character set.

#2 Found the solution to my long unanswered question. When writing Bash script, how do we skip certain parameter. For example, we want to skip first parameter but takes the second $2 parameter onward? `shift` my friend. Is a universal concept that I've looked at it almost every day in Perl but never occur to me that this is the same in Bash script as well.

#3 PostgreSQL 10 with examples. The only worthy stuff produced by HP besides the printer. People, embrace the most advanced FOSS database system. Stop playing with MySQL.

#4 Time your console commands but cannot capture the output of `time` to a file? You're not using the command correctly. You should surround it with parenthesis. Either one will work. Depends on how many output files you want to have.
$ (time ls) > outfile 2>&1
$ (time ls) > ls_results 2> time_results

#5 How do you lost 1kg per week or the perfect diet? Both gave the same good advice. It actually make sense without actually starving yourself. The key take here is to first figure out the daily needed calories. Then reduce 500 calories from your food intake and add activities that burn 500 calories as well. The second part make sense. You just don't focus on diet, you should incorporate physical activities as well.

#6 "How do I get started with artificial intelligence?" and "What can I do with AI in my own product or company?" Read this.

#7 The technology stack of craiglist. Surprising, they are using Sphinx Search Server. Thought they might be using Elasticsearch. Why? Based on the comparison on both search servers, Elasticsearch scores way higher than Shpinx. Maybe Sphinx fits the requirement usages in craiglist?