VideoJs : Html5 video player

Hello developers

Now you can use html5 video with good controls through Javascript

VideoJs provides a html video player with many options.

Some of its features are

  • Free & Open Source
  • Lightweight. NO IMAGES USED
  • 100% skinnable using CSS
  • Library independent
  • Easy to understand & extend
  • Consistent look between browsers
  • Full Screen & Full Window Modes
  • Volume Control
  • Forced fallback to Flash (even when there is an unsupported source)

Here is the link to VideoJs website

http://videojs.com/

Zend Framework : Zend_Db

In this post i will tell you how to connect database in zend framework using Zend_Db.

After initiating the Zend framework project make a folder like this

Zend Project -> applicaiton -> models -> Db -> Db.php

we make a class name  ”Db_Db” and define a static method “conn()”

 

Code

class Db_Db
{	
	public static function conn()
	{
		try 
    	{
    		$pdoParams = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8;');
    		
    		$connParams = array("host" => "localhost",
    		"port" => "PORT",
    		"username" => "DATABASE_USERNAME",
    		"password" => "DATABASE_PASSWORD",
    		"dbname" => "DATABASE_NAME",
    		"driver_options" => $pdoParams
    		);
    		
    		$db = new Zend_Db_Adapter_Pdo_Mysql($connParams);
    		return $db;
    	}
    	catch (Zend_Db_Exception $err)
    	{
    		echo $err->getMessage();
    	}    	
	}
}

Vote for best PHP Framework

Watch latest movie trailer on Bma Trailers

codeigniterZendYII framework

These days i am trying to shift myself from straight php coding to php mvc framework

when i searched for best php framework i found out there are alot of frameworks.

Right now i started reading about ZEND framework

Here is the list of frameworks you can vote on


PHP array_map()

Now with php array_map function you can apply a  function to all values in array on one go

here is an example

<?php
function cube($n)
{
return($n * $n * $n);
}

$a = array(1, 2, 3, 4, 5);
$b = array_map("cube", $a);
print_r($b);
?>

Result will be like this

Array
(
    [0] => 1
    [1] => 8
    [2] => 27
    [3] => 64
    [4] => 125
)

Bug Tracing in PHP

After joining a software house “Ovrlod”  i got to learn many new things about programming and engineering stuff

The good thing is that i now usually start using try catch in my code which was missing in my past projects…or say now my code is more towards standards

Well sitting at my office desk i was thinking to start my own bug tracking system…currently on web there are many others too but too much complicated to implement

Read more of this post

Make folder zip with php

Watch latest movie trailer on Bma Trailers

This code will zip the folder not single file but the whole folder…. You need to download the class mentioned below

Download this class from here http://www.phpclasses.org/package/2322-PHP-Create-ZIP-file-archives-and-serve-for-download.html



<?php
$date = date("d-m-y");

$directoryToZip="Folder name to zip/"; // This will zip all the file(s) in this present working directory

$outputDir="/"; //Replace "/" with the name of the desired output directory.
$zipName="File name - ".$date.".zip"; //Save file with specified name 

include_once("CreateZipFile.inc.php");
$createZipFile=new CreateZipFile;

//Code toZip a directory and all its files/subdirectories
$createZipFile->zipDirectory($directoryToZip,$outputDir);

$fd=fopen($zipName, "wb");
$out=fwrite($fd,$createZipFile->getZippedfile());
fclose($fd);
$createZipFile->forceDownload($zipName);
@unlink($zipName);
?>

Follow

Get every new post delivered to your Inbox.