## Wednesday, July 16, 2014

### Enable pgpass under Windows 7

Last year I have written a post about enabling pgpass under Windows XP. Today I repeated the procedure for Windows 7.

Basically everything worked as before, with the following exception - the APPDATA directory in Win 7 is different.

What I did first was to check the name of the user running PostgreSQL server process. Then log in as that user and find out where is the APPDATA directory for that user.

 echo %APPDATA% 

From that point on, just follow the instructions in the previous post.

Good luck!

## Sunday, June 22, 2014

### PHPUnit 4 on Windows 7

2. Find your php bin directory. In my case it is: C:\Program Files (x86)\Zend\ZendServer\bin
4. In the same php bin directory create .bat file with the following content:
@ECHO OFF
set PHP_BIN=php.exe
set FILE_PATH="C:\path\to\phpunit_phar_file\phpunit.phar"
%PHP_BIN% %FILE_PATH% %*


5. Done. phpunit will be available from any location.

## Monday, December 2, 2013

### Numeric Drop-down With PHP ranges

Here is an easy way to generate form numeric drop-down with ranges.
       $form = new Zend_Form();$ranges = array(
range(1, 20, 1) ,
range(30, 100, 10) ,
range(200, 1000, 100)
);
$a = array(); foreach ($ranges as $range ) { foreach ($range as $r ) {$a[$r] =$r;
}
}

$form->addElement('select', 'quantity', array( 'label' => 'Quantity' , 'required' => false , 'class' => 'form-control' , 'multiOptions' => array( '' => '--Select--' ) +$a
));



Please note that the ranges are with different steps. Here is the result:

## Wednesday, March 20, 2013

### Enable pgpass under Windows XP

These are the steps I used to enable pgpass under Windows XP.
1. Create file with name: pgpass.conf with this information in it: hostname:port:database:username:password

see this for file data format

2. Move the file to the %APP_DATA%\postgresql directory of the user running the backup ( not the db server user - postgres). In my case it was: C:\Documents and Settings\Windows User Name\Application Data\postgresql.
3. Add --no-password option to the backup statement like this: "C:\Program Files\PostgreSQL\9.X\bin\pg_dump.exe" -h localhost -U postgres --no-password -C -f "database_name_dump.sql" database_name_db
Done.

## Tuesday, January 15, 2013

### SSL certificate problem, verify that the CA cert is OK

This is a followup post related to this issue. I have proposed a solution to this problem in a previous post. In short the solution was to download a certificate file from Mozilla and add this information to $CURL_OPTS array in base_facebook.php file. Today I have found this blog post suggesting using this http://curl.haxx.se/ca/cacert.pem certificate file. Either one should work. The second point I want to make is this. Previously I suggested appending CURLOPT_CAINFO to$CURL_OPTS array in base_facebook.php file. Now I think it will be better if I change the location information from my client code and not touch facebook.php library code. Here is how I did it:

In my client code:

 require 'Facebook/src/facebook.php'; $facebook = new Facebook(array( 'appId' => 'some app id', 'secret' => 'some secret', 'cookie' => true, ));$facebook::\$CURL_OPTS[CURLOPT_CAINFO]='path_to_certificate_file/cacert.pem'; 

That way you can update facebook sdk library code without worrying that will have to update the certificate file path every time.