This Week I Learned - 2017 Week 16

Last week post or the regular whole series.

Minor hiccups due to sleeping schedule messed up my daily routine. Nothing but readjustment to get back on track. Switching different way of monitoring your habits did not produced the result needed. Furthermore, you should unwind during the weekend. If you need to use the Internet, write down the items you want to research instead of impulsively googling. Maybe I should just switch to dumb phone, nothing but for calls and SMS, like the old days. But it may not be a feasible solution and impractical.

#1 My whole development life in a circle where I have to encounter XXX again in the current development works. There is a write up on the origins of XXX as FIXME (via HN). Reason that we use XXX is easily greppable comment prefixes.

#2 How to handle Perl class-level variables. Two ways. (1) Lexical variable scoped (via subroutine) and (2) package variable. Simple concept that took me a while to finally realize and understand it.
# (1)
my $foo = 123;
sub get_foo { $foo }

# (2)
our $fubb = 456;

On a related note, found a list of Perl modules related to testing. There is so many modules that I haven't try out yet. So many things to try out, yet so little time.

#3 How do you remove all files except one? Seems hard yet so simple, if you know and remember how it works. Only on a rare instance you will encounter this. Typically we just move the file to different folder and delete the source folder.
$ shopt -s extglob 
$ rm -- !(file.txt)

#6 "If you haven't experienced true solitude yet, go find some. It's pretty grounding." (via HN) It's not a man against the wild but rather a man seeking himself through the solitude of nature. It has been so long that we ever lie down and look up the sky and enjoy the stars?

#7 "Colour is in the eye of the beholder". Interesting that our vocabulary influences how we perceive colours. Himba people have interesting vocabulary for colours, for example zoozu (dark colours and black), vapa (light colours and white), borou (green with blue and purple), dumbu (beige with yellow and some light green), and serandu (red with orange and pink). You can read more on this presentation, The Development of Color Categories in Two Languages: a longitudinal study.

#8 If you're facing problem with Google Chrome whenever you're opening new page but it took a while to load while waiting for "Resolving host...". Clear the DNS cache in Chrome. Seems to resolve the lagging issue for me and making browsing experience bearable.

Unable to Mount USB Thumb Drive in Nautilus - Physical Block Size Mismatch

Before I can proceed to setup my tiny homelab machine, Kabini, I need to burn the installation media to the USB thumb drive. However, when the thumb drive was plugged in, Nautilus can't seem to mount it although the kernel message did indicate device `/dev/sdc` did exists and mounted.

Checking through GParted, the default GUI partition tool in GNU/Linux shown that "The driver descriptor says the physical block size is 2048, but Linux says it is 512 bytes"


As usual, SO gave us the root cause and solution to rectify this block size error issue. It seems that I may accidentally wrote to the USB thumb drive using the wrong parameter through `dd` command. To fix this, we need update the thumb drive's partition to the right block size. Running the command below did resolve the issue for me.
$ sudo dd if=/dev/zero of=/dev/sdc bs=2048 count=32
32+0 records in
32+0 records out
65536 bytes (66 kB, 64 KiB) copied, 0.00655332 s, 10.0 MB/s

Once the corrupted block issue have been resolved, go back to GParted and refresh the thumb drive. GParted will prompt you to create a new partition table.


After we have created the partition table, Nautilus will show a proper mounted thumb drive. See screenshot below.


Download the Ubuntu installation ISO file. I'm downloading both the mini and Ubuntu server 17.04 ISO file. This is the time where torrent really shine where I can achieve the speed of 3.02 MB/s, a feat not doable even using parallel HTTP connection using download manager like Aria2.



Next, burn the ISO using the Startup Disk Creator. Load the ISO file as the source disc image and burn it to your thumb drive.


In the past I always used dd command line utility to burn ISO. Little I realized once you've done burning, you can test the thumb drive.


Verification is done by QEMU, hosted hypervisor. If you can see below installation menu, then the thumb drive have been burned and can boot up correctly.


You can achieve similar result through the command line command below. X is the alphabet of your thumb drive.
$ qemu-system-x86_64 -hda /dev/sdX

This Week I Learned - 2017 Week 15

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

While debugging a Makefile, I accidentally `rm -rf` my home folder. Lesson learned, always backup and sync your changes regularly. Nevertheless, it's always a good fresh start when your home folder contains not a single file or folder. Good that you have a weekly clean up of your machine, review, keep, or remove. Otherwise, there will be a lot of pending left over files.

It has been a while since I work on weekend. The serenity of the environment did improve your productivity ten-folds. There is no sounds other than the air-con, traffic, and your typing sounds. You're basically in the zone, focus solely on the task at hand. No more stupid shenanigan. In hindsight, you have to find or create your own optimal environment and zone. It all starts with a system that leads to a habit, good habits.

