This Week I Learned - 2017 Week 29

Last week post or some ramblings from the past.

The quest of finance independence will influence or make your adhere to different life principles. Minimalist life style, waste free, child free, debt free, and other approaches. Some of these deliberate choices may against the normal social norms. Is all depends on how aggressively you want to proceed ahead. The biggest obstacle is consumerism, especially in this digital age. Reducing your social media usage (yes, this includes normal Internet surfing) is a good start.

Interesting part that the WiFi extender cannot connect through 5GHz because certain countries does not support channels other than Band 1. It's quite confusing where extending your WiFi coverage if you're using the same SSID as you have to check the BSSID to differentiate which SSID you're currently connecting to. But one thing for sure, I definitely love `nmcli` console tool, probably my favourite software. Always gave me the hidden surprise of its usages and features.
$ nmcli -f BSSID,ACTIVE dev wifi list

Nostalgia bucklespring keyboard sound. Instead of spending a fortune in getting the real physical keyboard, just install the software and enjoy the emulated sounds. Good for the electric typewriter I was thinking of setting up using the underutilized Raspberry Pi.

Chinese cleaver (菜刀), compare to other similar type, is a general purpose kitchen knife.

"We receive subsidies from the government." (more write up from MiniMachines). Now we know why Orange Pi is so cheap, everything is sold as Bill of Materials (BOM) price. It would be nice if the software support is better.

Why you should not use React now due to the the BSD+Patent license issue. Partially open source but with patent grant issue tagged along. Are we going to see more PATENTS file issue in coming future?

"Being unwilling to adopt a necessary amount of structure and process is just as much of a hindrance once you hit a certain size." Full context of the discussion. The observation when you organization reached certain size where formal process is unavoidable. Yet, people are still making the same old mistake over and over again.

Using Linux kernel >= 4.9? Switch to BBR TCP to control the network congestion and increase your Internet speed. It seems to increase the download speed tremendously. Alternative and more detail explanations from APNIC and ACM Queue.

The secret passion of Git checkout. Funny but very well-written guide on using Git checkout. Meanwhile, use rebase by default, if possible for all your branches. While we at it, user `merge --no-ff` if possible because we want to preserve the branch history.

Kindness is underrated (via HN). Being polite, empathy, professional, helpful, or kind? Neither one will get the message across if the receiving end fails or unwillingly to listen. I totally agree with the comment, "On the internet, nobody can hear you being subtle".

LogiFind MSP430 LCD KIT-C - Part 1

As I was looking into available development kit of MSP430, I've made another curiousity purchase of another kit. This time is LogiFind's MSP430 LCD KIT-C, another tiny MSP430 kit using MSP430F413. Device is shown below (screenshot from local reseller, Partsories). As the device is powered through USB Type B connector (typically used by printer or camera), I've to purchase another USB Type A to Type B connector. Driver and documentation is located at LogiFind site.

Power up the device through my lappy seems straightforward, and the LCD immediately displays the current time and three red LED lights (TEST1, TEST2, and PWR) were turned on. The TEST1 and TEST2 LED lights were blinking continuously.

Checking the device info from the USB port in GNU/Linux shows that USB was detected as serial port or USB to serial interface bridge.
$ lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Even more details on the USB device.
$ sudo lsusb -D /dev/bus/usb/001/003
Device: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Device Descriptor:
bLength                18
bDescriptorType         1
bcdUSB               1.10
bDeviceClass            0 (Defined at Interface level)
bDeviceSubClass         0
bDeviceProtocol         0
bMaxPacketSize0        64
idVendor           0x067b Prolific Technology, Inc.
idProduct          0x2303 PL2303 Serial Port
bcdDevice            3.00
iManufacturer           1 Prolific Technology Inc.
iProduct                2 USB-Serial Controller
iSerial                 0
bNumConfigurations      1
Configuration Descriptor:
bLength                 9
bDescriptorType         2
wTotalLength           39
bNumInterfaces          1
bConfigurationValue     1
iConfiguration          0
bmAttributes         0x80
(Bus Powered)
MaxPower              100mA
Interface Descriptor:
bLength                 9
bDescriptorType         4
bInterfaceNumber        0
bAlternateSetting       0
bNumEndpoints           3
bInterfaceClass       255 Vendor Specific Class
bInterfaceSubClass      0
bInterfaceProtocol      0
iInterface              0
Endpoint Descriptor:
bLength                 7
bDescriptorType         5
bEndpointAddress     0x81  EP 1 IN
bmAttributes            3
Transfer Type            Interrupt
Synch Type               None
Usage Type               Data
wMaxPacketSize     0x000a  1x 10 bytes
bInterval               1
Endpoint Descriptor:
bLength                 7
bDescriptorType         5
bEndpointAddress     0x02  EP 2 OUT
bmAttributes            2
Transfer Type            Bulk
Synch Type               None
Usage Type               Data
wMaxPacketSize     0x0040  1x 64 bytes
bInterval               0
Endpoint Descriptor:
bLength                 7
bDescriptorType         5
bEndpointAddress     0x83  EP 3 IN
bmAttributes            2
Transfer Type            Bulk
Synch Type               None
Usage Type               Data
wMaxPacketSize     0x0040  1x 64 bytes
bInterval               0
Device Status:     0x0000
(Bus Powered)

