This Week I Learned 2019 - Week 06

Last week post or you can going through some earlier stuff.

Happy new year again or rather, happy Chinese New Year. The weather was blazing hot compare to all the previous year even though there is no fire haze from our neighbouring country.

What else I've learned this week not within this post? Going through the sixth week of ornamental fish culture on fish breeding techniques such as selective breeding and biotechnology. Since this is a short lecture notes, I've decided to continue with week 7 study notes which discuss on seed production on factors affecting larvae rearing and feeding (species and water medium). The review paper of this week is the masculinization of the ornamental Siamese fighting fish with oral hormonal administration. SMS::ClickSend is the Perl module of the week to be reviewed.

Is Nokia 6303c still available these days? The most memorable and funny post I've read so far this year. I'm not sure under what context the poster needs to use a durable normal dump phone, but moving from Nokia 6303c, Nokia 216, Nokia 150, and lastly CAT B30 His perseverance is commendable and definitely should be the coolest post (not coolest use) of Perl usage writeup. I miss the old monochrome dumb or feature phone which is durable, have long lasting battery, and purposeful usages (call, text, and defend). Does affordable dumb phones still exists (as in 2019) these days? Yes, there are quite a lot and the one that caught my attention are from Alcaltel model 10.54, 20.08, 20.51, 10.50. Why dump phone still have a market these days? Four words. Africa and senior citizen.


What are the differences among the subroutines in Carp module? Carp is a Perl module that provides alternative subtitutions to to `warn` and `die` in Perl? The screenshot below summarizes it the best. If you want the similar backtrace feature but don't or can't change your Perl code, there is always a Carp::Always module that will patch the `warn` and `die` subroutine.

What does a long time developer want? "Build more long lasting artifacts." How? Contribute more to FOSS then, is as simple as that.

Is Makefile redundant? In some context, yes. Because if you've a shell available, any shell scripts should be sufficient enough to emulate a Makefile as shown below.
    set -e

    case "$1" in
            docker-compose up -d

            docker-compose rm -vsf
            docker-compose down -v --remove-orphans
            docker-compose build
            docker-compose up -d
            echo "unknown verb: $1"

Write and publish a book in ten minutes per day? (via HN) Is this doable? Yes, you can just sit there and stare at it for ten minutes. However, the ten minutes is just the appetizer, to get your started. Maybe you can be in the zone or maybe not but you did something, even through you're just sitting there. The thing is you must do it every day, and every day it get easier. Remember the Jogging Baboon?

However, your brain still works on the task subconsciously even after the time frame. If you're not writing a book, what else can you do in ten minutes per day then? Doubt so as you brain still process the task the whole day even after the timed duration. Hence, the ten minutes is just to bootstrap the task and you've spend a few hours later doing it subconsciously.

There is another important lesson here. When to stop. If you don't have any juice left, stop. Or if you doing very well like in the zone, stop so you can look forward to continue tomorrow.

What else can you do during the ten minutes duration? There are plenty of things such as writing a dairy journals (via Lobsters), pick up any new habits, 5BX exercise plan, core wars kata.

Perl Module(s) Of The Week - 2019 Week 06 - SMS::ClickSend

This week Perl module, SMS::ClickSend was chosen because after reviewing the source code, I personally felt that this module embodies what I consider the Perl 5 way of simple coding style. Regardless Perl's notorious TMTOWTDI, as I observed, there exists a standard coding style which includes (1) Use minimum dependencies for speed and simplicity, (2) Prefer plain old Object-Oriented (OO) using blessed instead of Moose or Moo, (3) Snake case subroutine naming convention, (4) lack and little validation, and (5) Brevity without overly verbose. Even through the module was written in 2014 (5 years ago), I've seen new CPAN module that was written in such style even in 2019. There are some CPAN modules which were written in such over-engineered way that spans multiple modules. But that is a discussion for another day.

As usual, Installation is simple.
$ cpanm SMS::ClickSend

