Showing posts with label health. Show all posts
Showing posts with label health. Show all posts

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 22

Last week's post or the whole series.

Slow week. Lots of pending stuff needs to be cleared off.

One of the best thing in learning, always be the most stupid person in a class and ask a lot of questions. You never know you will learn something new or relearn something old. Or it may reaffirm some beliefs you always held truly to yourself.

#1 If you need to display CJK characters and emojis in MySQL, use 'utf8mb4_unicode_520_ci'. Historically (another good write-up), MySQL support 'utf8mb3', later changed to 'utfmb4', and changed again to 'utf8mb4_unicode_520_ci' (since MySQL 5.7), and lastly 'utf8mb4_0900_ai_ci' (since MySQL 8.0). Sometimes you wonder why you still stuck with the curse of MySQL where there are better solution out there.

`utf8mb4` is the superset of `utf8`. Meaning that the former also includes the later character set.

To show the supported character set in your MySQL installation.

First check your MySQL version.
mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+-------------------------+
| Variable_name           | Value                   |
+-------------------------+-------------------------+
| innodb_version          | 5.7.18                  |
| protocol_version        | 10                      |
| slave_type_conversions  |                         |
| tls_version             | TLSv1,TLSv1.1           |
| version                 | 5.7.18-0ubuntu0.17.04.1 |
| version_comment         | (Ubuntu)                |
| version_compile_machine | x86_64                  |
| version_compile_os      | Linux                   |
+-------------------------+-------------------------+
8 rows in set (0.33 sec)

Next list our the available character sets for `utf8mb4`.
mysql> SHOW COLLATION WHERE Charset = 'utf8mb4';
+------------------------+---------+-----+---------+----------+---------+
| Collation              | Charset | Id  | Default | Compiled | Sortlen |
+------------------------+---------+-----+---------+----------+---------+
| utf8mb4_general_ci     | utf8mb4 |  45 | Yes     | Yes      |       1 |
| utf8mb4_bin            | utf8mb4 |  46 |         | Yes      |       1 |
| utf8mb4_unicode_ci     | utf8mb4 | 224 |         | Yes      |       8 |
| utf8mb4_icelandic_ci   | utf8mb4 | 225 |         | Yes      |       8 |
| utf8mb4_latvian_ci     | utf8mb4 | 226 |         | Yes      |       8 |
| utf8mb4_romanian_ci    | utf8mb4 | 227 |         | Yes      |       8 |
| utf8mb4_slovenian_ci   | utf8mb4 | 228 |         | Yes      |       8 |
| utf8mb4_polish_ci      | utf8mb4 | 229 |         | Yes      |       8 |
| utf8mb4_estonian_ci    | utf8mb4 | 230 |         | Yes      |       8 |
| utf8mb4_spanish_ci     | utf8mb4 | 231 |         | Yes      |       8 |
| utf8mb4_swedish_ci     | utf8mb4 | 232 |         | Yes      |       8 |
| utf8mb4_turkish_ci     | utf8mb4 | 233 |         | Yes      |       8 |
| utf8mb4_czech_ci       | utf8mb4 | 234 |         | Yes      |       8 |
| utf8mb4_danish_ci      | utf8mb4 | 235 |         | Yes      |       8 |
| utf8mb4_lithuanian_ci  | utf8mb4 | 236 |         | Yes      |       8 |
| utf8mb4_slovak_ci      | utf8mb4 | 237 |         | Yes      |       8 |
| utf8mb4_spanish2_ci    | utf8mb4 | 238 |         | Yes      |       8 |
| utf8mb4_roman_ci       | utf8mb4 | 239 |         | Yes      |       8 |
| utf8mb4_persian_ci     | utf8mb4 | 240 |         | Yes      |       8 |
| utf8mb4_esperanto_ci   | utf8mb4 | 241 |         | Yes      |       8 |
| utf8mb4_hungarian_ci   | utf8mb4 | 242 |         | Yes      |       8 |
| utf8mb4_sinhala_ci     | utf8mb4 | 243 |         | Yes      |       8 |
| utf8mb4_german2_ci     | utf8mb4 | 244 |         | Yes      |       8 |
| utf8mb4_croatian_ci    | utf8mb4 | 245 |         | Yes      |       8 |
| utf8mb4_unicode_520_ci | utf8mb4 | 246 |         | Yes      |       8 |
| utf8mb4_vietnamese_ci  | utf8mb4 | 247 |         | Yes      |       8 |
+------------------------+---------+-----+---------+----------+---------+
26 rows in set (0.00 sec)

