Skip to main content

Posts

Configure Display Resolution in Raspberry Pi

Raspberry Pi 2 supports its HDMI display for 1080p resolution. But, when you want a smaller resolution whether it is in a large display panel, you can configure it manually from terminal. 1) Get the lists of supported resolutions and modes of your monitor tvservice -d edid edidparser edid 2) Edit the configuration file nano /boot/config.txt 3) Find configuration for HDMI group and HDMI mode. The mode is the code shown in the result of first step. DMT group is 2 and CEA group is 1. For example, hdmi_group=2 #(DMT) hdmi_mode=85 #(code 85) 4) Restart your Raspberri Pi More References:  http://www.cpmspectrepi.webspace.virginmedia.com/raspberry_pi/MoinMoinExport/OptimisedDisplaySettings.html

Sends Email in The Background in PHP

If you send email in PHP with any library through SMTP server, the process will take a while (2 seconds or more). The process isn't necessary to be sequential. Clients don't need to wait and know the sending process had finished or not. So, the sending process is better to be run as background process. If you use Linux, you can use exec method. If you're in Windows environment, you can use popen method. Then you send the result to the background. In Linux, you can use wget command to be executed to access email sending application script. The message contents can be setup and maintain in database before this action is run. exec("wget -qO- http://domain.com/send.php &> /dev/null &"); Or you can pass the contents directly as parameters for PHP arguments which is executed. exec("php /path/to/your/mailer/script \"arg1\" \"arg2\" > /dev/null 2> /dev/null &"); If you are in Windows pclose(popen(...

Custom Error Messages Location with jQuery Validation

jQuery Validation is a simple tools to validate a form with jQuery. We can custom error message location using this library. If you just want to set a box to gather all error messages, you can use this scheme. Javascript $ ( '#form' ). validate ({ rules : { first : { required : true }, second : { required : true } }, messages : {}, errorElement : 'div' , errorLabelContainer : '.errorTxt' }); HTML <form id = "form" method = "post" action = "" > <input type = "text" name = "first" /> <input type = "text" name = "second" /> <div class = "errorTxt" ></div> <input type = "submit" class = "button" value = "Submit" /> </form> But if you want to put error messages in different places for each fields, you c...

Chicken and Pig

A chicken and a pig are walking down the road. Then conversation begins. Chicken: "Do you want to open a restaurant with me?" The pig considers the question and replies Pig: "Yes, I'd like that. What do you want to call the restaurant?" Chicken: "Ham and Eggs!" The pig stops, pauses, and replies. Pig: "On second thought, I don't think I want to open a restaurant with you. I'd be committed, but you'd only be involved." In a project, there will be people who have committed to the project. Other might be interested in the project, but they aren't on the hook. Those who are responsible for the project have the authority to do what is necessary for its success. Those who aren't responsible can't interfere unnecesarily. from "Agile Project Management with Scrum by Ken Schwaber"

Generate SSH Keys in Ubuntu

An SSH key allows you to establish a secure connection between your computer and a remote server. This type of connection run by generating an SSH key in your local computer (or remote computer, keep private and public key in local computer, then store the public key in remote server. In Ubuntu, you can use this command: $ ssh-keygen -t rsa -C "lukibsubekti@gmail.com"

How To Use Git in Netbeans

Git is a popular version control application nowadays. Recently I have created a note about its differences with SVN and how to use it in Eclipse . There are many Git client tools. But I just want to show how to use Netbeans built-in Git tools. It makes the development process easier because it has been integrated with the IDE. Create Remote Git Repository We need a remote Git repository so everyone can store or receive any revision or updated files through the networks. We can set up our own Git server or use a public Git server like Github . In this note, I use Github. 1. Create an account in Github and create an empty Git repository Create an empty public repository in Github 2. Get the remote repository link Your Github Repository URL Create a New Project in Netbeans and Create Local Git Repository After we have a remote Git repository, we can create a project stored in the remote repository. We also need to create a local repository before we can push...

Creating a Self-Signed SSL Certificate

A self-signed SSL Certificate can be used if you want to make a secure connection to a server by encrypting the data like the HTTPS connection. We can utilize OpenSSL to generate the key and certificate. We can run  $ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /path/to/yourkey.key -out /path/to/yourcert.crt to generate the key and certificate files.  Some important parameters are as follows: req : This specifies a subcommand for X.509 certificate signing request (CSR) management. X.509 is a public key infrastructure standard that SSL adheres to for its key and certificate management. Since we are wanting to create a new X.509 certificate, this is what we want. -x509 : This option specifies that we want to make a self-signed certificate file instead of generating a certificate request. -nodes : This option tells OpenSSL that we do not wish to secure our key file with a passphrase. Having a password-protected key file would get in the way o...

Install PostgreSQL in Ubuntu 14.04

In Ubuntu 14.04, PostgreSQL repository isn't listed by default. We must add the record first. Run $ nano /etc/apt/sources.list.d/pgdg.list to add repository list file Add deb http://apt.postgresql.org/pub/repos/apt/ trusty -pgdg main in the file Run $ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \ sudo apt-key add - Run $ sudo apt-get update then $ sudo apt-get install postgresql-9.4 For administrator we can install pgadmin3 $ sudo apt-get install pgadmin3 For client tools we can install postgresql-client $ sudo apt-get install postgresql-client

Check integrity of a file using MD5 sum and verify authenticity via GPG

When you download a file from a website, sometime the website also provide some codes of MD5 sum result to check file integrity after downloading. MD5 sum result can be generated using this command. $ md5sum download.file Then you can compare your result with code provided by the website. Next, to verify authenticity via GPG, use this following steps. - download the public key - download the authenticity key - run: $ gpg --import publickey.asc - run: $ gpg --verify authkey.asc downloaded.file