Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Setting Git with P4merge in Babun

In previous post, we have discussed on setting up Babun in Windows, the next step was to setup a good merging tool to work with Git. Good and free merging tool is essential when resolving conflict during rebasing or merging. There are several good tools but the one we're comfortable with is P4Merge.

If the `p4merge.exe` binary is not found within the Babun shell, then you've to update the environment variable `$PATH` to append to the exact location of the binary. This can be done through Windows' environment path as well. Since we want our Git configuration file `gitconfig` to be portable with minimum tweaking, we can opt to set direct path.

This is where `cygpath` comes in which will convert path between Unix and Windows.

If we want to find the Windows path to our default Babun installation directory.
$ cygpath -w /
C:\Users\foobar\.babun\cygwin

How about the Unix path for `p4merge.exe` binary.
$ cygpath -u "C:\Program Files\Perforce\p4merge.exe"
/cygdrive/c/Program Files/Perforce/p4merge.exe

To make sure Git can find `p4merge.exe` binary from Babun.
$ cygpath -asm "/cygdrive/c/Program Files/Perforce/p4merge.exe"
C:/PROGRA~1/Perforce/p4merge.exe

Next, set `p4merge` our default merge tool and the direct path to its binary.
$ git config --global merge.tool p4merge
$ git config --global mergetool.p4merge.path C:/PROGRA~1/Perforce/p4merge.exe

If you don't like the tab ordering of the merging windows, customize to your liking.
$ git config --global mergetool.p4merge.cmd \
    "C:/PROGRA~1/Perforce/p4merge.exe" $BASE $LOCAL $REMOTE $MERGED

Additionally, `cygpath` also have built-ins options to access default system paths in Windows.
$ cygpath
......
System information:

  -A, --allusers        use `All Users' instead of current user for -D, -O, -P
  -D, --desktop         output `Desktop' directory and exit
  -H, --homeroot        output `Profiles' directory (home root) and exit
  -O, --mydocs          output `My Documents' directory and exit
  -P, --smprograms      output Start Menu `Programs' directory and exit
  -S, --sysdir          output system directory and exit
  -W, --windir          output `Windows' directory and exit
  -F, --folder ID       output special folder with numeric ID and exit

You can access these path directly with Windows Explorer using `cygstart`.
$ cygstart `cygpath -D`

`cygstart` is a tool is used open almost anything. For example, web URL but you must prepend it with `http`.
$ cygstart http://google.com

This Week I Learned 2018 - Week 38

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

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

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

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

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

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


This Week I Learned 2018 - Week 05

Last week post or something from the archive.

New week and we're embracing the second month of 2018. The summer (for Southern Hemisphere, summer starts from December 1 till February 28 or 29) wind was blowing gently indicating the near of Chinese New Year. 活了大半辈子,原来南半球的季节正好跟北半球相反,真的是受教了!俗语说,“一年之计在于春,一日之计在于晨”, 自己要好好检讨及规划!

Going through my daily steps count, less activity this week due to sickness. Icy cold drinks during midnight and middle-age guy don't was not a good combination. But luckily we have long vacation, good to catch up with my needed rest and recovery. Comparison of total steps walked as illustrated below. (Yes I know the missing legend) Target for next week is to average out the steps till 5000 steps and above.


Dropsy and the whole body is pineconing? Nothing much we can do besides except humanely euthanize the fish. We lost three this week and unexpectedly the Blue Mable is going down also. The typical treatment is daily water changes combines with aquarium salt, Methylene blue, or Malachite green. We're not sure but I suspicious was due to overfeeding which leads to stress and constipation as well as infection.

When visited enough Aquarium shops, you will learn a thing or two. First, antibiotic powder (yellowish colour, suspect the main ingredient is Sodium Nifurstyrenate) usage was quite common especially expensive tropical fish like Discus (not a fan and seriously, a moving water pancake?!). Second, fish sellers in Market Road packed their fishes in plastic bags treated green water (suspect is Malachite green) and unpack it again in plastic square tank for selling each water in plain water. You can achieve profit if you can sustain the longevity of the fishes until they are sold to the customer.

More conversations breeders. It seems that female Bettas are far more expensive than male and fellow breeders don't want to sell their precious female Bettas to retain their quality breed of lines. Only for those who have financial gains from doing this. I wish more breeders should focus partially on the locally Malaysian Bettas. There is one breeder and I wish him all the best. Wild Bettas found locally may not be that colourful but it's good to breed and increase the population.

