Skip to main content

Posts

Setup MongDB on Windows

Download and install MongoDB. You can set custom installation directory or let default location in "C:\Program Files\MongoDB\Server\<version>".

Add "C:\Program Files\MongoDB\Server\<version>\bin" to environment variable.

Create directory for database data and log data. For example, database is in "C:\mongodb\data\db\" and log is in "C:\mongodb\log\".

Create MongoDB configuration file. For example, it is in "C:\mongodb\mongod.conf".

systemLog: destination: file path: c:\mongodb\log\mongod.log logAppend: true storage: dbPath: c:\mongodb\data\db
(CAUTION: Use spaces, not tabs)

Start the server by:

$ mongod --config "C:\mongodb\mongod.conf"
OR install it as a Windows service

$ mongod --config "C:\mongodb\mongod.conf" --install
Then, start the service.

$ net start MongoDB
To stop the service.

$ net stop MongoDB
To remove the service after stoping the service.

$ mongod --remove
If you want to add R…
Recent posts

Obito Uchiha

Evolution





Enabling Single Webcam for Multiple Applications Access in Linux

A webcam can not be accessed by two or more applications simultaneously. The solution is you can duplicate the video stream and make it available for any application. In short, you create virtual webcam.
First, a webcam is commonly detected on /dev/video*. Before you go through the steps to duplicate video stream, you should check whether your webcam is working. You can try to capture video using VLC by this command. (For example, your webcam is on /dev/video0)

$ vlc v4l2:///dev/video0
If it doesn't work, you can try to change its mode to 0777 and make sure there's no other applications accessing it. If it still doesn't work, you can buy a new webcam. Seriously. Don't buy cheap and unknown-brand webcam. I have $5 webcam and it had wasted my time.

$ apt-get install ffmpeg linux-generic v4l2loopback-dkms
FFmpeg is main application that will access your webcam and duplicate its video stream. V4L2loopback is needed to create multiple virtual capture devices (loopback device…

Retrive Real Client IP in Nginx

Sometimes, your web application is installed in a web server which is behind reverse proxy server like Cloudflare or other services. In that condition, your application will always read the reverse proxy server IP as client IP. In Nginx, you can use ngx_http_realip_module to get the real client IP (see detail).

To enable this module, you need to make sure that you use latest Nginx server from repository or you can build it from source with --with-http_realip_module configuration parameter. I  prefer to install it from repository as Nginx 1.10.0 in Ubuntu 16.04 has enabled this module by default. You can check whether it's enabled or not by following command.

$ nginx -V
Then, the reslut should be like:

$ nginx version: nginx/1.10.0 (Ubuntu) ... ... --with-http_realip_module ... ...
Now, you can put the module configuration in http block or server block of your Nginx configuration. For example, you use Cloudflare service for your web application. You should list all available Cloudfl…

Setup Free SSL Certificate with Certbot

If you want to setup a site with HTTPS, you need a valid SSL certificate from Certificate Authority (CA). Let's Encrypt is a CA that can provide you a free valid SSL certificate by requesting it using certain software. The software which is recommended by Let's Encrypt is Certbot. From the main page of Certbot site, you can choose what web server and operating system you use then it will show you the installation steps. For example, I use Nginx on Ubuntu 16.04.

$ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:certbot/certbot $ sudo apt-get update $ sudo apt-get install python-certbot-nginx $ certbot --nginx
Last command will get a certificate for you and have Certbot edit your Nginx configuration automatically to serve it. Sometimes, you may get error notes. It is about failure of integration process to existing web server configuration. It's not crucial cause you can integrate manually with simple steps. If you only want to get certificate…

Ini Tidak Sehat

Baru saja saya membaca sebuah berita tentang seseorang yang membantu pembiayaan tempat tinggal untuk sekelompok orang. Ini beritanya. Sementara, bangunan tempat tinggal itu adalah bangunan yang ia prakarsai sendiri untuk didirikan dan dijadikan tempat tinggal untuk sekelompok orang itu.

Tampaknya baik, kan? Itu pakai uang pribadi, lho. Pertanyaannya, sampai kapankah hal itu akan dilakukan?

Kondisi yang lebih sehat adalah ketika pembiayaan itu dibantu oleh anggaran pemerintah atau pemerintah menciptakan lapangan pekerjaan untuk orang-orang yang lahan pekerjaannya sudah hilang itu.

Ceritanya seperti ini. Ada seorang CEO yang perusahaannya mengalami defisit. Lalu dia merelakan sebagian gajinya dipotong untuk membiayai gaji stafnya. Dalam konteks perusahaan, ilmu kepemimpinan macam apakah ini? Jangan menyetujui atau menyukai sesuatu hanya karena sesuatu itu tampak baik atau sejalan dengan ego Anda. Sebaliknya, sang CEO harus dengan segera memulihkan kondisi perusahaan dan segera membayark…

I Love Books

I like reading books since I was kid. Thanks to my parents that let me bought any books and embraced me to read. Bookstore becomes one of my favorite place. I like to learn any topics, not only about science or IT stuffs. For me, reading book isn't always intended to have possession in the topic, but it's for my personal pleasure and building an insight of something.


There're many things around us that we don't understand really well. If we try to figure it out by our selves, we will waste most of our precious time. So, it's better to learn from the expert who have studied it well then considering it with our common sense and logic.

I grow up, many affairs had occured, and shit happens. I realize that I have forgotten a lot of things. I likely tend to aware on less things. So let me open a cupboard full of books which I've collected since long time ago.