Showing posts with label make. Show all posts
Showing posts with label make. Show all posts

This Week I Learned 2019 - Week 06

Last week post or you can going through some earlier stuff.

Happy new year again or rather, happy Chinese New Year. The weather was blazing hot compare to all the previous year even though there is no fire haze from our neighbouring country.

What else I've learned this week not within this post? Going through the sixth week of ornamental fish culture on fish breeding techniques such as selective breeding and biotechnology. Since this is a short lecture notes, I've decided to continue with week 7 study notes which discuss on seed production on factors affecting larvae rearing and feeding (species and water medium). The review paper of this week is the masculinization of the ornamental Siamese fighting fish with oral hormonal administration. SMS::ClickSend is the Perl module of the week to be reviewed.

Is Nokia 6303c still available these days? The most memorable and funny post I've read so far this year. I'm not sure under what context the poster needs to use a durable normal dump phone, but moving from Nokia 6303c, Nokia 216, Nokia 150, and lastly CAT B30 His perseverance is commendable and definitely should be the coolest post (not coolest use) of Perl usage writeup. I miss the old monochrome dumb or feature phone which is durable, have long lasting battery, and purposeful usages (call, text, and defend). Does affordable dumb phones still exists (as in 2019) these days? Yes, there are quite a lot and the one that caught my attention are from Alcaltel model 10.54, 20.08, 20.51, 10.50. Why dump phone still have a market these days? Four words. Africa and senior citizen.

为何程序员找工作要有个黑名单?这是Github每星期的邮件里推荐的一个流行的Repo。看见这个Repo竟然有十多千个Star,没想到还蛮多大陆的同胞在使用Github。

What are the differences among the subroutines in Carp module? Carp is a Perl module that provides alternative subtitutions to to `warn` and `die` in Perl? The screenshot below summarizes it the best. If you want the similar backtrace feature but don't or can't change your Perl code, there is always a Carp::Always module that will patch the `warn` and `die` subroutine.


What does a long time developer want? "Build more long lasting artifacts." How? Contribute more to FOSS then, is as simple as that.

Is Makefile redundant? In some context, yes. Because if you've a shell available, any shell scripts should be sufficient enough to emulate a Makefile as shown below.
#!/bin/sh
    set -e

    case "$1" in
        up)
            docker-compose up -d
            ;;

        build)
            docker-compose rm -vsf
            docker-compose down -v --remove-orphans
            docker-compose build
            docker-compose up -d
            ;;
        *)
            echo "unknown verb: $1"
            ;;
    esac

Write and publish a book in ten minutes per day? (via HN) Is this doable? Yes, you can just sit there and stare at it for ten minutes. However, the ten minutes is just the appetizer, to get your started. Maybe you can be in the zone or maybe not but you did something, even through you're just sitting there. The thing is you must do it every day, and every day it get easier. Remember the Jogging Baboon?

However, your brain still works on the task subconsciously even after the time frame. If you're not writing a book, what else can you do in ten minutes per day then? Doubt so as you brain still process the task the whole day even after the timed duration. Hence, the ten minutes is just to bootstrap the task and you've spend a few hours later doing it subconsciously.

There is another important lesson here. When to stop. If you don't have any juice left, stop. Or if you doing very well like in the zone, stop so you can look forward to continue tomorrow.

What else can you do during the ten minutes duration? There are plenty of things such as writing a dairy journals (via Lobsters), pick up any new habits, 5BX exercise plan, core wars kata.

This Week I Learned - 2016 Week 37

Last week post or the whole series.

As we're moving to the end of the third quarter of the year, more things pop up for me to follow up. Interestingly but not surprisingly, life is as monotonous as ever. Yes, it can be routinely, but that probably the only way, through sheer discipline, to follow through your plans.

The components for setting up my homelab using AMD 5350 have been bought and set up accordingly. The only remaining tasks is to install the necessary OS and configuration. More writeups on this in coming future.

As usual, something I learned this week.

