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?

This Week I Learned - 2017 Week 21

Previous week post or the whole series.

If you cannot keep your habit in a consistent manner, you will need readjust the minimum goal of the habit until there is no more excuses for you not to do it. Is as simple as that.

Second week of eating your dinner before 7pm indeed have significant changes. Additionally with consistent meditation and healthier food choices, surprised to know that I've lost some weight. However, all these lost weight may due to water weight.

#1 Well said. Well said.
"Don’t confuse privacy with secrecy. I know what you do in the bathroom, but you still close the door. That’s because you want privacy, not secrecy."
#2 Interesting that it's not just me who have been doing my own TILs or keeping a developer journals. While some store their TILs in Github repositories, mine just as a weekly collective of blog post. Either way, keeping a journal is always a good habit for anyone practicing their craft.

#3 There are quite a few complimentary Docker utilities that help to improve your Docker usage experiences.

#4 Tracing in GNU/Linux. Always an interesting topic to explore, especially coming from Brendan Gregg.

#5 Managing Git merge conflict? git-mediate seems like a good tool to ease the pain of resolving merge conflicts. I now finally grok how three ways merge works.
  • HEAD - Your changes.
  • BASE - Code before your changes and other branches.
  • OTHERS - Code with other changes that going to be merged to your branch.
#6 Merge with squash. Good to know if you want to do lots of branching.
  • Put the to-be-squashed commits on a working branch (if they aren't already) -- use gitk for this
  • Check out the target branch (e.g. 'master')
  • git merge --squash (working branch name)
  • git commit

This Week I Learned - 2017 Week 20

Last week stuff or the previous posts.

The battlestation have been acting up this week again. Repeated restarts is getting old and rather annoying. Maybe it's a good time to sell it and build a new one instead, probably based on Ryzen. However, the next question to ask is do you want it or need it?

It was so simple that I was shaking my head wondering why it was never occurred to me before. Eating dinner at consistent times of the day will have significant impact on you, both physiological and psychological. Having your dinner before 7 p.m. seemed to have noticeable effects on my body weight and quality of sleep. This is one habit that I need to follow through.

#1 The Starfish Story. Everyone can make a difference in the world, no matter how small the change is. You just have to work fscking hard and stop being lazy. Or maybe taking the opposite approach instead? By adapting a minimalist lifestyle?

#2 While we have web proxy server, it seems that database system also have their own proxy server. For MySQL there are two popular DB proxy servers, ProxySQL and MaxScale. Sadly, I've never implement either one of them in actual production environment. Not everyone works with web scale system.

#3 nftables, iptables replacement. Installation procedure as follow.
$ sudo apt-get install nftables
$ nft --version
nftables v0.6 (Support Edward Snowden)

#4 Google I/O 2017. However, one of less obvious announcement that caught my attention is that the programming language Kotlin have been officially supported on Android. Steve Yegge's long post (HN and Reddit discussion) on the language, as usual, was an interesting read. Maybe it's a good time to start looking into long postponed Android development.

#5 How to start Web Development in 2017. The same old things repeated again and again but getting more and more complicated. Numerous technologies have been superseded by the core essential always remains the same.

#6 Michael W Lucas, interesting author who published both nonfiction and fictions books.

This Week I Learned - 2017 Week 19

Last week post or the whole series.

Slow week but nevertheless, it was an interesting turn of event. Can't wait for more excitements to unfold in coming week. Importantly, never lose focus on your goals over petty things.

#1 One of the best experience shared I've read when comes to employment agreement. Always read the agreement carefully and lawyer up when necessary. Emphasis added by me.
I got sucked into a dispute with a former employer once over intellectual property rights in an employment agreement. They kept trying to sneak in a clause into the agreement in every other paragraph that gave them ownership of, full rights/responsibilities for, and access to, anything I did remotely related to programming or computers outside of work while not on the clock. It was so broad, even my non-lawyer ass knew it was an awful thing. It became a deadlock argument back and forth until I asked if they were accepting liability for any illegal activities I could perform outside of work. Suffice to say those clauses disappeared by CoB the next day in the agreement.
#2 Perl's answers to the Fizz-Buzz question.
#! /usr/bin/env perl
use strict;
use warnings;
use 5.024;

my $t = <>;
chomp $t;

for my $ins ( 0..$t-1) {
    my $limit = <>;
    my $sum = 0;
    map {
        $sum += $_ if ($_ % 5 == 0 or $_ % 3 == 0) 
        } 0..$limit-1;
    print "$sum\n";

What interested me is not the solution but the input from the diamond operator (<>) used within this context, which itself is also another interesting story. The diamond operator is useful when writing GNU/Linux console utilities as the operator will work either on standard input or files.

#3 Probably the best sequence diagram to illustrate an HTTP request through CGI. Source from Web Development with Perl.

#4 Why does Google prepend while(1); to their JSON responses? (via HN)

#5 Why you should just use PostgreSQL if you're using Open-sourced database systems? See the number of features (those in green) available. Sigh. Yet we still stuck with MySQL.

This Week I Learned - 2017 Week 18

Last week post or you want to read through the whole series.

Since the prevalent of Internet these days, we're more connected that ever. And yet, we're even more isolated. More and more shopping malls and residential areas are being built especially around the transit stations. Basically all looks the same and people are discourage to travel to another town anymore because everything is available either online or at your nearest malls.

Sick. Down with fever. It has been a while since last time. No one but myself to blame. For people around my age, good rest and food is a way to healthy life. We're not seeking prolonged life but prolonged health.

#1 So, what's your Plan B? Good discussion from the comments. While there is some sort of discrimination against older programmers, but the reality is older programmers may just burn out or bore doing the same mind-numbling stuff over and over again. Yes, the same sh*t but different day. Not everyone have the opportunity to work meaningful projects (yes, subjective view), but most of us just work on some glorified spreadsheet or database skin. You see the same mistakes repeated over and over again from different systems and it's just pointless or bother to raise it up again.

#2 On becoming a low-level programmer. There is a curated list of information especially on the hardware part.. There is also another list of learning the fundamental of computer science. So many things to learn and explore and yet, so little time. Sometimes the reality of life commitments limit our choice on the thing we want to pursuit. I need to finish everything by July before I can start to clear the list from my bucket list. One step at a time. Follow the system.

#3 First, make it work, then make it right, and finally, make it fast. Get the thing to work first before you're thinking about making it right (giving the right name) and optimize it. Fulfill the requirements of the stakeholders first (prototyping) before you're looking into doing it right and fast. Something I need to remind myself constantly as we're often obsess with perfection. What's the point if your build it the right way and fast but does not meet the stakeholder needs?

#4 How to write a REST client in Perl. Most Perl modules have limited documentation, for example, little example on how to use the APIs. This is where PHP (it has been so long since I mentioned something about PHP) really shines. As the language is slowing dying, there are little or no good example on how to start something up fast.

Meanwhile, something rather interesting about Perl. I've seen quite a few Perl codes with subroutines that prepended with ampersand (&) operator. Basically, the ampersand is needed if you're calling a subroutine before its declaration. Off course, there are many other reasons and usages to use the ampersand, but commonly as reference to a subroutine.

sub hello {
    print "hello";

When using OO with Perl, you will need to instantiate the constructor or method invocation through the arrow (->) operator (a reference). Good examples given below.

Using the arrow notation or virtual method.
my $apple = Fruit->new("apple");

Using the double colons notation or static method.
my $apple = Fruit::new("apple");
Fruit::get_price($apple, "usd");

However, to invoke the method either statically or virtually, you'll need to write the constructor as follow.
sub new {
    my $self  = shift;
    my $class = ref($self) || $self;
    return bless {}, $class;

#5 "error: src refspec master does not match any." Silly me. You need to commit something locally before pushing to remote Git server.

#6 Tiny Python Notebook. Definitely not tiny but quite comprehensive guide to Python 3.6.

#7 How to unstage all staged files in Git? It's so easy that the best answer is not upvoted enough.
$ git reset

#8 Postgres Weekly. When come to FOSS database choices for web application for Intranet application, I'm strong opinion that PostgreSQL should be the default choice. Feature like Range Types and others solves quite a lot of issues and save lots of developer-hours. Yes, MySQL has its own usage, but for any business application which involves monetary and strong ACID compliance, it's not a right choice.

Software Process Improvement

The lecture I was attending last week was probably the best so far. The first session was eye-opening for me personally. There are so many things I've learned from the instructor who shared his wisdom and experiences regarding the necessity and relevance of standards like ISO/IEC or CMMI in ensuring quality and process management. Below are some interesting notes taken.

What is quality? Is the degree how we meet the expectation of users. This is to ensure that materials, products, processes, and services are fit for their purposes. Repeatable and scalable are two characteristics of a good pieces of software. (There should be more, for example, like good usability)

What is standard? Collection of best practices. Consultants or auditors always refer to the ISO/IEEE standards to polish up and summarize these before they apply it to the field. Following a standard depends on the degree of compliance. However, there are two questions you will need to ask yourself before apply any standards.
  1. Is BEST, good enough?
  2. Is GOOD ENOUGH, the best?
The answer to these two questions is "the best is the enemy of the good" or also known as "perfect is the enemy of good". In other words, close enough or good enough is sufficient as exact is far too costly. On a similar note, there is this concept of Nirvana fallacy, where we can't or won't (procrastinate) a task due to unrealistic or idealistic expectation.

Sudoku Server

Interesting snippet of Perl code I've found. More complete version is found in Sudoku Garden.

Installing the required packages.
$ sudo apt-get install cpanminus
$ sudo cpanm ojo
$ sudo cpanm Spreadsheet::HTML
$ sudo cpanm Games::Sudoku::Component

Starting the application instance.
$ perl -Mojo -MSpreadsheet::HTML=sudoku -e "a('/' =>; {text =>; sudoku})->;start" daemon
Server available at

This Week I Learned - 2017 Week 17

Last week post or the whole series.

What happen to software developers who are still coding in their 40, 50, and 60?  What will happen in the next 22 years will be an interesting and unknown territory for older programmer to explore. There is always the case of how to do keep improving or how can we be a better programmerKaizen. Continuous improvement through through learning with understanding and stay healthy, both physically and mentally.

Complacency is your worse enemy when come to learning. We take it easy, do not dare to explore out of our comfort zone and afraid to look stupid. We know if we're heading this path, we will stuck forever, basically doing the same thing every year. Hence the developer with ten years experience but doing the same thing every year. Yet, we're afraid to start. Keep waiting for the right moment, the right motivation, and so no.

The older I get, the more I realized that motivation is fleeting and only discipline is reliable. Motivation is based on feeling where discipline is based on your habit. Best to cultivate good habits rather than waiting for the right feeling to come. Nothing but one step at a time.

#1 RIP Robert Pirsig. (via HN) Yes, he is the author of the cult book, Zen and the Art of of Motorcycle Maintenance. Interesting write-up on him during his day at spent in Banaras Hindu University (Varanasi, India).

#2 Good write-up on being a serious code reviewer. Only professional developer will take their code review session seriously as both parties, the reviewer and the code will learn something out of the session. The main obstacle is always how to handle it in a objective manner. Sometimes developer forget that you are (as a person) not your code. It's always a tricky situation.

#3 Sometimes, certain websites could change your life. No surprise some sites from are Ask Metafilter. All these reminds me of the web of the '90 and the time spent on aimlessly browsing through each pages. This is before RSS was even a thing yet.

#4 How many ways to execute your script parallelly? Three. Using wait, xargs, and GNU Parallel. The last one is the most comprehensive, featureful, and still being maintained.

#5 How Technology is Hijacking Your Mind. The prevalent tactics on manipulating our surfing behaviour. Throw in some dark patterns, we're basically somehow influenced to a certain agenda and direction. Given the ubiquitous Web and the Internet, how do we anticipate this manipulation? For a start, digital detox is a good start but still, this is not a long term solution, especially for those working in technology sector.

#6 Real-time Programming. (PDF) A course in learning about programming embedded real-time system.

#7 Is Perl still a good choice for web development? Yes and no. If you're not inheriting legacy Perl project, switch to something else more modern. If you're stuck with CGI, move to CGI alternatives like Mojolicious, Dancer2, Catalyst, or PSGI.

#8 Virtualization in GNU/Linux. Good introduction of different virtualization technologies available that we can use.

#9 The web is not desktop applications. Well said. Well said.

This Week I Learned - 2017 Week 16

Last week post or the regular whole series.

Minor hiccups due to sleeping schedule messed up my daily routine. Nothing but readjustment to get back on track. Switching different way of monitoring your habits did not produced the result needed. Furthermore, you should unwind during the weekend. If you need to use the Internet, write down the items you want to research instead of impulsively googling. Maybe I should just switch to dumb phone, nothing but for calls and SMS, like the old days. But it may not be a feasible solution and impractical.

#1 My whole development life in a circle where I have to encounter XXX again in the current development works. There is a write up on the origins of XXX as FIXME (via HN). Reason that we use XXX is easily greppable comment prefixes.

#2 How to handle Perl class-level variables. Two ways. (1) Lexical variable scoped (via subroutine) and (2) package variable. Simple concept that took me a while to finally realize and understand it.
# (1)
my $foo = 123;
sub get_foo { $foo }

# (2)
our $fubb = 456;

On a related note, found a list of Perl modules related to testing. There is so many modules that I haven't try out yet. So many things to try out, yet so little time.

#3 How do you remove all files except one? Seems hard yet so simple, if you know and remember how it works. Only on a rare instance you will encounter this. Typically we just move the file to different folder and delete the source folder.
$ shopt -s extglob 
$ rm -- !(file.txt)

#6 "If you haven't experienced true solitude yet, go find some. It's pretty grounding." (via HN) It's not a man against the wild but rather a man seeking himself through the solitude of nature. It has been so long that we ever lie down and look up the sky and enjoy the stars?

#7 "Colour is in the eye of the beholder". Interesting that our vocabulary influences how we perceive colours. Himba people have interesting vocabulary for colours, for example zoozu (dark colours and black), vapa (light colours and white), borou (green with blue and purple), dumbu (beige with yellow and some light green), and serandu (red with orange and pink). You can read more on this presentation, The Development of Color Categories in Two Languages: a longitudinal study.

#8 If you're facing problem with Google Chrome whenever you're opening new page but it took a while to load while waiting for "Resolving host...". Clear the DNS cache in Chrome. Seems to resolve the lagging issue for me and making browsing experience bearable.

Unable to Mount USB Thumb Drive in Nautilus - Physical Block Size Mismatch

Before I can proceed to setup my tiny homelab machine, Kabini, I need to burn the installation media to the USB thumb drive. However, when the thumb drive was plugged in, Nautilus can't seem to mount it although the kernel message did indicate device `/dev/sdc` did exists and mounted.

Checking through GParted, the default GUI partition tool in GNU/Linux shown that "The driver descriptor says the physical block size is 2048, but Linux says it is 512 bytes"

As usual, SO gave us the root cause and solution to rectify this block size error issue. It seems that I may accidentally wrote to the USB thumb drive using the wrong parameter through `dd` command. To fix this, we need update the thumb drive's partition to the right block size. Running the command below did resolve the issue for me.
$ sudo dd if=/dev/zero of=/dev/sdc bs=2048 count=32
32+0 records in
32+0 records out
65536 bytes (66 kB, 64 KiB) copied, 0.00655332 s, 10.0 MB/s

Once the corrupted block issue have been resolved, go back to GParted and refresh the thumb drive. GParted will prompt you to create a new partition table.

After we have created the partition table, Nautilus will show a proper mounted thumb drive. See screenshot below.

Download the Ubuntu installation ISO file. I'm downloading both the mini and Ubuntu server 17.04 ISO file. This is the time where torrent really shine where I can achieve the speed of 3.02 MB/s, a feat not doable even using parallel HTTP connection using download manager like Aria2.

Next, burn the ISO using the Startup Disk Creator. Load the ISO file as the source disc image and burn it to your thumb drive.

In the past I always used dd command line utility to burn ISO. Little I realized once you've done burning, you can test the thumb drive.

Verification is done by QEMU, hosted hypervisor. If you can see below installation menu, then the thumb drive have been burned and can boot up correctly.

You can achieve similar result through the command line command below. X is the alphabet of your thumb drive.
$ qemu-system-x86_64 -hda /dev/sdX

This Week I Learned - 2017 Week 15

Last week post or you can browse through the whole series.

While debugging a Makefile, I accidentally `rm -rf` my home folder. Lesson learned, always backup and sync your changes regularly. Nevertheless, it's always a good fresh start when your home folder contains not a single file or folder. Good that you have a weekly clean up of your machine, review, keep, or remove. Otherwise, there will be a lot of pending left over files.

It has been a while since I work on weekend. The serenity of the environment did improve your productivity ten-folds. There is no sounds other than the air-con, traffic, and your typing sounds. You're basically in the zone, focus solely on the task at hand. No more stupid shenanigan. In hindsight, you have to find or create your own optimal environment and zone. It all starts with a system that leads to a habit, good habits.

#1 How to read more books? Lots of good tips and increasing the volume of books you can read. It's already early April and I only managed to finish 2 books. Not really on track on finishing 12 books this year. Thinking back, reading style, book choices, timing, and context are what causing the slowness. One of the best strategy is to switch different books if you're stuck or bored. Some books need more mental energy to go through it. While reading 2 pages per day can develop a good habit, it's not sufficient fast enough to catch up with my pilling reading list.

#2 Engineer's Disease. The unconscious thought that can lead to arrogant and condescending personality. Maybe because such behaviour "stems from the OCD and emotional detachment our peoples tend to have, mixed in with a good dose of raging insecurity"? Good forum discussions to ponder upon, especially by those working in software development.

#3 Does teenager and adult have different learning capability? Time, available perceived time. Also discipline, attention, and focus. The discussion at HN gave a lot of strategies to attack the problem. Simple daily practice and learning together with different learning strategies. What to learn then? Fundamental. There is an interesting discussion on software development being a dead-end job after 35-40.

#4 On understanding the fundamental of Vim. Before you install any Vim's plugin, best to learn what the default features exists or not.

#5 System Design Primer. If you want to learn how to design large scale systems. However, premature optimization is still evil. Knowing something can be done right doesn't means it should be done now. There are always contexts and constraints. Solutions looking for problems always end up wasting everyone resources. This HN user's experience on scaling your system accurately illustrates such scenario.

#6 Looking busy at work?. Most people don't realize that pretend to work and look busy is actually far more harder than doing the actual work. Faking will deplete you psychologically as your thoughts, actions, and words are not in sync. However, there are always exception. Certain group of people thrive on such behaviour without caring for any forms of repercussion. While some just stuck with mind-numbing boring job. There is a saying by Napoleon Hill which states "If you are not learning while you’re earning, you are cheating yourself out of the better portion of your compensation.” Unless you're stuck with certain constraints, move on. You're not a tree!

#7 LXD finally available for Fedora. Not as native RPM package but through Snap. I'm going to reformat another workstation and install Fedora with it. One less reason to stick with Ubuntu. Only left the DEB package, which I believe, no way Fedora/CentOS/Red Hat is able to dethrone the number of available packages provided by Debian. I'm not looking for rolling release like Arch but availability of different software. Maybe Snap, the universal GNU/Linux package can change that?

Upgrade to Ubuntu 17.04

Just read that Ubuntu 17.04 was supposed to be released today and eager to try it out. While nothing special and significant was added to this release, nevertheless, it's good to have the latest greatest when possible. Furthermore, I've accidentally `rm -rf` my home directory few days back.

Running through the typical upgrade steps.
$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo do-release-upgrade -d

However, upgrade seems to fail due to broken packages, see below. Most likely due to many legacy PPA added for certain kind of special packages.
Calculating the changes

Could not calculate the upgrade

An unresolvable problem occurred while calculating the upgrade.

This can be caused by:
* Upgrading to a pre-release version of Ubuntu
* Running the current pre-release version of Ubuntu
* Unofficial software packages not provided by Ubuntu

Found the answer to troubleshot this issue. You must keep the upgrade running at the same time, otherwise the `apt.log` file would not be found. I was surprised that I have so many broken and conflicting package. Follow the procedure, I have to manually remove all broken packages. For certain packages, I have to reinstall because it can't find the actual packages. Result below were truncated to save space.
$ grep Broken /var/log/dist-upgrade/apt.log

Broken libdouble-conversion1:amd64 Breaks on libdouble-conversion1v5:amd64 ......
Broken imagemagick-6-common:amd64 Breaks on libmagickcore-6.q16-2:amd64 ......
Broken libgjs0f:amd64 Conflicts on libgjs0e:amd64 < 1.46.0-1 @ii mK >

Upgrade was slow as I've just installed LaTeX few days back. Downloading all those `texlive-` packages going to take some times.

This Week I Learned - 2017 Week 14

Last week post or you can go through the whole series.

Proposal have been presented and submitted. Standard feedback received. Nevertheless, better than nothing regardless the quality of the reactions.

#1 GTCafe Studio. Stumbled upon this site while searching for different covers of Guthrie Govan's Emotive Ballad. It's rare these days to find any blog with original good content. Reading through his journal on learning guitar made me reflect back on my decision on donating all my guitars away few years back. Maybe is time to start all over again? Or maybe not? Learning to play an musical instrument is one of the way to escape from mind-numbing daily routines. However, there is a time and place for everything in life. In hindsight, sometimes you just have to move on.

#2 "CentOS is not stable, it is stale". So true that it hurts. For me, as a whole, Fedora provides a better desktop experience than Ubuntu. Yet, I still revert back to Ubuntu on my daily usage. Why? APT is definitely better than YUM and plenty of software selection. Furthermore, LXD works only in Ubuntu and not Fedora. And yes, finally Canonical realized that and declared Ubuntu Unity will be replaced by Gnome 18.04 LTS. Maybe this Ask HN post on feedback for Ubuntu 17.10 from the community have finally sealed the fate for Unity?

I always wonder what would happen if Red Hat decided to use build a distro based on Debian or DPKG package manager instead of creating their own RPM packaging manager? A unified GNU/Linux desktop will come sooner rather than unnecessary fragmentation and efforts. For example, the competition of next generation display server of Mir and Wayland. Yes, I know having options and competitions is good for progress. But the priority and effort should be on fixing the damn display drivers performance and stability issues. Fragmentation leads to duplication of works.

#3 Five great Perl programming techniques to make your life fun again. An old article, 11 years ago but everything described there is as relevant as today especially iteration using `map` and `grep` and Dispatch Table as illustrated in example below. As Perl does not have `switch` statement, hence using Dispatch Table is a good Perl design patternMark Jason Dominus, in his book, Higher-Order Perl also devoted a whole chapter (PDF) on this matter.
my $dispatch_for = {
   a => \&display_a,
   b => \&display_b,
   q => sub { ReadMode('normal'); exit(0) },
   DEFAULT => sub { print "That key does nothing\n"; },

my $func = $dispatch_for->{$char} || $dispatch_for->{DEFAULT};

#4 Perl 5 Internals (PDF). Interesting reading on the intricacy part of the Perl itself. It was brought to my attention that Perl is a bytecode compiler, not an interpreter or a compiler.

#5 The 'g' key shortcuts in Vim. You will learn something new everyday, there are so many key bindings. Surprisingly, I only knew and regularly use two. Really needs to refresh and relearn this.

This Week I Learned - 2017 Week 13

Read the last week post or follow the whole series.

Night owl turned early bird messed up my sleep cycle badly. Nevertheless, the draft report have been completed and waiting for submission.

#1 Feeling nostalgia after watching the unboxing video of IBM PC AT and Model M. The sounds of the diskette reading and loading the data reminded me of the good old days of early computing period. I'm not sure what happened to our XT 8088 but I'm surely wish I can see it again and try to boot it up again. I did once during my college days but would really love to do it again after all these years. Back in those days, XT 286 is my dream machine and how I wish we have the financial means to upgrade to it. 

#2 Lots of Docker debugging for the past week and I learned quite a lot. It's the right time to setup my virtualization machine (more on this in coming week) and start looking into Docker.

When using Docker Compose, use `docker-compose ps` instead of `docker ps`. While both commands show the listing of the available containers, the former command will only list containers declared in the `docker-compose.yml` file, a subset of the all available containers. Best to go through all the Docker Compose CLI command line parameters.

Next, you want to read (or search) the content of a file in the docker container. See the example below. Yes, I know you can just simply use the `grep` command directly.
$ docker exec -i mycontainer cat /etc/hosts | grep localhost

#3 Setting up multiple SSL certificates using one IP address in Nginx. And also how to verify and read SSL certificate info from the console. Next is to configure Google Chrome to accept invalid certificate from localhost. Copy and paste `chrome://flags/#allow-insecure-localhost` to the address text box to access the setting. Instruction as shown below.

This Week I Learned - 2017 Week 12

Last week post or you can read the whole series.

9 hours of writing and only 3 pages done.

#1 The important of morning rituals in developing a system (install a habit) to achieve your life goals. Is good to be morning person as you can achieve quite a lot when your mind is fresh. There are these 7 morning rituals which I will slowly introduce to my daily life. These are:
  1. Plan a day before. I've been slowly adopting this habit by going through the list of items in my bag and write down what I need to do tomorrow. Not consistent though as for some day I failed to plan for anything.
  2. Wake up early. Either from 4:30 AM till 6:30 AM. This is doable provided that you sleep quite early on the previous day. According to this sleep calculator, these are the corresponding time you should sleep if you want to wake up at a particular hours.
    1. 04:30 AM - 7:30 PM or 9:00 PM or 10:30 PM or 12:00 AM
    2. 05:30 AM - 8:30 PM or 10:00 PM or 11:30 PM or 1:00 AM
    3. 06:30 AM - 9:30 PM or 11:00 PM or 12:30 AM or 2:00 AM
  3. Start the day with exercise.
  4. Do your highest priority projects. Study in the morning and reviewing again in the evening before bedtime. This is good for learning as you can recall and rethink what you've learned in the morning. Also? Before even you start your journey to work, you've already accomplished so much for the day.
  5. Work on your side projects. Definitely need to try this. Do not work on your side projects late at night. Do it in the morning.
  6. Have a uninterrupted conversation with your partner. Do we actually having any serious and uninterrupted conversation with our partner, even for just two minutes? Doubt so.
  7. Meditate. I've been doing this since the moment I woke up in the morning. Although for just a mere 10 seconds, slowly but surely I can really concentrate on it.
#2 Beautiful SICP. There is another Python version as well. The discussion is always revolves whether it's good or not. I haven't yet finish the damn book since I bought it 20 years ago. Is this year the year for me to finish it? Doubt so. Even though I placed the book next to my work place and look at it on daily basis. Also, SICP is also the recommended book (debatable) on the subject on programming in Teach Yourself CS. (via HN) While we on that, someone should start another list on Teach Yourself SE. My personal experiences is that Software Engineering knowledge far outweight the Computer Science knowledge.

Since we can all access good quality CS education through the Internet, does local CS degree still relevant today? Or does this means that universities or colleges have been rendered to just another platform for face-to-face socializing instead of gaining knowledge?

#3 Almost 15 years of Design by Contract. I can relate to the author experience and still is a firm believer of Design by Contract (DbC). Bertrand Meyer still have a huge influence on me. Like most things in life, moderation is the key. Use DbC only when necessary.

#4 Real-time LED strip visualization (see Gif animation below) using ESP8266 or Raspberry Pi. Not only the project was interesting, the detail documentation by the developer was impressive. Definitely one of the most solid Github project I've encountered.

#5 Alone in the Wilderness. (via Reddit) A documentary (search YouTube for the video) about Richard Proenneke, who upon his retirement at age of 51 years, build an ultimate man cave to live a life of solitude in Aslaka. Carpentry is such a underestimate skill a man could have.

#6 Interesting Git graph generated by Bit-Booster, the offline commit graph drawing tool from one of my personal Git repository. I'm not sure how to interpret the relationship of my commits, seems somehow broken?

This Week I Learned - 2017 Week 11

Last week post or you can read through the whole series.

Readjust and swapping some my morning and night rituals. I've managed to clear of daily to-do items in a more manageable and less stressful manner. It's amazing that a small change can have a significant impact on your daily life.

#1 What is the best time to have breakfast, lunch, and dinner? McLaren's F1 driver diet plan provides some good reference plan. Breakfast starts at 7 am, follow by lunch at 12:30 pm, and lastly dinner at 6:30pm. Interestingly bedtime is around 10pm, seems way too early. However the total calories is quite high, roughly 2800kcal. Best if you check your daily needed calories.

While we're on calories counting. Someone managed to lose 45kg in 6 months (via HN). Be warned, his approach is quite drastic and not suitable for everyone. Similar posts (here and here) in HN.

#2 Dynamic Dispatch and Jump Table. I've been stuck with a problem of implementing console application in C++. Countless hours of searching and reading and it finally occurred to me that I was googling for the wrong keywords. Unfortunately, my limited knowledge with C++ hamper the progress of the project. Some discussions with two young chaps did open up possible solutions on how to implement Jump Table in C++. Will explore further once everything have been settled down.

#2 Learned optimism as presented by Reginald “raganwald” Braithwaite. Good to read slide and watch the presentation together. The audio quality is kind of lacking. To be more optimistic, use Cognitive Behavioural Therapy to change the way how you explain things to yourself.

#3 Cultural fit for a candidate in a company. The ironic, bitterness, and sarcasm. The comment by sokoloff is spot on. It should be a mutual process, both the candidate and the company. And it should be the responsibility and challenge for the management rather than those reluctant employees. Interestingly, there is only three interview questions to assess whether a candidate is suitable for the job.

This Week I Learned - 2017 Week 10

Last week post or just follow the whole series.

Got my result today. It seems I've officially "crossed" the borderlines stage. I'm still contemplating on the next step but drastic life style changes is inevitable (more in item #5). If left untreated, it can grow into bigger problems, not only for yourself, but for your loved one as well.

#1 You May Want to Marry My Husband (via HN). Beautifully written. We need to be constantly reminded of the fragility of life especially contemplating one's mortality. The lack of awareness will bite you and your loved ones somehow in the future. Over 30-something and still bogged down by random trivialities in life? Nothing but continual reflection on your life priorities (often misplaced) and gratefulness helps to make peace with current and past self. Regrets? Yeah, plenty. Who doesn't? But not to a point where you will lament later in life that you should, would, or could. Wish you've taken a different path? Nah. I'm good. Yes, there is still room for improvement. Looking forward to that.

Further reading. The 10 Best Modern Love Columns Ever.

#2 On Perl. Interesting thing learned. How do you clone a hash and at the same time, reassign new values to some of the existing keys? Simple and yet so effective. To explain this,  `%$foo` expands expands the hash into a key-value pair and the curly braces (anonymous hash constructor) will create a new hash reference. Output is from Devel::REPL module, the modern Perl interactive shell.
$ my $foo = {a => 1, b => 2, c => 3};
\ {
    a   1,
    b   2,
    c   3
$ my $bar = {%$foo, a => 4, b => 5}
\ {
    a   4,
    b   5,
    c   3

Instead of just doing this.
$ my $foo = {a => 1, b => 2, c => 3};
\ {
    a   1,
    b   2,
    c   3
$ my $bar = {%$foo};               
\ {
    a   1,
    b   2,
    c   3
$ $bar->{a} = 4;
$ $bar->{b} = 5;
$ $bar
\ {
    a   4,
    b   5,
    c   3

#3 Carton. Bundler for Perl. In other words, module dependency manager for Perl. Is Perl a lost cause that only a few diehard users still using and maintaining it? Seems likely to me.

#4 Ship daily. That probably the way to get your side project moving and don't feels like you're not completing anything. Can't do it? Maybe you're setting the bar too high and setting yourself up to failure. Of course, some are created to be thrown away. While I don't totally agree on the needs to to finish all your side projects, but when comes to actual paid work, we need rethink our role. Instead of a programmer, think yourself as a problem solver instead. A tiny shift of that mentality will get you closer to the deliverable.

#5 Getting older? Getting weaker? Maybe you should check your weight and measure your Body mass index (BMI)? If so, you should to readjust your diet. Stop eating like you're in college days. More (not just) portions of fruits and vegetables? Furthermore, be informed and mindful of what you put inside your body. Of course, exercise is needed as well. However, exercise alone does not lose weight. Joao Venture have experienced weight lost by reducing most of his sugar intake and maintaining 3 km daily walks per day. Using this calculator, 3 km is 3937 steps, rounded to 4000 steps. Those who works as software developer with sedentary life style, it's a struggle to reach 4000 on daily basis.

Looking through my steps count below, both my mean and median are roughly around 3000 to 4000 range. This fulfill at least one of the criteria. The next step is to adjust my diet by reducing my sugar intake. Interestingly, since the beginning of 2017, I only manage to hit 10000 steps only four times!

On a related note, sleep is also a crucial factor as well. What Kind of Sleeper Are You?

#6 The Unofficial MySQL 8.0 Optimizer Guide. The section on profiling is interesting and I really don't have time to go through each item on databases I'm working one. Definitely going to improve any legacy and messy databases.

#7 When comes to programming, some of us still missing the point that we're a problem solver first and a programmer second. Follow a process and the convention. Prioritize. Keep the solution simple (yes it maybe boring) and don't try to do things the fancy way unless really, really necessary.

Samsung M2070W WiFi Printing with TP-Link Archer C7

It took me a while to finally set this up and to my amazement, this is actually quite damn simple. While there is another way to do it, through Samsung's Printer Settings Utility, unfortunately the `` does not exists anymore in Ubuntu 16.10. Therefore, to get this to works, we have to resolve to WPS method.

There are three devices you will need to setup properly. These devices are your laptop, the router, and lastly the printer itself.

1. Install the Samsung printer driver in your Ubuntu system. You should be able to print through USB cable.

2. Next is to get the network configuration details of the printer, specifically the MAC address. From the printer buttons, Menu -> 4. Network -> Network Conf. -> Print? -> Yes. Jot down the MAC address.

3. Go to the router. DHCP -> Address Reservation -> Add New. Assign the MAC address in Step 2 to a fixed IP address so we always connect to the printer using a consistent IP address. Reboot the router. If you enable MAC filtering, do remember to white list the MAC address of the printer.

4. Again, in the router, we will need to enable WPS. Go to Wirelss 2.4GHz -> WPS -> Enable WPS. You may need to reboot the router again if WPS is not enabled.

5. Continue by clicking the Add device button. There are two options to add new device. Pick the second option and click Connect.

6. Go to your printer and press the WPS button for more than 2 seconds. Wait until the printer connected to the router. Once the printer is connected, you can disable the WPS in the router. You printer now will be part of your home network and assigned an IP address.

7. In your Ubuntu installation, open the browser the connection to CUPS management site at Go to `CUPS for Administrators` -> `Adding Printers and Classes` -> `Manage Printers` -> Select the printer you've install in Step 1 -> `Administration` -> `Manage Printer`. You will be prompted for login credential. Use the same credential when you login to Ubuntu desktop environment.

We're going to use the Internet Printing Protocol (IPP). While there are many printing protocols but for convenient sake, we will pick IPP. You can obtain the IPP full address from Step 2. It looks something like `ipp://`. The IP address is set in Step 3.

8. Unplug your USB cable and print any sample test page from your laptop. If everything have been setup properly, you should be able to print wireless.

9. Additionally to enable Samsung Cloud Print, you can manage the printer remotely through SyncThru™ Web Service. Open up your browser and connect using these details. You will see this page if everything have been set up correctly.

Login : admin
Password: sec00000