However conversion from `utf8` to `utf8mb4` will encounter these issue of `ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes`. There is a DAMN good guide (ironically better than official documentation) written to resolve that issue and planning for the migration. However, the SQL queries only works for MySQL 5.6.

Meanwhile, this is one good example of writing Perl unit test cases to evaluate `utf8mb4` character set.

#2 Found the solution to my long unanswered question. When writing Bash script, how do we skip certain parameter. For example, we want to skip first parameter but takes the second $2 parameter onward? `shift` my friend. Is a universal concept that I've looked at it almost every day in Perl but never occur to me that this is the same in Bash script as well.

#3 PostgreSQL 10 with examples. The only worthy stuff produced by HP besides the printer. People, embrace the most advanced FOSS database system. Stop playing with MySQL.

#4 Time your console commands but cannot capture the output of `time` to a file? You're not using the command correctly. You should surround it with parenthesis. Either one will work. Depends on how many output files you want to have.
$ (time ls) > outfile 2>&1
$ (time ls) > ls_results 2> time_results

#5 How do you lost 1kg per week or the perfect diet? Both gave the same good advice. It actually make sense without actually starving yourself. The key take here is to first figure out the daily needed calories. Then reduce 500 calories from your food intake and add activities that burn 500 calories as well. The second part make sense. You just don't focus on diet, you should incorporate physical activities as well.

#6 "How do I get started with artificial intelligence?" and "What can I do with AI in my own product or company?" Read this.

#7 The technology stack of craiglist. Surprising, they are using Sphinx Search Server. Thought they might be using Elasticsearch. Why? Based on the comparison on both search servers, Elasticsearch scores way higher than Shpinx. Maybe Sphinx fits the requirement usages in craiglist?

This Week I Learned - 2017 Week 21

Previous week post or the whole series.

If you cannot keep your habit in a consistent manner, you will need readjust the minimum goal of the habit until there is no more excuses for you not to do it. Is as simple as that.

Second week of eating your dinner before 7pm indeed have significant changes. Additionally with consistent meditation and healthier food choices, surprised to know that I've lost some weight. However, all these lost weight may due to water weight.

#1 Well said. Well said.
"Don’t confuse privacy with secrecy. I know what you do in the bathroom, but you still close the door. That’s because you want privacy, not secrecy."
#2 Interesting that it's not just me who have been doing my own TILs or keeping a developer journals. While some store their TILs in Github repositories, mine just as a weekly collective of blog post. Either way, keeping a journal is always a good habit for anyone practicing their craft.

#3 There are quite a few complimentary Docker utilities that help to improve your Docker usage experiences.

#4 Tracing in GNU/Linux. Always an interesting topic to explore, especially coming from Brendan Gregg.

#5 Managing Git merge conflict? git-mediate seems like a good tool to ease the pain of resolving merge conflicts. I now finally grok how three ways merge works.
  • HEAD - Your changes.
  • BASE - Code before your changes and other branches.
  • OTHERS - Code with other changes that going to be merged to your branch.
