So, I am watching some TotalBiscuit’s E3 Snarkathon VR Killing Floor… whatever The idea, consoles have solved the moving by having 2 sticks on the controller (I hope am right about that), so lets have 2 sticks on VR, wait this is bullshit, you will say? Well may be, we already have the right stick […]
Zf2 Naviagation Custom Active Page Call in layout/view $nav = $this->navigation('Navigation'); $pages = $nav->getContainer()->getPages(); foreach ($pages as $page) { if ($page->getId() == 'admin') { $page->setActive(true); } }
In this article I will show a simple way to log every change to doctrine 2 entity. This one will not be copy / paste. Just check out the code and help yourself. 1. Create event service /** * @developer Ivan Gospodinow */ namespace Application\Service; use Application\Entity\DbLogEntity; use Application\Entity\AbstractEntity; use Doctrine\Common\Persistence\Event\LifecycleEventArgs; use \DateTime; class DoctrineLogChangesService […]
1. Dump structure of the big database. 2. Open the sql file and cut the constraints. 3. Import the structure to another database. 4. Run this code: /** * Sync from live database */ ini_set('memory_limit','512M'); $limit = 100000; $time = time(); $sleep = 1; $sleepEvery = 60; $link = new mysqli( “__HOST__”, “__USER__”, “__PASSWORD__”, “__DATABASE__” […]
As always we go straight to coding. Download how-to-create-google-login-on-my-site-with-openid-in-5-min.zip
Right to the example… $identifier = spl_object_hash(function(){ // some function content }); Simple as that. Suggestions or problems ? Write a comment.
function csvToArray($file){ $rows = array(); $headers = array(); if(file_exists($file) && is_readable($file)){ $handle = fopen($file, 'r'); while (!feof($handle) ) { $row = fgetcsv($handle, 10240); if(empty($headers)) $headers = $row; else if(is_array($row)) $rows[] = array_combine($headers, $row); } fclose($handle); } else { throw new Exception($file.' doesn`t exist or is not readable.'); } return $rows; } Simple as that. Suggestions […]
Most of the time Zopim chat makes your site slower.Here is an example how you can make your site load faster using Zopim chat. Step 1. Create html page zopim.html and put this code inside: Step 2. Go to the page where you want to put Zopim chat and put this code: That is! It […]
In this tutorial you will learn how to setup zend framework 2 acl and check if user has access for current route. If you don`t have testing project , download one from here. Add file module.acl.roles in application/config/ Tip: In fact role resources may be zend framework 2 routes. return array( 'guest'=> array( 'home', 'login', […]
A bit hard this one , but there is a way to convert EU odds to UK odds in php. function eu_to_uk_odds($odds){ if(floor($odds) !== $odds){ $odds = (string) round($odds – 1,2); $oddsArr = explode('.',$odds); $f1 = (int) $oddsArr[0].''.$oddsArr[1]; $f2 = str_pad('1', ($f1 >= 10 ? 3 : strlen($f1) ),'0',STR_PAD_RIGHT); $minDel = $this->gcd($f1,$f2); $odds = $f1 […]