Skip to main content

Posts

Introduction to Wolfram Mathematica

Free-form inputs To compute, press SHIFT + ENTER In[1]:= 3 + 9 SHIFT + ENTER Out[1]:= 12 To suppress output, add ; after the line In[1]:= 3 + 9; SHIFT + ENTER -> no output You can execute multiple lines at once In[1]:= a = 2 b = a + 2 c = b ^ 3 SHIFT + ENTER Out[1]:= 2 Out[2]:= 4 Out[3]:= 64 Starting from now, when we have output, it means that in the end of the previous line, we press SHIFT + ENTER . To get the most recent output, use % In[1]:= 3 + 9 Out[1]:= 12 In[1]:= % + 5 Out[1]:= 17 Basics in Programming Variable A variable starts with letters. If you want, you may add numbers into the variable name. It is much better if you start the variable name with lowercase In[1]:= myVariable123 = 2 Out[1]:= 2 Please notice how I join the two words and the number into a single word. If you put space between the variable name, it will indicate multiplication In[1]:= x = 3; 5 x x Out[1]:= 45 To clear the variab...

Push docker container

In this post, I will give you an example for what I do to push a docker container into docker hub. Here I will use my repository in docker hub i.e. arwankhoiruddin/hadoopbuild . You can find it here: https://hub.docker.com/r/arwankhoiruddin/hadoopbuild/ In order to modify it, first I have to login $ docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username (arwankhoiruddin): arwankhoiruddin Password: Login Succeeded Then I run the docker image $ docker run -it arwankhoiruddin/hadoopbuild /bin/bash If it is not in my computer, it will download automatically from docker hub. After I finish, I type exit and I can save the changes into the docker hub. Followings are the steps $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 856e2774909...

Getting Started with Flask

In this post, I will give you a very basic example to run a hello world program in flask. What make it different with the other tutorial is that this will enable your program to run from a cloud server, not just on a local server. Before we go further Because you want to run it in a cloud server, most probably you will use your ssh to connect and run it. However, you need to know that when you end your ssh session, your Flask server will also be shut down. To prevent that, my favourite is to use screen . If you are ubuntu lover like me, you can install it by typing $ sudo apt-get install -y screen Before you do any work, start by typing $ screen It will open a session for you. Later, after you run your Flask server, you may want to detach the session using this command ctrl-a d If you later want to go back to your session, you can do it by using the following command $ screen -r OK, without further ado, this is your first hello world program in Fl...

Some useful SSH Commands

Install SSH Server in Ubuntu sudo apt-get install openssh-server Run SSH Server sudo service ssh restart The output will be like * Restarting OpenBSD Secure Shell server sshd [ OK ] Check SSH Status ps -ef |grep "sshd" The output will be like hduser@d1:/hadoopSetup$ ps -ef | grep "sshd" root 125 0 0 02:35 ? 00:00:00 /usr/sbin/sshd hduser 138 79 0 02:45 pts/2 00:00:00 grep --color=auto sshd

Tips for cheap overnight car parking for your flight from KLIA or KLIA2

If you want to travel from KLIA or KLIA2, the parking fee for overnight parking in the airport is just crazy. In KLIA2, the first night will be 42 MYR. After that, it will be reduced to 21 MYR. Even after reduced, the fee is still very very very very very expensive. I will prefer to spend the money to buy some foods. 21 MYR equals to two or three times meals. Hahaha OK. So where you should put your car when you travel from KLIA or KLIA? I found some answers, but for myself, I prefer to park my car at Salak Tinggi Station. In Google Maps, you can find the coordinate from this link: https://goo.gl/maps/WWSdj2ZiTN22 Previously it was so cheap to park in Salak Tinggi. Only 3 MYR per night. However, now they increase the fee to 3 MYR for parking during the day and 8 MYR for overnight parking. However, 8 MYR is not that much compared to 21 MYR. Right? OK. So after parking the car, how can we go to KLIA or KLIA2? The first KLIA Transit train from KL-Sentral to KLIA2 st...

Check Status of Running Nodes in Hadoop

To see if nodes in your Hadoop cluster connected and run, followings are the ways to see JPS Command Run jps command in master node and slave nodes. In master node, the output of the jps should be something like this $ jps 1634 JobHistoryServer 692 NameNode 2471 Jps 1191 ResourceManager 841 DataNode 1023 SecondaryNameNode 1311 NodeManager When you run jps in slave, the output should be something like this $ jps 528 Jps 292 NodeManager 170 DataNode hdfs dfsadmin -report This is a very nice tool to see the statistic of each nodes in your Hadoop cluster. When you run the command, you will get ouput something like $ hdfs dfsadmin -report Configured Capacity: 82999410688 (77.30 GB) Present Capacity: 59326111744 (55.25 GB) DFS Remaining: 59325284352 (55.25 GB) DFS Used: 827392 (808 KB) DFS Used%: 0.00% Under replicated blocks: 0 Blocks with corrupt replicas: 0 Missing blocks: 0 Missing blocks (with replication factor 1): 0 Pending deletion blocks: 0 ...