Hall of Fame 2017

Hall of Fame 2017.

With the Standard Chartered Marathon Singapore 2017 ended earlier this month, my Hall of Fame 2017 is completed. This year, I ran for 8KM, 10KM and two 21.1KM. They are the CCK Big Farm Walk and Run, Sundown, 2XU and SCMS. It is a real excitement to run in these marathons especially when I feel being able to run and complete the race for the prestigious marathons in Singapore.

Why I want to run a marathon when we can just run in the park for free?
Well, it really gave me a different experience when running alone in the park, running alone during the race and running with thousands of people. The race’s route, weather, atmosphere and people are different during each race.

For example, running for an half marathon, the race will begin around 4.30AM in the morning. It is cooler and windy when run at this hour as compared to a 10KM marathon which usually begin at 7.30AM when the sun arises.

Besides that, it tests our endurance during the race, determination to complete the race and satisfaction and sense of achievement upon crossing the finishing line. The feeling of running toward the finishing line is great especially you are cheered by strangers standing along the street and keep telling you, “it is almost there, 100m away, come on keep running” and when you are very close to the finishing line, someone will shout “just another 5 seconds of running!”. Sometimes, we could get consolation prize when the person next to you congratulate for your victory.

Having group picture after the marathon to show off medal.
It is a great moment to be captured and shared in the Facebook and Instagram. Unfortunately this SCMS, we did not manage to take a group picture together at the race village when my running partners flagged off at different timing then mine due to two of them were at the baggage deposit area for an hour. Anyway, we are planned to meet up for the post marathon dinner or pre-Christmas gathering, it is just giving ourselves an excuse to meet up again!

Do I stop at each kilometer signboard to take picture?
Yes, in my earlier years when I started to run and I got to know a friend at one of the signboard when I ran for Standard Chartered KL in 2015. However, right now I did not do it anymore. These signs reminds me that I have completed 1st quarter of the race,  1/3 of the race, 1st half of the race and 3/4 of the race which give me a positive thought to complete the race with determination.

I will feel of signing up for the next marathon each time I completed one.
Yes, I am keeping a close check on the RunSociety for the next half of the year 2018’s marathons. I am not too sure if I will still continue running for Sundown or 2XU for next year, however, I am interested to run for other marathons which I have not tried before. One of it is the Income Eco Run 2018.

Advertisements

Standard Chartered Marathon Singapore

#scms2017. This is the hash tag for this year Standard Chartered Marathon Singapore.

My last participation in the Standard Chartered Marathon Singapore was in Year 2015, few months after I completed my Standard Chartered Marathon Malaysia. Both were 10KM marathons.

This year I signed up with my three ex colleagues who wanted to run for half marathon after our 2XU. Four of us registered when the early birds registration opened and with one of us has the Standard Chartered’s credit card, we got extra discounts. It was sort of a good deal with all these discounts. Back then, we would have six months to practise and prepare ourselves well.

Unfortunately, after my 8KM Big Farm Run at Choa Chu Kang in October, I did not practise for the half marathon because I fell sick with stomach flu for a week and my body got weaker.

I focused on my food intake a week before the marathon by taking mainly the pasta, breads and oats with milk.

The night before the marathon, I went to have a great Japanese food with my cousin and my aunt. Again, I loaded plenty of carbohydrates and the salmon which are recommended food for running and pre-marathon preparation. On the same night, I went to my friend’s house to stay overnight. She stayed pretty near to the city and we could walk to the starting point.

It was 4.00AM in the Sunday’s morning, we walked on the closed, emptied road toward Orchard Road, where the full and half marathons would be flagged off. At this wee hours, I could see people who just finished partying were sleeping or sitting at the bus stop to wind off while thousands of people heading down the road to run 21KM and 42KM marathon. What kind of silly thing to be done!

Even without the practise, I was grateful that my first 8KM with my friend’s friend and able to complete the marathon in the end. It is not my personal best timing at all.

I was able to surpass my 13KM marker before my legs started to stress up at 15KM. Also, I was able to surpass my 18KM marker before I completely walked at 19KM to 100m before the finishing line. I love running this marathon because we run like a king on four-lane roads.

Acting Cute?