Next, is to check the connectivity through MSPDebug.
$ mspdebug --usb-list
Devices on bus 002:
    002:002 8087:0024
    002:001 1d6b:0002
Devices on bus 001:
    001:003 067b:2303
    001:002 8087:0024
    001:001 1d6b:0002

It seems I need to find a way to connect to it either through TI, FET, or Olimex FET driver.
$ mspdebug --fet-list | grep "Devices\|MSP430F413"
Devices supported by FET driver:
    MSP430F1611        MSP430F413         MSP430F6435
Devices supported by Olimex FET driver:
    MSP430F4132              MSP430F6730
    MSP430F5333              Preliminary_MSP430F413

More to connecting through MSPDebug in coming post.

Docker and Docker Compose Installation in Ubuntu

It's kind of annoying that when you're upgrading the Dockerfile version, your Docker Engine and Docker Compose does not support it and you've up either upgrade both the softwares. Reading through the documentation was rather frustrating as you've to jump from section to section. Or maybe I miss out something instead?

First, read and check which Docker server supports which Dockerfile version.

Next, upgrade your Docker Engine. This will work for either new or existing installation.
$ sudo apt-get remove docker docker-engine
$ sudo apt-get update

$ sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual \
apt-transport-https ca-certificates curl software-properties-common

$ curl -fsSL | sudo apt-key add -

$ sudo add-apt-repository \
"deb [arch=amd64] $(lsb_release -cs) stable"

$ sudo apt-get update
$ sudo apt-get install docker-ce

Next, check your Docker client and server version.
$ docker version
 Version:      17.06.0-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:18:10 2017
 OS/Arch:      linux/amd64

 Version:      17.06.0-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:17:03 2017
 OS/Arch:      linux/amd64
 Experimental: false

For Docker Compose, just install or upgrade the software through Python package manager, pip.
$ sudo -H pip install docker_compose --upgrade

Check the installed version just to verify it.
$ docker-compose version
docker-compose version 1.14.0, build c7bdf9e
docker-py version: 2.3.0
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t  3 May 2016

This Week I Learned - 2017 Week 28

Last week post or something from the archive.

Another long and outstanding issue resolved. While I'm not partially involved but glad it has finally been settled in a mature and non-violent manner. Long story short, is a long story. Nevertheless, everything back on track and are quite a few things I need to follow up and get it done by this year. Half year have gone and not much time left before the end of 2017.

When you're switching character set and column collation in MySQL, you will encounter certain limitation of the index length of Innodb storage engine, the error of 'The maximum column size is 767 bytes.' . There are three ways to resolve this issue. First, you resize the column size from VARCHAR(255) to VARCHAR(191). Second, you resize the the table index length. Third, you switching the storage engine from Antelope to Barracuda and then switch the table to dynamic row format. Similarly, MySQL utf8 to utf8mb4. This post summarized three essential SQL statements needed to do the migration.

MySQL, while is a pile of mess, is a good case study of Worse is better. Likewise, same goes to Craiglist. Say you want about the site, which still stuck in the early 90 design, but still making profit until this day. Sometimes, good enough should be sufficient.

Everyone's code basically sucks, including yours. Honest insight on what you will learn after many years into software development. Importantly, don't get too comfortable in any job. In the end of day, you're delivering software to solve problem, is all what the stakeholder wants, nothing more and nothing less. While some have more pessimistic view of moving to management instead of development and managing up (some said it's overwhelmingly cynical or Machiavellian).

The hierarchy of 'Troubleshooting Software Problems. Probably the best thing I've read so far on how to troubleshooting any problems. The hierarchy of problem as shown below:
  • data
  • code
  • workflow
  • design
  • architectural
  • team
  • project
  • organizational
  • leadership / existential