#1 How to read more books? Lots of good tips and increasing the volume of books you can read. It's already early April and I only managed to finish 2 books. Not really on track on finishing 12 books this year. Thinking back, reading style, book choices, timing, and context are what causing the slowness. One of the best strategy is to switch different books if you're stuck or bored. Some books need more mental energy to go through it. While reading 2 pages per day can develop a good habit, it's not sufficient fast enough to catch up with my pilling reading list.

#2 Engineer's Disease. The unconscious thought that can lead to arrogant and condescending personality. Maybe because such behaviour "stems from the OCD and emotional detachment our peoples tend to have, mixed in with a good dose of raging insecurity"? Good forum discussions to ponder upon, especially by those working in software development.

#3 Does teenager and adult have different learning capability? Time, available perceived time. Also discipline, attention, and focus. The discussion at HN gave a lot of strategies to attack the problem. Simple daily practice and learning together with different learning strategies. What to learn then? Fundamental. There is an interesting discussion on software development being a dead-end job after 35-40.

#4 On understanding the fundamental of Vim. Before you install any Vim's plugin, best to learn what the default features exists or not.

#5 System Design Primer. If you want to learn how to design large scale systems. However, premature optimization is still evil. Knowing something can be done right doesn't means it should be done now. There are always contexts and constraints. Solutions looking for problems always end up wasting everyone resources. This HN user's experience on scaling your system accurately illustrates such scenario.

#6 Looking busy at work?. Most people don't realize that pretend to work and look busy is actually far more harder than doing the actual work. Faking will deplete you psychologically as your thoughts, actions, and words are not in sync. However, there are always exception. Certain group of people thrive on such behaviour without caring for any forms of repercussion. While some just stuck with mind-numbing boring job. There is a saying by Napoleon Hill which states "If you are not learning while you’re earning, you are cheating yourself out of the better portion of your compensation.” Unless you're stuck with certain constraints, move on. You're not a tree!

#7 LXD finally available for Fedora. Not as native RPM package but through Snap. I'm going to reformat another workstation and install Fedora with it. One less reason to stick with Ubuntu. Only left the DEB package, which I believe, no way Fedora/CentOS/Red Hat is able to dethrone the number of available packages provided by Debian. I'm not looking for rolling release like Arch but availability of different software. Maybe Snap, the universal GNU/Linux package can change that?

Upgrade to Ubuntu 17.04

Just read that Ubuntu 17.04 was supposed to be released today and eager to try it out. While nothing special and significant was added to this release, nevertheless, it's good to have the latest greatest when possible. Furthermore, I've accidentally `rm -rf` my home directory few days back.

Running through the typical upgrade steps.
$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo do-release-upgrade -d

However, upgrade seems to fail due to broken packages, see below. Most likely due to many legacy PPA added for certain kind of special packages.
Calculating the changes

Could not calculate the upgrade

An unresolvable problem occurred while calculating the upgrade.

This can be caused by:
* Upgrading to a pre-release version of Ubuntu
* Running the current pre-release version of Ubuntu
* Unofficial software packages not provided by Ubuntu

Found the answer to troubleshot this issue. You must keep the upgrade running at the same time, otherwise the `apt.log` file would not be found. I was surprised that I have so many broken and conflicting package. Follow the procedure, I have to manually remove all broken packages. For certain packages, I have to reinstall because it can't find the actual packages. Result below were truncated to save space.
$ grep Broken /var/log/dist-upgrade/apt.log

Broken libdouble-conversion1:amd64 Breaks on libdouble-conversion1v5:amd64 ......
Broken imagemagick-6-common:amd64 Breaks on libmagickcore-6.q16-2:amd64 ......
Broken libgjs0f:amd64 Conflicts on libgjs0e:amd64 < 1.46.0-1 @ii mK >
......

Upgrade was slow as I've just installed LaTeX few days back. Downloading all those `texlive-` packages going to take some times.

This Week I Learned - 2017 Week 14

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

Proposal have been presented and submitted. Standard feedback received. Nevertheless, better than nothing regardless the quality of the reactions.

#1 GTCafe Studio. Stumbled upon this site while searching for different covers of Guthrie Govan's Emotive Ballad. It's rare these days to find any blog with original good content. Reading through his journal on learning guitar made me reflect back on my decision on donating all my guitars away few years back. Maybe is time to start all over again? Or maybe not? Learning to play an musical instrument is one of the way to escape from mind-numbing daily routines. However, there is a time and place for everything in life. In hindsight, sometimes you just have to move on.

#2 "CentOS is not stable, it is stale". So true that it hurts. For me, as a whole, Fedora provides a better desktop experience than Ubuntu. Yet, I still revert back to Ubuntu on my daily usage. Why? APT is definitely better than YUM and plenty of software selection. Furthermore, LXD works only in Ubuntu and not Fedora. And yes, finally Canonical realized that and declared Ubuntu Unity will be replaced by Gnome 18.04 LTS. Maybe this Ask HN post on feedback for Ubuntu 17.10 from the community have finally sealed the fate for Unity?

