How to Install Mail Server on Mac OSX


In this post, I would like to share how to install mail server on Mac OSX. Having mail server is important if you need to send email from your web application in local environment. To do this, we will use Postfix.

Postfix is a Mail Transport Agent (MTA), supporting LDAP, SMTP AUTH (SASL) and TLS. In this post, We will setup Postfix to run with SMTP.

Continue reading

Prevent Bootstrap Modal From Closing


The default configuration of Bootstrap modal is can be closed when visitor click outside the modal or by pressing the escape (ESC) key. If you want to prevent boostrap modal from closing by those actions, you need to change the value of backdrop and keyboard configuration. The default value of backdrop and keyboard is set to true.

You can change the configuration in HTML or Javascript directly.

In HTML, just set data-backdrop to static and data-keyboard to false

<button type="button" data-toggle="modal" data-target="#myModal" data-backdrop="static" data-keyboard="false">Launch modal</button>

or using Javascript

backdrop: ‘static’,
keyboard: false

I use Bootstrap v3.2.0 when this article is written. More information about Bootstrap modal.

Good luck :)

Bind Param of PDO Statement Inside Loop

I had a case to use bind parameter of PDO statement inside loop. This was code that I used

foreach ($this->data as $key => $value) {
$st->bindParam(‘:’ . $key, $value);

I executed this code and got surprising result, it didn’t work. Apparently, PDO statement use $value with last looping value. I took a look at PHPDoc for bindParam() and found why this could be happened.
Continue reading