You know the play was so good that even the opposite bench players applauded it. This reminded me of Kobe Bryant's baseline reverse dunks. Along with Giannis AntetokounmpoBen Simmons is another NBA player to watch out for in the coming few years. Only time will tell.

Too many blockchain wannabe tech startups in Malaysia. Enough said. The never ending of startups chasing the next hype cycle.

How do you unstaged changes in Git? There are cases where merging or rebasing kind of messed up and you're left with a list of modified files.
$ git stash save --keep-index --include-untracked

Meanwhile, you can clean up your local working repository in Git through interactive mode or Git clean interactive.
$ git clean -di

The list reduction functions in List::Util. Some good examples:
$foo = reduce { $a > $b ? $a : $b } 1..10       # max
$foo = reduce { $a gt $b ? $a : $b } 'A'..'Z'   # maxstr
$foo = reduce { $a < $b ? $a : $b } 1..10       # min
$foo = reduce { $a lt $b ? $a : $b } 'aa'..'zz' # minstr
$foo = reduce { $a + $b } 1 .. 10               # sum
$foo = reduce { $a . $b } @bar                  # concat

More effed up stuff in our beloved MySQL. This time, "SQL Error (1451): Cannot delete or update a parent row: a foreign key constraint fails ....". To quote from the documentation (emphasis added),
If ON UPDATE CASCADE or ON UPDATE SET NULL recurses to update the same table it has previously updated during the cascade, it acts like RESTRICT. This means that you cannot use self-referential ON UPDATE CASCADE or ON UPDATE SET NULL operations. This is to prevent infinite loops resulting from cascaded updates. A self-referential ON DELETE SET NULL, on the other hand, is possible, as is a self-referential ON DELETE CASCADE. Cascading operations may not be nested more than 15 levels deep.

In other words, self-referenced foreign key(s) or recursive deletes doesn't work in MySQL (it WORKS in a PROPER database management system like PostgreSQL). You have to create another new table to link the relationship, something like many-to-many data model. If you needs deep nested hierarchy data structure, use Closure Table.

This Week I Learned - 2017 Week 41


Last week post and something else from the archive.

Slow week. Too many pending stuff that needs my urgent attention and got sidetracked into firefighting some unplanned work.

So much I've learned regarding audio stuff. Some are hard lessons. First, active (or powered) and passive speaker have different features and usages. When you're getting a standalone DAC or DAC/Amplifier combo, make sure the DAC have enough output terminals. For example, passive speakers need two pairs of left and right output terminals where each pairs is channeled out to each speaker. Good comparison is the popular JBL LSR 305 and Pioneer SP-BS22-LR. See screenshots of the input terminals for each speaker.

The JBL LSR 305 only have two types of input, XLR and 6mm jack.


Meanwhile, the SP-BS22-LR have both positive and negative terminals. You will need to connect speaker wires to transfer the sound signal to both left and right speakers.




Second hard lesson. Not all amplifiers are created equally. Bookshelf and tower (floor-standing) speakers needs different output watts to produce optimal sound output.

After so many days, managed to finish Neil Gaiman's American Gods  book. Sadly, the TV series does not really live up to the book expectation (maybe due to limited budget?).

Use the `git stash` command correctly. Differentiate between `git pop` (apply and remove) and `git stash` (apply and keep in stash cache).

This Week I Learned - 2017 Week 34

Last week post or the old archive stuff.


Having a working and non-disrupting battle station have finally let me able to concentrate on my personal stuff. There are a lot of things to clean up and de-clutter but one thing at a time. At least I can sync up the productivity at both work and home.


Lots of re-learning of ConTeXt, after so many years away from it. The number one rule in using ConTeXt, you must append a comma (,) in a list of items. Not sure why, but I was burned several times where the intended results were not obtained regardless numerous times of trials and errors.

This will not work.
\setuphead[subject][
    textstyle=cap,
    header=empty,
    alternative=middle,
    style=bold
]

This will work.
\setuphead[subject][
    textstyle=cap,
    header=empty,
    alternative=middle,
    style=bold,
]

Undo certain Git commit. Two steps involved. First is to reset or remove the particular commit and push the changes to remote origin. Second, pull from the remote origin and reset the index.
$ git reset 7f6d03 --hard
$ git push origin -f

$ git fetch origin
$ git reset 7f6d03 --hard

