This Week I Learned 2018 - Week 38

You may like to read archived posts or something from last week?

What happened if your Perl's structure exceeded maximum nested level? You will get this error message of "json text or perl structure exceeds maximum nesting level (max_depth set too low?." I was surprised that certain structure may reach over the default level of 512 (a sign for you to redesign your data structure). Changing the 'max_length' threshold to unlimited did not solve the problem. Likewise, switching to the faster JSON::XS. Looking through the data structure did not indicate any circular loops? Due to time constraints, in the end, I just switched from text to binary serialization through Sereal package (benchmark wise is better than others).

What happened when you exceed the maximum daily exposure to Bisphenol A (BPA)? (via Reddit) So many things that can mess up your immune and nervous system. You should avoid drinking from soda can, plastic bottle number 3, 6, or 7, plastic cups, and paper receipts (those using heat). One thing for sure, avoid drinking from any plastic bottles exposed to the sun (especially left in the car). Temperatures shift may leach this chemical into the drinking water. What worse is there is so little studies on the side effect of this chemical, we may only figure out the harm it causes in coming 30 till 50 years. For now, just use nothing but stainless steel (18-8 food grade) bottle (e.g. Klean Kanteen) or glass jar. Also, do no microwave food in plastic container or wash them in dish washer.

Worse still, there are more of these harmful chemicals. The American Academy of Pediatrics have written a policy on identifying and preventing these chemicals from entering our body. If the paper is too long, read the summarized version by Harvard Health.

How do you slow down a gif image? Use GIMP and GAP libraries and adjust the delay between frames.

Why Git was more popular than Mercurial? (via HN) The battle of DVCS have long won by Git (largely due to GitHub and GNU/Linux) even though Mercurial provides a better usage experiences and documentation, based on my biased preference opinion. I'm quite surprised that a bottleneck performance issue (as it was written in Python?) in large repository is still not resolved after all this while even though performance-wise, both are quite the same (old benchmark in 2011, things have surely changed). What's next for DVCS? Pijul, written a Rust and inspired by Darc. But I doubt it can dethrone the popularity of Git in coming future.


This Week I Learned 2018 - Week 37

Something from the archive or last week post.

If you want to do a YouTube video on tutorial on photography, how should you do it? So far, nothing can top this video. Well choreographed, interesting topic, and relevant demonstration on applying Morandi (a famous 20th century Italian still life painter) colour style in your photography. What impressed me was the tutorial was not focusing on the post-processing but instead stressed on the importance on scene selection and model's clothing choices. Sometimes, you just simply just post process (photoshop) everything.


How easy to setup development workstation in Ubuntu these days? In seconds, if you exclude the time needed to download all the packages. I've been looking into TypeScript, React, and VS Code these days and it's the right time to setup a new development environment through Ubuntu's Snap.
$ sudo snap install node --channel=10/stable --classic
$ sudo snap install vscode --classic
$ sudo snap install --edge typescript --classic

What is the best approach to read a book? Reading with a pencil  (via HN) or also known as marginalia. The idea is simple, you're basically collaborating with the book author by scribbling down your questions, thoughts, and ideas in the free margin space (limited for some books). In other words, purposeful annotations while reading or active reading (suitable for research papers but not some book genres where you read for leisure).  Also, such reading method is not applicable for ebook reader (yes, reMarkable exists but the steep price does not justify it), which still does not provides a good paper experience for doodling.

Is JQuery dead? Not yet but soon, probably within these few years. Reading through the blog post by Github Engineering on removing JQuery from Github frontend, little have I realized that the frontend (JavaScript) have matured enough to deprecate JQuery. What does this indicates? The web have move beyond the dreadful old incompatible Internet Explorer versions, which the main reason of the existence of JQuery project. What next? TypeScript becomes ES Next (maybe?) and the standardization and popularity of custome web components. One thing for sure, old things will be rediscovered, reimplemented, and rehyped again and again, as usual. Same old same old. (ง'̀-'́)ง

How to teach yourself hard things? (via HN) Alternatively, the Richard Hamming tackled this in his The Art of Doing Science and Engineering: Learning to Learn course and Edward Kmett in his Stop Treading Water: Learning to Learn lecture. Furthermore, comments in HN provides us with a few good gems in area of exercising, programming, or physics. However, this is only applicable for those who are discipline, having intrinsic motivationgood quality sleep, and don't get burn out (you will eventually). In short, learning will come naturally if you interested in tackling the problem itself. Time is limited, pick your battle wisely.