Is our eating habit, and thus eating habit influenced by "the array of microscopic organisms that live inside our intestinal tract." The whole thread was an interesting read with comments backed by scientific research. Maybe gastrointestinal microbiota is manipulating our eating behaviour. Which leads to the new type of obesity treatment through gut microbiome transplant. In other words, taking care of your gut is one of the essential way to stay healthy and fit.

Shelving and checkpointing in Subversion. It has been so long that finally someone look into adding local commit support. However, it's just the initial stage although there are many design documents available.

Where We Started. The movie and the guitar song. The former is a low budget movie with witty dialogue and the later made me want to pick up guitar again.

Buying a Power Support Unit (PSU)?

The motherboard have arrived today but I don't have a Power Supply Unit (PSU) yet. It seems that I did not pay much attention to the PSU and took things for granted. Luckily I didn't make any unnecessary purchase and decided to wait (limited budget) and research more before making any buying that I will regret later. Three things need to take into consideration when buying a PSU. First, power connector type of your motherboard, the required power needed, and lastly, the power efficiency needed.

First, normal and high-end (like server or workstation) motherboard have different power consumption which determines different connector type. There are different type of connector (differentiate by number of pins) which provides additional power to your CPU. Normal desktop uses 4-pin connector where server or workstation uses 8-pin connector. To quote Wikipedia (emphasis added),
ATX12V 4-pin power connector (also called the P4 power connector). A second connector that goes to the motherboard (in addition to the main 24-pin connector) to supply dedicated power for the processor. For high-end motherboards and processors, more power is required, therefore EPS12V has an 8-pin connector.
The screenshot below (credit to Mark Allen) shows different type of power connector used by the motherboard. The 8 pin EPS connector and 4+4 pin connector (not EPS compliance) are equivalent. Unless you can find 4-pin to 8-pin adapter (not sure this is applicable for server motherboard), best to just find the right PSU which support the number of pin needed. 4+4 pin is your best bet.

Next, determine (or through this site as well) the load wattage needed. Fill in the type of machine and all its components needed, you will have an estimation of power required. Unless you're always upgrading your machine, buy the one nearest to your required load wattage. My calculation of my hardware specification yields around 273W needed.

The next question is how many watts should you get? Remember, you will not fully utilize 500W out of the PSU as there is no way for 100% efficiency usage. Energy will be leaked due to heat. For example, a PSU with maximum power (also known as peak power) output of 500W, continuous voltage power (you may look for wording like 'combine +12V' or 'max combined power') of 450W, and rating of 80% efficiency under certain load. Then, the actual energy drawn continuously from the PSU is 360W. That basically fulfill the energy requirement I've calculated earlier.

Lastly, determine the power efficiency. Unless you're running a server for 24/7, goes for anything PSU with 80 Plus standard, 80 Plus Bronze standard should be good enough. You can choose from different manufacturers. However, rating sometimes can be misleading. PSU is as good as its capacitor used and there are many different tier of capacitor manufactures. Tom's hardware provides a good list of matching PSU manufacturers and capacitor manufacturer. Use that list to make an informed purchase. Another way to determine whether the particular PSU is using a good capacitor is check the warranty period. Longer warranty given indicates better components or capacitor used.

My research leads me to these PSUs due to availability and budget. Since this is not an urgent buy, might as well sleep through it and revisit it from time to time.

In conclusion, follow these following steps.

  1. Determine your form factor. Is it ATX, micro-ATX, or something else?
  2. Estimate your load wattage need based on the component needed.
  3. Calculate the actual wattage needed from your PSU.
  4. Check the PSU manufacturer tier list and see which brand and model use the best capacitor.
  5. Select the PSU with 80 Plus Bronze rating that fit your budget.
  6. Google for any reviews of the selected PSU brand and model.
  7. Buy the PSU.

This Week I Learned - 2017 Week 27

Last week post or something from the archive.

One of the biggest item in my to-do list is getting closer to be checked off. If everything goes well, the pain in the butt for the past eight years will come to an end. It didn't work out the first time but I've learned my lessons when I went in for the second time. Will I ever do it again? Definitely. Without a doubt. But in a more manageable way.

You have too much shit. That what will happen if we fall prey to our own fears and deepest insecurities which lead to we hoarding insane amount of unnecessary stuff. Give, sell, share, digitize, fix, or destroy these stuff. This problem wouldn't exists if we don't buy stuff in the first place. However, living in the digital age, we also have another form of too much digital shit, some are due to data hoarding.