말해!뭐해?(Tell me! What are you doing?), said my client. Well, he saw I was listening to this song when I paused the playlist from my Note3 and he said he was listening the same song as me. I was rolling my eyes 🙄 and he further showed his playlist to confirm it. It was kind of an ‘huh’ situation that I gave more 🙄🙄🙄 expression.

MongoDB – Create New User

After the MongoDB installation, I continued with creating a new root user which carries the admin right with password. It is recommended to secure the database with password all the time.

To do so, I used the Mongo command shell to run the commands.
1. Create the root user.

db.createUser({user:"admin", pwd:"admin123", roles:[{role:"root", db:"admin"}]})

The command prompt will show success message once the new user is created.

2. Enable Mongodb authentication
Edit the Mongodb service file ‘/lib/systemd/system/mongod.service’ with your editor on the ‘ExecStart’ line 9, add the new option ‘–auth’.

ExecStart=/usr/bin/mongod --quiet --auth --config /etc/mongod.conf

And here is where I faced the same problem again, I am unable to edit the file using the text editor because of the permission. If you able to edit, then continue with below steps.

3. Reload the systemd service using systemd daemon-reload
4. Restart MongoDB service.
5. Connect to the Mongodb shell with this command:
mongo -u admin -p admin123 –authenticationDatabase admin

Fill in using the userID and password set when we create new root user. Even I did not change the file, mongod.service, I am still able to connect to the MongoDB with my own userID and password. Below, showed the success login.

Lastly, you can show or list the databases by using command,

show dbs

MongoDB – Installation

Today I am going to try the MongoDB installation on my Linux machine which I installed in my VMware. I am not going to do the same installation on my Windows’ laptop. I am expected to learn and workaround with the MongoDB in my virtual machine only.

Let us get started, it is simple installation and just a small confusion on one of the configuration parts, not to worry about it too much at this point. As I googled how to install MongoDB on Ubuntu, there is a list of guides to follow and I personally followed these two links:
1. From the MongoDB website: https://docs.mongodb.com/v3.2/tutorial/install-mongodb-on-ubuntu/
2. From a tutorial website: https://www.howtoforge.com/tutorial/install-mongodb-on-ubuntu-16.04/

Both are guiding us on how to install on the Ubuntu 16.04. Just follow the commands given in the website and I will just briefly mention what I do on each step.

1. Import the public key.
2. Create source list file MongoDB. I used below command, but using my Ubuntu version, Xenial,

echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list

Else, the default command is,

echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list

3. Update the repository.
4. Install MongoDB.
At this step, it asks us to create a new mongodb systemd service file in the ‘/lib/systemd/system’ directory. Below is the instruction:
Go to that directory and create the new mongodb service file ‘mongod.service’ with vim.

cd /lib/systemd/system/
vim mongod.service

In the edit mode (command prompt), I am unable to edit anything in which I should paste the setting on it and save. I have no idea how the vim works. Maybe you can enlighten me on this part.

I tried to use the text editor and I am unable to save the file because of permission issue. I did not change the file, anyway, and proceed to update the systemd service using the given command line.
5. Start Mongodb and add it as service to be started at boot time.
6. Now check that Mongodb has been started on port 27017 with the netstat command.

You can check the MongoDB’s log at /var/log/mongodb/mongod.log and the port configured in /etc/mongod.conf, 27017 by default.

The installation is completed. Few commands to be remember:
1. Start service – sudo service mongod start
2. Stop service – sudo service mongod stop (or control-C)
3. Restart service – sudo service mongod restart
4. Go to Mongo shellmongo

Scala Programming – Hello World

This is a continuation from the previous entry which I wrote about the Scala Programming’s setup and IDE installation. In the previous entry, we were successfully setup the JDK, sbt, Scala and installed the IntelliJ. The last step is start coding.

Besides using the IntelliJ, you can install and use other IDEs to write codes, for example, Eclipse. It is just a personal preferences. I asked my friends which tools that they are using for Scala programming and I received a standard reply from them, Eclipse.

As for my Coursera’s course, the instructor is using IntelliJ and I am going to use it in my virtual machine. I will try to use Eclipse as well on my Windows environment. Come, let try to write a Hello World program using the IntelliJ.

When the new project loads, the Project explorer on the left side shows the structure of the Scala project. Go to the src folder and expand it. Under the main folder > New Scala Worksheet > Enter file name. The text editor at the center of the application loads the new file. Type as below,

