This Week I Learned 2018 - Week 24

Previous week post and from the archive.

When you have so many fishes died and so many was born in the same week, it did bring a whole new meaning regarding the circle of life. However, looking closely, it's simply just the incorrect water parameters issue in multiple aquarium tanks.

How the heck we return an array reference when using Perl's map to manipulate each element in the array list? The answer is quite straightforward, using bracket `[]` to wrap the list in array context.
use Data::Dumper;

my $items_in_lowercase = [ map { lc($_) } ('Foo', 'Bar', 'Baz') ];
print Dumper($items_in_lowercase);

What are the available core modules in your Perl installation? Use `corelist`, a command line front end to Module::CoreList to find out.

How does a Perl's coding standard documentation looks like? The SEI (Software Engineering Institute) Cert Perl coding standard not only well organized, it's also well written. Really put some software companies own documentation to shame. To be fair, this is from SEI, yes, the one that introduced CMMI (Capability Maturity Model Integration).

Writing and releasing free and open source software? Which license to choose? Pick one that suite you then.

Are you working on interesting technical problems? "You might as well have asked who among us won the lottery." The top post has the best answer I've read since so long. The whole discussion not really about the technical problems but more towards your attitude towards it.

How do you handle undefined methods in Perl? AUTOLOAD or Autoload::Can, or Mojolicious' AutoLoader? Either ways is still a hack somehow or another when compare to other programming languages implementation.

Betta Spawn Log : BSL201806011 : HMPK Black Dragon (M) x HMPK Black Dragon (M)

Yes, another attempt with breeding two Black Dragon, this is similar to the failed BSL20180506 breeding project. For this project, we're using another male Betta but with the same female Betta. All these Betta were purchased from the same breeder and siblings.

Male: HMPK Black Dragon
Age: 4+ months
Temperaments: Normal.
Size: Small (3.5cm body only)
Grade: B

Compare to its sibling in BSL20180506, this male Betta is more silverish where the other one more bluish. We don't pay much attention to this male Betta so nothing much we can describe about this one compare to the other more aggressive male Betta.

Female: HMPK Black Dragon
Age: 4+ months
Temperaments: Curious and active.
Size: Small (3.0cm body only)
Grade: B

The same female that did create a big spawn. We let it rested for a month instead of the usual two weeks before our next spawn. Other than minor bruises, the female Betta looks perfectly fine and was actively swimming around.

Log Notes
Egg was seen on the bubble nest. But we're not sure but suspected that mating did happen before. Will wait a few days to see if any fry were found swimming around.

Saw some fry swimming vertically. Immediately removed the female Betta from the spawning tank. As usual, the male Betta busy collecting and moving the fry back to the bubble nest.

Saw most of the fry started to swim freely. Again, immediately removed the male Betta to prevent similar incident in BSL20180506 to occur again. We don't want to take our chances and decided not to use leaving-father-with-fry breeding method.

This Week I Learned 2018 - Week 23

Last week stuff or something from the archive.

We're half way through the year of 2018. Some new adjustment to my weekly blogging. Starting from this week, more question and answer style of writing.

Old school or just plain hipster? It seemed that the newly appointed important person does not or will not use a mobile phone. Interesting indeed.

What happened when the town beats the land in a sweep? It will get boring and expected, the usual classic rags to riches story line. We need more competition, super teams, and nemesis within the NBA league for the next coming seasons.

What happened when your stakeholders want to start a project that requires "seven red lines" ? Brutally honest or diplomatically tactful?

Does open office have a big impact towards deep work? And does it matters? The discussion in HN yields a few interesting points but the main question remains, why organization still insists on open office and expects deep work?

Is QBASIC a good beginner programming language? The sentiments in the HN members believed so, so do I. Simple (yes, even simpler than Python) and easy to get it up with a good TUI. For a modern equivalent, load81 is probably the closest thing.

Should you use your ISP's DNS server? Hell no. Switch to either Cloudflare's or Google's Not only you gain faster domain resolving speed, you also have privacy (debatable). When comes to implementing privacy in DNS, it seemed we have three protocols of DNSCrypt, DNS over TLS, and DNS over HTTPS.

Should you learn multiple programming languages or master one? Depends. Different people have different motivation, learning strategies, and priorities in life. Either one should works. Do what you love and love what you do.

How do you improve your writing skills? Measurement and volume. First, "you improve what you measure", a very metric-driven way of doing it. However, this may backfired as according to Goodhart's law, "When a measure becomes a target, it ceases to be a good measure.". Second, just write, deliberately, in fixed amounts of words. How? First, don't judge your works, forget grammar and spelling, just churn out words. The Emacs's typewriter mode is a good strategy.

When come to superheroes, how do you justify the existence a character without any special super powers? They have better soft skills and less ego than more powerful super heroes. Watch A critical component for a better visual answer. I almost chocked myself laughing non-stop while watching this, repeatedly.

How do we implement operator overloading in Perl? Use `overload` package. Example of good implementation is the `Data::Money` package.

Betta Spawn Log : BSL201806008 : Giant Armageddon (M) x Giant Galaxy (S)

An ad-hoc breeding project since we obtained another Giant Betta and quite a few female Giant Bettas were in fertile with eggs. Hence, we decided to proceed with this breeding project.

Male: Giant Armageddon
Age: 7+ months
Temperaments: Active.
Size: Medium (4.0cm body only)
Grade: B

We bought this at the local fish shop near Jalan Pasar as we never have a Betta Armageddon before, moreover it's a giant Betta. This male was quite active and started to make bubble nest every time a female Betta was near its proximity. Since SO like this Betta, we have setup a special tank and minor aquascaping to keep the fish entertained. We suspected that this Giant Betta was quite old due to its humpback.

Female: Giant Galaxy
Age: 8+ months
Temperaments: Fast.
Size: Medium (3.0cm body only)
Grade: B+

Since the last Giant breeding project, BSL20180315, with this female Betta, the fish have been kept separated for any breeding project. We did once try to match this female Betta with a Betta Koi. However, this female Giant was so aggressive to the male Betta and the breeding project was not successful.

Log Notes
Eggs were seen in the bubble nest.

Fry were seen swimming vertically. The female Betta was removed immediately to prevent it from eating the eggs.