Finally, found the effective way of managing your dotfiles and the full write-up describes the details on how to set it up, either new or existing Git repository. Good example where the lack of understanding of Git undermines the effective usage of managing your dotfiles. There is no need for external programs to manage your symlink and updates. Just plain old Git. The hassle and complexity of managing your development environment setups (I've tried a few ways) is not worth the time and efforts.


People, this is how you design a login or registration form.



Installed, uninstalled, and reinstalled the Vim package. Somehow the path to Vim binary have been messed up. However, update the Bash's hash table of full path names of executable files seems to solve it.
$ vim
-bash: /usr/local/bin/vim: No such file or directory

$ which -a vim
/usr/bin/vim

$ hash -r

Somehow my Vim installation does not support Python plugins. Some googling here and there revealed that I have multiple implementation of Vim installed in the system. The default selected Vim binary does not support Python plugins. The only way is to update the alternative.
$ sudo update-alternatives --config vi
There are 3 choices for the alternative vi (providing /usr/bin/vi).

  Selection    Path               Priority   Status
------------------------------------------------------------
* 0            /usr/bin/vim.gtk3   50        auto mode
  1            /usr/bin/nvi        20        manual mode
  2            /usr/bin/vim.gtk3   50        manual mode
  3            /usr/bin/vim.nox    40        manual mode

Press  to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/vim.nox to provide /usr/bin/vi (vi) in manual mode

$ sudo update-alternatives --config vim
There are 2 choices for the alternative vim (providing /usr/bin/vim).

  Selection    Path               Priority   Status
------------------------------------------------------------
  0            /usr/bin/vim.gtk3   50        auto mode
  1            /usr/bin/vim.gtk3   50        manual mode
* 2            /usr/bin/vim.nox    40        manual mode

Press  to keep the current choice[*], or type selection number: 2


People start hating their jobs at age 35? (via HN) The best possible reason is that they become very aware of mortality and realize time move at a relatively faster pace.


How the RPi::WiringPi distribution is tested. You have to be amazed by the effort the author is putting in ensuring the quality of the libraries. Probably one the most meticulous developer I've seen online. The hardware setup is shown in the screenshot.


Don't like any ready-build electronic prototyping platforms? You can try Shrimp parts kits. I love the minimalist approach of gathering different electronic components and build something up. Good alternative to Arduino. The step-by-step guidance, for example, to blink an LED, is a good introduction for any beginner (yours truly) who want to pick up some electronic.

This Week I Learned - 2017 Week 32

Last week post or something from the old TWIL archive.


Everything should be back on track this week after the "nature appreciation week". Lots of pending items to be checked off. Luckily, a few long delay items have been cleared off. As they said, one thing at a time. If you can't do it today, continue tomorrow but do not postpone for more than two days. Keep the streak going!

I've been quite effective in applying Scrum or Kanban at my workplace. Sadly, I can't say the same about my personal projects. What if I can obtain the same efficiency at my own stuff? Surely I will be surprised by the results. Lately, I have been thinking about what are the effective ways to get the best of each day, either at workplace and home. Discipline is definitely a must, of course with effective system. Another approach is to focus on overlapping what you done at work and your own personal projects. Focus on the important stuff, one thing at a time. Throw it the work life balance as well. Sometimes you just need to walk away from anything and just to unwind and recharge.


Invest in your own learning. Julia Evans shared her thought on this matter on keeping learning outside working hours. Learn and read something new but relevant to your work. That's it. However, it's best to set a time after work, for example, half an hour and learn or work on something new. This may sound easy but it's quite hard to do it in a constant manner. Consistency is always hard. Self-discipline is always hard.


What would you do if programming is made illegal overnight? Be a problem solver. Or do something else other than development works. There are millions of problems that need to be solved and and you can leverage your programming or IT knowledge one way or another. During the nature appreciation week, I've thought and discussed about this with my younger peers during the whole trip. Unfortunately, we are still caught into the tribalistic pressure or social conditioning in the name of team work or company culture. Someone told me before when I was starting out as a programmer, pick your battles, not everything is worth fighting for. These battles here refers to the things you want to do in your life, your bucket list, or something meaningful. And off course, at the same time, without starving yourself.


The morning paper and the Arxiv Sanity Preserver. I love reading research papers, even though most of the time I can't really understand most of it, especially those not within my domain of expertise. But the morning paper site makes everything fun and bearable. Beware, energy, attention, focus, and time are scarce, use it properly on things that matter to you. That's why social media are big time waster unless you're working in the digital content industry.


Ligne claire. French of clear line, the art style used by many illustrator, especially Moebius. Most recent illustrator who follows such style is Josan Gonzalez.


Money has a way of being the perfect "excuse" for vicious people to expose their viciousness. Interesting digression from the forum discussion which turned dark half-way.


Git bisect, the proper workflow. Didn't realize such things exists and probably won't bother to pick it up.

This Week I Learned - 2017 Week 31

Another week, another post. Looking for last week post or something from the archive?


The annual nature appreciation week. Didn't realize that such a place exists in this country. I really need to brush up my local geographical knowledge. However, nature should be explore in its natural form, as in camping, not from some resort built near to it.  And the food, that's a lot to be desired. Pity though.


Fighting with idiotic MySQL 2013 lost connection error for the past week with the Docker instance. Tried different approaches to tweak the server so the database restoration process won't kept throwing such error. In the end, proceed with Plan B approach by changing the mysqldump script so that it will skip extended insert. The side effect of such approach is that the dump file will be bigger and database reloading will take longer. But something working even though slow is way better that something broken. In coming weeks, will look into different approaches, for example, putting the whole test databases in memory (using tmpfs approach which can speed up testing), mysqlpdump (parallel version of mysqldump), or using ProxySQL.


Scientific communication as sequential art. I hope one day that the academic world will publish literature in more readable and accessible way. Actually it's not that hard, some common sense with certain good "taste".


Unit circle. After living for so long, I finally grok trigonometry and understand what the heck is sine, cosine, and tangent.


If you've fork a repository and want to sync from the remote upstream? Two steps. First, set up the remote upstream URL. Second, sync the fork from the upstream.

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

This Week I Learned - 2017 Week 25

Last week post or you can explore the archive.

Writing and nothing but writing. Imagine starting from 8 in the morning until 12 in the night, minus the eating time and occasionally short breaks, you have to write up something to fill the remaining 12 pages. Staring at the monitor for 16 hours non-stop will definitely depleted you and causing much stress, especially to your eyes. The sudden and urgent feedback caught me by surprise. Totally messed up my daily routines. The aftermath of this last minute changes is you have become wordy, like one of those week I've experienced before. Therefore, this week blog post will be a bit wordy than usual.

One hard lesson I've learned during this writing period, reading and lots of reading is essential for writing. There is no way for you to churn out anything fast, if you don't even have a clue on what you're going to say. Want to be a better writer? Be a better reader. Reading a technical paper and a fiction requires different strategy. The former needs a systematic and structural way of extracting information. The later, you just need to use your imagination and indulge with it.

Another one. Statistics is very important, far more practical and relevant than other branches of mathematics. You never know when you going to need it, but when you do, you really do! Time for relearn and pick up some statistics.

The next lesson? I think I finally and partially understand what the heck is methodology, which in short, a set of practices or procedures. To explain in another way, a step-by-step procedure on how you going to tackle a particular problem. Particularly, you have to explain when, where, and how you're going to carry the procedures. It changed how I read, understanding, and absorb information. In the end, all the details, some ways or another, are transformed into a flow chart.


Back to the regular weekly ramblings.

Via Reddit. World oldest gymnast, Johanna Quaas, 91 years old to be exact. Nothing but good genetics, healthy and active lifestyle, be independent, and how to age gracefully. There are so many ways your body will let you down and kill you when you age. Genetics aside, which is out of our control, this is definitely doable, you just need to have the persistent and patience to do it. Seems that cycling is preferable than running, if you don't want to damage your knees due to running.


Do you plan your next day ahead? I've been facing the same problem in organizing my life. It's a long tedious process of trying different organizational systems (Four Quadrants / Eisenhower BoxGTD, Bullet Journal, and Pomodoro) to see which one sticks. Typically, nothing stick for a long time, after a while, you will drifted away and back to your old self. The main issue procrastination. You're aware of the priority, but don't feels like doing it. Then it dawned to me that time management is actually mood or mind management. If you need to to something important, schedule it at the time where mentally you're most alert and aware. For example, early in the morning when you first woke up is probably the golden hour of productivity.

Maybe the mentioned systems are way complicated as it can lead us to overly micro planning. Remember, there is no one true system, it's a mixed of everything with some adaptation. Why not going analogue and low tech with a simple pen and paper. Jot down your to-do list, prioritize, try to get things done within that day will work. Not every day is a perfect day. Accept it. Not everything will be completed within that day. Reschedule the unfinished tasks to the next day. For more refinement, break the day into four sessions of morning, afternoon, evening, and night.

Regardless how you optimize your day, the first thing is to plan ahead, way ahead like life goals from 6 months to 30 years. The longer the planning, the more you will aware that most things don't matter that much in life eventually. I agreed with the poster's four assumptions, especially that "productivity is getting the most important things done" and "most people don't have that many things they truly want to accomplish.".


Classic Papers: Articles That Have Stood The Test of Time. Collection of ten most cited papers from different area of research. Unfortunately, only from 2006. It would be nice the paper can be extended from far longer before 2006, say from 1900. Interesting found was this paper, Who should fix this bug? where the author was using machine learning to semi-auto assign a reported bug ticket to the a developer.


LaTeX, where what is hard is easy, and what is easy is hard. Editing LaTeX file with Vim? Plenty of errors that you probably needs to amend to make it go away. Generating PDF file and the page dimensions seems off? Readjust the page margin dynamically. Sigh. No matter how much I love typesetting, the hassle and effort of tweaking the layout is not worth the time.


When using Git, branching is easy and cheap. Two things that I need to use quite often when merging changes from different branches. First is create more throwaway branches and squash merge using the `--squash` parameter. Second is cherry picking using the -n parameter. Both ways do merge but not commit the changes.

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 18

Last week post or you want to read through the whole series.

Since the prevalent of Internet these days, we're more connected that ever. And yet, we're even more isolated. More and more shopping malls and residential areas are being built especially around the transit stations. Basically all looks the same and people are discourage to travel to another town anymore because everything is available either online or at your nearest malls.

Sick. Down with fever. It has been a while since last time. No one but myself to blame. For people around my age, good rest and food is a way to healthy life. We're not seeking prolonged life but prolonged health.

#1 So, what's your Plan B? Good discussion from the comments. While there is some sort of discrimination against older programmers, but the reality is older programmers may just burn out or bore doing the same mind-numbling stuff over and over again. Yes, the same sh*t but different day. Not everyone have the opportunity to work meaningful projects (yes, subjective view), but most of us just work on some glorified spreadsheet or database skin. You see the same mistakes repeated over and over again from different systems and it's just pointless or bother to raise it up again.

#2 On becoming a low-level programmer. There is a curated list of information especially on the hardware part.. There is also another list of learning the fundamental of computer science. So many things to learn and explore and yet, so little time. Sometimes the reality of life commitments limit our choice on the thing we want to pursuit. I need to finish everything by July before I can start to clear the list from my bucket list. One step at a time. Follow the system.

#3 First, make it work, then make it right, and finally, make it fast. Get the thing to work first before you're thinking about making it right (giving the right name) and optimize it. Fulfill the requirements of the stakeholders first (prototyping) before you're looking into doing it right and fast. Something I need to remind myself constantly as we're often obsess with perfection. What's the point if your build it the right way and fast but does not meet the stakeholder needs?

#4 How to write a REST client in Perl. Most Perl modules have limited documentation, for example, little example on how to use the APIs. This is where PHP (it has been so long since I mentioned something about PHP) really shines. As the language is slowing dying, there are little or no good example on how to start something up fast.

Meanwhile, something rather interesting about Perl. I've seen quite a few Perl codes with subroutines that prepended with ampersand (&) operator. Basically, the ampersand is needed if you're calling a subroutine before its declaration. Off course, there are many other reasons and usages to use the ampersand, but commonly as reference to a subroutine.
&hello;

sub hello {
    print "hello";
}

When using OO with Perl, you will need to instantiate the constructor or method invocation through the arrow (->) operator (a reference). Good examples given below.

Using the arrow notation or virtual method.
my $apple = Fruit->new("apple");
$apple->get_price('usd');

Using the double colons notation or static method.
my $apple = Fruit::new("apple");
Fruit::get_price($apple, "usd");

However, to invoke the method either statically or virtually, you'll need to write the constructor as follow.
sub new {
    my $self  = shift;
    my $class = ref($self) || $self;
    return bless {}, $class;
}

#5 "error: src refspec master does not match any." Silly me. You need to commit something locally before pushing to remote Git server.

#6 Tiny Python Notebook. Definitely not tiny but quite comprehensive guide to Python 3.6.

#7 How to unstage all staged files in Git? It's so easy that the best answer is not upvoted enough.
$ git reset

#8 Postgres Weekly. When come to FOSS database choices for web application for Intranet application, I'm strong opinion that PostgreSQL should be the default choice. Feature like Range Types and others solves quite a lot of issues and save lots of developer-hours. Yes, MySQL has its own usage, but for any business application which involves monetary and strong ACID compliance, it's not a right choice.

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?

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 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?

Using ansible-lint with Git's pre-commit

While browsing randomly, I stumbled upon the linter for Ansible called, you guess it, ansible-lint. However, another interesting utility came up called pre-commit, which is a framework to manage your Git's pre-commit hooks.

Installation is simple. Use `pip` to install it.
$ sudo -H pip install pre-commit

Create the config file, `.pre-commit-config.yaml` and add the content below.
- repo: https://github.com/willthames/ansible-lint.git
  sha: v3.3.3
  hooks:
    - id: ansible-lint
      files: \.(yaml|yml)$


Install the necessary tool.
$ pre-commit autoupdate
Updating https://github.com/willthames/ansible-lint.git...already up to date.

Install to the repository's `pre-commit` hook.
$ pre-commit install
pre-commit installed at /home/ang/src/dotfiles-ansible/.git/hooks/pre-commit
$ git commit
[INFO] Installing environment for https://github.com/willthames/ansible-lint.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...

This Week I Learned - 2017 Week 01

Last week post or the whole series.

First week of the new year 2017. A busy and slow week. Busy because wrapping up most of the pending to-do list. Slow due to the progress of clearing up the list. When you're overwhelmed by numerous tasks at hand, the best way is still sleep over it. You can't do much with a tired mind, especially at my age now. You can accomplish lots of thing with a good sleep and fresh mind in the wee hours in the morning, roughly around 4:30 a.m.


Did something happened in July? Darker green means more steps and lighter green, the opposite. To the best of my recollection, I've misplaced my pedometer and resolved to use Google's Fit step counter, which is not entirely accurate. Typically offset by half against my pedometer.

#1 Remember about last week post on adding extra options so we compile the sample D source code? The extra options can be added to the `dmd.conf` configuration file. Following these steps to add them to `dmd.conf` file so that you won't need to type them again and again.

Copy the config file to your home directory
$ cp /etc/dmd.conf $HOME

Append the options, `-fPIC -defaultlib=libphobos2.so` to `DFLAGS` variable.
[Environment32]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import
-L-L/usr/lib/i386-linux-gnu -L--export-dynamic -fPIC -defaultlib=libphobos2.so

[Environment64]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import-L-L/usr/lib/x86_64-linux-gnu
-L--export-dynamic -fPIC -defaultlib=libphobos2.so

#2 Some new concepts in Modern C++. What is this Resource acquisition is initialization (RAII) I kept reading about? It's a programming idiom is about safe resource management and in C++, through an object's lifetime. Resources are initialized and acquired in object's constructor and released through object's destructor. In other words, resources are cleaned up when the scope of code have exit. See the diagram below for further understanding. Other programming languages implemented this idiom through a try/finally block instead through an object's destructor.


Second, is the concept of template. As C++ is a statically typed programming language (type checking is done at compile-time rather than run-time, see this good example), when you declare or initialize any variables, you need to specific a data type. What if you need to pass in a variable to a function which can accept different kinds of numeric data, an integer or and a floating-point number? This is when you will use template to specific a generic type.

Example of the function templates is shown below. You can pass in different kind of data types like integer, floating-number, or character.
#include <iostream>
using namespace std ;
//max returns the maximum of the two elements
template 
T max(T a, T b) {
    return a > b ? a : b ;
}

While we're at Modern C++, there is a list of resources which can get you started as well as the C++11/14/17 feature list. For learning C++ today, the minimum standard you should follow is C++11.

#3 Instead of listening to music while coding, why not listen to development related podcasts like Software Engineering Radio, The Changelog, The Bike Shed, or FLOSS weekly? All this better than some annoying pig squeal and snort noises.

#4 Accidentally messed up my commit dates while testing Git. Need to updates some old commits. However, you have to force push to override the history.
$ git filter-branch --env-filter \
'if [ $GIT_COMMIT = f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 ]
then
    export GIT_AUTHOR_DATE="Sun Jan 7 01:02:03 2017 +0800"
    export GIT_COMMITTER_DATE="Sun Jan 7 01:02:03 2017 +0800"
fi'

$ git push -f origin master

And to remove all the uncommitted files from your project, you can use this Git command. However, be careful as it also remove my Vim's swap files (.swp). Did I forget to set a global path for all Vim's swap files?
$ git clean -d -f -x

#5 As I'm starting to build something in C++, creating and maintaining a Makefile is quite a hassle. Luckily we have CMake which helps let us bootstrap the Makefile fast. One thing I've learned when using CMake is compile and build your program in a specific folder. This will prevent all the temporary files generated by CMake from cluttering your root folder.
$ mkdir build && cd build
$ cmake ../
$ tree -L 1 .
.
├── CMakeCache.txt
├── CMakeFiles
├── cmake_install.cmake
└── Makefile


This Week I Learned - 2016 Week 50

Last week post or the whole series.

Two more weeks to go before we close the chapter for the year 2016.

Am I a good programmer? Think again, it's not just you but the remaining 99% of developers as well. The key point here is stop comparing, but instead identify the gap, and work out a plan to reduce the gap. This is doable provided that you realize what HN user, socmag advised that "...program if you enjoy it. Everything else will come. Financial reward is a side effect, not a cause.". Otherwise, just do something else. YOLO. Maybe rephrase the question, ask yourself, am I having fun? Need more advice? Read through similar discussions in HN.

Discipline is sustain through repeating a specific behaviour. How can we develop this systematically? Pick and develop ONE habit. Start small and start seriously. Don't overwhelmed yourself. Do it on daily basis and no more zero day. Anything is better than do nothing. Walking is better than sitting at the couch. Running is better than both. While we at it, get consistent sufficient sleep and rest. Try meditation to enhance your awareness and mindfulness as well. Follow the cue/craving -> response -> reward cycle suggested by Charles Duhigg. Do this for 66 days instead of the conventional 21 days. Also, another good write-up on building habit. Good luck!

Learning modern C++? So many resources, unfortunately, mostly are outdated and some still use Turbo C++. It seems C++ also suffered the same fate as Perl, hence, Modern Perl books was written. Then where can we obtain up-to-date information? Arne Metz suggested a few sites to check out for a start.
Follow up on implementing Full-text searching (FTS) in MySQL in week 48. The SQL example given there only suitable for searching exact keyword. What if you want to search partial word matching instead ala SQL LIKE operator? This is possible using asterisk (*) and BOOLEAN MODE modifier. Under this mode, the asterisk (*) is a wildcard operator, as in '%' in SQL. Example as shown.
SELECT name, MATCH(name) AGAINST('bio*' IN BOOLEAN MODE) AS relevance
FROM subjects
WHERE MATCH(name) AGAINST('bio*' IN BOOLEAN MODE)
ORDER BY relevance DESC
LIMIT 10

Something interesting on Git encountered this week. As I was git pulling the source, the unpacking process was so slow and I killed it with Control+C. The issue by doing this is that you've a lot of dangling commits or blob.
$ git fsck
Checking object directories: 100% (256/256), done.
Checking objects: 100% (540/540), done.
dangling blob f7c89a6a3fd135a16531bd776ecf04dcc9096cc1
dangling blob c66981a6cc4b877e1fe2064e6423c21831e308b3

To clear these dangling blob, you will need to clean up. Later I found out that unpacking was slow because there are a lot of binary files (graphic files) were added.
$ git gc --prune=all
Counting objects: 953, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (541/541), done.
Writing objects: 100% (953/953), done.
Total 953 (delta 392), reused 498 (delta 204)

Branching is cheap and free for SCM like Git. This is one concept I forgotten and during the last sprint, having two developers working on a single branch maybe not be a good idea unless both of you are can resolve conflicts correctly, do not rebase from master branch until testing, and squash your commit before merging as shown below.
$ git checkout featureX
$ git merge --squash featureX-dev1
$ git commit

Reflection on being a developer after 40. Most of the advices he gave were spot on especially choosing the galaxy (technology stack) wisely and open spaces office is crap. Yes, open collaboration my big foot, open noises would be the right description.

Learning Perl? Need to advance your Perl knowledge? Read Advanced Perl.

This Week I Learned - 2016 Week 48

Last week post or the whole series.

December. How fast the time flies as we're approaching the end of the year 2016. Four more weeks to go and we will embrace the new year 2017. Yet, there is so much more to do here and there.

Full-text search (FTS) support for InnoDB was added in MySQL since version 5.6. While is a welcoming feature, especially those who don't want to use third party search engine like Sphinx or Apache Solr, there are still some default behaviours that you'll need to be aware of. First, there is this minimum and maximum word length to be indexed. By default, the minimum word length is three. If you need to produce results with two word length, consider adjusting the server settings and restart it later. Next, you can enable stop words being indexed. Stop words are common words in the language likes "the", "is', or others. Both settings are discussed here in good details.

Looking for FTS full examples, do look into Gutenberg book searching or song searching implementation. For a quick example, below SQL query is good enough for you to get started using FTS through multiple tables.
SELECT *, 
    MATCH(books.title) AGAINST('$q') as tscore,
    MATCH(authors.authorName) AGAINST('$q') as ascore,
    MATCH(chapters.content) AGAINST('$q') as cscore
FROM books 
LEFT JOIN authors ON books.authorID = authors.authorID 
LEFT JOIN chapters ON books.bookID = chapters.bookID 
WHERE 
    MATCH(books.title) AGAINST('$q')
    OR MATCH(authors.authorName) AGAINST('$q')
    OR MATCH(chapters.content) AGAINST('$q')
ORDER BY (tscore + ascore + cscore) DESC

On SQL. Sometimes the solution was so simple that we have overlook even the basic default feature. If you want to find the unique and maximum row by each group which sorted overall, the direct approach is just use MAX aggregate function. Example as shown below. Another approach is to use user variables, not my preference though.
SELECT t.client_id, MAX(t.points) AS "max"
FROM sessions t
GROUP BY t.client_id 
ORDERY BY MAX(t.points) DESC

Want to retain the order of the SQL query in your `IN()` operator? Use MySQL `FIELD()` function. Example as shown.
SELECT * FROM table ORDER BY FIELD(ID,1,5,4,3);

Perl Advent Calendar 2016 have started. I've mixed feeling regarding the first day post before Christmas. Till today, we still don't have a graphing feature built-in to visualize class relationships for any IDE out there for any less supported languages. And yet, we still needs to rely on Graphviz to visualize it. While Graphviz is an excellent tool, it lacking one crucial feature, better automatic diagram layout, something similar to yWorks' yFiles library.

Which Git workflow should you use? Gitlab have a discussion on different workflows. For me, master branch is always deployable approach seems to work for me. This HN user describes it succintly. Key points are:

1. Master branch is the deployable branch
2. All new features and developed in feature or topic branches.
3. Continiously rebase from master. Read this on resolving rebasing conflicts.
4. Send pull request for reviewing.
5. Testing is done in feature branches after rebasing from master and signed off from reviewer.
6. Feature branch is merged to master with a `--no-ff` (no fast foward). See diagram below.


The Github Flow is have the similar approach but the feature branch is deployed first before merge back to the master branch. The advantage of this approach is that you can always rollback to the master branch. Another variation is the Git flow, more complex with additional develop branch. Trunk-based development is another approach but I used before (another variation). However, I don't like the complexity introduced. Suitable if you have a dedicated release engineer.

Looking back at C++ again and I've no idea what I'm looking at. Why use typedefs to create alias for the default basic types? Portability. Implementing callbacks is a bit tricky, you really need to get over the C++ syntax used. Delegation in C++? Seriously, so many ways? All looks very hackish to me. Where is ? Didn't realize C++ don't have a ISO standard for quite some times. Undefined references? Most likely the order of the files being compiled causing linker problem.

Overwhelmed by front-end development works? The front-end scene is a moving target right now. There even a study plan to cure all these Javascript fatigue.

This Week I Learned - 2016 Week 47

Last week post or the whole series.

What an excruciating stressfull week. So many things to follow up and so many things broken, including my own body till I have lost 3kg. On a positive side, when you're down with sickness, your perspective towards your environment changed, in a slightly turn off way.

On Git. I just realized, unintentionally, my git-fu just increased by 0.5% since last two weeks. When checking for merge through rebasing and merging, it seems the LOCAL and REMOTE branch have been interpreted differently in all merging tools. P4Merge interprets it differently? To summarize it, LOCAL is the originals, REMOTE is the changes you want to add regardless it's a rebasing or merging process.

Now, after you've resolved all the conflict either through rebasing or merging, to visualize and compare your changes (just to be sure), we can use `git diff` command to compare between two ranges.
$ git diff branchX..branchY

Note the double-dot to specific range there. It seems that you can specific either double-dot or triple-dot to specific ranges but indicates different types of output. The Venn diagrams and commit trees below shows the differences.




There is one practive that I do follow when using Git in feature branch, which is to commit early and commit often. However, one of the issue is that the feature branch history is cluttered with many tiny commits. While this is useful when working with others on the same branch (we're aware of what's going on), it's best to squash these commits before merging into `master` branch. There are two ways (with different behaviours) to squash all the commits.

First, is to squash these commits when merging to `master` branch. The source branch, in this case, `branchX` will be throw away.
$ git checkout master
$ git merge --squash branchX
$ git commit

Second, is to sqush these commits when rebasing. This is my prefer method where we still keep the source branch. However, if you have a lot of commits, it's quite slow as you have to assign the rebasing method (either squash or fixup) for each commit. Some Git client tools support this feature to squash commit but I never really explore this.
$ git checkout branchX
$ git rebase -i `git merge-base branchX master`

That about it for this week, more stuff to come in coming weeks as we're approaching the end of they year.