Thursday, February 5, 2015

Notes In Resolving Conflict on GIT Rebase

So after doing git rebase master from a featured branch or some other branch you get a conflict.

Here are some notes on resolving.
  • After getting the conflict, you will be redirected to temporary branch where you have to resolve your conflict.
  • Resolve your conflicts as usual removing <<<<<<, ======, >>>>>>>> and doing your manual merges
  • After resolving do a git add .
  • Do not commit but after doing git add do git rebase --continue or git will complain about having no resolution to your conflict
  • The rebase should go as usual

Friday, January 9, 2015

LEFT JOIN that acts as an OUTER JOIN

If your LEFT JOIN is acting up like an OUTER JOIN or is joining everything on the RIGHT table but this is not your intended purpose, make sure that your LEFT table's foreign key is set to NULL for it to work properly. If it has something like 0 (zero) you will have unsuspected results.

Tuesday, November 4, 2014

Access SSL Enabled URL via Curl

Sometimes you may have problems accessing URL that are SSL enabled. The solution is to simply set the flags below:


    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
To output and debug the problem you can:
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_STDERR, fopen('php://temp', 'rw+'));
$result = curl_exec($ch);
curl_close($ch);

if ($result === FALSE) {
    printf("cUrl error (#%d): %s
\n", curl_errno($curlHandle),
           htmlspecialchars(curl_error($curlHandle)));
}

rewind($verbose);
$verboseLog = stream_get_contents($verbose);

print_r($verboseLog);

Monday, April 14, 2014

How to Fix SSHFS Mounts Not Writable by PHP

Problem:
When accessing a php file in the browser that uses is_writable(), is_dir(),... etc of a mounted directory through sshfs, PHP sometimes cannot detect the mounted directory so the functions above always returns false.

1.) Steps to resolve:
$> sudo adduser $USER fuse
$> ls -l /etc/fuse.conf
$> sudo chmod a+r /etc/fuse.conf

2.) Edit fuse.conf and enable user_allow_other
$> sudo vim /etc/fuse.conf

3.) Connect with allow_user
sshfs -o allow_other,uid=1000,gid=33 user@192.168.1.101:/path/to/mounted/mydir mydir

Sunday, January 12, 2014

install fastcgi

sudo apt-get update && sudo apt-get install libapache2-mod-fastcgi sudo a2enmod fastcgi

Monday, January 6, 2014

Composer Update/Install

Dont install require-dev packages (--no-dev), prefer the distribution packages (--prefer-dist), maximum verbosity (-vvv), show profiles such as memory usage and time (--profile)
php composer.phar update --no-dev --prefer-dist -vvv --profile

Tuesday, November 26, 2013

Tip: How to Add Timestamp With CURRENT_DATETIME in Doctrine 2 ORM

Assuming that your database profiler is Mysql:
    /**
     * @ORM\Column(type="datetime", nullable=false)
     * @ORM\Version
     * @var string
     */
    protected $creationTimestamp;

The above declaration should produce:
CREATE TABLE mytable (creationTimestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL);
The trick is adding @Version which converts the type 'datetime' to 'timestamp'. Remember that this is only for MySql profiler.