Skip to main content

Posts

Showing posts with the label tutorial

How to Easily Generate Big File

I had difficulty in finding any large text file. In Google, some of them suggest to download from wikimedia dump and some of them from gutenberg project. However, the following steps are a lot easier than going to all the menus in either wikimedia or gutenberg. Enter any small text file In the first step, just enter any small text file. For example: $ echo 'arwan ahmad khoiruddin' > mytext.txt Merge the text into big file Next, you can merge the text into big file. Here's how $ cat mytext.txt mytext.txt mytext.txt > merged.txt The content of file merged.txt will be arwan ahmad khoiruddin arwan ahmad khoiruddin arwan ahmad khoiruddin So, if you want to create big file, you can just repeat the cat as many as possible. For example $ cat mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt mytext.txt ...

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...

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 ...

Mininet/Containernet Problem: Exception: Error creating interface pair (s2-eth5,s3-eth1): RTNETLINK answers: File exists

If you did not shut down the previous running mininet/containernet network (e.g. if you lose your connection to remote server), you will got the following error when you try to rerun your mininet network Traceback (most recent call last): File "./mynet.py", line 31, in <module> net.addLink(d2, s1) File "build/bdist.linux-x86_64/egg/mininet/net.py", line 403, in addLink File "build/bdist.linux-x86_64/egg/mininet/link.py", line 430, in __init__ File "build/bdist.linux-x86_64/egg/mininet/link.py", line 474, in makeIntfPair File "build/bdist.linux-x86_64/egg/mininet/util.py", line 202, in makeIntfPair Exception: Error creating interface pair (d2-eth0,s1-eth2): RTNETLINK answers: File exists In order to solve the problem, you need to clean up the previous running topology by using the following command sudo mn -c It will clean up all your cache. It will be something like this $ sudo mn -c *** Re...