ECS with Private Link

If you have ever run into this issue though you’ve already had Private Link for ECR to pull the image

DockerTimeoutError: Could not transition to started; timed out after waiting 3m0s

, then you may need to create a VPC Endpoint for Cloud Watch as well.

Go back to VPC / Endpoints, create a new one for service name com.amazonaws.ap-southeast-1.logs

At the moment, Fargate tasks will not need a public IP because they will call the AWS services via VPC endpoints.

Install Apache and phpMyAdmin on MacOS using Brew

Run the following commands.

Install Apache

brew install httpd

Install PHP

brew install php

Install PHPMyadmin

brew install phpmyadmin

Change port (just to avoid port conflicts)

sudo vi /usr/local/etc/httpd/httpd.conf

Edit

Listen 6060

Config PHP

sudo vi /usr/local/etc/httpd/httpd.conf

Add/edit these lines

LoadModule php7_module /usr/local/opt/php@7.3/lib/httpd/modules/libphp7.so
LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so

Make sure index.php is taken into account

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

Config PHPMyAdmin

sudo vi /usr/local/etc/httpd/httpd.conf

Edit these lines to point to your Sites folder

DocumentRoot "/Users/hieunguyenduc/Sites"
<Directory "Users/hieunguyenduc/Sites">

Turn on this thing there too

AllowOverride All

Add this block to the end of “httpd.conf” as well

Alias /phpmyadmin /usr/local/share/phpmyadmin
<Directory /usr/local/share/phpmyadmin/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    <IfModule mod_authz_core.c>
        Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Allow from all
    </IfModule>
</Directory>

Restart Apache

brew services restart httpd

That’s it!

Switching between JDK versions on MacOS

Sometimes you need to switch between JDK versions to work on different projects. Adjust bash script or JAVA_HOME will be bothering and time-consuming. jEnv was born to do the job for you. Let’s get started!

Install JDKs on your own by different ways.
For example, I have JDK 1.8 and JDK 11 on my machine.

hn-localizedirect:JavaVirtualMachines hieunguyenduc$ pwd
/Library/Java/JavaVirtualMachines
hn-localizedirect:JavaVirtualMachines hieunguyenduc$ ls -al
total 0
drwxr-xr-x  4 root  wheel  128 Jun  6 17:15 .
drwxr-xr-x  4 root  wheel  128 Jun  3 13:21 ..
drwxr-xr-x  3 root  wheel   96 Jun  6 17:15 jdk-11.0.3.jdk
drwxr-xr-x  3 root  wheel   96 Jun  3 13:21 jdk1.8.0_211.jdk

1) Install jenv using Homebrew

brew install jenv

2) Load jenv in your bash

echo 'eval "$(jenv init -)"' >> ~/.bash_profile

3) To make sure JAVA_HOME is set, enable export plugin

jenv enable-plugin export

4) Add JDKs to jenv

jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home
jenv add /Library/Java/JavaVirtualMachines/jdk-11.0.3.jdk/Contents/Home

5) List all installed JDK versions

hn-localizedirect:Home hieunguyenduc$ jenv versions
  system
* 1.8 (set by /Users/hieunguyenduc/.jenv/version)
  1.8.0.211
  11.0
  11.0.3
  oracle64-1.8.0.211
  oracle64-11.0.3

6) Switch to your favorite JDK (globally)

JDK 1.8

hn-localizedirect:Home hieunguyenduc$ jenv global 1.8
hn-localizedirect:Home hieunguyenduc$ java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
hn-localizedirect:Home hieunguyenduc$ echo $JAVA_HOME
/Users/hieunguyenduc/.jenv/versions/1.8

JDK 11.0

hn-localizedirect:Home hieunguyenduc$ jenv global 11.0
hn-localizedirect:Home hieunguyenduc$ java -version
java version "11.0.3" 2019-04-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode)
hn-localizedirect:Home hieunguyenduc$ echo $JAVA_HOME
/Users/hieunguyenduc/.jenv/versions/11.0

That’s it!

References: http://www.jenv.be/

The miracle on the Hudson

I just watched the movie Sully starred by Tom Hanks about an emergency landing of an aircaft conveying 155 passengers and also read the truth behind the scenes. I was shocked to know that Sully had never been practically trained for that kind of incident. The only thing he had learned was theoretical classroom discussions.

I was deeply moved when he said

I delivered a millions passengers over 40 years in the air but in the end, I’m gonna be judged in 208 seconds.

The movie was so damn good especially when you get a chance to know much more about aviation industry!

LOWER(NAME()) and OR

Let’s look at the below query.

SELECT t.*
FROM [nt:base] AS t
WHERE LOWER(NAME(t)) = 'a' OR NAME(t) = 'b'

It looks just normal but throws UnsupportedRepositoryOperationException. This seems like a bug of parsing the condition clause.

A workaround is to use

... OR LOWER(LOCALNAME(t)) LIKE ...

Environment: Jackrabbit 2.12.4 and 2.16.0

Playing with IPA

Let’s take a look at this!

ɑːn ðɪ æftəˈnuːn əv θæŋksˈgiviŋ ɪːv, nəˈvembə 24, 1971, ə mæn ˈkeriiŋ ə blæk əˈtæʃeɪ keɪs əˈproʊtʃt ðə flaɪt ˈkaʊntə aːv ˈnɔːrθwest ˈɔːriənt ˈerlaɪns æt ˈpɒrtlənd ɪntəˈnæʃənəl ˈerpɔːrt. hɪ aɪˈdentəfaɪd ˈhɪmsef æs dæn ˈkuːpər ænd ˈpɜːtʃəsd ə ˈwɒnweɪ ˈtikit ɑːn flaɪt 305, ə 30-ˈminit trip tuː siˈæːt̬əl.