Why Microsoft Word is a better writing tool than LaTeX? Reading through the post by Thorsten Bell on the tools he used to write his book (via HN) reaffirms the mistake I've made when typesetting documents, books, and thesis using LaTeX, ConTeXt, and pandoc. Fancy tools may distract you from doing what matter most, writing itself. If the writing is difficult, we can be sidetracked through fiddling with these tools under the pretense of productive procrastination.That's why, a slow and noisy typewriter (surprise that it's still expensive these days) was such an efficient tool for writing. You can't do nothing else but type or write. Which is why so many distraction-free editors exists in these Interweb days.

Why I still love PostgreSQL after all these years? 100-plus of custome data types (even table and view can be as well) supported in the database itself (via HN). Programming languages can change numerous times for a long maintained systems. Not sure for the database system. Some developers prefer strongly typed programming languages, but they seldom look into database systems with custome data types support.

How do we test web service API through console or command line? (via HN) There are so many choices like Strest, Newman (console version of Postman), shakedown (Bash script), karateDSL, UnRAVL, Artillery, and Tavern (Python-based). Coming from console background, I have preference for shakedown and Tavern due to its simplicity.

To rent or buy a house? HN user isostatic gave a practical answer to this question. Buy if you're investing, having kids, or don't want to be forced to move. Rent if you don't want to maintenance the house.

What is the symptom of midlife crisis in a good way? Extreme athleticism. (via HN) One key point I agree with the writer is that we're preparing for the coming old ages as highlighted in this quote. Interesting days ahead.
...... extreme fitness is less about being young again and more about building yourself up for the years ahead. In other words, getting better at getting older.

This Week I Learned 2018 - Week 36

Old posts from archive or something from last week.

Why SGI's Onyx was such an attractive and desire visual battle station during the 90's? (via HN) Yes, the size was overwhelming and looks like a mini fridge (or an espresso machine) but its graphical processing was the best during that period. Looking back through their history, all SGI's machines were always powerful but damn expensive. Sadly they should have created a consumer version instead of focusing on high end market which leads to its slow demise.


Is Nikon Z6/Z7 worth it? No, pricing and features (compare to Sony equivalents) and limited lens available making it a less suitable choice. Unless you're professional or prosumer photographer who prefers Nikon's ergonomic body and wants to reuse all your existing Nikon lens collection (however, autofocus only works with AF-S or AF-P lens). Otherwise, for normal hobbyist, maybe it's wise to wait for budget or entry level models like Z3/Z4/Z5 or something from Canon to release it's own mirrorless system to join the competition. Maybe you should just stick with your mobile camera, you don't need the latest greatest camera anyway.

Do you have any good advice on writing? Write fast, throw away everything, and take the conclusion as introduction.
"My English teacher used to say “when you have to write an essay, write a first version. Then throw away everything but your conclusion and use that as the introduction of your real essay"
What is the one thing you should be aware when using React Router? Check the version of the installed package first. There were some differences on how the router rules work between version 4 onward and before version 3. I was stuck with a router problem for a while before I realized that I'm looking at legacy documentation.

How to sort NULL column at the end of the queried result in SQL? The simple answer (which I always forgot) is shown below. This is compatible with both PostgreSQL and MySQL.
ORDER BY date IS NULL, date DESC

Why we need to use generics in TypeScript instead of `any` type? To quote from the official documentation (emphasis added).
While using any is certainly generic in that it will cause the function to accept any and all types for the type of arg, we actually are losing the information about what that type was when the function returns. If we passed in a number, the only information we have is that any type could be returned.

Instead, we need a way of capturing the type of the argument in such a way that we can also use it to denote what is being returned. Here, we will use a type variable, a special kind of variable that works on types rather than values.
In short, we want to know the return type of a generic function.

This Week I Learned 2018 - Week 35

The previous post or something else from the archive.

How do you increase your monitor resolution if the default resolution was not sufficiently enough? As I was reorganizing my battle station, the old monitor resolution was off due to changes in the display adapter name. These steps have to be done as the display driver will not set to the correct resolution due to old VGA adapter.
$ cvt 1280 1024 60
# 1280x1024 59.89 Hz (CVT 1.31M4) hsync: 63.67 kHz; pclk: 109.00 MHz
Modeline "1280x1024_60.00"  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync
$ xrandr --newmode "1280x1024_60.00"  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync
$ xrandr --addmode VGA-1 1280x1024_60.00
$ xrandr --output VGA-1 --mode 1280x1024_60.00

While the new UI in Gnome's display settings have been polished and updated. However, it still can't detect or add the correct solution for each display adapter. Is there a way to better manage and automate this process? Yes, this is possible through autorandr and pool-xrandr.


How does USB upstream and downstream ports works in Dell monitors? There are two types of connection. First, the type B connector which connects to your PC to get its power source to your USB hub. Second, the remaining type A ports for you to use for other devices. (See screenshot captured below, credit to Psycogeek). Now where is that USB Type B to Type A cable?


What happened when you start another culture in a remote island? Interesting documentary on Cocos (Keeling) Islands.