Contrary on what I said about not getting new stuff, I was thinking of getting another ThinkPad, for another more portable machine. X220 seems like a decent choice. It's relatively new, affordable, upgradable, and furthermore, almost waterproof, as shown in video below.

Who Americans spend their time with? (via Slashdot) Nothing unusual about this. As you age, the time you want to spend with your family (especially your partner) and yourself increases accordingly. Occasional happy hours with co-worker is acceptable to a certain point (you've spent more than 8 hours per day with them anyway), but most of the time, you just want to go home and be left alone.

How to read and understand a scientific paper: a guide for non-scientists. (via HN) It a long tedious process and normally you won't get it right the first time and may need to sleep to digest the information subconsciously. How I wish I've all the times to read up those pending research papers. Maybe I have the time and motivation for the second part of this year. Again, there is always this guide on How to Read a Book, which can be useful to apply to different reading materials.

What habits make a programmer great? Some said is the three virtues of a programmer, laziness, impatience, and hubris. However, on a personal level, basically is can be summarized by thisthis, and this comment. Nothing but take care of yourself, be healthy, sleep well, eat well, manage your stress. Never take any emotions from work back to home. What ever stays in the office, stays in the office. Generally, it can be applied to any professions.

This Week I Learned - 2017 Week 26

Last week post or browse the archive of mindless ramblings.

Week 26 of 2017. We've finally reaching the half part of the year. So many things to do, so little time available.

"Eat food, not too much, mostly plants.". Avoid white processed food or any kind of fast food. Sounds simple right? Hard for us to follow. With a tendency of bridge, especially during dinner and sedentary life style, I doubt anyone have the time to eat a proper good healthy meal. What can we do then? Read discussion on forum and read scientific papers, and develop your own methodology. Good example of such research. However, some studies were paid studies to fit certain agendas, checking for a reputable sources is quite difficult due to signal to noise problem. Furthermore, most discussions are just personal anecdotal, which you know, is just a sample size 1 observation or N = 1 situation. To reduce all these noises and personal anecdotal, do your own research and refer to few reputable sites like NHS Choice and Harvard Health Online (paid subscription). Everyone mileage may varies, as we tends to trust our body and conduct N = 1 experiments on ourself.

Be careful when going to any chiropractors, don't let anyone have a quick jerk of your head. Better still, see an orthopedist with chiropractic knowledge.

MySQL, seriously, what an effed up database system. Conversion from one character set and collation to another was rather tricky. Resolving "ERROR 1071" was not as straightforward at it seems.

Interesting idea. Just focus on 3 things. 3 things per day, per week, per month, and per year. Experience have taught me figuring out which three things is the hardest part. We're constantly fighting over on the should and want.

This is what happened when an organizational system have been practiced rigorously. Way overboard for my taste. But different people have different working style and culture. While it's good to go for simplicity with an analogue approach, but managing index cards the manually way is just way too cumbersome. Pen and paper is good when you don't need to archive the information and can simply throw it away.

Meanwhile, the post on electric typewriter and reading environment gave me an idea on converting my Raspberry Pi into one digital typewriter. I just need to setup my writing environment with a monitor, mechanical keyboard, a mouse, and a good reading lamp. Just fire up the tiny box and start writing. Jot down what ever come to you without any prejudices and judgement. And eff grammar.

Why process is important? Cognitive errors more likely to happen than procedure errors. Stick to the process.

Fanny pack and Underbone (kapchai). These are like almost like everyday carry (EDC) and yet I don't even know the actual names.

Seeking job fulfillment? Depends on what you want or to sugar coat it, whether its align with you moral and ideological compass. Some don't dream big and content with their role, even through with minor contributions. Some based on ideology. If you want better pay, you will likely to end up with job you don't like, just like 98% people out there. Or maybe you should take a different view, the job itself is just your bread and butter, use the money to do something you find more fulfilling. Provided that you save your income aggressively like 25 times annual expenses.

Something of similar nature, how not to bring emotion from work back to home or how do you decompress after work?

Another day, another weird validation rule when using Vim and LaTeX.

GNU GPLv3 turns 10. What a long way to go since the first decade. Like it or hate it, this license have significantly changed the whole computing industry, especially free and open source software development. Without it, we are still at the mercy of proprietary licenses in all our computing devices. If you ever use any free and open source software and benefits from it, it's time for you to help out, sign up and be a member!

"TDD failed for economic reasons, not engineering ones." This is so true for legacy system when you want to add new feature but don't want to break existing stuff.