Sample usage of the API based on the synopsis.
use SMS::ClickSend;
my $sms = SMS::ClickSend->new(
    username => 'username',
    api_key  => 'API_KEY...',
my $res = $sms->send(
    to => '+61411111111',
    message => 'This is the message',
print Dumper(\$res); use Data::Dumper;

Let us look at the constructor. The constructor, `new` accept an array of values that needs to be converted to a hash. Hence, the number of items in the array should be even, hence the modulo by 2 to detect any odd number of items passed. Converting an array to a hash is quite straight forward, just `%hash = @array` should be sufficient;
sub new {
    my $class = shift;
    my %args = @_ % 2 ? %{$_[0]} : @_;

Check whether the required parameters exists without using the `exists`. Just use short-circuit evaluation through logical or operator. Read more on logical disjunction.
    $args{username} or croak 'username is required.';
    $args{api_key}  or croak 'api_key is required.';

Use default user agent if nothing was set or defined through the logical-or assignment.
    $args{ua} ||= LWP::UserAgent->new;

Lastly, just make sure or bless the hash arguments to be part of an object in the `SMS::ClickSend` package.
    return bless \%args, $class;

To fully understand how the constructor works, we need to show how the constructor was being called by the calling code.
# We are passing an array of four elements
my $sms = SMS::ClickSend->new(username => $username, api_key => $api_key);

# We are passing a hash and this can be obtained from first element from the argument, `$_[0]`.
my $sms = SMS::ClickSend->new({username => $username, api_key => $api_key});

# This will not work and `$args` will become an empty hash.
my $sms = SMS::ClickSend->new($username);

# This will work partially as `api_key` argument is missing and trigger the `croak`.
my $sms = SMS::ClickSend->new(username => $username);

Instead of catering for all possible inputs, perhaps we can just stick to one way of an array instead of hash to accept arguments to the constructor.
sub new {
    my ($class, %args) = @_;

    $args{username} or croak "username os required";
    $args{api_key} or croak "api_key is required";

    return bless \%args, $class;

Another interesting module found within the code. Basically, `var` is "Perl pragma to predeclare global variable names". Basically a global variable within the scope of the package. Superseded by `our` function which is a "lexical alias to a package (i.e. global) variable".
use vars qw/$errstr/;
sub errstr { $errstr }

Research Paper to Read: (2011) Masculinization of the ornamental Siamese fighting fish with oral hormonal administration

Source: ResearchGate.

(1) Oral administration of 17a-methyltestosterone (MT) hormone of 3 and 4 mg/kg doses resulted in 100% masculinization or all males within a spawn.

Why this paper?
Discussion with different breeders shared their experiences buying Betta sp. broodstock from neighbouring country (hint: north) that cannot or won't breed. They have long suspected that the broodstock was somehow treated with certain chemicals that make it harder for the pair to mate and spawn. We've read some papers that probably can explain the root cause of the broodstock that can't breed, masculinization. From early stage of larvae, Through exposure to MT hormone that reverse sex in Betta sp. from early stage of larvae, a breeder can control the sex of the fry by turning the spawn into almost all males Betta sp. This allows the breeder to gain more profits as the male Betta sp. fetches way higher prices compare to female Betta sp. in the ornamental fish market.

Material and methods
The research starts with fry production using 4 pairs of Betta sp. of crowntails, veiltails, and spaidtails strain in four separate 15 litres plastic tank. Once eggs have been fertilized it's extracted and removed to a separate bowls. The spawning was done into two sessions, once in January and another one in May where each experiment group produced around 400 fries. For each experiment group, equal number of 80 fries were placed into 5 separate 2 litres cages within a large 160 litres aquarium tank. The experiment designs in shown in the table below.

Feeding were done 6 times per day (assuming it's 4 hours interval) with different feeding post hatching schedule and diet. DPH is referring to days after post hatching.

(1) Experiment A
- 4 DPH till 7 DPH with artemia nauplii.
- Feeds with MT (Classic AAF-F) until 30 DPH
- Feeds with MY (Lucky Star 2) until 56 DPH.

(2) Experiment B
- 4 DPH till 11 DPH with artemia nauplii enriched with red pepper.
- Feeds with MT (Classic AAF-F) until 30 DPH
- Feeds with MY (Lucky Star 2) until 56 DPH.

The experimental group of A0 and B0 is the control group where no treatment was added. Experiment groups of A2, A3, A4, B3, and B4 shows 100% sex reversal. Mortality rates does not have significant statistical difference.

There are quite a number of confusion in this paper that raise many unanswered questions. Bar chart is not a suitable presentation to summarize the result of the experiment compare to a table with figure. It's very hard to visually identify which experimental group have yield 100% sex change to monosex population.

These treatment were used on ornamental fishes instead of farm fish for food consumption. Hence, it is recommended to use cheaper MT hormones to reduce cost and increase profit.

Further Questions
(1) Why the needs of two separate experiment groups done in two separate period (6 months interval)?
(2) Why both experiment groups have different diet and schedule feeding DPH?
(3) Is MT hormone really have 100% sex reversal impacts on Betta sp.? Can we consider that these fishes is 100% male or in between?
(4) What are the ecological side effects if these fishes were released in the wild?
(5) What are the possible legislative issues on using MT hormone?
(6) Does long exposure to MT hormone affects the mortality rates?

UMT MOOC: Ornamental Fish Culture - Topic 7: Seed Production - Factors to be Considered for Feeding - Species & Water Medium

Continue from previous post.

Besides the consideration of tank or pool size when rearing larvae, fry, or hatchling, the next item we should look into is feeding in the grow-up tank or pool. We will go through all these factors that will influence the feeding as listed below:

(1) Species
Before a fish egg becomes a fry, it have to go through different development stages of the body parts which consists of: (1) incubation period, (2) eye pigment, (3) mouth formation, (4) fins development, (5) digestion system. Different species have different body and egg sizes. Hence, feeding volume should take this into the consideration. For example, feeding an Arowana fry is totally different from Betta sp. fry as both species have different rate of growth development. An Arowana fry have bigger yolk-sac volume than a Betta sp. fry. Furthermore, ornamental fish values is based on its colours and patterns. Hence, diet that promotes good pigmentation in term of certain colours and patterns should be factored in as well.

(2) Water medium
This is something that we never thought off. Using "Green water" when feeding the fry after the yolk-sac have been used up. Basically "Green water" is just plain fresh with Chlorella sp. (micro-algae which have green pigment due to Chlorophyll) which can serve as initial and additional live food for fry and juvenile fish. This means Chlorella sp. cannot be used as the only feed and must combined with other live food sources like Rotifier sp., Artemia (Miona nauplii) for optimal growth (one of the research paper I've reviewed indicates this as well).  For normal rate of larval rearing, the density level should be 10×3-5 cells with water changes every 7 till 10 days (it was in the slides, not sure why so).

There are two ways to produce Chlorella sp., either naturally or in the lab. For the former method, just take and a bucket of water and put it under the natural sunlight or artificial fluorescent light (similar to green algae found in your aquarium tank). The aged water will slowly turn greenish and you will have your Chlorella sp. If you need pure Chlorella sp. without any contamination, you can culture it within a lab or facility as shown in the video below.

UMT MOOC: Ornamental Fish Culture - Topic 7: Seed Production - Factors Influencing Larval Rearing

Seed production, not referring to plant, is the production and hatchery management of offspring (larvae, fry, or fingerling) of the fish. Constant supply of seed production (from the wild or hatchery production) ensures optimal production output. Seed production goes through these four stages: (1) broodstock husbandry, (2) spawning, (3) larvae rearing and weaning, and (4) nursery and grow-out. Item (1) and (2) have been discussed in previous topics, hence, our focus will be on third phase in larvae rearing, feeding, and weaning.

After spawning, depending on the type of fish species, hatchling should be either separated or kept together with the broodstocks. This is the first crucial factor that influences the size of the grow-up tank. Next, is the stocking density or how many juveniles within the tank? pH which will affect the growth needs to be considered. The type of food and feeding practices will also impact the area needed for growing. Tank size will determines the water changing volume and frequency. Larger tank size needs less frequent water changes, more so with gentle filtration. Lastly, what kind of rearing media will be used like aquatic plants or substrates.

Discussion about tank size have reminded me about how to calculate the tank water volume as shown in the video below.

UMT MOOC: Ornamental Fish Culture - Topic 6: Ornamental Fish Breeding - Biotechnology Application

Continue from previous post.

Biotechnology application of genetic modification provides an alternative approach to selective breeding to combine different quality traits to increase production, improve aesthetic in term of colours and patterns, and enhance immunity against microbial infection. Biotechnology have been applied to control the sex of fishes (same sex populations), delay sexual maturity (delay aging and increase growth),  manage the reproduction cycle (gametogenesis and spawning), and genetic improvement (resistance to disease and stress).

While Genetically Modified fish (GM fish) for recreation purpose poses less risks than those for human consumption, regulation is still needed to ensure that there are no ecological concerns. However, GM fish which have larger growth and immunity, when introduced or escaped from fish farms to local native environment, may affect the native population. These fishes may end up as invasive species that causes negative effects.

One of the famous genetic modified ornamental fish is the Fluorescent Angelfish as shown in video below. Gimmicky as it seemed but still a subjective taste on this type of fish.

UMT MOOC: Ornamental Fish Culture - Topic 6: Ornamental Fish Breeding - Selective Breeding

We're going to review back on why ornamental fish is one of the growing sector in the aquaculture in MY. Since the last few decades, due to its geographical location, MY is one of the largest exporter of ornamental fish of local and exotic species. The main producers are from the state of Johore (83%), Perak (14%), and remaining states of Selangor, Malacca, Negeri Sembilan, and Pahang (3%). Note that statistic are from the slide. These ornamental fish farms are mostly family-owned and more than 95% of fishes are for exporting. Therefore, if you want good quality fishes, buy directly from fish farms (only if they are willing to sell to consumer directly) instead of aquarium shop.

Fish with good quality and different varieties boost production of ornamental fish and economic gain in the aquaculture industry. Selective breeding is one of the technique through many generation of breedings to obtain the desired traits (morphology and colourization). This technique is based on the genetic manipulation of genotype (genetic makeup) to obtain quality phenotype (characteristics or traits). In other words, phenotype is the physical expression of genotype. The figure (Tave, Douglas. (1995). Selective breeding programmes for medium-sized fish farms.) below illustrates the relationship of selective breeding.

For something else more visually appealing of genetic tree, see the screenshot of Gene tree of Nishikigoi from International Nishikigoi Promotion Centre (INPC). This is a good example of showing how selective breeding works by breeder to obtain certain traits, in this case, colours and patterns.

There are several selective breeding categories which are:

(1) In-breeding.
This type of breeding is used to mass produce a stable quality traits of fishes like colours, patterns, and fins. Breeding is done through genetically close broodstock.

(2) Line-breeding
Similar to in-breeding but only selected traits of the ancestor or ancestors were targeted in breeding. Selected good traits of flaws were identified either to retain or remove in next generation. Such breeding method is very time consuming as the breeder needs to select and keep track of good fish population to continue the next breeding generation. Betta sp. are mostly breed using this method.

(3) Out-cross breeding
Use this method when you want to diversify the genetic of the fishes to reduce possible genetic anomalies and diseases.

This Week I Learned 2019 - Week 05

Last week post or something else instead.

What else I've learned this week not within this post? Going through the fifth week of ornamental fish culture on fish breeding specifically in live bearer; eggs scatterer and eggs depositor; bubble­‐nest builder and mouth‐brooder. The review paper of this week is the study of effects of photoperiod on reproduction of Siamese fighting fish, Betta splendensThe week was concluded with a Perl module review of API::Google.

How do you pick the best traits to breed Betta sp? If you watch the video below, typically it will take a few generations (if you're lucky) to obtain the good traits to develop a good line. How long? Roughly 4 generations which is around 2 to three years, provided that these broodstock reach maturity around 6 months and you've a quality traits to choose from.

Which show has the best NBA commentary? The Jump, the weekday daily discussion and debate show in ESPN on NBA. Compare to other NBA commentary shows, Rachel Nichols did a wonderful job setting the pace and keep the discussion going on. Commentary was always to the point and the viewer can always learn something new from the guests. Tracy McGrady and Jackie MacMullan combo was great with healthy debate.

How to improve your Bash-fu? Do everything in pure Bash. The main issue with shell script or terminal is we have too many choices and too many legacy baggages. Does having a software monoculture solve the issue with decision fatigue? Yeah, in some ways. I've been using Zsh for a while and there are some quirks that need some times to adapt to.

How to be successful? (via HN) Always debatable and subjective as certain things can be measurable (financially) or not (relationship). Perhaps when you have enough and be content, "moderation in all things." Or being healthy in term of physically and mentally. Maybe you can do what ever you want to do? Why not just read the opposite, advices from people who are not successful instead? When comes to advices, be careful of the survival bias. Maybe there is no such thing as success, a donkey is successful as a donkey.

Maybe reading through what People Say Before They Die? (via HN) will let us reevaluate our definition of success. Nevertheless, this quote caught my attention when come to your own career. However, if you still love what you're doing after so many years, effectiveness is just the side effect.
"You don't want to be in a career where people who have been doing it for two years can be as effective as people who have been doing it for twenty—your rate of learning should always be high."

Perl Module(s) Of The Week - 2019 Week 05 - API::Google

While there are tons of web service API module in the CPAN, we will look into a rather simple and useful Perl's module, API::Google. As the name implies, this module allows us to connect to Google services via the API. There are not a lot of recent released modules written in non-Moo/Moose-way which allows us to look into using the Perl's plain old Object-oriented (OO) way.

Installation is quite straight forward. Usage wise, you will have to obtain the OAuth2 credential and generate the token file, `config.json` file.
$ cpanm API::Module

Let's move on the study and reading the code.

Firstly, I'm quite surprised that the default user agent or HTTP client module to make web request used is not the typical LWP::UserAgent but instead Mojo::UserAgent. There is nothing wrong with LWP::UserAgent, it's an established and works well. But if you need to make non-blocking I/O or Websocket web request, then Mojo::UserAgent is the preferred module, especially for modern web development. Moreover, the documentation is very comprehensive and helpful.

Next, since the author did not use Moo or Moose, therefor a helper subroutine was created to access the object attribute or the hash value.
sub ua {

Looking through the code, I'm constantly reminded that I forget how to join two hashes in Perl. Basically you have to understand the difference between a list and an array or a hash (an associative array) and numerous examples to illustrate that.
  $payload = { payload => $payload };
  %$params = (%$params, %$payload);

Research Paper to Read: (2012) Effects of photoperiod on reproduction of Siamese fighting fish Betta splendens

Source: Research Gate.

(1) Photoperiod of ratio of 16h light : 8h darkness (spring) and 12h light : 12h darkness (summer) yield optimum reproduction and growth.

Why this paper?
As we have limited space, all our Betta sp. breeding projects were done within an indoor environment. For observation and appreciation purpose, the breeding and growing tanks were equipped with typical T5 LED lights. In the past, we kept the light on for 24 hours because we want to maintain the growth of the aquatic plants. Little we realized, it just dawned to us that animals and plants should follow the natural photoperiods just like in the wild. This begs the question, what is the optimum photoperiods when breeding and keeping Betta sp. Hence, the relevant of reading and understanding this paper.

Material and methods
This research includes 30 matured pairs or 60 fishes of super delta strain. On average, the weight and length of male is 1.92±0.28g and 3.84±0.13cm and female is females 3.72±0.18 cm and 1.72±0.23 g. (Note that the female size is roughly the same as male and typically for breeding, the female size should be smaller). These fishes were hosted within a 2 litres jar.

The design of the experiments for 5 treatments and 6 replicates for each pair of fishes as follows:
(1) 8L:16D
(2) 12L:12D
(3) 16L:8D
(4) 20L:4D
(5) 24L:0D

The breeding conditions for the next 150 days or 5 months are:
(1) Fluorescent light of 60 cm with 200 watt around 500-lux controlled by analogue timer.
(2) Total water changes every two days.
(3) Feeding done twice daily using diet of 45% crude protein and 12% fat in light photoperiod.
(4) Water treatment conditions are: pH 6.9±0.3, dissolved oxygen >5.0 mg L,-1 and ammonia <0.1 mg. L-1. Water parameters are monitored weekly.

The graphs below shows that photoperiod of 16L:8D and 12L:12D shows the significant differences in frequency of spawn, eggs volumes, and fecundity. 24L:0D yields the worst performance of all the measurements.

Does long exposure to light stresses the fishes which affects the production of the spawn size? The result indicates that this may be the main reason. Long light exposure is not natural and does not simulate a natural photoperiod (12L:12D) in outdoor or in the wild. Therefore, extra care needed to control the photoperiod as close as possible following the nature.

Further Questions
(1) Can we obtain similar result if the design and experiment was done in the outdoor environment where the photoperiod was controlled by exposure to sunlight?
(2) What kind of exposure to sunlight is suitable enough? The general consensus among breeder is that you cannot expose the fishes to direct sunlight but within the shaded area.