Showing posts with label sleep. Show all posts
Showing posts with label sleep. Show all posts

This Week I Learned 2019 - Week 01

Happy new year 2019! Another year, another new TWIL post.

For those who miss out the previous post of the series, check out the last TWIL post of previous year or the whole year review. As usual, go through some legacy TWIL posts as well.

What else I learned this week in separate posts? First, ornamental fish culture in terms of overview, industry, popular tropical fish species through our local online MOOC. Second, the literature review of the paper on the effect of salinity and diet on Betta fish growth and survival. And lastly, the start of Perl Module(s) of the Week (plMOTW) series which we review the Data::Money Perl's module.

What is a mental model? According to Wikipedia, mental model "is an explanation of someone's thought process about how something works in the real world." In other words, a mental model is a systematic thought process that helps you to make better decisions. There are several list of mental model catalogues, Gabriel Weinberg's list (for Anki as well), Kent Beck's list, Slava Akhmechet's list, and Farnam Street's list. Similarly, there are cognitive tricks or  "brain hacks" that you can use on daily basis to manage your life. Contrary, the discussion on these "brain hack" is more philosophical rather than systematic to approach any issues. Nevertheless, good mental exercises for anyone, especially those on writing which I should adhere strictly. This reminded me of a research on when is the best time to write.

What is the morning writing effect? (via HN) Discussion and research on what is the best optimum hours to write. Not surprising, morning is the preferable schedule but because for those who were interviewed, they worked as a full time writer or writing is a major part of their works. Hence starting to work or write in the morning is obviously answer. Discussion at Reddit seemed to have different opinions. For those who have a day job and write casually, night time is the most suitable hours, where everything have slow and quiet down. The discussion on best hours to write relates to our sleep hours and quality.

What is circadian rhythms? It's our internal biological clock responses corresponding to external environment factors like light, temperature, and others. Your health and productivity will be affected if there are any disturbances in your circadian rhythm, for examples, jet lag or blue LEDs light (mobile phone or PC) which affects our sleep (secretion of melatonin hormone which regulates circadian rhythms) leading to drowsiness. To achieve good health and improve our quality of life, not only we need to eat well and exercise adequately, we also need to sleep satisfactory. Does fishes have circadian rhythms? Not really but there was a research suggesting that fishes may have.

This Week I Learned 2018 - Week 45

Last week post or something else from the old archive.

手写的温度还在吗?放慢生活节奏,回归朴实。

What would happened to Red Hat after IBM have acquired it? (via HN) I'm not sure Red Hat will be still Red Hat (you can work your own FOSS stuff even if it detriment to the company) since IBM is well-known for aggressive creating and protecting its patents portfolio. FOSS is not its core business values, it's just another department. But question remains, why purchased Red Hat? They need to control and be a major player as a cloud vendor compare to Amazon, Microsoft, and Google. Red Hat, with its full FOSS stack, libraries, or tools, provides a platform for them.

Build your own professional-grade audio amp on the sort of cheap (via HN), worth it? Not really, unless you're really into learning (great things to do with your kids) and assembly the whole thing. Most of the DIY kits are way too pricey (Cmoy is the exception) and not worth the effort of getting the whole thing from Ali Express. Again, it's not the audio equipment itself, you still needs to manage the audio room or environment with acoustic panels. Be warned, stop when you can and don't buy into the whole system, cables, furniture, panels, and misc. Unless you can hear the differences (doubt so in my case), you're making money from audio, or friscking rich, don't join the audiophile madness.

Why does privacy matter or I'm not motivated enough to take privacy seriously? Well, if you want to prevent something like Social Credit System from the big brother.

Why kick timing is important in swimming? I intrigued by so many coaches overlook the kick timing aspect in the swimming drill. It seemed the focus was on building the stamina through drill rather than the technique and style. With the right kick timing that syncs with hand actions (catch, pull, exit, and recovery). Sun Yang, is a well-known swimmer which utilizes all three kick timing techniques depends on his breathing patterns as shown in his 1500m freestyle world record in 2012 Olympics race. 2-beat or 4-beat kick for the first 1400m and 6-beat kick for the last 100m.

