by admin on November 30, 2009
Bbjobs has arranged a workshop on “Zend framework fundamental” on December, 09 and invited us (me and Emran Hasan) to take it. We agreed happily. This is (so far I know) the first formal Zend Framework workshop in Bangladesh. The workshop has been defined as -
The Zend Framework Workshop is a 5 half-day tutorial-style course that takes an in-depth look at Zend Framework and its components. The workshop is designed for experienced PHP programmers who want to learn to combine ZF concepts and structural elements to utilize the full power of this software development kit for PHP 5 applications.
As per our plan about the context of this workshop, we are going to cover the following 8 basic topics of Zend Framework in 5 days.
by admin on November 21, 2009
Three weeks ago, I was contacted by Packt publishing asking if I’d review their new book “PHP Team Development” by Samisa Abeysinghe. I agreed and received the book. But, after reading it, I was wondering about how to tell negative things politely.
In the mean time Lorna Jane, Brandon Savage, Ken Guest, Walter Ebert and some other people wrote their review about this book. And I found, most of their opinion supports my thoughts on it. Actually, most of the things that I thought has already been said in their posts. So, I am not going to repeat them and will tell my views shortly.
This book will introduce teamwork and some development processes (XP, Scrum) to fresh devs . It has brief introduction about source control, bug tracking, continuous integration and many other important terms of software development. These may help a beginner who have made software for university assignments but never worked in a professional team. The author had intention to describe the complexity and some commonly occurring problems of software development with suggesting solutions.
It presents MVC as the way of working of a team and tried to solve everything(!) with it. As some others mentioned, the author has presented his solutions as the only way of doing something. It didn’t enlighten the readers about other available solutions. Also, a few of the topics did not seem to be related with the context of this book title.
This book mentioned about many tools, processes and methods – but most of them are not explained up to such a level that one can implement them after reading the book. Some concepts of the book seemed unrealistic to me. For example, separating teams based on concern (one team will work with model, another with view; and tie them up together later).
Like Walter Ebert said, this book seems to be a “quick ‘n dirty guide on team development” to me. About recommendation, I’d say, if you are a beginner in PHP (also in programming) and just know how to connect and retrieve data from MySQL, then the book can help you know many of the terms which you should study next. If not, then you should spend some time on finding a better book to start with.
by admin on August 29, 2009
A few days ago, I was looking for a PDO wrapper to work with a small PHP application. I’ve searched around and found fractalizer’s PDO wrapper nearest to my purpose. Then I just wrote my wrapper on the shadow of his one.
Let’s see what’s inside and how it works.
- Easy to use.
- Works with MySQL and Sqlite.
- All pubic functions works statically.
- Connection string created internally.
Download the PHP PDO wrapper (downloaded [downloadcounter(PHP-PDO-Wrapper)] times).
The download archive includes -
- Db.php – the PDO Wrapper class.
- DbTest.php – Unit testing class for Db.
- DbExample.php – Example of some common uses.
- Some other unit test related files.
by admin on May 17, 2009
Special thanks for all the organizers, group members and participants.
Here is the slide available for you.
Hope you’ll Enjoy the slides! Suggestions are welcome.
by admin on April 5, 2009
- Document is ready – How to get the our document ready and where to start.
- Selecting elements – How to select elements in Ext.
- Dom scripting – Changing on and in the element.
- Ext events – Assigning and firing events.
- Ext Components – The powerful alternate of jQuery UI.
- Ajax – Making Ajax request in Ext.
Ok, let’s dive in to deep of each of these points.
by admin on February 3, 2009
A web application goes through some stages when growing up. Generally, it starts from development and ends at production. There can be some more stages within this two ends. And, in maximum cases this stages are overlapped. The overlapped stages can be hosted in different servers with different settings but shares the same code. In this situations, if we want to keep bootstrap in SVN repo, it needs to setup bootstrap in a little different way. So that, it can handle many server settings with a single bootstrap.
For example, just now I am working on an application which is being developed in 3 local machines (me and two other members of my team) and being tested in our staging server. Besides, our client is monitoring progress of current sprint in their staging server and testing completed sprints in their pre-production server. Here, except the production servers, all hosts contains a checked out copy of code from a single repository. But this hosts have some difference in their library path, database host and authentication etc.
If my assumptions are ok for you, let’s start after downloading.
I have assumed that you are familiar with Zend Framework. And already worked on (atleast one) ZF MVC application. You know the basic things about bootstrapping and using the most common directory structure (shown in image). However, you can tune this technique for your favorite Zend directory stracture.
Downoad the files from here. The zip file contains -
- index.php – This is the bootstrap file. Your .htaccess file points all request to this file.
- config.xml – Contains all configurations of your application, for all hosts.
- Bootstrap.php – A php class that handles all startup settings in a vary organized way. (I don’t know who first wrote it, Thanks to him)
by admin on December 26, 2008
Before I move into PHP Speedy, a small background won’t hurt much! Until a few days back, whenever I hear the word optimization, my brain quickly shows a few keywords in my mental screen: “query optimization, page caching, opcode, etc”. All these terms and the associated work relates to the optimization of a web application in the back-end. This has been serving my need pretty good, until I became aware about the excellent 13-point front-end optimization techniques from Yahoo (thanks Emran bhai).
At first I was a bit skeptical, but as soon as I started seeing the points – I knew its importance. Without much delay, I gave it a short in my latest project at work. And the tool that made it a less than 10 minute work is: PHP Speedy. I am literally speechless with it’s performance and way of working. Just in 10 minuets, It upgraded the Yslow grade of our project from 43 to 88. Just like a magic touch!
Now, let’s see what Yslow Grade is (for those who are not yet using it) and how php-speedy helps to upgrade it. Hope this enlightens someone like me
by admin on September 12, 2008
In the huge set of library, Zend Framework have no options for manipulating image. There is a proposal for Zend_Image which aimed to provides easier image manipulation using GD. But the proposal was not considered. Bill Karwin of ZF said,
Proposal not being considered
This proposal has been reviewed. The proposal describes functionality that is very similar to the existing PHP interfaces for ImageMagick or GD.
We are not considering this for inclusion in the Zend Framework at this time.
So, what to do when we need to make image thumbnail, resizeing or cropping image etc in Zend Framework?
Zend Framework has the extensive power of integrating any library. So, we can use ImageMagick or GD library or any wrapper class using this libraries for manipulating image.
Here, I am explaining creating image thumbnail using PHP Thumbnailer Class v2.0 in 2 easy steps. I am assuming that, you are using Zend’s MVC with common directory structure and you’ve GD library with your PHP installation.
Step 1 – Create a Model for image manipulation :
Download the PHP5 version of PHP Thumbnailer Class v2.0 and put the class file “thumbnail.inc.php” in your model directory. Now change the file name to “Thumbnail.php” as it’s class name. Now your model is ready for action.
Step 2 – Use this model in Controller :
In your Controller, write a function to make thumbnails using this model. For example, you can use this function below:
Done. Now you can use this function to resize/make thumbnail of an image. To resize an image with keeping it’s original name, pass the $sourcePath again in $destPath parameter. Then it will overwrite the existing image.
So, was it so though to manipulate image in ZF?
by admin on August 24, 2008
Zend_Paginator is one of the newest members of Zend framework family. It’s surely a rich addition with Zend’s power. Moreover, It’s handling the main data of pagination, not only pagination links. Which I didn’t found in any other pagination library.
But, when I (and many other developers) start to working with this library, found many problems/bugs. The matter is, they are being solved very fast and hope to get a bullet-proof pagination library soon. For example, here is tow important fixings about Zend_Paginator and Zend_Db_Table_Select.
I had to face a problem with Zend_Paginator when using Join in Zend_Db_Select object. I am explaining here how the problem arises and how to solve it.
One of the 4 Adapters for Zend_Paginator is DbSelect which uses a
Zend_Db_Select instance. Now, the problem occurred if I need to have some calculative data from other tables and use join with the
Zend_Db_Select object for them. For example, I am retrieving data from `deals` table and collecting number of comments from `comments` table and total votes from `votes` table. So, with other conditions, I had to add this lines with select object:
Now, the Zend_Paginator will always calculate the TotalRows as 1. That means, $this->totalItemCount; will always print 1 in “view partial“.
Why it happens?
Let’s take a look to the count function of DbSelect Adaptor of Zend_Paginator:
Here, at line 7, the column list is being removed. But we have a `Group By` clause in our select object which is not cleared by this function and the result is always 1. At this point, if we add “->reset(Zend_Db_Select::GROUP)” after line 9, the calculation will get rid from always being 1. But there will arise another problem. That is, joined tables are still remaining in `From` clause. You can see them by adding “die(print_r($rowCount->getPart(Zend_Db_Select::FROM)));” after line 10. This join tables will make the calculation inconsistence because there is no expression columns now to summarize their result.
Just alter this function as following to prevent this problem:
At line 9, I am running a foreach which will remove the `from` clause and again assign only the main table and inner join tables. And, at line 23, just removing the `Group By` clause from query. Now, this function will provide right calculation even when there is some joins like this.
But, if you use inner join in your Zend_Db_Select object (which is very rare for pagination), this function may not serve properly.
If there is any mistake in this alternation or any other way can make it better, please let me know. And… let’s meet power with simplicity.
UPDATE [26/08/08] : The function is updated and hopefully it will work fine for inner joins too.
UPDATE [24/09/08] : This issue is solved in ZF 1.6. Jurrien Stutterheim has reported about this post in Zend Framework Issue tracker and worked on it. After the release of 1.6, he requested me to check if this issue still exist. I’ve checked and found it solved. Thanks to JurriÃ«n Stutterheim.