'how to ?' Category

  • How to solve VR moving ? #E3onTwitch

    June 13, 2016

    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

    October 31, 2015

    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); } }

  • Zf2 Doctrine 2 Log Every Entity Change

    September 18, 2015

    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 […]

  • Copy big MySQL database with php in 5 steps

    July 17, 2015

    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__” […]

  • How to create google login on my site with openid in 5 min

    August 21, 2013

    As always we go straight to coding. Download how-to-create-google-login-on-my-site-with-openid-in-5-min.zip

  • How to get an unique identifier for php closure ?

    June 17, 2013

    Right to the example… $identifier = spl_object_hash(function(){ // some function content }); Simple as that. Suggestions or problems ? Write a comment.

  • How to read csv file into array ?

    June 16, 2013

    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 […]

  • How to use Zopim chat outside your site.

    June 11, 2013

    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 […]

  • Zend Framework 2 ACL setup in 5 minutes – tutorial

    March 13, 2013

    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', […]

  • How to convert european(eu) odds to united kingdom(uk) odds ?

    March 12, 2013

    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 […]

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org