ˈkuːpə ˈbɒrdɪd ðɪ ˈerkræft, a ˈboʊɪŋ 727-100 (FAA redʒəˈstreɪʃən N467US), ænd tuːk sɪːt 18c (18E baɪ wɒn əˈkoʊnt, 15D baɪ əˈnɒðər) ɪn ðə rɪa əv ðə ˈpæsəndʒər ˈkæbɪn. hɪ lɪt ə ˈsɪgəret ænd ˈɔːðəd ə ˈbɜːbən ænd ˈsoʊdə. ˈaɪwitnəsɪs ɑːn bɔːrd rɪˈkɑld ə mæn ɪn hɪs midˈfɒːt̬ɪs, bɪˈtwɪːn 5 fɪ:t 10 ˈɪntʃɪs (1.78 m) ænd 6 fɪːt 0 ˈɪntʃɪs (1.83 m) tɑːl. hɪ wɔːr ə blæk ˈlaɪtweɪt ˈreɪŋkoʊt, ˈloʊfəs, a dɑːk suːt, ə ˈnɪtlɪ prest wɑɪt ˈkɑːləd ʃɜːt, ə blæk ˈnektaɪ, ænd ə ˈmʌðər əv pɜːl ˈtaɪpɪn.

If you’re an English learner, you may know this is IPA which is an alphabetic system being used to pronounce words correctly. This may be hard and strange to you from start. However, once you get familiar with it, I’m pretty sure that you can get your pronunciation much better.

I’ve just found out a game that we can chat with each other by using IPA instead of regular text. I’ve typed out the above paragraph from this original text using a special keyboard.

If you’re on MAC, follow this steps to install the IPA keyboard.
1. Download Charis SIL IPA
2. Extract it into ~/Library/Fonts
3. Download IPA MAC Keyboard
4. Extract it and open the dmg file
5. Copy “IPA Unicode 6.2(v1.5) MAC.keylayout” into ~/Library/Keyboard Layouts
6. Open MAC’s System Preferences, go to Keyboard. In Input Sources tab, scroll down to “Others”, look for the IPA keyboard, add it.
7. It’s done. Now you can follow this manual to type IPA.

American Legend

American Sniper is not only an amazing movie but also has a sad true story behind. The movie is about Chris Kyle who is known as The Legend because he took down hundreds of terrorists in Iraq war by his shooting skill.

What I find most fascinating is how he was always willing and prepared for the war, in particular, to devote his life to his country. After coming back, he had to fight against Post-traumatic Stress Disorder (PTSD) all the time. He was at home but didn’t feel the inner peace because his team were still fighting in Iraq and that always urged him to get back to the battlefield and bring the remaining things to an end.

His wife Taya said in tears when he once came home during the period of serving

Even when you’re here, you’re not here. I see you, I feel you but you’re not here.

The story gets much more touching when I know the story behind the black ending scene. Chris Kyle was murdered by a veteran. Chris’s wife then requested the movie director Clint Eastwood to get rid of the murder scene from the release.

This is going to be how my children remember their father, so I want you to get it right.

The movie ended with the scene many citizens standing, waiting and saluting Chris in his funeral procession.

What a true hero!

Positivity in Blind

Truthfully, I am positive all the time.

I have a friend. He always says he thinks positive. Whenever I thoughtfully talked with him about the current state of our country like the infamous environmental disaster, he tended to ignore the bad things although it was so true. Also, he gave excuses for thousand times that every country has the similar problems and our one is still much better than North Korea, for example. More interestingly, he didn’t forget to blame me that I have no perception to talk about it. That’s fine. Thank him.

Personally, I think that is not positive thinking but fallacy and self-delusion. Barbara Ehrenreich, the author of Bright-Sided: How Positive Thinking is Undermining America says “It’s an ideological force in American culture that encourages us to deny reality, submit cheerfully to misfortune, and blame only ourselves for our fate”. Theoretically, there’s nothing that can’t be solved with a bright smile and a grand effort. Nevertheless, thinking that a bad thing is good doesn’t change anything and just hypothetically delude yourself.

“A bandage with a smiley face slapped onto a wound cures nothing and obscures everything. Just remember that while life can be beautiful, pretending it is doesn’t make it so.”, said Micheal Fumento.

I think it’s worth for us to try together to see things as they truly are.


Site Note: This is just my English homework that I try to use voiced and voiceless TH words as many as possible. No offense. Cheers!!!

Google Drive URI

Image credit: Wavy1

Traveling Legend

A friend of mine is a professional traveler. Every time I stayed with him, I found myself standing under a huge beautiful sky. He told me a lot about the journeys he had been ever through. I excitedly listened to him and wished that I would be going there someday.

When we left the old company, sadly, he also moved to the US with his family. I lost contact with him.

Traveling then has become my passion of youth and I’ve never stopped thinking of it. Today I officially release Traveling Legend which is a travel diary sharing my experience and feelings about my trips. I just have the posts in Vietnamese at the moment but I’m going to have quality posts in English in the near future.

Welcome, guys!

Give it 5 minutes

Found that tmux is quite popular and many developers are using it these days, I wasn’t hesitant to give it a try as well as had a conversation with my friend about the hotkeys of tmux and vim. He told me that in vim we could use “hjkl” to move the caret and immediately I objected that idea, I said “How weird the hotkeys are!” because it didn’t reflect the directions like, for example W (up) – A (left) – S (down) and D (right) or the arrow keys. He was quite patient and sent me this link Give it 5 minutes of Jason Fried and didn’t forget to tell me “Give the article 5 minutes!”. After reading it, I’ve figured out the attitude of a developer is even more important than his thinking and it should come first all the time.