Skip to main content

Posts

Showing posts from June, 2017

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

Obito Uchiha

Evolution Kid Obito Obito with White Zetsu Masked Obito Obito Jinchuriki Obito and Black Zetsu End of Obito

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 a 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 are no other applications accessing it. If it still doesn't work, you can buy a new webcam. Seriously. Don't buy a 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 the main application that will access your webcam and duplicate its video stream. V4L2loopback is needed to create multiple virtual capture devic...

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