So You Wanna Be a Chef? (via HN) Why the world need more honesty so young people can calibrate their own expectation in their career of choice? If not, we're setting them up for unreasonable failed expectation and brutal honestly about life, especially when come to financial (high student debt) and emotional reality (unreciprocate passion) . While having passion is good for your career of choice, but this does not means you can work for free or being undercharged.

Was Hindu god, Ganesha created to curb Buddhism? Debatable view but one thing for sure, Buddhism influence was limited by Adi Shankara in the 8th century.

When should you go to bed? The right question to ask is what time you want to wake up instead.

What is your books reading strategy? This approach is probably the most comprehensive I've seen so far.


This Week I Learned 2018 - Week 42

Last week post or some random stuff from the past.

Can you still be a developer in your 60s? Yes, it's still possible (look at Carl Sassenrath) but looking at the poster qualifications, he is over qualified and can be very intimidating to someone. The root cause is still "cultural fit' and ageism. Perhaps the poster can join the FOSS movement and contribute to it instead? Looking at the positive side, if you can survive until 60s and is fit to work, consider yourself very lucky than most people around that age. Nonetheless, just live below your means, be healthy, and enjoy what you're doing.

Why good sleep is crucial for learning? (via HN) More importantly, insufficient sleep can lead to numerous health issues and diminish your enjoyment of life. While you can't feel the impact when you're young, only at certain age, you will sense something have messed up somehow somewhere in your body. While it varies by person, but you needs at least 8.5 hours of sleep. If you're working, minus your working hours and travel times, with 8 hours of sleep, you're left with 6 hours to do your own errands. What can we do? Lifestyle changes and stick to a constant schedule, every day, every single damn day.

Is semicolon necessary in TypeScript? No but it's good to have it for consistent results, especially for new comer and coding convention. Even this is recommended by Ecma TC39. Off course with much debates and interesting point of view. I believe in the camp of better safe than sorry, just use semicolon;

What should a front end developer knows? Here are some common topics you will encounter eventually.
  1. ForEach vs. Map
  2. Promises vs. Generators
  3. What are the states in Promises?
  4. How many ways to lazy loading an image?
  5. What are the differences between Local Storage, Session Storage, and Cookies?
  6. What is event delegation in JavaScript?
  7. What is Cross-Origin Resource Sharing (CORS)?
What is 30 seconds of code? A bunch of JavaScript code snippets that demonstrates different features of this programming language.

Why we need `EXPORT` and `EXPORT_OK` in Perl? Well, we use the later if we need to let the library consumer or caller to explicitly import the module's symbols like subroutines, variables, constants, and so forth.

This Week I Learned - 2017 Week 24

Last week post or from the archive.

Golden State Warrior won the 2017 NBA title. I've been following NBA these past few years back and it dawned to me that NBA as with other sports these days, is actually a sport entertainment, similar to WWE. The champion of the NBA, can be determined (ahem rigged) by how many shoes the athlete can sell or by the superstar (Kevin Durant in this case) having of the biggest impact on the overall market of the sport. Relevant comment that shared my sentiment, emphasis and spacing added.
Definitely. It is an entertainment business after all, and players are their own brand. Every single thing you do has an effect on your image; it has to be exhausting.
Some players feel so much more natural as superstars than others. I know some people don't like him, but Blake Griffin (for instance) never seems "fake" to me even when he does things to get himself exposure. He's very likable in interviews (one of the best Pardon My Take guests) and that helps push his brand.
Some players just feel so cold and calculated, even when they are doing things to make them seem likable. A lot of people probably will disagree and that's fine, but LeBron to me comes off as extremely manufactured. By no means do I think he's not a good person at heart, but he is VERY self-aware of what he does at all times. He has to be, so I can't blame him. Overall it's a good thing -- he doesn't have any blemishes on his record and he's a great role model for the kids -- but it has always slightly rubbed me the wrong way and I could never find myself rooting for him as a fan. Very well could be my Celtics bias though, who knows.

