All these while I had been using AngularJS to populate dynamic rows on table from JSON array. Now that it is deprecating soon at the end of 2021. It is time I try something else, and I had chosen to try Vue.js

By running the code above you will see an output like this

One important thing to note here is that unlike AngularJS or perhaps earlier version of Vue.js. You are unable to populate values into HTML attribute.

<a href="www.google.com/search?q={{ item.fruit }}">
{{ item.fruit }}
</a>

If you do that, you will get an error saying

Interpolation inside…

The disadvantage of coding in multiple languages at the same time is that you tend to mix up which function is for which language. I had to google for the same function over and over again.

It is time start my own cheat sheet and append more into it over time.

String

Concatenate string

name = 'Bitcoin'
price = 42000
puts name+ ' is now USD ' + price.to_s # Bitcoin is now USD 42000
puts "#{name} is now USD #{price}" # Bitcoin is now USD 42000
puts '%s is now USD %d' % [name,price] # Bitcoin is now USD 42000


In my other articles on web scraping with Puppeteer, the code works nicely if it never encounter any errors. But once it hit an error, most likely a timeout error while waiting for page content to load like example below at line 13. The whole scraper will hang and causes memory leak.

These are the error messages you will most probably encounter.

UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().

And the deprecation warning.

DeprecationWarning: Unhandled promise…

You can now run Ubuntu in Windows 10 and access your C drive contents through SSH in Ubuntu. To install follow the steps below.

First open control panel.

Programs

Under programs and features


In my previous article “Jigsaw Search In Image”, the naming I used still sort of confusing. Lets use the famous phrase of searching for a needle in the haystack.

In the previous version, searching for a needle in the haystack took almost 11 seconds for a small 360x360 image, it will be worse if I tried to search for a thumbnail in a bigger resolution image.

I managed to enhance it to search for four corners of the needle in the haystack and later verify the results pixels by pixels. …


3 Wheels

Both 3 wheels frames I owned are flat, Powerslide Trinity 3x100 and 3x125. Wear and tear of the wheels on my right foot wears out more than my left due to my dominant dragging leg for T stop. As for the wear and tear of individual wheels for both feet, it seems to be wearing out at the same rate.

Some skaters tend to do T stop dragging the wheel at the toe more, whereas for me I dragged it flat. Due to this I just do a mirror swap of my wheels to balance out the wear and tear.

4 Wheels


In my previous article, I compared two images of the same size pixel by pixel. To further enhance its functionality, I now search for a small image (I’m going to call it a jigsaw) in the big image pixel by pixel and return the coordinates of the top left corner pixel location.

a.png

I cropped a 36x36 image from a.png and named it c.png


How to compare 2 images to check if it is identical. The easiest way is to compare pixel by pixel of the 2 images.

In my example, I am using Python Pillow to compare. To install it in macOS, just run these 2 lines

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow

For other OS, you can refer to their official site at https://pillow.readthedocs.io/en/stable/installation.html

The source code of my function

WebP to PNG conversion. No pixel edited.

AWS will disable the preconfigured password that was previously configured when launching an instance from AMI. To keep the password active so that it can be login using username & password immediately upon launching it from image, lock_passwd needs to be set to false.

lock_passwd: False

Let’s start from the beginning. Login EC2 with key.

Enable SSH login by password by editing the ssh config file

sudo vim /etc/ssh/sshd_config

Kevin FOO

A software engineer, a rock climbing, inline skating enthusiast, a husband, a father.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store