Looking into Makefile, specifically GNU MakeExtracting parameters from target? Yes, is doable but it's not pretty. See code below. If your target is not an actual physical file, make it a '.PHONY' target instead. Otherwise you will encounter "No rule to make target" error. Next, we will need to 'eval' when extracting the assigning the parameters passed, otherwise the 'PARAMS' assignment will be executed as command.
.PHONY: action

action:
    $(eval PARAMS := $(filter-out [email protected],$(MAKECMDGOALS)))
    @echo $(PARAMS)

Interestingly, there are four ways for variable assignment in Make. The 'Set If Absent' way of variable declaration and initialization is quite handly. Funny though, Perl, which is known for its brevity, does not have such language construct.
# Lazy Set. Value is expanded and set when used.
FOOBAR = x

# Immediate Set. Value is set when declared.
FOOBAR := x

# Set If Absent
FOOBAR ?= x

# Append
FOOBAR += x

Write it down, make it happens. Never underestimate the power of writing. Sometimes, the pen is mightier than the sword.

'git commit --allow-empty'. My goodness! I'm not aware of this option exists in Git. How many times I've adjusted a space just to create and make an empty dummy commit. While we on Git, if you seems to "misuse" it somehow, there are many ways to recover back.

Web development is a layer of layer of layer of abstraction hacks? I firmly believe. It's messy, plagues with multiple choices, and feels like wild wild west. HN user, meredydd mentioned that modern web application today consists of five programming languages and three frameworks. Interestingly, I never realize there are so many choices. Maybe future Javascript, ES2016 can reduce that paradox of choices by standardizing on using the same language for frontend and backend, as in isomorphic Javascript? But that also raises another interesting question. Is web development a constant rewrite of existing application to newer technologies?

This Week I Learned - 2016 Week 12

Last week post or the whole series.

#1 LXD 2.0 blog post series. Write-up by Stéphane Graber on the upcoming LXD 2.0 release. Since the REST API support are pretty much quite stable these days, you can't blame where numerous web front ends (lxd-webui and lxd-webgui) exists. Between two different container implementations, I still prefer LXC to Docker. The unfortunate case is Docker has the popularity and financial backing to move things faster.

#2 "End of file during parsing". Encountered this error message when I was customizing my Emacs. This is due to excess open or close parentheses. Surprised to know that the debugging procedures is quite tedious. I'm still not getting used to the enormous long Emacs default key bindings.

#3 Emacs' Sequence of Actions at Startup. For Emacs 24.x. That is one long list of items to run during program startup.

#4 .PNONY in a Makefile. It just dawned to me that the obvious reason is that we set certain targets as .PNONY because these are not file target!

#5 Certain metals antiseptic effect. Hence, why musical instruments and some door knobs are made from brass.

#6 Which activity brings out the worst in people? Sad but true, I've to agree with the discussion of the top post. Inheritance, mostly caused by the wife/husband of the siblings.

#7 Seeing the Current Value of a Variable. Either 'Ctrl+h v' or 'Mx describe-variable' to find the value of a configuration item in Emacs.

#8 Telsa's Euology. Surprised to found out about her passing. Used to follow her blog in the early days of GNOME project when Alan Cox was still the Linux kernel maintainer.

Python and Makefiles

"Besides building programs, Make can be used to manage any project where some files must be updated automatically from others whenever the others change."
-- Wikipedia on Make
One of the issue I've noticed while doing a Django project was there are a bunch of shell scripts in the project folder. These tiny shell scripts were mostly related to creating virtualenv, resetting database, and others. Would that be nice if we can combine and group all these scripts into one file?

That is possible and easy through Make and makefiles, provided that you're willing to pick up the rules. The only minor annoyance is those running Windows need to install Make for Windows.

Something I learned while working on my Makefile.

1. A rule tells the make program on how to build your program. The syntax, as shown below, is straight forward and consists of a target, dependencies, and commands.
target: dependencies/target
commands

2. Prepend the build target name with '_' if you don't want the build targets to show up autocompletion in your shell.

3. Build script too noisy or verbose? For example, printing of working directory. To silence it, use make -s or prepend '@' before the commands.