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)) {
    $self->$method(whatever);
  } 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") ) {
    &$ref(...);
}

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
2018-05-20
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.

2018-05-27
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.

2018-06-03
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.

Retrospection
1/ We still haven't figure a good way to quarantine the pair after breeding. There were several cases of casualty due to post-breeding infections and stress.

2/ For easy feeding and water maintenance, we merged quite a few spawn together but did not keep track of each spawn. Thus for those small spawn, we're not sure about the growth progress of the Bettas.

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
2018-05-18
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.

2018-05-19
Jarred the female Betta. Waiting for these eggs to hatch.

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

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

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

2018-07-26
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.

2018-08-05
Jarred most of the Betta and cleaned up the breeding tank.

Retrospection
1/ We have a female Betta tank where we put all our female Betta for breeding after a week of quarantine after successful mating. However, some female Betta may bring other kinds of infections back to this tank.

2/ Instead of breeding other types of Betta, best if we can focus on few selected species or colour types. For now, we want to focus on Super Red instead.

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
2018-03-29
The CT was purchased and delivered to us. Looked quite small and fragile but it seemed to settle down just right.

2018-05-17
We put the pair into a small plastic breeding jar.

2018-05-26
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.

2018-10-11
Since this small spawn was moved to other breeding tank, till today we still can't find any of its fry. There were no noticeable fry with CT tail. Unfortunately, we have decided that this breeding project was not really successful.

Retrospection
1/ For CT, maybe we should pair it up with another CT female. Otherwise, the gene will not be inherited over to the next generation.

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
variable)

The sample SQL statement as follows.
CREATE FUNCTION f1(i INT)
RETURNS INT
DETERMINISTIC
READS SQL DATA
BEGIN
  RETURN i;
END;

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.
DELETE e.*
FROM tableE e
WHERE id IN (SELECT id
    FROM (SELECT id
        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
2015-05-07
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.


2018-05-08
We assumed the pair have mated on this day.

2018-05-10
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.


2018-05-12
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.




2018-05-15
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.

2018-05-17
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.

2018-05-20
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.

2018-05-23
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.

2018-05-25
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.

2018-08-19
Most fry have grown into juvenile Betta. We can observe some colour variation and some with curved spine (water quality or infection?).

Retrospection
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 `setup-travis-yml.pl`.

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
2018-04-03
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.

2018-04-30
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.

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



2018-05-08
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.

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

Retrospection
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.