"Hello World"

And, press the ‘Run’ button on the top. It renders the result on the right side of the application. We need to include the double quotation in our codes.

This is our first helloworld. Different IDEs will show the result in different mode or presentation but the end result is the same. You can try to use the command line to run and print helloworld too. When I tried it using my virtual machine’s command line by typing scala, it prompted me an error. It is my very first time using command line in Ubuntu to run a scala program.

scala

It advised me to install the Scala using the command below. I just did as per advised.

sudo apt install scala

It took a while to install when I run it in my Terminal. Can someone highlight to me what causes the error? Does it mean that Scala installation on the IDEs is not the same as the Terminal?

When the installation is completed in the Terminal, I try again as below and it is correctly displaying the string input I entered.

This is Scala Programming! I am going to stop writing for a while and concentrating on learning this programming language. See ya 🙂

Scala Programming – Setup

As a part of the new environment, I start to learn this functional programming language called Scala Programming. I sign up the Coursera’s course, Functional Programming Principles in Scala. The course began in May 2017.

Therefore, most of my write-up on Scala is be based on the Coursera’s course and some of the experience I gained from my hand-on or on-job-training.

Before I start coding, there is a few things need to be installed and configured before I can start the basic print out “Hello World”. Let me walk through the setup processes here. My machine is running on the virtual machine with Ubuntu 16.04 installed.

Installing the JDK

The first thing first is installing the Java Development Kit. At the point of my learning, its latest version is JDK 8.0. To install JDK on the Ubuntu, we need to run a command in the Terminal. So, let’s open the Terminal and put the below code,

sudo apt-get install openjdk-8-jdk

It will prompt you to enter user password of your machine and it will proceed to get it installed. For other Linux operating systems, there are other commands to be run. To check the installed Java version, you can type the below command in the terminal.

java -version

You can expect to see the detail as below,
ubuntu16-04@ubuntu:~$ java -version
openjdk version “1.8.0_121”
OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-0ubuntu1.16.04.2-b13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)

Alternatively, you can install the JDK manually by downloading the .tar.gz archived file from the Oracle website, unzipped it at the preferred directory and add the bin/ directory of the extracted JDK to the PATH environment variable.

Installing sbt

Okay, what is sbt?

sbt is an open source build tool for Scala and Java projects, similar to Java’s Maven or Ant. This is a definition I found from the Internet. There is an online document you can read up for ‘Getting Started with sbt’, http://www.scala-sbt.org/0.13/docs/Getting-Started.html. I refer to this online document to install sbt on Linux. For other operating systems, you can refer to the relevant document.

echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt

Installing IntelliJ

For the Coursera’s course, the instructor teaches us to install the IntelliJ IDEA. You can choose to install other IDEs such as Eclipse, Sublime and etc. It is your own preferences. For my virtual machine, I will follow the Coursera’s course to use the IntelliJ. The installer can be found from its website, https://www.jetbrains.com/idea/download/#section=linux.

Proceed to download the Community version .tar.gz file. Upon completion, change directory to the file location. You can run the command below to check the file too.

Next, we need to extract the file and begin to install it on our machine by navigating to the bin folder and run the idea.sh. Pardon me for the wrong change directory in the screenshot below.

Viola! The IntelliJ’s first screen prompts up. Go along with the step by step setup until you click the ‘Finish’ button. The customization of IntelliJ IDEA allows us to set the UI Theme, create desktop entry for integration with system application menu, create launcher script which allows us to open files or projects from the command lines, install plugin in which Scala must be installed before we start using it.

So, what is next? Of course we shall create a Scala project and have our very first program runs. Let us give a try and not just finish here… You will get to see UI of IntelliJ with options to a create project, import project and etc on the screen as below,

And yes, we are just two more steps nearer to the first Scala program. Click on the ‘Create New Project’. In the screen below, select the Scala > SBT > Next button.

It brings us to the next page where we fill in the project name and check on the JDK, SBT and Scala properties. Remember that we have done the JDK installation in the first step, then followed by the SBT installation before we began our IntelliJ installation whereby we did the Scala installation too?

Click on the ‘Finish’ button and it creates the project for us. The interface looks as below when it launches on my virtual machine which is running on Ubuntu 16.04.

Last step is start learning how to code! Keep it up!