This Week I Learned 2018 - Week 05

Last week post or something from the archive.

New week and we're embracing the second month of 2018. The summer (for Southern Hemisphere, summer starts from December 1 till February 28 or 29) wind was blowing gently indicating the near of Chinese New Year. 活了大半辈子,原来南半球的季节正好跟北半球相反,真的是受教了!俗语说,“一年之计在于春,一日之计在于晨”, 自己要好好检讨及规划!

Going through my daily steps count, less activity this week due to sickness. Icy cold drinks during midnight and middle-age guy don't was not a good combination. But luckily we have long vacation, good to catch up with my needed rest and recovery. Comparison of total steps walked as illustrated below. (Yes I know the missing legend) Target for next week is to average out the steps till 5000 steps and above.


Dropsy and the whole body is pineconing? Nothing much we can do besides except humanely euthanize the fish. We lost three this week and unexpectedly the Blue Mable is going down also. The typical treatment is daily water changes combines with aquarium salt, Methylene blue, or Malachite green. We're not sure but I suspicious was due to overfeeding which leads to stress and constipation as well as infection.

When visited enough Aquarium shops, you will learn a thing or two. First, antibiotic powder (yellowish colour, suspect the main ingredient is Sodium Nifurstyrenate) usage was quite common especially expensive tropical fish like Discus (not a fan and seriously, a moving water pancake?!). Second, fish sellers in Market Road packed their fishes in plastic bags treated green water (suspect is Malachite green) and unpack it again in plastic square tank for selling each water in plain water. You can achieve profit if you can sustain the longevity of the fishes until they are sold to the customer.

More conversations breeders. It seems that female Bettas are far more expensive than male and fellow breeders don't want to sell their precious female Bettas to retain their quality breed of lines. Only for those who have financial gains from doing this. I wish more breeders should focus partially on the locally Malaysian Bettas. There is one breeder and I wish him all the best. Wild Bettas found locally may not be that colourful but it's good to breed and increase the population.

You know the play was so good that even the opposite bench players applauded it. This reminded me of Kobe Bryant's baseline reverse dunks. Along with Giannis AntetokounmpoBen Simmons is another NBA player to watch out for in the coming few years. Only time will tell.

Too many blockchain wannabe tech startups in Malaysia. Enough said. The never ending of startups chasing the next hype cycle.

How do you unstaged changes in Git? There are cases where merging or rebasing kind of messed up and you're left with a list of modified files.
$ git stash save --keep-index --include-untracked

Meanwhile, you can clean up your local working repository in Git through interactive mode or Git clean interactive.
$ git clean -di

The list reduction functions in List::Util. Some good examples:
$foo = reduce { $a > $b ? $a : $b } 1..10       # max
$foo = reduce { $a gt $b ? $a : $b } 'A'..'Z'   # maxstr
$foo = reduce { $a < $b ? $a : $b } 1..10       # min
$foo = reduce { $a lt $b ? $a : $b } 'aa'..'zz' # minstr
$foo = reduce { $a + $b } 1 .. 10               # sum
$foo = reduce { $a . $b } @bar                  # concat

More effed up stuff in our beloved MySQL. This time, "SQL Error (1451): Cannot delete or update a parent row: a foreign key constraint fails ....". To quote from the documentation (emphasis added),
If ON UPDATE CASCADE or ON UPDATE SET NULL recurses to update the same table it has previously updated during the cascade, it acts like RESTRICT. This means that you cannot use self-referential ON UPDATE CASCADE or ON UPDATE SET NULL operations. This is to prevent infinite loops resulting from cascaded updates. A self-referential ON DELETE SET NULL, on the other hand, is possible, as is a self-referential ON DELETE CASCADE. Cascading operations may not be nested more than 15 levels deep.

In other words, self-referenced foreign key(s) or recursive deletes doesn't work in MySQL (it WORKS in a PROPER database management system like PostgreSQL). You have to create another new table to link the relationship, something like many-to-many data model. If you needs deep nested hierarchy data structure, use Closure Table.

No comments:

Post a Comment