I always wonder what would happen if Red Hat decided to use build a distro based on Debian or DPKG package manager instead of creating their own RPM packaging manager? A unified GNU/Linux desktop will come sooner rather than unnecessary fragmentation and efforts. For example, the competition of next generation display server of Mir and Wayland. Yes, I know having options and competitions is good for progress. But the priority and effort should be on fixing the damn display drivers performance and stability issues. Fragmentation leads to duplication of works.

#3 Five great Perl programming techniques to make your life fun again. An old article, 11 years ago but everything described there is as relevant as today especially iteration using `map` and `grep` and Dispatch Table as illustrated in example below. As Perl does not have `switch` statement, hence using Dispatch Table is a good Perl design patternMark Jason Dominus, in his book, Higher-Order Perl also devoted a whole chapter (PDF) on this matter.
my $dispatch_for = {
   a => \&display_a,
   b => \&display_b,
   q => sub { ReadMode('normal'); exit(0) },
   DEFAULT => sub { print "That key does nothing\n"; },
};

my $func = $dispatch_for->{$char} || $dispatch_for->{DEFAULT};
$func->();

#4 Perl 5 Internals (PDF). Interesting reading on the intricacy part of the Perl itself. It was brought to my attention that Perl is a bytecode compiler, not an interpreter or a compiler.

#5 The 'g' key shortcuts in Vim. You will learn something new everyday, there are so many key bindings. Surprisingly, I only knew and regularly use two. Really needs to refresh and relearn this.

This Week I Learned - 2017 Week 13

Read the last week post or follow the whole series.

Night owl turned early bird messed up my sleep cycle badly. Nevertheless, the draft report have been completed and waiting for submission.

#1 Feeling nostalgia after watching the unboxing video of IBM PC AT and Model M. The sounds of the diskette reading and loading the data reminded me of the good old days of early computing period. I'm not sure what happened to our XT 8088 but I'm surely wish I can see it again and try to boot it up again. I did once during my college days but would really love to do it again after all these years. Back in those days, XT 286 is my dream machine and how I wish we have the financial means to upgrade to it. 


#2 Lots of Docker debugging for the past week and I learned quite a lot. It's the right time to setup my virtualization machine (more on this in coming week) and start looking into Docker.

When using Docker Compose, use `docker-compose ps` instead of `docker ps`. While both commands show the listing of the available containers, the former command will only list containers declared in the `docker-compose.yml` file, a subset of the all available containers. Best to go through all the Docker Compose CLI command line parameters.

Next, you want to read (or search) the content of a file in the docker container. See the example below. Yes, I know you can just simply use the `grep` command directly.
$ docker exec -i mycontainer cat /etc/hosts | grep localhost

#3 Setting up multiple SSL certificates using one IP address in Nginx. And also how to verify and read SSL certificate info from the console. Next is to configure Google Chrome to accept invalid certificate from localhost. Copy and paste `chrome://flags/#allow-insecure-localhost` to the address text box to access the setting. Instruction as shown below.


This Week I Learned - 2017 Week 12

Last week post or you can read the whole series.

9 hours of writing and only 3 pages done.

#1 The important of morning rituals in developing a system (install a habit) to achieve your life goals. Is good to be morning person as you can achieve quite a lot when your mind is fresh. There are these 7 morning rituals which I will slowly introduce to my daily life. These are:
  1. Plan a day before. I've been slowly adopting this habit by going through the list of items in my bag and write down what I need to do tomorrow. Not consistent though as for some day I failed to plan for anything.
  2. Wake up early. Either from 4:30 AM till 6:30 AM. This is doable provided that you sleep quite early on the previous day. According to this sleep calculator, these are the corresponding time you should sleep if you want to wake up at a particular hours.
    1. 04:30 AM - 7:30 PM or 9:00 PM or 10:30 PM or 12:00 AM
    2. 05:30 AM - 8:30 PM or 10:00 PM or 11:30 PM or 1:00 AM
    3. 06:30 AM - 9:30 PM or 11:00 PM or 12:30 AM or 2:00 AM
  3. Start the day with exercise.
  4. Do your highest priority projects. Study in the morning and reviewing again in the evening before bedtime. This is good for learning as you can recall and rethink what you've learned in the morning. Also? Before even you start your journey to work, you've already accomplished so much for the day.
  5. Work on your side projects. Definitely need to try this. Do not work on your side projects late at night. Do it in the morning.
  6. Have a uninterrupted conversation with your partner. Do we actually having any serious and uninterrupted conversation with our partner, even for just two minutes? Doubt so.
  7. Meditate. I've been doing this since the moment I woke up in the morning. Although for just a mere 10 seconds, slowly but surely I can really concentrate on it.
#2 Beautiful SICP. There is another Python version as well. The discussion is always revolves whether it's good or not. I haven't yet finish the damn book since I bought it 20 years ago. Is this year the year for me to finish it? Doubt so. Even though I placed the book next to my work place and look at it on daily basis. Also, SICP is also the recommended book (debatable) on the subject on programming in Teach Yourself CS. (via HN) While we on that, someone should start another list on Teach Yourself SE. My personal experiences is that Software Engineering knowledge far outweight the Computer Science knowledge.