#6 Merge with squash. Good to know if you want to do lots of branching.
  • Put the to-be-squashed commits on a working branch (if they aren't already) -- use gitk for this
  • Check out the target branch (e.g. 'master')
  • git merge --squash (working branch name)
  • git commit

This Week I Learned - 2017 Week 11

Last week post or you can read through the whole series.

Readjust and swapping some my morning and night rituals. I've managed to clear of daily to-do items in a more manageable and less stressful manner. It's amazing that a small change can have a significant impact on your daily life.

#1 What is the best time to have breakfast, lunch, and dinner? McLaren's F1 driver diet plan provides some good reference plan. Breakfast starts at 7 am, follow by lunch at 12:30 pm, and lastly dinner at 6:30pm. Interestingly bedtime is around 10pm, seems way too early. However the total calories is quite high, roughly 2800kcal. Best if you check your daily needed calories.

While we're on calories counting. Someone managed to lose 45kg in 6 months (via HN). Be warned, his approach is quite drastic and not suitable for everyone. Similar posts (here and here) in HN.

#2 Dynamic Dispatch and Jump Table. I've been stuck with a problem of implementing console application in C++. Countless hours of searching and reading and it finally occurred to me that I was googling for the wrong keywords. Unfortunately, my limited knowledge with C++ hamper the progress of the project. Some discussions with two young chaps did open up possible solutions on how to implement Jump Table in C++. Will explore further once everything have been settled down.

#2 Learned optimism as presented by Reginald “raganwald” Braithwaite. Good to read slide and watch the presentation together. The audio quality is kind of lacking. To be more optimistic, use Cognitive Behavioural Therapy to change the way how you explain things to yourself.


#3 Cultural fit for a candidate in a company. The ironic, bitterness, and sarcasm. The comment by sokoloff is spot on. It should be a mutual process, both the candidate and the company. And it should be the responsibility and challenge for the management rather than those reluctant employees. Interestingly, there is only three interview questions to assess whether a candidate is suitable for the job.

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 09

Last week post or the whole series.

Medical checkup. Enough said.

#1 Geek Career Paths. Or should I just rephrase it as where does old grumpy programmer goes? Tim Bray shares his experiences and explores different different career paths for a technical person. There is one thing missing from the list, being a teacher, especially when come to tech-related stuff. Something which I found surprisingly fulfilling and engaging, putting aside some idiocy office politics.

#2 Why we use 32768 KHz crystals? The MSP430G2 LaunchPad came with a 32k-Hz crystals. Unfortunately, you will need to solder it manually yourself. What is a crystal (think salt) or cyrstal oscillator? Basically a electronic component used generate consistent time.


While we're at electronic, there exists a type of clock which is powered by electric and the accuracy is determined by utility frequency of 50 or 60 Hz.

#6 Design Patterns revisit. The main purpose of any pattern book is to have a common vocabulary of how things are organized. After so many years, some patterns are still not built into the programming languages. Good examples are:
// Unit of work, commits changes before the reference gets removed from stack
public unit CustomerForm { } 

// There can be only one.
public singleton DatabaseConnectionHighlander {}

// Any method called updates values in some way
public builder QueryString {}

#7 What Happens to Your Body on a Thru-Hike (via HN). Most important blogpost I've read so far when come to health. Walk as much as possible, especially after meals may increase your metabolic efficiency. Cut down those refined carbs as well. Before you start any plan to keep yourself healthy, you must measure before you can improve. Knowing what to measure and where you stands is half the effort for healthy lifestyle. List of items to measure are:

Body Mass Index (BMI). To determine your body fat which directly indicates whether you are obese or not. Measure yourself.

Resting Heart Rate (RHR). Measurement is quite easy and you do not need special equipment, just two fingers and a timer. First, locate your pulse. You can sense this at your wrist, side of the neck, inside of elbow, or top of the foot. Then, place index and middle fingers on these areas. Count the number of beats over 30 seconds and double that figure. Similarly, count the beats by 15 seconds and multiple by 4 to get the heart rate per minutes. Do this while resting (after you've wake up in the morning) and log the counts for several times per week.

What does this RHR indicates? It shows physical fitness. RHR is the number of times within a minute for your heart to pump all the blood to your whole body. Figure within the range of 40 till 100 is considered as normal but if your RHR falls within the range of 80 till 100, chances of you getting cardiovascular disease is extremely high. Athlete will have lower RHR of 40. To lower your RHR, there is no other way than exercise.

Blood sugar. Hemoglobin A1c. For screening and diagnosis of diabetes or pre-diabetes.

Cortisol and Testosterone. Especially for a man, both hormones are highly influences to your health. We should striving for low Cortisol and high Testosterone level. Stress is linked to Cortisol level, the higher, the more stressful you are. Meanwhile, Testosterone defines, physically, what makes a man, man. For example, muscle development and your sex drive. I can't seems to find local

Metabolic efficiency. How efficient your body in burning carbs and fat? While it's more relevant for athlete involved with endurance sports, it's good to know how you can fully optimize your body energy usage. Check out Andrew Skurka's detail post on this.

This Week I Learned - 2017 Week 06

Last week post or the whole series.

Slow week. Just back from holiday and my aging brain is slowly picking up the pending tasks on hand. Not a productive week.

Changing my approach to handle to-do list when comes to own personal project. Have an idea or looking at a procastinated long list, just get something up. Don't care it's not working, even a simple "Hello World!" is good enough. Once it's up, you will have to tendency to do something about it later or in future. It's basically just moving an item from a to-do list to another form of to-do list. Nevertheless, something get started somehow. Best to keep the momentum going.

#1 MSP 430 Competitive Benchmarking (SLAA205C, PDF). Is an old (2009) benchmarking results comparing MSP430 (MSP430F5439) against several other microncontrollers. For more up-to-date results, see the report from EEMBC. CPU is not just the main factor, sometimes, power consumption is an important deciding criteria. Top 5 most efficient microcontrollers according to ULPBench.

#2 The answer is seven. When end result have higher social values over hardworks (you can trace it back to financial reason), do we still care crap about the effort? People always looking for shortcuts in life. Some would prefer to call this being smart and efficient where the goal is to spend minimum efforts to obtain maximum output. Have you encounter student who tried to contest the exam result when he put little efforts? There exists a group of people who are lazy and entitied. Well, laziness is virtue right?

#3 Reverse-Engineering work on the TL-WR703N 150M 802.11n Wi-Fi Router. Interesting works on TL-WR730N which was used as a cheapest embedded GNU/Linux platform (OpenWrt). However, it's quite hard to find this in MY anymore but there is another model which superseded it, TL-MR3020. Alternative choices includes GL-MT300N and Nexx WT3020. I was considering getting one but hold that thought because I'm not sure what to do with it. My Raspberry Pi and Beagleboard still collecting dust.

#4 Ceriatone. Surprising good (from the YouTube reviews) and "affordable" (compare to those established amp makers) guitar tube amp board kits from MY. See TubeDepotTV if you want to find out how to assembly your own guitar tube.

While we're on guitar. Thinking of getting a Squier? Watch Squier Roundup: A look at six Squier guitars from worst to first. Which Squier then? Anything over MYR1000 should be a good choice. To be more specific, skip all Affinity or Bullet series and those made in China.

#5 Box Breathing via HN. The steps is quite straight forward, inhale, stop, exhale, and stop. Just four steps with different duration for these four steps. There are several other breathing techniques as well like The Stimulating Breath4-7-8 Breath, and Breath Counting. I've tried different Android app, so far, Breathe (similar to the Box Breathing site) works for me.

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 16

Write-up for last week or you might want to read the whole series.

Using short URLs when sharing document through OneDrive or Google Drive? Think twice. Researchers have managed to brute force short URLs within six characters to obtain the content.

Ubuntu 16.04 (Xenial Xerus) finally released (Vagrant box download here). The is the LTS release that going to replace the 14.04 (Trusty Tahr) and by looking at the release notes, there are so many upgrades, especially LXD 2.0 (more on other features in coming post). However, there is one feature that everyone is yearning on for so many year. We can now move the launcher to the bottom of the screen ! Hooray ! The funny thing is after so many years of yearning for such feature, I'm getting used of the launcher on the left. How ironic is that?
$ gsettings set com.canonical.Unity.Launcher launcher-position Bottom # to the bottom
$ gsettings set com.canonical.Unity.Launcher launcher-position Left # to the left

While we're on Ubuntu, another new feature added was Snap package format. However, was seems to be not secure at all as made known by Matthew Garrett. While I'm not sure how this things works, is best to avoid installing any Snap packages.

Talking to a dying person. Pieter Hintjens, the programmer of ZeroMQ, distributed messaging, has been diagnosed with incurable cancer. The best way to talk about this is to remind the patient about the good old days or experience both of you have together. Remind and cherish the memory you have together.

Particular case of renaming files? Didn't realize that renameutils exists. Basically running the 'qmv' command will fire up your editor and let you change the file names as you wish.

I've been tinker with Emacs these days and the ironic part is I've become a more informed Vim user. If you want to save a portion of file to external file and delete it at the same time, pipe it out through ':!cat > filename.txt'.

Surprise found in Youtube, Gundam Thunderbolt (ONA released) was probably the only Anime that caught my attention. Fluid animation (the drum solo), Jazzy music (kind of remind you of Cowboy Bebop, someone even joked about this series as Gundam Bebop), face paced action, and character designDiscussions at Reddit share the same sentiment. All this reignites my interest for Mecha and Gundam Model Kit again.




This Week I Learned - 2016 Week 13

Last week post or the whole series.

#1 Unexpectedly Realistic. (Reddit thread). Not entirely true but it always a good time to hit the gym to workout consistently.

#2 Conrad Jon Godly. Simple yet mesmerizing oil painting.

#3 tracker-store and tracker-miner-fs eating up my CPU on every startup. My CPU load have have been high for the past few days. Booting and starting programs have been testing my patience.

#4 An Autobiography of a Blind Programmer. (Reddit thread) If a visually impaired person can learned to code, no one else have other more lame excuses not to do so. His story reminds me of the infamous blind programmer, T.V. Raman, known for creating Emacspeak.

#5 Microsoft's EEE. Good discussion on the Embrace, Extend, and Extinguish strategy by Microsoft. Is history going to repeat itself like wIat happened to OS/2, Netscape, and the Internet Explorer monopoly which held back the web for a few years? People still need to remember that they are is still a for-profit organization. I will remain skeptical until they truly embrace the GNU General Public License.

#6 How do you integrate remote developers? Discussions there are spot on. Unless the company truly embrace remote-first culture and reduce the jealousy and tension from regular employees, otherwise it will not work.

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 07

Last week post. Slow week, caught up with lots of pending stuff.

#1 Why Docker Is Not Yet Succeeding Widely in Production. Old but still relevant HN discussion regarding Docker. I've been experimenting with Docker for the past three weeks and it seems to be more stable and feature (v1.10.1) compare to the earlier version (two years ago) I've tried. Expect more write-ups on Dockers and Vagrant for coming weeks.

#2 Do you really need 10,000 steps a day? (HN discussion) For a healthy and active person, the daily 10k steps may not be necessary.

#3 Vagga. The equivalent tool I can think of right now is Otto. Good alternative to Vagrant and Docker to bootstrap your development environments.

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().

This Week I Learned - 2016 Week 00

Happy new year, 2016!

Inspired by Christian Neukirchen's blog, Trivium, where he curated interesting stuff about technology, mostly related to programming. I will start something similar but not limited just to programming. Instead of storing all those things I've stumbled upon as bookmark, in Google Plus' collection, or in my paper journal, why not turn it into an "essayish content"?

I didn't blog that much in 2015. Comparing to the previous years, which I vowed to write on a near daily basis, I blogged sporadically without any specific topics. Just mindless ramblings following the current technology fad, mostly those in Hacker News. Also, my writing style change. I tends to write longer post these days or rather, I've become wordy. Maybe the migration from Google Plus to Blogger caused that. It feels weird to write short blog post in Blogger. Contrary to what they said, especially in photography, the tool is as important as the doer.

A weekly post sounds reasonable. Most probably on every Saturday. Or Sunday if something come up a day before. That means I should have a minimum 52 posts by the end of year 2016. And additional few posts in between. A good baseline figure to motivate yourself to write even more. When comes to writing or reading, quantity always triumph quality. You always need more deliberate practices and discipline to master any skills.

Or maybe because I miss Memepool?

Without further ado, I present you the first post of this week I learned.

#1 Scott Meyers, the foremost expert on C++ programming language, announced that he is retiring from it after 25 years of involvement. Quarter-century is a very long period for anyone to just focus on one particular programming language. Especially to resist all the temptation of chasing the latest technology fad. The discussion at r/programming regarding his retirement is both funny and interesting. Some speculated that his next step. Maybe he is moving to Golang (due to title of the blog post), Ceylon (from his past posts), Node.js (I doubt so), Swift (possible), or Rust (another possible candidate)? Nevertheless, C++ always remains one of the item in my someday list (to-do list for procrastinator).

Some interesting tidbits about him. He has a consistent and unique hairstyle. There is even a poll on his hairstyle resemblance to famous people. The funny thing is I always mistaken him for Bertrand Meyer, the creator of Eiffel. Also, besides Philip Greenspun, he is the second technical people I'm aware of who seems to have a deep connection to their pet dog.

#2 Matt Might blog post on 12 resolutions for programmer should be reread annually during new year. I've covered this in the past, around 2013. Rereading his post and comparing to what I've done for the past two years, it seems that I didn't manage to pull through of the resolutions. Something I learned last year, discipline and persistency always outweigh passion. Also one mistake I've made was that you can't multitask your goals. As stated in his blog post, this is a "twelve month-size resolutions". Meaning that you should carry out one resolution at a month. This is akin to changing a habit, one at a time, for one at a month. Sometimes you've to slow down in order to move faster. One issue still remains, which can be summarized from HN discussion, sedentary life style is a huge health risk for IT jobs like programmer and system administrator.

#3 There are 64 GNU/Linux or Android friendly Single-board Computers(SBCs). Overwhelmed by the number of choices? As shown in the survey results, you can't go wrong with Raspberry Pi for its software support and community ecosystem even though it has lower hardware specification. For my case, the main reason is the pricing as I can procure both SBCs from the local element14 (electronic components distributor) site. For other SBCs, the shipping fees, tax, and delivery time does not justify it. Otherwise, I would have go for Odroid especially Odroid-C1 and Odroid-XU4. Adapteva's Parallella, marketed as mini supercomputer, caught my attention but the price and its usage, again, does not worth it.

150 Minutes Per Week

"The study found that 150 minutes of vigorous physical activity per week added two to three years to the lives of the men during the 13-year study."
-- The University of Western Australia, emphasis added
Found via Reddit. 150 minutes per week is roughly around 21.43 minutes per day. Before that, what is vigorous physical activity? According to World Health Organization (WHO), any high intensity activity that increases heart rate is considered vigorously. Examples are running, brisk walking, fast cycling, aerobics, and others.

It seems daily walking of 10,000 steps (which I still fail to do so) merely enough for fitness or weight loss but not enough to extend your life expectancy. Is time to include the Scientific 7-Minutes Workout in my daily as I don't suffered any foot pains anymore.

Dizziness

"The inflammation of the lining of the stomach is called gastritis. Dizziness and fatigue after eating meals are common symptoms of gastritis. This condition may be caused by irregularity in eating meals, consuming improperly cooked food, excessive eating of oily foods, overeating, alcohol intake, and drinking strong coffee or tea."
-- MD-Health, emphasis added
Be wary of any health-related information found online. The site itself has no disclaimer, no source of information, and furthermore, not HONCode certified. The best next course of action is to check with a doctor.

There are two symptoms of dizziness. One is light-headedness where you feels like fainting. Second is vertigo (which I always thought not a word but a unique name of the imprint of DC Comics, silly me), where you feels the spinning sensation. You can sense the sensation from three sources, objective (world is moving), subjective (the person him/herself is moving), and pseudovertigo (rotation inside your head).

How many calories do you need to burn daily to lose weight ?

Short answer for me : 1554.16

Step 1. Calculate your Basal Metabolic Rate (BMR), which is the calories you would burn just by lying on the bed all day. For my case, my BMR is 1711.8.

Step 2. Based on your BMR, determine the total daily energy need using Harris Benedict Equation based on your lifestyle. Unfortunately my current lifestyle is quite sedentary even with a Pedometer. Hence, the calculation as follows:

Calorie = BMR x 1.375
              = 1711.8 x 1.2
              = 2054.16

Step 3. To lose weight, for a start, just reduce your daily calorie by 500. Hence, total daily calories intake should be around 1554.16.

Off course, counting calories is cumbersome and demotivating as well. But is nice to have a baseline figure and you will slowly pay attention to the calorie count of any packages food.

Maybe I should just start with Keto (low carbs, moderate protein, and enough right fat) diet instead as I current weight is not moving anywhere.

Programmer Mortality

"Damn, there's a lot of early software people death lately..."
-- ttrreeww
That's so true. Went to his Python talk last month and now he's gone. Another painful reminder that life is so fragile. Surprised to find out (unconfirmed) he was in his early 40s and that just a few years older than me.

On a related note, few weeks ago, I ran into an old acquaintance. As we were catching up, I noticed he looked different, way thinner and tired. To my surprise, he told me he was recently diagnosis with certain illness. I was taken aback by this but was not surprise, knowing his caffeine-high life style.

I told Ms Hippopotamus about this and finally convinced (frightened and threatened) her to go for blood testing with me after so many years. Test results came back were unsatisfactory and there will be follow up session for confirmation. No, is not life threatening but alarming. I can probably guess what going to kill us in coming future if we don't make any adjustment to our lifestyle. Sitting all day will slowly kill you.

Just take care of yourself. Walk more, sit less. "Eat food. Not too much. Mostly plants." (Michael Pollan, food writer). Or maybe I should stop being a software developer and do something else instead? Something that involves more manual labours like farming?

Diets Don't Work

Something interesting I read during lunch hour today. Book author, Bob Schwartz, in his book, Diets Don't Work,  proposes four simple rules to stay naturally thin.

1. Eat only when hungry.
Don't eat when you're emotional (bored, sad, happy, and etc.) Eat when you're feeling hungry. You will know when your stomach starts to growl. But instead, we eat (mostly junk food) when we are doing some other activities (movies, web surfing, or chit-chatting). Have your ever notice we sometimes have the urge to chew on something even though we're not hungry ?

2. Eat exactly what your body wants.
If you're craving for certain food, go take it but do not take this rule literally. This does not means we can eat fast food or soft drink for every meal. See rule 4.

3. Eat each bite consciously.
Be mindful, deliberately focus on the eating. Be aware of the food that goes into your mouth, the smell, colours, texture, or taste. Stop any other activities. No computer, television, or conversation with other people. Can you remember your last meal ? Can you describe it (the taste, colour, texture) ? What are the ingredients ? If you can't remember, then you're not paying attention.

4. Stop when your body has had enough.  
Moderation is the key here. Follow rule 3 and stop when you're satisfied. If you are worry about wasting food, take a smaller portion, like half cup of cooked rice.

In summary, the general rule is be conscious of what you put into your mouth and learn to enjoy your food. By the way, these rules are applicable to money as well.

Resolutions for Programmer - Part 1

It's almost the end of January 2013. No resolutions set yet ? Why not read +Matthew Might's 12 resolutions for programmer for some inspirations ? If I were following his resolutions, how would I do it differently? I will start with the first 6 resolutions and continue the subsequent 6 in next post.

1. Go analog.
Definitely cooking. Gordon Ramsay's Scrambled Eggs and Jacques Pépin's omelette are two egg-related dishes I really like to master. I've tried and failed miserably. Trust me, is not as simple as it seems. Cooking is always a good weekend activity.

2. Stay healthy.
I had fought hard and recovered (almost 95%) from Repetitive strain injuries (RSIs), nervous injuries due to repetitive typing (for my case). But the current obstacle is become more healthy. Doing maintenance programming and sitting all day will harm your body somehow. Bought a Pedometer, start monitoring my daily walking steps.

3. Embrace the uncomfortable.
Switch to CamelCase from underscore-based style. I fscking hate CamelCase. Enough said.

4. Learn a new programming language.
Scheme functional programming language and finish the Structure and Interpretation of Computer Programs (SICP). Unfortunately, I can only start this by June due to other pressing commitments. Will continue learning Python as well but is learning by doing small projects.

5. Automate.
The only thing I can think of is to put every important events, birthday, and life milestones into Google calendar.

6. Learn more mathematics.
Read one book on statistics. Relearn statistics.