The male Betta was extracted and moved back to its own tank. The male seemed to have sudden shock and was seen holding upwards position for a while.

This Week I Learned 2018 - Week 22

Last week post or something else instead.


It actually dawned to me that `eval` is quite similar to try-catch block. If your language did not have the support of try-catch exception handling, `eval` (yes it's evil) is your friend. Even Try::Tiny have its own issues. Perl is really a f-up programming language.

VS Code can do that? (via HN) I still haven't have time to install VS Code in my lappy and set up all the necessary configuration and settings.

What's the point of Perl's map? To transform list without using for (each) loop. Is as simple as that and yet we still having hard time understand that? Another good discussion on different between `map` and `grep`, the former is to process a list, the later is to filtering a list.

Containers according to xkcd. Sometimes the simplest solution is the best solution.

30 is too old for tech job in China. (via HN)

REST API tutorial. Yes, I've done a few wrapper for third parties API and two common issues are not up-to-date documentation and inconsistency, especially when handling different HTTP responses.

Block EU users from accessing your site due to complication of implementing GDPR. Brilliant or just simply crazy. And then you have the GDPR compliance checklist or search through the whole GDPR legislation document instead from the original source or community curated info. GDPR is probably the best things that happened to protect user privacy and reduce the abuse of any organizations on handling our personal data.

"Just write. You'll find your own voice". Probably the best common advice given to anyone who wish to become better at writing. For something related to writing, Janki Method, an approach to learning. When you learn something new, write it down but in an approach of question and answer. Maybe you can use a flash card or something.

Stack Overflow for Team. Interesting, very interesting indeed. I chuckled when I saw this feature was released. Wonder how it likes to re-implemented someone else features. Yeah, we should see things from both ends. DRY can be violated if necessary, only if necessary.

Yeah, making money is nothing but how much you care about making money (emphasis added).
Caring a lot about specifically making money is, in my opinion, absolutely key to making money, because otherwise you just end up focusing on other things (family, pleasures, ideals, etc.). If I wanted to make money, I'd design a very different thing in a very different way compared to if I wanted to make something me and my circle of friends would find useful. These things are practically disjoint.

This Week I Learned 2018 - Week 21

Previous week post or something from the past.

Malaysian honorific title, an analysis. How many Datuk, Tan Sri, and others have been granted by each state. Yes, you can check whether a person have received any honorific title.

The more I coded with Perl, the more I've learned something so obvious that I didn't pay much attention. For example, to check if a method or subroutine exists in a class or package, use `can()`.

Check if method exists and invoke it.
sub make {
  my ($self, $item) = @_;
  my $method = "make_$item";
  if ($self->can($method)) {
  } else {
    die "No such method $method";

Another approach, using reference. If the method or subroutine not found, `undef` returned.
if ( my $ref = __PACKAGE__->can("$method") ) {

Check if a hash is empty? Perl's TMTOWTDI is just crazy.

if (%foo) {
    # %foo has at least one key
} else {
    # %foo has no keys

What is the closet HTTP method equivalent to ping? HTTP HEAD.

2018 Perl survey results. Surprised to look at the result of the age group. Two things that caught my attentions. First, there are developers who still code in their 70+ years old. Second, young new developers have been declining. You can see the trend there, Perl it's a dying programming language.

Betta Spawn Log : BSL20180525 : HMPK Black Dragon (M) x HMPK White Spot + Blue (M)

Decided to give it another try with the same male Black Dragon in BSL20180506. Since the male Betta still making bubble nest in the existing same breeding tank, we've decided to put another female to mate with it. Starting from this batch, we will remove both male and female Betta once the fry starts to swimming freely.

Male: HMPK Black Dragon
Age: 3+ months
Temperaments: Very aggressive and brutal.
Size: Small (3.0cm body only)
Grade: B

Yup, the same male Betta in BSL20180506. Seemed to be less aggressive these days after several attempts of breeding with it. While it was left alone in the breeding tank, we noticed that it was actively making bubble nest.

Female: HMPK White Spot + Blue
Age: 5+ months
Temperaments: Passive.
Size: Medium (3.5cm body only)
Grade: C

The same female used for breeding in BSL20180326. Little we realized that this female Betta have grown so much and this is probably the largest non-Giant female Betta we have right now.

Log Notes
We decided to put in another female Betta and see how will the male Betta react. For this breeding project, the female Betta was slightly larger than the male Betta and it did not show any slight fear towards to male Betta.

Saw quite a few fry swimming vertically. Surprised to found out that this pair have successfully mated. The male Betta was busy collecting and picking up fry to the fragile bubble nest. Based on the lessons learned in BSL20180506, we immediately jar both the female and male Betta.

The female Betta was growing so well and we noticed that it can produced much eggs. We've decided in future to put her either in a special aquarium tank on her own or a larger community tank. Not a lot of fry, we believe this female Betta can't produce much eggs. Maybe it was not conditioned properly with the right amount of food and so forth.

The male Betta was a bit resistant when we jarred it and quite aggressively of moving around the smaller aquarium tank. Quarantined the male Betta in a quiet and darker place so it won't be stress leaving its fry and new environment.

The male Betta was doing well, although a bit stress and refuse to eat much pellet. The fry was doing fine as well even though the number was quite small. One issue when you removed the male Betta, the idle breeding tank may be infected with Mosquito larvae. We have to manually removed it and feed to other Betta fishes.

This Week I Learned 2018 - Week 20

Week 19 post or something from the past.

Interesting development on the local scene. Everyone is overwhelmed by the endless good news which some seemed too good to be true. Still too soon to tell but nobody think it will get worst than the current mess. On a side note, at least now we can read articles in Medium from our mobile devices.

The completion of BSL20180124. Our second successful spawn. As usual, write-up on the whole process and retrospection on our breeding process. Both of us are getting more experienced, selective, and bolder when breeding Bettas. So many things learned during these few months and what we learned can definitely can help us to improve our other spawning projects. We can now confidently buy better grade (ahem, more expensive) Betta fishes and breed them. But right now, the main focus is to change our breeding method from leaving fry with father to removing fry after free swimming. The former method produces limited number of fry and the later will yield large (till 500 fry) spawn. We shall see the result in coming months.

The difference between `application/xml` and `text/xml`. Encounter this when making RESTful request and the existing CPAN module does not recognizes `text/xml`.

Good sample Dockerfile to setup your Perl application in Docker instance.
FROM perl:5.26

RUN cpanm Carton && mkdir -p /usr/src/app
WORKDIR /usr/src/app

ONBUILD COPY cpanfile* /usr/src/myapp
ONBUILD RUN carton install

ONBUILD COPY . /usr/src/app

Detect whether an item exists in a Perl's array. Why such simple stuff needs to be so complicated in Perl?
# $value can be any regex. be safe
if ( grep( /^$value$/, @array ) ) {
    print "found it";

A Practical Guide to (Correctly) A Practical Guide to (Correctly) Troubleshooting with Traceroute (PDF). We have been using traceroute wrongly all this while.

Betta Spawn Log : BSL20180518 : Super Red HMPK (M) x Super Red HMPK (M)

Finally, the time is right to start with breeding project with a pair of Betta from the same type and colour even although it's not a sibling pair. For this breeding project, we're going to ditch the leaving fry with father method and extract the male Betta once the fry start to swim freely.

Male: HMPK Super Red
Age: 3+ months
Temperaments: Fast and active.
Size: Small (3.0cm body only)
Grade: B

Another purchased due to attractive low price. Our plan b for Super Red. Initially it was quite fragile and small but over the time, it was moving actively and making bubble. Hence, we decided to proceed ahead with the breeding.

Female: HMPK Super Red
Age: 5+ months
Temperaments: Aggressive.
Size: Small (3.0cm body only)
Grade: B

The female Betta was used for different breeding project with another Super Red male but it didn't went through due to size difference. The female was larger than the male. For this project, we were concerned about the size differences as well.

Log Notes
Back from work and was sitting in front of the breeding tank. Didn't realized that both pair was mating during in front of me. We're quite surprised that mating started so soon and can't recall when did we put both pair into the breeding tank to condition them.

Jarred the female Betta. Waiting for these eggs to hatch.

Found some fry swam vertically and the male Betta was busy picking them up. Waiting to jar the male Betta by tomorrow.

Nothing found within the breeding tank. Not sure what happened but we assumed no fry survived.

Found some fry but very small and fragile. We've started to fed BBS to them. Will check if everything goes well.

Still some fry within the tank. Decided to keep the male Betta as it's. Once the fry starts to grow a bit and survive the male Betta, will move to our common breeding tank.

Betta Spawn Log : BSL20180526 : CT Red + Blue (S) x HMPK White + Blue (S)

Yet another breeding project with Crown Tail (CT) betta. The previous CT breeding project, BSL20180309, did not produce any fry and SO decided to try again.

Male: CT Red + Blue
Age: 3+ months
Temperaments: Very active.
Size: Small (2.5cm body only)
Grade: C

Our second CT, nothing special about this one except it has been idle there for quite some time and we decided to test out this CT.

Female: HMPK White + Blue
Age: 4+ months
Temperaments: Active.
Size: Medium (2.5cm body only)
Grade: C

The first female from our breeding project, BSL20171231 that was used for this breeding project. We have a spawn of female Betta waiting to be mate with another male Betta so we tried with this one first. Again, nothing particular special about this female Betta.

Log Notes
The CT was purchased and delivered to us. Looked quite small and fragile but it seemed to settle down just right.

We put the pair into a small plastic breeding jar.

Mating started and we saw some eggs. Immediately we removed the female Betta as the breeding jar was too small. The male Betta will attack the female Betta since the container was so small.

This Week I Learned 2018 - Week 19

Last week post or something else instead.

Surprised and shocked. The only two words I can think off to describe my feeling for the past week. First, surprised because this one particular item on my bucket list which I guestimate will took me next 20-plus years or never to check off have been accomplished this week. Secondly, shocked it came so soon and such a massive shift and the non-stop flair of dramas. The staycation was well-needed as I was still recovering from my injury. Enough said, I've done my part and moved on to next item on my list.

Infestation of the Blue Green Algae (BGA) is getting worse and we have to do almost daily water changes on certain aquarium tanks. Prevention method is quite straightforward, use blackout method. First, 30% to 50% water changes, add air stone, cover tank for 3 to 4 days, and did another 30% to 50% water changes again.

Some MySQL stuff I've encountered recently.

When creating a MySQL stored function, do remember if the function does not modify data, you will need to set extra explicit options for binary logging.
ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL,
or READS SQL DATA in its declaration and binary logging is enabled
(you *might* want to use the less safe log_bin_trust_function_creators

The sample SQL statement as follows.

The limitation or restriction of subquery in MySQL. It doesn't supports `LIMIT` in subquery yet? Encountered this error message. To work around, you've to rewrite you SQL query using `JOIN` instead.
SQL Error (1235): This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

Can't delete using subquery? Wrap your subquery in additional subquery.
FROM tableE e
        FROM tableE
        WHERE arg = 1 AND foo = 'bar'
    ) x

Betta Spawn Log : BSL20180507 : HMPK Koi Red (M) x HMPK Koi Red (M)

This is the continuity to the failed breeding project of BSL20180328. For this breeding project, the same female was paired up with the newly bought male Betta. We were a bit reluctant to mate this pair as the female Betta was older and a bit larger than the male Betta. Past experiences have shown us that mismatch body size between the pair where the female is larger than the male may not work. The male Betta may get bullied by the female Betta.

Male: HMPK Koi Red
Age: 3+ months
Temperaments: Cowardy.
Size: Small (3.0cm body only)
Grade: B

Even after several months this young male Betta with us, it's still still quite wary of human interaction. When we placed it next to the female Betta, it have shown some interests and started to making bubble nest.

Female: HMPK Koi Red
Age: 5+ months
Temperaments: Curious and active.
Size: Small (3.0cm body only)
Grade: B

Since the last breeding project in March, the female have been quarantined for two months. It's now more active and curious and we noticed the female Betta was ready to mate as its stomach was full with eggs.

Log Notes
We monitored it for a while but didn't find the female Betta was interested with mating. The female Betta was older and size-wise, is quite similar and larger than the male Betta. Both were flaring with each other.

We assumed the pair have mated on this day.

To our surprised, we noticed some fry were swimming vertically and didn't realized that the pair have already mated. Immediately, we removed the female Betta and put into quarantine tank. As usual, the male Betta was busy collecting the fallen fry and relocated it back to the bubble nest.

These fry start to swim freely and we've started to feed Baby Brine Shrimp (BBS). To our surprised again, this spawn is probably one of our largest spawn, roughly around 200 to 300. We were wondering how many would survive for the coming weeks? We're tempted to remove the male Betta but decided to keep the male Betta in the spawning tank. Let's hope the male Betta will not eat up all the little fry.

The number of fry in the breeding tank still maintain. The male Betta still leave them aside. We were discussing on whether to take out the male Betta so we can have a spawn of 200 till 300. In the end, we decided to keep the male Betta so it can curl those unhealthy fry till a average number of 40-plus fishes. Too soon to tell, it will end up that the male Betta wipe out the whole spawn.

Yup, as we predicted, the population of the fry have been reduced by 70%. Not much left within the breeding tank. Maybe we should proceed with different breeding method by removing the male Betta by the time the fry already started swimming freely.

We can't find more fry except maybe one. Therefore, we've decided to move the male Betta into a quarantine tank and left the breeding tank as it's before wrapping it up.

It seemed we made a mistake. Most of the fry where hiding within the aquarium plant. We've decided to extract and move them to different breeding tank. A total of 83 fry were captured and moved.

Found even more fry in the existing tank. Total count was 107. It's very hard to find and see any fry if they are too small and body were transparent.

1/ Not every male Betta is suitable for leaving fry with father method. Mostly likely it will eat up all the fry due to stress. Main cause of the stress was due to the breeding tank was a clear tank instead of the covered box.

2/ For future spawning project, out discussion lead us to use different breeding method. We will extract the male Betta once the fry start to swim freely.

This Week I Learned 2018 - Week 18

Last week post or something else from the archive.


FORMS. Interesting concept on how to manage your week. In other words, you have a daily theme or something you're going to focus on each day. For example,
  • Monday: Finances 
  • Tuesday: Operations 
  • Wednesday: Research & Development 
  • Thursday: Marketing 
  • Friday: Sales
Interesting learning experience with Perl and Travis CI. From how-should-i-start, to why-this-is-not-working, and finally-something-is-working, Axel Beckert's guide is a definitely must read material. Furthermore, the Travis-CI testing helper for Perl modules does help a lot. However, like most Perl modules out there, documentation and maintenance is still a major issue. No worry, there is a tool to bootstrap the `.travis.yml` file, just install App::CISetup and use ``.

Having fun coding and can't seem to stop. Moderation is the key here.

kwalitee. Yes, kwalitee or Test::Kwalitee.

Facepalm. Totally speechless when using Dzil and Perl::Critic. You cannot put the package name in the first line of the code otherwise Perl::Critic will complain.
use strict;
use warnings;
package Foo;
# ABSTRACT: This is a Foo.
# KEYWORDS: foo bar baz

use frobnitz;
use OtherStuff;

Betta Spawn Log : BSL20180506 : HMPK Black Dragon (M) x HMPK Black Dragon (S)

This is probably the worse breeding process ever we've observed and partly it's due to our negligence. We started this breeding project because this is our first spawn which consists of a pair of siblings and more importantly, a pair of Black Dragon.

Male: HMPK Black Dragon
Age: 3+ months
Temperaments: Very aggressive and brutal.
Size: Small (3.5cm body only)
Grade: B

Female: HMPK Black Dragon
Age: 3+ months
Temperaments: Curious and active.
Size: Small (3.0cm body only)
Grade: B

Log Notes
Due to some luck, we managed to buy two pairs of HMPK Black Dragon from a same breeder. Based on the size, we estimated these Bettas were around 3+ months. We decided to let these fishes to settle down as we're too occupied with other breeding projects.

We tried to breed with a pair of Bettas. Due to our carelessness, the male Betta was attacking the female Betta very aggressively during the mating. The female Betta was badly injured and we removed and quarantined the female Betta after two days of severe injuries. It did not survive.

Second mating with another female Betta proven to be successful. We found some eggs in the scattered bubble nest.

Quite a large spawn and we found quite a lot of fry. The male Betta was busy picking up fry and brought back to the bubble nest.

Whole population was wipe out by the male Betta. No a single fry left in the breeding tank.

1/ If the male Betta is very aggressive (pay attention to how much damage it causes the female Betta), remove the female Betta immediately if no eggs were seen in two days. Aggressive male Betta should be monitored very closely.

2/ Refer to point (1). Move the male Betta immediately after the fry swims freely. Aggressive or frighten male Betta may eat the whole fry population.

This Week I Learned 2018 - Week 17

Last week post or something from the past instead.

Humour aside, I've known two persons (a tech guy and a lecturer) who don't even have a mobile phone, let alone social media accounts. Yes, they are on the rather extreme cases but that was due to their own personal stands and life philosophy. While there have been quite a lot of minimalist life style movement these days but little emphasis on digital world. As usual, moderation is the key here. Too much of everything will cause unwanted disturbance and distraction to your personal and working life.

The Playoff Rondo is part stats and part myth although the stats don't tell the full story. But it's quite entertaining to watch him play, especially the playoff and with big centers.

Plan B before you turn 40. (via HN) Relevantly, experiences on those over 50 who have been laid-off from the tech-force seemed quite positive, life still goes on although on different path. Well there are differences different between Western and Asia countries, this is just part of your work life, especially for those working in tech. Practice minimalist life style, live below your means, exercise and keep healthy, and do what you love. You have to agree with, web development is so accessible these days. Anyone good basic knowledge of English and keen persistence, they can build up the system fairly quite fast. Furthermore, as you aged, priority in life changed as well as your health. Moreover, older tech guy tends to question more and call out BS.

Where SCRUM is not the right choice. (via Reddit) The discussion in the Reddit tells a lot of the horror or abuse stories where SCRUM was implemented literally. It does not work for software team with different project and don't share the SAME backlog. If you have different products, you can't implement SCRUM within the same backlog! Period.

Friendship’s Dark Side: ‘We Need a Common Enemy’. It's a common knowledge but right now it have been proven that "Xenophobia and in-group bias go hand-in-hand". Average fall-outs withing the social group is around 7-plus months. Interesting read.

One item checked off the bucket list. More items to go.
$ cpanm Webservice::Swapi
--> Working on Webservice::Swapi
Fetching ... OK
Configuring Webservice-Swapi-0.1.1 ... OK
Building and testing Webservice-Swapi-0.1.1 ... OK
Successfully installed Webservice-Swapi-0.1.1 (upgraded from 0.1.0)
1 distribution installed

Select all parent and child records. This is when having a Venn diagram really help in visualizing the details.
FROM comments AS parent
LEFT JOIN comments AS child 
ON child.parent_id =
WHERE parent.parent_id IS NULL

Upgrade to Ubuntu 18.04 Bionic Beaver

Yes, the regular updates on my Ubuntu distro in my lappy. While reading back my old posts, I just realized that I've written personal for almost each Ubuntu release like 17.10, 17.04, 15.10, and 13.04. Not sure why, but I didn't jot down any upgrade notes on 16.10, 16.04, 14.10, 14.04, 13.10, and earlier.

Upgrade was done as usual but with a few hiccups. Full upgrade was possible with a few manual intervention of the package management.

First, not enough free disk space in '/boot' folder.

The upgrade has aborted. The upgrade needs a total of 127 M free
space on disk '/boot'. Please free at least an additional 82.7 M of
disk space on '/boot'. You can remove old kernels using 'sudo apt
autoremove' and you could also set COMPRESS=xz in
/etc/initramfs-tools/initramfs.conf to reduce the size of your

Resolved this by removing all the previous Linux kernels and so surprised to know that my machine have so many different versions lying around. No wonder there was limited spaces available.

Second, upgrading was halted due to packaging dependency. Not sure why. Googling around for answers and trying a few usual solutions did not help at all and kept getting the same old error message.

E: Sub-process /usr/bin/dpkg returned an error code (1)

dpkg: error processing archive 
   /var/cache/apt/archives/libmariadb3_3.0.3-1build1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/mariadb/plugin/', 
   which is also in package libmariadb2:amd64 2.3.3-1
 Errors were encountered while processing:
 E: Sub-process /usr/bin/dpkg returned an error code (1)

At the end of the days, the Synaptic tool save the day and resolving all the conflicts.

It's just me or something else, `apt` doesn't seems to have a right default options to resolve conflicts compare to Synaptic.

Now for the changes, reading through the release notes, I've learned a few things and realized that I was quite lost touch with the server part of Ubuntu distro.

1/ Netplan, the network configuration abstraction renderer. Basically it's just a tool to manage networking through YAML file. Surprisingly, the console tool was written in C instead of the regularly used Python. Not sure why but surely it must have a good reason.

2/ New features only available for new installation but not upgrade. For example, swap file instead of swap partition, Python 3 over Python 2, full disk encryption (LUKS) instead of folder encryption.

3/ Subiquity, the server installer was available for server user. Definitely a DIY solution to differentiate themselves from default Debian installer.

4/ LXD 3.0. A better alternative or solution to Vagrant or Docker. I've been lost tracked of this project. Maybe it's the right time to look and get my homelab machine to run this again.

5/ chrony replaced ntpd (there are comparison as well). One good thing is chrony was licensed in GPLv2.

6/ On the desktop front, from the GNOME 3.28 release notes, Boxes was getting much needed love. Previous version was so buggy that made you wonder why it was ever released in the first place.

Cpanm with local library installation

One of the issue I kept facing when developing local Perl modules installation and dependency management.

$ cpanm -nq --installdeps --with-develop --with-recommends .
! Can't write to /usr/local/share/perl/5.26.0 and /usr/local/bin: Installing modules
! to /home/foobar/perl5
! To turn off this warning, you have to do one of the following:
!  - run me as a root or with --sudo option (to install to 
!    /usr/local/share/perl/5.26.0 and /usr/local/bin)
!  - Configure local::lib in your existing shell to set PERL_MM_OPT etc.
!  - Install local::lib by running the following commands
!    cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)

Either we do this manually everytime.
$ cpanm --local-lib=~/perl5 local::lib 
$ eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
local::lib is up to date. (2.000024)

Or setup your local environment for once through local::lib.
$ PATH="$PATH:~/perl5/bin"

Additional directories for Perl library.
$ export PERL5LIB=~/perl5/lib/perl5

Options for Module::Build.
$ export PERL_MB_OPT="--install_base '$HOME/perl5'"

Options for Module::MakeMaker.

$ curl -L | perl - -l ~/perl5 App::cpanminus local::lib

Add this to your `.profile` as well.
$ eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)
$ source ~/.profile # reload

Or just use Perl's Docker container image.

Or just use Carton and set everything to local folder.

This Week I Learned 2018 - Week 16

Last week post or something from the archive.


Another week of learning new English vocabulary. One issue with making sentences using these words was that the sentences was either too forceful or too literally (直译的) translated.
Sandy alleviates (缓解) the excruciating pain on her lower body part by elevating both legs into a bucket with warm water. By doing so, they hope it can obliterate (忘却) the pain she was going through. Both legs were swelling due to her falling into liquescent (易液化的) soil and stabbed by tree trunk while trekking in the wood. The swelling have worsen and everyone worry that the muscle may liquefy (使液化) from within. 

Stuck with an interesting MySQL problem, which was quite easy but I can't seem to get it right after several tries. Basically we want to update certain column in t1 to the maximum value from a group of similar records. The SQL query was quite straightforward, just join with the second table, t2 with maximum record with the first table, t1.
UPDATE t_transaction tu
    SELECT code, MAX(flag) AS flag
    FROM t_transaction
    GROUP BY code
) t
ON tu.code = t.code
SET tu.flag = t.flag

Modern backend developer in 2018? (via HN) A checklist and decision making tree are always a good choice to make good decision making when picking up new technology stack.

Perl constant array. Sometimes the simplest and easiest way is the only way instead of going through and abusing quirky Perl syntax.
use constant FRUITS => ['apple', 'orange', 'banana'];

my $fruit = 'apple';
if (!grep $fruit eq $_, @{+FRUITS}) {
    print "Is not a fruit";
} else {
    print "Is a fruit";

use constant FRUITS => qw(apple orange banana); 
use constant FRUITS => (apple orange banana);  
my $fruit = 'apple';
if (!grep $fruit eq $_, FRUITS) {
    print "Is not a fruit";
} else {
    print "Is a fruit";

Modern PHP without a framework. (via HN) Nah, still hate it after all these years. Maybe I'm just prefer a more prettier programming language.

所以,你得先釐清有哪些條件是你重視的,像薪水、公司品牌、職位、工作內容等,一一把它寫出來。列出條件後,再排定先後順序,之後,和你手邊的 offer(拿到手的工作)比較,做成表格。縱軸是你重視的條件,並依照先後順序,由上而下排列;橫軸則是你拿到的 offer。當你完成表格後,該選擇的工作就會自動「跳出來」。
工作上要留下那个”人才“? 当然是人品态度优先,能力可以慢慢去培养。

What are some tech companies that do not use open floor plan? Interesting question for those who are looking to justify cubicles. The office at Fog Creek was in between, open space for collaboration and private office for working.

Data class in Python 3.7. (via HN) What took them so long? Syntactic sugar or not, this should have been in any fundamental data type for any programming that supports OOP.

Vipassana for Hackers. (via HN) A book on how a tech guy perceived and practiced Vipassana meditation without involving religion, just the practice. Contrary to typical meditation book, lots of pictures explaining the core concepts.

Moving for good. (via HN) Good write-up when you're moving to a new place. Key quote here (emphasis added),
Ask lots of questions. Ask them to explain things, and show you how it’s done. When they state a fact, ask how they know. When they state an opinion, ask for examples.
How to be a systems thinker. (via HN) I still can't get my head to understand this and the list of reading materials is quite long. Worth spend time on this? We shall see then.

This Week I Learned 2018 - Week 15

Last week post or grab something from the archive.

Travelling. Short and late write-up for this week.


Travis CI and Perl. Some minor hiccup but I managed to get the Continuous Integration (CI) to work correctly. Unfortunately, I can't seem to find a way to test the CI within the local development environment.

The history of React.js. Didn't realize that React have came a long way, since 8 years ago. Yes, you got it right, 8 long years ago! The competition of the front-end Javascript libraries have settled down to either React, Angular, and Vue. Due to some "compelling" circumstances, this is a good time for "reacting" (pardon the pun), and nothing better to start with the fundamental basis (via HN).

"Manage your energy, not your time." How you manage your day (especially the morning) determine the productivity for the whole day, week, month, and year.

This Week I Learned 2018 - Week 14

Something from the archive or last week post.

We have been doing blood pressure measurement wrongly for all this while. You must measure blood pressure from both arms. Yes, both arms and find the differences. According to Harvard Health,
"A blood pressure difference of 10 to 15 points or more between arms also boosted the chances of having a stroke or dying from cardiovascular disease. "
Personal data and GDPR: practical guide for developers. Shaking my head while reading through the whole post. I was wondering how a software team going to ensure data anonymization in development environment when handling production data? When come to this, the US/Canada software houses are doing a better job than the EU/Asia counterpart.

What if we apply this to our life instead? Rearrange your line of thoughts in your writing. Intriguing discussion when come to writing.

"The Surgical Team" (chapter 3 in the infamous book, The Mythical Man-Month), a different software development team structure which it's similar to the surgery team where,
"The idea was to construct development teams in a way similar to the surgery teams - one lead developer, one assistant developer (these two "adult" and very good), and a 3-4 other people who 's job is to make the life easier for the main devs - someone to manage documentation, someone else to do detailed testing, one average dev to do the simple and boring stuff, and so on."
Maybe an alternative approach where the Agile methodology like Kanban or Scrum cannot be applied successfully or productively. Why so? Cargo cult software engineering, as coined by Steve McConnell where software development houses try to imitate successful processes or approaches without understanding why such methodologies works for them. What works well (may due to luck and timing) for an organization or team may not be suitable for another organization or team. Don't uses Scrum for the sake of using Scrum. Another good example, the reinventing of office space, open office, pool table, ping pong table, gaming corners, and the like. Yes, the startups starter pack.

Fork and Pull Request Workflow. While version control system have been available since the 70s, till today, amazingly, some companies still refuse or slow to adopt it. Everyone have their own workflow and branching models.

Quite a number of MySQL Gotchas this week. Fair enough, it will happen to any of the DBMS out there. My tolerance towards MySQL have increased along these years. Must be something to do with getting old.

How do you order a list of items where the NULL data is at the bottom of the list? It's actually quite easy, just use ORDER BY ISNULL. See the example below.
SELECT * FROM table ORDER BY ISNULL(field), field ASC;

NULL, NULL, NULL, 1, 2, 3, 4
1, 2, 3, 4, NULL, NULL, NULL

Creating a function in MySQL. That was rare but somehow we may need it to reduce or shorten the SQL query. Yet, we kept encounter this idiotic error of "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER |' at line 1". Just add a BLOODY space! Yes, a BLOODY space before the semicolon!
Create function or procedure
Write your function or procedure here...
End (without semicolon)
DELIMITER ; (semicolon with space)

Write UPDATE SQL query with multiple joins and SUB-SELECT but the query won't work in SUB-SELECT? Wrap the SUB-SELECT condition with one more join!
DELETE FROM story_category
WHERE category_id NOT IN (
    SELECT cid FROM (
        SELECT DISTINCT AS cid FROM category
        INNER JOIN story_category ON
    ) AS c 

How many ways to insert a not found record in MySQL? Plenty of ways. Not sure these works cross database systems.

Career do-over? Either moving to management and if you don't like it, restart your development career again.

This Week I Learned 2018 - Week 13

Last week post or something from the past. This going to be a very long weekly post. So many things written down this week and might as well put everything together.

The Nightmare Letter: A Subject Access Request under GDPR (via HN). GDPR (General Data Protection Regulation), the new data protection law coming into force on 25th May, 2018. Ironically, an article posted in a site that making profit from our shared data. There always this saying I read online many moons ago regarding privacy, "If you have done nothing wrong, then why you need to worry about people tracking your Internet usage?". And the counter argument to this question is "Everyone knows what we did in the toilet, then why we still need to close our door?". Corporations have long monitored and tracked our daily movements and behaviours and people needs to be educated and aware of such activities and their right to erasure, also known as "the right to be forgotten".

Off course, all these discussions was due to the recent social media data breaching. And usual things was, some noises were made, another call for deletion of your social media account, and things will cool down, and live goes on. Nothing drastic will happen, people still will keep their social media account and no one will delete it. Social media site will be replaced by another social media site, somehow or another.

Surprising to find out about this on feeding Betta fish (emphasis added). And we were feeding the Betta fishes with more than 2 to 3 pellets! Pellets will expand in their stomach. No wonder some of the Bettas were having constipation issue.
Adult bettas can be fed once a day and babies (young) can be fed twice a day. It may not seem enough, but many pellets expand to more than 2x their size when they get wet. To put this in a further perspective, the stomach of a betta fish is about the size of their eye! Additional power supplies may be necessary depending on the level of activity and personality of your betta.
Read the story about the origin of Giant Betta. Most of the new Betta type was due to anomaly of breeding and continuous selective breeding.

Reality when comes to management as described below:
In this case, it's management giving the impression that they are "doing something." We see the same thing with, "can we add more developers to speed this up?" The answer is almost universally "no" and, presumably, any manager in the modern era should have read (or at least be familiar with) the over 40 year-old book, "The Mythical Man Month." But, from a senior management position, there aren't many levers to pull--and when the heat is on, they have to be seen to "do something."
Write or build your own software projects. Yes, is a time waster to re-implement something from scratch, but you will gain valuable insights by doing so. Build your own React is probably something relevant that everyone should look into if they wish to understand what the hype about front-end development using React and the like.

Thought provoking post on how Lisp, the programming language ruined a person development career (via HN). Are you a software plumber or software developer? The comment did raise an interesting question on how once see his or her software development career. If you're doing mostly business software or glorified spreadsheet, then you're a plumber, not the later. If remember correctly, long ago, there was this discussion about software developers who are producer and those who are consumers.

Is the ability to focus the key skill that separate successful and unsuccessful people. This HN user think so. The next question is how to increase your focus?
Pretty awesome! If I ever had to say the one thing that differentiates successful people from unsuccessful people it wouldn't be intelligence, or even perseverance, or passion. It'd be focus. With focus, you can be amazingly successful in so many types of occupations.
(That being said, passion / perseverance / intelligence can often lead to focus)
How to tell great story? Feeling stuck or suck? Just follows the Pixar’S 22 rules of storytelling. Rule number 4 or the The Story Spine way is the most common and popular.
Once upon a time there was ___. Every day, ___. One day ___. Because of that, ___. Because of that, ___. Until finally ___.
Meanwhile, while reading about writing, saw this post about whether we can start a sentence with a conjunction? Definitely yes. Good examples shown below:
It’s a pretty smart and progressive budget. But do you think those changes go far enough?
Some people are calling this film the worst movie ever. And who are we to argue?
Dworkin’s answer is no. But why not?
Who would have thought it? And is it really true?
While we at it, this week vocabulary list. Lots of similar words and it was quite hard to link these words up into a cohesive paragraph.
When sedition (煽动叛乱) law have been applied selectively, societies will slowly disintegrated (瓦解) from within rather by external influences. Inconsistency and partially interpretation this law will result in serious crisis in the legislation and judicature (司法) of our country or worse, the ridicule (奚落) of our judicial (法庭的) system. Therefore, there should be a judicial review of the law should be an integral (整体) part of the to the rule of law. That was David, an adjunct professor (副教) of law, judicious (有见识的) closing statement before the class adjourned (休庭) for lunch break. While he was discussing remaining details with his fellow students, Mary, his personal assistant, interjected (插话) their discussion to remind Davis about his itinerary (行程) for today. He should be in the transit (中转) lounge at the airport in two hours and additional amendment of this law was not be the ambit (范围) of their discussion right now.

Betta Spawn Log : BSL20180328 : HMPK Koi (M) x HMPK Koi (S)

Longest possible pair that we've conditioned before breeding, roughly 1-plus month. SO was not hurried to breed this pair and wanted to wait for other spawn to mature enough. Nevertheless, we've noticed that the female Betta have been ready for so long and might as well let both mate and breed.

Male: HMPK Koi
Age: 3+ months
Temperaments: Active and curious.
Size: Small (3.5cm body only)
Grade: B

Always curious and not afraid to confront us when ever we feed the male Betta. This is one male Betta which swims in an aggressive and majestic way.

Female: HMPK Koi
Age: 3+ months
Temperaments: Curious.
Size: Small (3.0cm body only)
Grade: B

Nothing particular special about this female Betta. Just quite quiet.

Log Notes
The female Betta was let out from the isolation cup and both Bettas started to mate without much trouble. However, we've noticed not much eggs were produced and kind of disappointed with the outcome. We decided to let both fishes to settle down during the night.

The male started to chase the female Betta. We assumed that the mating should have been completed. Unfortunately, we don't see much eggs in the bubble nest. The female Betta was jarred and quarantined. The female was looking quite good without any damages to its fins. Most likely explanation was both Bettas was conditioned within the breeding tank for so long. Maybe that could be the reason why not much eggs was fertilized during mating?

Not many fry found within the tank as most were swimming or hiding at the back of the breeding tank covered by thick aquarium tank.

No fry left.

1/ We've underestimated the stress level of certain male Betta. Some male Bettas were not comfortable with human presence and may led them to eat up all the fry.

Betta Spawn Log : BSL20180327 : HM Blue (M) x HMPK Koi (S)

Yes, the continuity of BSL20180305, same pair of Betta fishes and same environment. Both the Bettas were healthy and especially the female, which was full of eggs. Our plan this time was to remove the male Betta once the fry starts to swimming freely (or horizontally).

Log Notes
The female Betta was full of eggs and was swimming slowly in the sorority tank. We've decided to get it out to the same breeding tank.

We didn't realize but the female Betta was dropping eggs on its own and piled it up in the plastic bottle in the breeding tank. Immediately we released it out so it can mate with the male. The male Betta have been busy making the bubble nest. Upon released, both already starting to mate but the female Betta was dropping eggs non-stop (see photo below), even without mating. We suspected that too many eggs within the female itself. Again, pity that we've so many unfertilized eggs. We should have released it and let it mate immediately before we headed up to work this morning. Let's us how this goes!

The female Betta was removed from the breeding tank. There were some eggs in the bubble nest and the male Betta was making more bubbles to make it stronger.

Nope. Again, no eggs were found in the bubble nest or what the remains of it. We're going to give up breeding this HM. Might as well give the HM a good rest and keep it as it.

Cleaned up the breeding tank and moved the male Betta into a smaller plastic jar.

1/ Numerous attempts have been tried with this male Betta. It seemed the effort was fruitless as the male Betta was easily spooked and it was eating up all the fry.

Betta Spawn Log : BSL20180326 : HMPK Blue + Red (M) x HMPK Blue (S)

Probably the longest breeding process for this male Betta. We wish to breed more Betta which have this body shape but different colours. Maybe this will come after a few generations.

Male: HMPK Blue + Red
Age: 3+ months
Temperaments: Extremely aggressive and brave.
Size: Medium (3.5cm body only)
Grade: B

If not for the colour and under-developed fins, this male Betta have the best overall body shape in our collection. It's not afraid of us and always flared at us. We've seen how it tore apart several female Bettas fins and causing trauma to these females. One of the female Betta, which was purchased as a pair, was so frightened to be put along side this male Betta.

Female: HMPK Red Blue
Age: 3+ months
Temperaments: Passive.
Size: Small (2.5cm body only)
Grade: C

Generally passive and not much eggs produced. We've chosen this one as we want to breed blue colour HMPK. Nevertheless, this female have successfully mated with the male (finally)!

Log Notes
Found some eggs in the bubble nest, not a lot and scattered around. Immediately removed both female Bettas as the this male Betta was very aggressive and biting all the females. We've tried to add more female Bettas to encourage competition among the female Bettas so that it can breed with this male. We definitely need to revise our preparation procedures.

Found some fry were swimming vertically and the male Betta was busy picking it up. We also noticed that the male Betta was too tired and not flaring anymore but resting at the bottom of the breeding tank. A common behaviour of overly aggressive male Betta after post-breeding.

Moved the breeding tank to different rack. Still quite a large number of fry and the male Betta was not as aggressive as before.

Cleaned up the breeding tank. Remaining fry (8 found) were moved to BSL20180316. There fry were too small and not growing at usual rate.

1/ Monitor the fry growth rate. Big breeding tank may not be suitable if the number of fry were too small.

This Week I Learned 2018 - Week 12

Last week post or something from the past.

A minor adjustment of book placement and I've been reading one page per day without any interruption for the whole week. Keep the reading streak going!


There is a Chinese idiom, “对症下药”. With the right medication, a disease can be effectively cured. Surprisingly the medication that I've impulsively bought reduce the inflammation and speed up the recovery process. The problem have been plagued me for the past 4 years and it's finally reaching to an end. Surprising (not really after you went through different doctors), I've consulted a few doctors in the past but they can't seem to give the right prescriptions (can't blame them, doctor these days just want to sell more medications that fix symptoms). In the end, I've to thank to that pharmacist who ever he is.

Two interesting English words I've found, may sounds a bit too fancy. Big word, they said, nevertheless sounds "intelligence". Affordance. When come to daily object interaction, the handle of a cup is a good example to describe the words. The handle gives an obvious way on holding it. Kerfuffle. This was a popular words this week in the NBA, basically refers to a commotion between NBA players. Yes, big word.

Back to regular weekly learning new English words. Here we go.
The posthumous (作者死后出版的) publication of the researcher on the hydrodynamic (水力的) model of the eruption of the underwater volcano aroused quite a few interests among the archaeology field. While the late researcher main focus of the publication was on the igneous (火成岩) rocks formation, there was a section which documented about the ancient ideograph (象形文字) found within the underground caves carved (雕刻) by the lava near the coastal(沿海) and insular (海岛的) area. Insulated (使隔离) from the air under the sea, archaeologists are still puzzled how the ancient civilization were once ever existed in that area.
Hoarding? Too much stuff? Read this post on how a Redditor removed that habit. In short, go to thrift shop on weekly basis, you will aware that most stuff bought or collected will ended up there. The most memorable things are your experience in life, captured in photos or some ways or another. Definitely something to ponder.

Betta Spawn Log : BSL20180325 : HMPK Marble Blue (S) x HMPK Red (S)

We made so many mistakes with this spawn and learned quite a lot of hard lessons here. The main lesson here was, never put in a pair of Betta fishes with mismatch size, especially when the male was smaller than the female.

Male: HMPK Marble Blue
Age: 3+ months
Temperaments: Extremely aggressive and brave.
Size: Small (3.0cm body only)
Grade: B

The last surviving Marble we have. Initially we thought it won't breed because it doesn't seem to make any bubbles since the first day we have it. And, certain Betta fishes from our northern neighboring country may be sterilized before being shipped out to us. But after certain arousal medication, it started to make bubble and afterward, bubble nest.

Female: HMPK Red Base
Age: 3+ months
Temperaments: Aggresive.
Size: Small (3.0cm body only)
Grade: C

Quite aggressive for its size and kept flaring at other male Bettas.

Log Notes
Both male and femala Betta was flaring each other and mating was tedious and aggressive. Both did mate, but only once or twice. No eggs were seen in the bubble nest.

We've noticed that the male Betta was injured and was panting in the far corner resting on the plastic bottle. Its operculum (the area that protect the gills) was shredded (See the arrow in the photo below). We immediately removed it from the breeding tank and quarantined it. As we're out of Indian Almond leaves, we resorted to use Malachite Green and keep the water level as low as possible. The recovery jar was put within a box so the male will not be interrupted.

The male Betta was doing well but still very weak. I've changed 80% water changed but retain the Machinate Green water. We will switch to different medication tomorrow if we still can't find any Indian Almond leaves.

Meanwhile, the female Betta was shredding eggs and picked it up itself. This was the first time we observed that a female Betta was shredding its own eggs if it can't find a male Betta to mate. Pity though, quite a number of eggs were wasted.

The male Betta was looking better and more active today. I believe its recovery was doing well.

1/ Size does matter! If you want to breed Betta fish, make sure you buy a medium or large size Betta. Those with smaller sizes are harder to breed because you have to find an even smaller female Betta.

2/ During mating, if you find that the female Betta was larger and flared at the male Betta continuously, and even worse, chased the male Betta away, stop the breeding immediately. There mating and breeding will be unlikely to success.

3/ Female Bettas will drop its own eggs without mating if it's too ripe. Don't waste it.