Since we can all access good quality CS education through the Internet, does local CS degree still relevant today? Or does this means that universities or colleges have been rendered to just another platform for face-to-face socializing instead of gaining knowledge?

#3 Almost 15 years of Design by Contract. I can relate to the author experience and still is a firm believer of Design by Contract (DbC). Bertrand Meyer still have a huge influence on me. Like most things in life, moderation is the key. Use DbC only when necessary.

#4 Real-time LED strip visualization (see Gif animation below) using ESP8266 or Raspberry Pi. Not only the project was interesting, the detail documentation by the developer was impressive. Definitely one of the most solid Github project I've encountered.


#5 Alone in the Wilderness. (via Reddit) A documentary (search YouTube for the video) about Richard Proenneke, who upon his retirement at age of 51 years, build an ultimate man cave to live a life of solitude in Aslaka. Carpentry is such a underestimate skill a man could have.

#6 Interesting Git graph generated by Bit-Booster, the offline commit graph drawing tool from one of my personal Git repository. I'm not sure how to interpret the relationship of my commits, seems somehow broken?


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.

Samsung M2070W WiFi Printing with TP-Link Archer C7

It took me a while to finally set this up and to my amazement, this is actually quite damn simple. While there is another way to do it, through Samsung's Printer Settings Utility, unfortunately the `libnetsnmp.so.10` does not exists anymore in Ubuntu 16.10. Therefore, to get this to works, we have to resolve to WPS method.

There are three devices you will need to setup properly. These devices are your laptop, the router, and lastly the printer itself.

1. Install the Samsung printer driver in your Ubuntu system. You should be able to print through USB cable.

2. Next is to get the network configuration details of the printer, specifically the MAC address. From the printer buttons, Menu -> 4. Network -> Network Conf. -> Print? -> Yes. Jot down the MAC address.

3. Go to the router. DHCP -> Address Reservation -> Add New. Assign the MAC address in Step 2 to a fixed IP address so we always connect to the printer using a consistent IP address. Reboot the router. If you enable MAC filtering, do remember to white list the MAC address of the printer.



4. Again, in the router, we will need to enable WPS. Go to Wirelss 2.4GHz -> WPS -> Enable WPS. You may need to reboot the router again if WPS is not enabled.


5. Continue by clicking the Add device button. There are two options to add new device. Pick the second option and click Connect.



6. Go to your printer and press the WPS button for more than 2 seconds. Wait until the printer connected to the router. Once the printer is connected, you can disable the WPS in the router. You printer now will be part of your home network and assigned an IP address.

7. In your Ubuntu installation, open the browser the connection to CUPS management site at http://127.0.0.1:631. Go to `CUPS for Administrators` -> `Adding Printers and Classes` -> `Manage Printers` -> Select the printer you've install in Step 1 -> `Administration` -> `Manage Printer`. You will be prompted for login credential. Use the same credential when you login to Ubuntu desktop environment.

We're going to use the Internet Printing Protocol (IPP). While there are many printing protocols but for convenient sake, we will pick IPP. You can obtain the IPP full address from Step 2. It looks something like `ipp://192.168.0.123/ipp/print`. The IP address is set in Step 3.


8. Unplug your USB cable and print any sample test page from your laptop. If everything have been setup properly, you should be able to print wireless.

9. Additionally to enable Samsung Cloud Print, you can manage the printer remotely through SyncThru™ Web Service. Open up your browser and connect using these details. You will see this page if everything have been set up correctly.

Login : admin
Password: sec00000


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 08

Last week post or the whole series.

Interesting week where your body is giving up on you. Not only adequate and timely sleep is important, it's also crucial for you to keep alert, especially when riding a bike.

#1 Git merge vs. rebase. While I'm almost doing it on daily basis, yet I can can learn a few tricks from time to time. First, is to rebase local commits before commit. One of the mistake I did with another teammate while working on a topic branch is that we `git pull` instead of `git pull --rebase` before committing to the topic branch. Alternatively, we can rebase from remote topic branch before committing. Second, is that I always rebase from `master` branch but always have to resolve a lot of merge conflicts. Instead of rebasing, maybe I should merge instead?
$ git checkout branchX
$ git merge master
$ git rebase -i @{u} # @{u} stands for upstream
$ git push origin branchX

#2 Laura Vanderkam on gaining control of your free time. The key to time management is to focus on the priority. If you don't have time for something, then something is not a priority. If someone willing to pay you 100k for that task, then you will find time to do that task! In short, lacking time is not the actual reason, but you just don't want to do it. You are procrastinating.


How to find those priority items? Start with the end in mind. List down 3 to 5 items. Imagine writing your own performance review for next year for either personal or professional. Foresee what great things you're expecting. Now you've a list of items, how do you manage it?