Struggle with sleeping? (via HN) To keep yourself healthy, we must have consistent sleep cycle of 7 to 8 hours as well as bedtime and wake-up time. Anything less than 6 hours will eventually lead to health problem. Unfortunately, inadequate sleep is a common thing these days due to heave mobile phone usage which caused light pollution and messed up the melatonin hormone.

Social good through programming? Somehow, some of us will go through the period of soul searching whether our development work contributes to society or make a difference? I asked the same question every year and yet, still haven't have a good answer. Maybe the 80000 hours is a good start?

It has been a while since I last really look into LaTeX. Some of the item I've learned along this week. First, how do we make sure that in bibliography, the font stay the same.

This Week I Learned - 2017 Week 10

Last week post or just follow the whole series.

Got my result today. It seems I've officially "crossed" the borderlines stage. I'm still contemplating on the next step but drastic life style changes is inevitable (more in item #5). If left untreated, it can grow into bigger problems, not only for yourself, but for your loved one as well.

#1 You May Want to Marry My Husband (via HN). Beautifully written. We need to be constantly reminded of the fragility of life especially contemplating one's mortality. The lack of awareness will bite you and your loved ones somehow in the future. Over 30-something and still bogged down by random trivialities in life? Nothing but continual reflection on your life priorities (often misplaced) and gratefulness helps to make peace with current and past self. Regrets? Yeah, plenty. Who doesn't? But not to a point where you will lament later in life that you should, would, or could. Wish you've taken a different path? Nah. I'm good. Yes, there is still room for improvement. Looking forward to that.

Further reading. The 10 Best Modern Love Columns Ever.

#2 On Perl. Interesting thing learned. How do you clone a hash and at the same time, reassign new values to some of the existing keys? Simple and yet so effective. To explain this,  `%$foo` expands expands the hash into a key-value pair and the curly braces (anonymous hash constructor) will create a new hash reference. Output is from Devel::REPL module, the modern Perl interactive shell.
$ my $foo = {a => 1, b => 2, c => 3};
\ {
    a   1,
    b   2,
    c   3
}
$ my $bar = {%$foo, a => 4, b => 5}
\ {
    a   4,
    b   5,
    c   3
}

Instead of just doing this.
$ my $foo = {a => 1, b => 2, c => 3};
\ {
    a   1,
    b   2,
    c   3
}
$ my $bar = {%$foo};               
\ {
    a   1,
    b   2,
    c   3
}
$ $bar->{a} = 4;
$ $bar->{b} = 5;
$ $bar
\ {
    a   4,
    b   5,
    c   3
}

#3 Carton. Bundler for Perl. In other words, module dependency manager for Perl. Is Perl a lost cause that only a few diehard users still using and maintaining it? Seems likely to me.

#4 Ship daily. That probably the way to get your side project moving and don't feels like you're not completing anything. Can't do it? Maybe you're setting the bar too high and setting yourself up to failure. Of course, some are created to be thrown away. While I don't totally agree on the needs to to finish all your side projects, but when comes to actual paid work, we need rethink our role. Instead of a programmer, think yourself as a problem solver instead. A tiny shift of that mentality will get you closer to the deliverable.

#5 Getting older? Getting weaker? Maybe you should check your weight and measure your Body mass index (BMI)? If so, you should to readjust your diet. Stop eating like you're in college days. More (not just) portions of fruits and vegetables? Furthermore, be informed and mindful of what you put inside your body. Of course, exercise is needed as well. However, exercise alone does not lose weight. Joao Venture have experienced weight lost by reducing most of his sugar intake and maintaining 3 km daily walks per day. Using this calculator, 3 km is 3937 steps, rounded to 4000 steps. Those who works as software developer with sedentary life style, it's a struggle to reach 4000 on daily basis.

Looking through my steps count below, both my mean and median are roughly around 3000 to 4000 range. This fulfill at least one of the criteria. The next step is to adjust my diet by reducing my sugar intake. Interestingly, since the beginning of 2017, I only manage to hit 10000 steps only four times!


On a related note, sleep is also a crucial factor as well. What Kind of Sleeper Are You?

#6 The Unofficial MySQL 8.0 Optimizer Guide. The section on profiling is interesting and I really don't have time to go through each item on databases I'm working one. Definitely going to improve any legacy and messy databases.

#7 When comes to programming, some of us still missing the point that we're a problem solver first and a programmer second. Follow a process and the convention. Prioritize. Keep the solution simple (yes it maybe boring) and don't try to do things the fancy way unless really, really necessary.

This Week I Learned - 2017 Week 05

Last week post or whole series.

Always an interesting CNY holidays. The flood was not as worse as it seems. The weather is good and the air, seems cleaner. I've managed to get some good rest and deep sleep (more on this in #4).

#1 Canonical have launch Ubuntu tutorials, a step-by-step guideline for setting up development or devops related activities. I was surprise that they started the tutorial using Intel Joule 570x (their answer to IoT?) as the reference hardware. With a price tag of USD 369, I failed to see how this development kit is going to gain any traction when compare to Raspberry Pi. Maybe the target audience is not the Maker community but the industry?

#2 I've bought TI MSP430 development kit to learn more about embedded programming. So far,, the only thing I learned is microcontroller or MCU is "computer on a chip" or also known as System on a chip (SoC). Compare to the Arduino, Raspberry Pi, or Beageboard, it's way more low-level and cheaper. Once I've done with this, the next SoC that I will get is the ESP32, the successor to ever popular ESP8266. For the time being, the next step is introductory write-up on the hardware, setup the development board, testing the serial communication, go through the tutorials, and follow these four things to do with new microcontrollers.

I've noticed that there is this M430F1612 chip (square shape) on the launchpad. Feature-wise, it's similar to MSP430G2553 (rectangular shape) but was used for debugging purpose via JTAG from our computer.

I was thinking on getting more MSP430G2553 and stumbled upon this site, FindChip, which can search through all the popular electronic parts resellers. Note that the search links does contains affiliate links. But is a good way to find available stock and prices in one place.

#3 Are we over-dramatize our life or why people need drama in their life? Sometimes, no news is good news. If you ever complain about boring and simple life, you've been trying to mold your life according to a fairy tale. Follow your dream is such a clichéd pieces of advice. Too abstract and too vague. Be more specific, for example, stay healthy by exercising for 30 minutes on 5 days a week.

#4 Interesting idea on restricting exposure of lights can affect your sleep patterns. I've been living in the city for many years and my exposure and computing usage (you brain is kept active and Melatonin production is delayed) have somehow affecting my sleep cycle and thus my health. Maybe I should switch to something like Philips Hue Bulb? Need to readjust my time and remember, bedroom is for sleeping. Is okay to have TV in the room, just for the sake of white noise. Maybe because there is a healthier life without Internet. Remember, there is way to get you hook on an app or site. Off course, there is antidote to that as well.

#5 "Short answer, It doesn't. Long answer, It does not." Regardless the context of the discussion, the comment is both humourous and fscking brilliant. There is a similar saying as well. "To make it short, is a long story". Maybe we should invest our time in writing? While we on writing, be careful when you use the pharase "duly noted". It usually means "heard and ignored" in a sarcastic way or if you add an extran 'l', it becomes "dully" noted, which means you "barely" acknolwdge. To prevent unnecessary misunderstanding, replace it with "Got it, thanks!" (informal) or "Noted, and thanks!" (format).

This Week I Learned - 2016 Week 09

Last week post.

#1 Goals vs. Systems. Before pursuing any goals, make sure you're making an informed and educated decision. The strategy is to use knowledge instead of willpower to pursuit your goals. For example, as not all carbohydrate foods are equal, you can lose weight easier if you pick the right food choice by knowing its Glycemic Index, which have an effect on a person's blood sugar.

#2 Raspberry Pi 3 is out. (HN discussion) The built-in onboard Wifi and Bluetooth as well as 64 bits support are welcoming feature. Unfortunately, local Element14 still awaiting stock. Heck, I can't even procure a Pi Zero till today. Not sure if the specs boost is worth the upgrade, however, some review claimed this release it's a worthy desktop replacement. If you never own a Pi before and itchy get on the single-board computer bandwagon, then you should get a Pi 3. As for me, will skip this as I'm saving money to get a SSD drive which definitely help with my testing of containers.

#3 Git rebase and the golden rule explained. Detailed explanation on Git rebase. If you want to stick to the Subversion's model of a single linear tree, then Git rebasing is the preferred choice. The only caveat is you may need to force-push if you rebase already commits that have been shared.

#4 Prevalence of Healthy Sleep Duration among Adults — United States. (Reddit discussion) Seriously, sleeping less than 7 hours per day may increase your chances of mortality. Rest people, rest.

#5 Using Make with Django. Lots of people (especially those from non-Unix background) overlook or underestimate the useful of GNU Make to manage tasks with your software project.

#6 How do you remember what you read? It will take times to internalised or digest the information but memorization is the initial step. If you can't retain the information within your brain, you can't analyze it. Retention is useful to verify your understanding if you just follow the these steps.
  1. Read a paragraph.
  2. Close the book.
  3. Write down what you remember.
  4. Re-read the paragraph and check.

This Week I Learned - 2016 Week 03

In case you miss out, last week post.

#1 The Happiness Code. Using rationality to overcome bad mental habits. For programmer, is like identifying the bottleneck of a legacy system and then refactor and optimize it. In other words, hack yourself. I agree with one of the comment, seems like a rediscovery of Cognitive Behavioural Theraphy (CBT) to me.

#2 The Akrasia Effect: Why We Don’t Follow Through on What We Set Out to Do. (HN discussion) Struggle with self-control and making bad decisions against your best interests while knowing it? You're in Akrasia state. Procrastination is an exemplar of such self-denial mental state. There is a step-by-step visual guide on beating procrastination through identifying your motivation. I firmly believe that motivation is related to willpower as written by Roy Baumeister in his book, Willpower: Rediscovering the Greatest Human Strength. Strong willpower correlates with keeping yourself healthy though enough sleep, adequate exercise, and stress management.

#3 Upgrade to Ansible 2.0. Already encountered one showstopper bug, fixed but does not seems release out yet. Also, more explicit deprecation warning of using 'sudo' instead of 'become' as privilege escalation method. Lots of changes needed for my dotfiles using Ansible.

#4 Can't boot into graphical login by default through Systemd and Lightdm seems corrupted. It seems I've messed up my Ubuntu installation after I nuked the Gnome 3 and reverted back to Unity desktop. I'm too accustom to SysV init system and it going to take a while for me to get acquitted with Systemd. Need to remember the runlevels used as runlevel 1 (rescue.target), runlevel 3 (multi-user.target), and runlevel 5 (graphical.target).

#5 ERROR 1524 (HY000): Plugin 'unix_socket' is not loaded. Weird behaviour when I downgrade from Maria 10.0 to MySQL 5.6, MySQL client login as root won't work. When come to reading multi-pages forum post, never try the first solution purposed. Always start reading from the last page and moving backward. It seems this was due to leftover configuration of MariaDB where authentication using UNIX socket is not enabled by default. Purged both MariaDB and MySQL and installed PerconaDB instead. However, even PerconaDB has its own rather idiotic issue with AppArmor.

#6 The sound of the dialup, pictured. Bring back all those nostalgia memory of connecting to the Internet using your dial-up modem. I still remember the agony and disappointment when the download failed at 99% and can't be resumed. So close yet so far.

#7 We all should get a FitBit or something equivalent. Our body always trying to tell us something but we tend to ignore it. Use this as a monitoring tool to 'listen'. It's alarming that the lack of quality sleep can have such damaging effects to our health and shorten our lifespan.

#8 What 20 years difference makes. With passion, fueled by persistency, and self-exploration and guidance, one can live up to his/her childhood dream. The 10 thousand hours rule at work here.

#9 Working with CSVs on the Command Line. Using common Unix utilities (cat, grep, awk, and the like) to manipulate CSV file. Similar post that describe the usage but grouped by intention. There is also more refine CSV processing console tools like csvtool, csvfiltercsvkit (the equivalent GUI version is OpenRefine), txt-sushi, and tabulator.

#10 Have a Panda's Series or DataFrame? You can sort both data structures either by index, using sort_index() or by values, using sort() or sort_values().