Friday afternoon (is a low opportunity cost, you don't have to give up a lot). Make three categories, career, relationship, and self. Put two or three items into the three categories and plan these items for the next week. Normally, things aren't always proceed with what we planned.

168 hours. This is equivalent to 24 hours times 7 days. Typical breakdown of the hours spent per week for me are:
  • Work plus travel : 10 hours / day, 50 hours / week
  • Sleep: 8 hours / day, 56 hours / week
  • Total hours left: 168 - 106 = 62 hours / week, 8.8 hours / day
62 hours?! What was I doing all these years?

Having awareness is a key step for moving forward. The question right now is what can you do with those 62 hours? Schedule your items according to these 62 hours. Develop a system accordingly. Easy right? No, we're not busy, Sometimes, we're just plain lazy.

#3 Browsing through MSP430 Q&A in StackExchange's Electronic Engineering forum. Some interesting selected questions.
#4 ARM Cortex-M4. Another interesting microcontrollers which support 32-bit processing capability and quite a few number of brands to choose from. TI MSP432 LaunchPad and STM32 F4 Discovery Kit caught my attention. I prefer the later due to the embedded 2.4" QVGA TFT LCD screen. Will proceed with this microcontrollers once I've done enough with my MSP430.

#5 Dual in-line package (DIP) is one of the packaging types of integrated circuit. When switching different processor from the microcontrollers board, you will need a DIP extraction tool, the professional one. Due to budget constraint, I bought the cheapest I can find, roughly around MYR7.

#6 Buying a TV? The Cnet TV buying guide is best I've read so far. I was surprised to learn some of my generalizations regarding TV were far off. In short, at least 40 inches LED LCD TV with local dimming, full-array LED backlights, and dumb TV. Unfortunately, the recommended brand, TCL is not available in MY. Something interesting and coincident. While going through my photos, I've noticed I've took the same TV model at the same day at two different years. Maybe it's a sign for me to get that TV instead?

This Week I Learned - 2017 Week 07

Last week post or the whole series.

When come to getting new stuff, I really should have a one-item policy. For example, if I'm going to get a new bag, either I sell off the existing bag or donate it out. Otherwise, no point having two bags where you only going to use one. Not only is wasteful, it's also a hassle to store it and clean it as well. Something for me ponder upon when I'm thinking of getting any new stuff.

#1 Six modern keys to wealth. HN user, monodeldiablo describes six possible ways for anyone to accumulate wealth. In essence, you should be competent (both book smart and street smart), persistent (perseverance), and extraordinary lucky (right place, right time, and right people).

Developers are generally book smart but always having difficulties to monetize their projects or technical ability (turn it into a business). The most recent example is JWE, the author and maintainer for GNU Octave is looking for job after 25 years of maintaining the software (I think he is doing a great job since he have been doing it for 25 years but having some financial difficulties these few years). I've made a small contribution to him and being a FSF associate member can help too (just make a note in your monthly contribution). Expect some blog posts on GNU Octave in coming future.

#2 Coroutines in Perl? Use Coro module. More on asynchronous programming in Perl in coming posts. Busy week and I can't seem to allocate any time to look into this. So many things to follow up and so little time.

#3 Prioritize! Prioritize! This reminds me of Stephen Covey's four quadrants approach (similar to The Eisenhower Method) of prioritizing to-do list and time management.

#4 theXeffect subreddit. Fundamental approach to build habits and prevent procrastination. Also known as the "Seinfeld Strategy". Following Bombjoke advice, the steps as follow.
  • Buy a pack of index card. Get the one from Daiso with 5mm grid.
  • Start with Boléro by Maurice Ravel as your background music.
  • Pick a daily habit you want to develop. May I recommend meditation?
  • Write the reasons on why you want to develop the habit on the back of the card.
  • Start now. Do the habit. Once done, mark a big 'X' on the box. If you fail, mark a big 'O'.
  • Continue for 66 days or 2 months. A habit is formed after that period.
The index card by hardcase00 shown below is a good example to illustrate the steps mentioned. Look closely at the card. In order to continue the streak, he have different minimum meditation time ranging from 5 seconds till 15 minutes. Set your goal so low and easy that you don't have any excuses of not doing it. Remember the main purpose is not to focus on how long you can meditate but to develop a habit of daily meditation.



#5 Software developers who started after 35. I have mixed feeling about this. Is good that anyone who are diligent enough can pick up software development skill but Peter Norvig's post on teaching yourself programming in ten years reminded me otherwise. Well, it depends on how you see software development itself. Is it a tool for your to achieve your goal? Or a skill you wish to gain and master? Different people have different motivations.

#6 Is PostgreSQL good enough? (via HN) By far, best written technical post I've read this year. Sad about the font size though. Seriously, who read at such small font size? I've seen quite a few systems which can benefit greatly if they switch to PostgreSQL instead of MySQL. MySQL, being popular and easy to learn doesn't means that it's suitable for all scenarios.There are other requirements where PostgreSQL fits, for example, PostGIS. For a comparison between two to programming languages, MySQL is like dynamic-typed programming language and PostgreSQL is like static-typed programming language. If I'm going to develop any intranet web application which involves critical financial information, my first choice is definitely PostgreSQL.

#7 Goals are for Losers. Passion is Overrated. Provocative opinion but make sense. You need to implement a system or habit to achieve what you want in life. Not passions or goals. Example from the slide is losing 10kg is a goal but eating the right way is a system. To increase the success of what you want in life, use a system approach to acquire more skills which can increase your odd. Summary of this appraoch. Item #4 is also another good example of systematic approach increasing the success rate of what you want to achieve in life.

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

MSP430 - Serial Communication Monitoring

Follow up on last post, I supposed to write about usage of MSPDebug but instead we will discuss out capturing the output from the LaunchPad.

The default microcontroller, MSP430G2553 was pre-installed with a demo Temperature Measurement program. Once you've powered up the LaunchPad via USB port, the red and green LED will toggle alternatively. Pressing the P1.3 button (left to the blinking LEDs) will start the measurement. To reset back, press the reset button (right to the blinking LEDs).

Since the only visual indicator (did I mentioned I should have bought the other LaunchPad with embedded LCD?) of the program is through the LEDs, how to we obtain the measurement of the temperature? Basically using mspdebug, stty, and cat (similar post but with more descriptions)
$ mspdebug rf2500 exit
$ stty 2400 -F /dev/ttyACM0
$ cat /dev/ttyACM0

There are other ways to read or sniff raw data from serial ports but this is out of the scope of the discussion here.

Press the P1.3 button to start the measurement. You will obtain a series of characters as shown below. Each character is the numerical representation of the ASCII characters. P indicates 80 °F / 26.67 °C and Q indicates 80 °F / 27.22 °C.
QPQPQQQQQQQPQQQQQQQPQQQQQQPQQQPQQQQQPQQQQQQQQQ

From the output above and `dmesg` output when we plugged in the USB cable to power up the LaunchPad, the device will be assigned to device name of `ttyACM0` instead of `ttyUSB0`. TTY stands for TeleTYpewriter.
[21518.005311] cdc_acm 2-1.2:1.0: No union descriptor, testing for castrated device
[21518.005357] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device

Why so? Turn out for any USB communication devices like embedded microcontrollers or mobile phones, it's reusing an old control model called Abstract Control Model (ACM) for exchanging raw data. In other words, these devices were identified as modem and communication is done by reusing an old modem communication standard.

To reconfirm that, show all information on `/dev/ttyACM0' using `udevadm` command. For privacy reason, serial number have been replaced with `XXX`.
$ udevadm info /dev/ttyACM0
P: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/tty/ttyACM0
N: ttyACM0
S: serial/by-id/usb-Texas_Instruments_Texas_Instruments_MSP-FET430UIF_XXX-if00
S: serial/by-path/pci-0000:00:1d.0-usb-0:1.2:1.0
E: DEVLINKS=/dev/serial/by-path/pci-0000:00:1d.0-usb-0:1.2:1.0
/dev/serial/by-id/usb-Texas_Instruments_Texas_Instruments_MSP-FET430UIF_XXX-if00
E: DEVNAME=/dev/ttyACM0
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/tty/ttyACM0
E: ID_BUS=usb
E: ID_MM_CANDIDATE=1
E: ID_MODEL=Texas_Instruments_MSP-FET430UIF
E: ID_MODEL_ENC=Texas\x20Instruments\x20MSP-FET430UIF
E: ID_MODEL_FROM_DATABASE=eZ430 Development Tool
E: ID_MODEL_ID=f432
E: ID_PATH=pci-0000:00:1d.0-usb-0:1.2:1.0
E: ID_PATH_TAG=pci-0000_00_1d_0-usb-0_1_2_1_0
E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
E: ID_PCI_INTERFACE_FROM_DATABASE=EHCI
E: ID_PCI_SUBCLASS_FROM_DATABASE=USB controller
E: ID_REVISION=0105
E: ID_SERIAL=Texas_Instruments_Texas_Instruments_MSP-FET430UIF_XXX
E: ID_SERIAL_SHORT=XXX
E: ID_TYPE=generic
E: ID_USB_DRIVER=cdc_acm
E: ID_USB_INTERFACES=:020201:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=Texas_Instruments
E: ID_VENDOR_ENC=Texas\x20Instruments
E: ID_VENDOR_FROM_DATABASE=Texas Instruments, Inc.
E: ID_VENDOR_ID=0451
E: MAJOR=166
E: MINOR=0
E: SUBSYSTEM=tty
E: TAGS=:systemd:
E: USEC_INITIALIZED=21528600683

MSP430 - Setting Up LaunchPad Development Board with Ubuntu 16.10

Following up on previous post on MSP430 LaunchPad development kit. We'll proceed with setting the console-based development environment for MSP430 in Ubuntu 16.10. Once this is have been done, we will look into how to interact with MSP430 through MSPDebug via USB interface.

First, find all relevant packages for MSP430.
$ apt-cache search msp430
binutils-msp430 - Binary utilities supporting TI's MSP430 targets
gcc-msp430 - GNU C compiler (cross compiler for MSP430)
gdb-msp430 - The GNU debugger for MSP430
msp430-libc - Standard C library for TI MSP430 development
msp430mcu - Spec files, headers and linker scripts for TI's MSP430 targets
mspdebug - debugging tool for MSP430 microcontrollers

However, notice that the GNU toolchain for MSP430 in the repository is still using the old GCC version of 4.6.3. A newer version of the 5.x toolchain (maintained separately by different vendor) exists but you'll need to install it manually.
$ dpkg -L gcc-msp430 | grep bin | grep gcc-
/usr/bin/msp430-gcc-4.6.3

Install all these packages.
$ apt-cache search msp430 | awk '{print $1}' | xargs sudo apt-get install -y -

Open your console and run `dmesg` command in tail mode.
$ dmesg -w

Plug in and power up the LaunchPad to your USB port. By default, MSP430G2553 will have a demo temperature measurement app installed. Once you've connected through USB, there still be a sequence of LED blinking between red and green color. To stop that, please the P1.3 button to start the Temperature Measurement mode (I've no idea what this, just follow the Quick Guide).

Output of `dmesg` as follows. Note I've removed the serial number for privacy reason.
[ 2407.555756] usb 2-1.2: new full-speed USB device number 6 using ehci-pci
[ 2407.687908] usb 2-1.2: New USB device found, idVendor=0451, idProduct=f432
[ 2407.687913] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2407.687917] usb 2-1.2: Product: Texas Instruments MSP-FET430UIF
[ 2407.687920] usb 2-1.2: Manufacturer: Texas Instruments
[ 2407.687922] usb 2-1.2: SerialNumber: 
[ 2407.695830] cdc_acm 2-1.2:1.0: No union descriptor, testing for castrated device
[ 2407.695858] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
[ 2417.806759] hid-generic 0003:0451:F432.0004: usb_submit_urb(ctrl) failed: -1
[ 2417.806843] hid-generic 0003:0451:F432.0004: timeout initializing reports
[ 2417.807991] hid-generic 0003:0451:F432.0004: hiddev0,hidraw0: USB HID v1.01
Device [Texas Instruments Texas Instruments MSP-FET430UIF] on
usb-0000:00:1d.0-1.2/input1

The device, MSP-FET430UIF, is an external USB hardware debugging device but I'm not sure why the embedded USB interface was using the same serial number. Maybe it's using the same chipset? Also, you can probably ignore the error message in the log as we can connect to the board without issue.

You can also check the device id using `lsusb` command.
$ lsusb | grep Tool
Bus 002 Device 009: ID 0451:f432 Texas Instruments, Inc. eZ430 Development Tool

# More verbose details
$ lsusb -v -d 0451:f432

To connect to the board through the USB interface and MSPDebug program. Run this command and observe that the blinking LEDs have stop. Why we use `rf2500` driver? Turn out that the MSPDebug tool was originally written for EZ430-RF2500. The drive name was confirmed by showing the list of USB devices through MSPDebug. Again, serial number was removed for privacy concern. The bus:device number (002:011) may be different every time you plug in the USB cable.
$ mspdebug --usb-list | grep 2500
    002:011 0451:f432 eZ430-RF2500 [serial: ]

There are several ways to connect to MSP430. First way should be sufficient enough.
$ mspdebug rf2500

# Using bus:device id
$ mspdebug -U 002:011 rf2500

If there are no other errors, you should see below results.
MSPDebug version 0.22 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2013 Daniel Beer 
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Trying to open interface 1 on 007
rf2500: warning: can't detach kernel driver: No data available
Initializing FET...
FET protocol version is 30394216
Set Vcc: 3000 mV
Configured for Spy-Bi-Wire
fet: FET returned error code 4 (Could not find device or device not supported)
fet: command C_IDENT1 failed
Using Olimex identification procedure
Device ID: 0x2553
  Code start address: 0xc000
  Code size         : 16384 byte = 16 kb
  RAM  start address: 0x200
  RAM  end   address: 0x3ff
  RAM  size         : 512 byte = 0 kb
Device: MSP430G2xx3
Number of breakpoints: 2
fet: FET returned NAK
warning: device does not support power profiling
Chip ID data: 25 53

Available commands:
    =           erase       isearch     power       save_raw    simio       
    alias       exit        load        prog        set         step        
    break       fill        load_raw    read        setbreak    sym         
    cgraph      gdb         md          regs        setwatch    verify      
    delbreak    help        mw          reset       setwatch_r  verify_raw  
    dis         hexout      opt         run         setwatch_w  

Available options:
    color                       gdb_loop                    
    enable_bsl_access           gdbc_xfer_size              
    enable_locked_flash_access  iradix                      
    fet_block_size              quiet                       
    gdb_default_port            

Type "help " for more information.
Use the "opt" command ("help opt") to set options.
Press Ctrl+D to quit.
(mspdebug)

When you first execute the MSPDebug program, the temperature measurement app in the MSP430 will halt and waiting for your next command. To resume its execution, just type `run` command and the LEDs will start blinking. (provided you don't activate Temperature Measurement mode).
(mspdebug) run
Running. Press Ctrl+C to interrupt...

More to come as we will explore more and different usage with MSPDebug.

MSP430 LaunchPad - Introduction to Low-powered Microcontrollers Development Board

Two months ago, I was working on an assignment which involved writing code for a simulator where the targeted machine was a microcontroller (also known as MCU or SoC). There were numerous issues with the project. One of such issue is using Interrupt Service Routine (ISR) to display the LED light at a specific interval and duration. There are numerious ways to solve this (I only found this after the submission), but we didn't managed to get it done right during that time. Furthermore, the main goal of the assignment was to let everyone experience a software engineering process through different team roles. Hence, correctness is not the priority here. Nevertheless, these unresolved issues piqued my interest on embedded programming and C/C++ programming languages. Also, my own self-exploration exposed me to different microcontroller kits available in the Maker community.

When come to microcontroller kits, Arduino Uno is the preferred choice right now due to its popularity, which again, is due to its beginner friendliness. But these comments by david-given (a), IgorPartola, wyager, Declanomous, david-given (b), and sotojuan at HN convinced me that TI MSP430 LaunchPad would be a better choice. Cheap (I've made a mistake purchasing the wrong LaunchPad kit, more on this later) enough and low-powered microcontroller for anyone to learn embedded programming and study hardware.

The next step is to purchase the microcontroller kits. Now, which MSP43X LaunchPad development kits? I bought the original LaunchPad kit, MSP-EXP430G2 for roughly MYR 50+ inclusive of tax from Element14. Make sure you add comment to the order form that the purchase is for personal use. Otherwise the sales person will have to reconfirm with you again. If you still remember I said I made a mistake picking the wrong kit. If I were to choose again, I will pick MSP-430FR4133 instead although it's more expensive. Two good reasons. First, the development board have an embedded Liquid Crystal Display (LCD). You don't have to buy an additional LCD display and going through the hassle of connecting it through the breadboard. Second, the MSP-EXP430G2 is not supported by GNU/Linux version of Code Composer Studio, the default Integrated Development Environment. These are not critical issues but just merely minor inconveniences. Videos below will show more details on the differences between two development boards.





The item arrived within 3 working days in a black box. The list of items inside the box is clearly explained by video below.


The full list of items are:
  • 1pc Quick Start Guide (slac432a)
  • 1pc MSP-EXP430G2 LaunchPad development board
  • 1pc MSP430G2553 microcontroller (with temperature measure demo app)
  • 1pc MSP430G2452 microcontroller
  • 1pc Mini-USB cable
  • 1pc 32kHz external crystal (I've no idea what this for even I've read slaa322c)
  • 2pc 10-pin PCB Connector (2 male/2 female)
  • 2pc LaunchPad sticker
One mildly interesting thing is the MSP430 part numbers. For example, the breakdown of the part number of microcontroller MSP430G2553 are:
  • MSP430 = CPU
  • MSP = Mixed Signal Processor
  • 430 = 430 MCU platform
  • G = Flash (value line) memory type
  • 2 = Generation 2 series where speed is up to 16 Mhz
  • 5 = Model within the generation
  • 5 = Memory configuration (RAM: 0.5K, ROM: 8K)
  • 3 = Variant of the devices
In the coming post, we will go through on setting the development environment in Ubuntu 16.10. Stay tuned.

This Week I Learned - 2017 Week 04

Last week post or the whole series.

What is like to reach the end of middle age and heading towards old age? Both good and bad. The good thing is after a perennial quest of what you want out of life, you finally have some ideas on what to pursuit. The bad? Eventually reality will catch up on you. Your body is getting weaker, both physically and mentally. Distractions or rather addiction to distractions to fend off. Resistances to stay focused due to our short attention spans (made worse by increase mobile phone usage). And never ending growing lists of to-do items to check off. Hence, before this coming Chinese New Year, I've decided to do some virtual "house cleaning", remove and clear off all those pending draft blog posts, my digital drives, and others. One of the post is Using ansible-lint with Git's pre-commit. However, nothing much can be written down this week as I've limited Net access.
#1 Why you shouldn't use delay function in embedded project (Arduino). You should use non-blocking function (also known as asynchronous function) or work along the hardware timer. Working with embedded project made me realized that I'm quite ignorant about programming with constraints and limited resources. Well, if you spent most of your web development time with PHP, I doubt anyone needs to worry much about optimization, just delegates to the frameworks.

#2 "Sometimes people fit snugly into a crack in the world that fits their shape, and sometimes no such crack exists." via HN. Very well written comment.